Skip to content

Commit

Permalink
Merge pull request #230 from sangcomz/release/1.0.0-alpha04
Browse files Browse the repository at this point in the history
Release/1.0.0 alpha04
  • Loading branch information
sangcomz authored Jan 4, 2021
2 parents a4bf0d7 + 8b8cd41 commit f7721be
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 80 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Android CI

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew build
- name: assemble and jacoco
run: ./gradlew assembleDebug jacocoTestReport
- name: Android Emulator Runner
# You may pin to the exact commit or the version.
# uses: ReactiveCircus/android-emulator-runner@e08f702234bdc95883c7fd5c7d2867ccf1a8463b
uses: ReactiveCircus/[email protected]
with:
# API level of the platform and system image - e.g. 23 for Android Marshmallow, 29 for Android 10
api-level: 25
script: ./gradlew connectedCheck connectedAndroidTest
- name: Codecov
uses: codecov/[email protected]
55 changes: 0 additions & 55 deletions .travis.yml

This file was deleted.

9 changes: 9 additions & 0 deletions FishBun/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'com.hiya.jacoco-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'de.mobilej.unmock'
apply plugin: 'maven-publish'

buildscript {
repositories {
Expand Down Expand Up @@ -86,3 +87,11 @@ dependencies {
tasks.withType(Javadoc).all {
enabled = false
}

install {
repositories.mavenInstaller {
pom.groupId = 'com.sangcomz'
pom.version = gradle.versionName
pom.artifactId = project.name
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ class PickerIntentDataSourceImpl(private val intent: Intent) : PickerIntentDataS
&& intent.hasExtra(ARG_ALBUM_ID)
&& intent.hasExtra(ARG_ALBUM_POSITION)
)
AlbumData(
intent.getLongExtra(ARG_ALBUM_ID, -1),
intent.getStringExtra(ARG_ALBUM_NAME),
intent.getIntExtra(ARG_ALBUM_POSITION, -1)
)
intent.getStringExtra(ARG_ALBUM_NAME)?.let {
AlbumData(
intent.getLongExtra(ARG_ALBUM_ID, -1),
it,
intent.getIntExtra(ARG_ALBUM_POSITION, -1)
)
}
else
null
}
Expand Down
5 changes: 4 additions & 1 deletion FishBun/src/main/res/layout/header_item.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1dp"
Expand All @@ -9,7 +10,9 @@
android:id="@+id/rel_header_area"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#d9d9d9">
android:background="#d9d9d9"
android:foreground="?attr/selectableItemBackground"
tools:targetApi="m">

<ImageView
android:layout_width="wrap_content"
Expand Down
15 changes: 15 additions & 0 deletions FishBun/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<resources>
<string name="album">专辑</string>
<string name="camera">相机</string>
<string name="done">完成</string>
<string name="done_all">全部完成</string>
<string name="msg_no_selected">没有选择图片。</string>
<string name="str_all_view">所有视图</string>
<string name="msg_permission">缺少权限。</string>
<string name="msg_no_image">没有专辑。\n拍一张照片吧!</string>
<string name="msg_full_image">选择数量达到上限。取消一张照片以继续选择其他照片。</string>
<string name="msg_loading_image">加载中…</string>
<string name="image">照片</string>
<string name="msg_error">有点临时错误哦。请过几分钟再试试哦。</string>
<string name="msg_minimum_image">请至少选择 <b>%d</b> 张图片。</string>
</resources>
2 changes: 1 addition & 1 deletion FishBunDemo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

buildscript {
repositories {
Expand Down
7 changes: 6 additions & 1 deletion FishBunDemo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />

<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>

<application
android:name="com.sangcomz.fishbundemo.CommonApplication"
android:allowBackup="true"
Expand All @@ -23,5 +29,4 @@
</activity>
<activity android:name="com.sangcomz.fishbundemo.WithFragmentActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.sangcomz.fishbun.FishBun
import com.sangcomz.fishbun.adapter.image.impl.CoilAdapter
import kotlinx.android.synthetic.main.fragment_sub.*
import java.util.*
import kotlin.collections.ArrayList

/**
* A simple [Fragment] subclass.
Expand Down Expand Up @@ -52,7 +53,7 @@ class SubFragment : Fragment() {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
FishBun.FISHBUN_REQUEST_CODE -> if (resultCode == Activity.RESULT_OK) {
path = data!!.getParcelableArrayListExtra(FishBun.INTENT_PATH)
path = data?.getParcelableArrayListExtra(FishBun.INTENT_PATH) ?: arrayListOf()
imageAdapter.changePath(path)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.sangcomz.fishbun.FishBun
import com.sangcomz.fishbun.MimeType
import com.sangcomz.fishbun.adapter.image.impl.GlideAdapter
import com.sangcomz.fishbun.adapter.image.impl.CoilAdapter
import kotlinx.android.synthetic.main.activity_withactivity.*
Expand Down Expand Up @@ -46,7 +47,7 @@ class WithActivityActivity : AppCompatActivity() {
super.onActivityResult(requestCode, resultCode, imageData)

if (requestCode == FishBun.FISHBUN_REQUEST_CODE && resultCode == RESULT_OK) {
path = imageData!!.getParcelableArrayListExtra(FishBun.INTENT_PATH)
path = imageData?.getParcelableArrayListExtra(FishBun.INTENT_PATH) ?: arrayListOf()
imageAdapter.changePath(path)
}
}
Expand Down Expand Up @@ -84,8 +85,8 @@ class WithActivityActivity : AppCompatActivity() {
.setSelectedImages(path)
.setAlbumSpanCount(2, 3)
.setButtonInAlbumActivity(false)
.setCamera(true)
.exceptGif(true)
.hasCameraInPickerPage(true)
.exceptMimeType(arrayListOf(MimeType.GIF))
.setReachLimitAutomaticClose(true)
.setHomeAsUpIndicatorDrawable(
ContextCompat.getDrawable(
Expand Down Expand Up @@ -119,8 +120,8 @@ class WithActivityActivity : AppCompatActivity() {
.setSelectedImages(path)
.setAlbumSpanCount(1, 2)
.setButtonInAlbumActivity(true)
.setCamera(false)
.exceptGif(true)
.hasCameraInPickerPage(false)
.exceptMimeType(arrayListOf(MimeType.GIF))
.setReachLimitAutomaticClose(false)
.setHomeAsUpIndicatorDrawable(
ContextCompat.getDrawable(
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ _FishBun_ is a highly customizable image picker for Android.
<img src="/pic/fishbuns.png">


## What's New in _FishBun_ 1.0.0-alpha03? :tada:
## What's New in _FishBun_ 1.0.0-alpha04? :tada:

- Refactoring for rapid development:rocket::rocket::rocket:
- Change PickerSpanCount default value (`3`->`4`)
- target SDK 29 support
- target SDK 30 support
- In API 29 or higher, the camera can be used only in the total image folder.
- Fix Issue(#215)
- Change DetailView statusBar color
- Removed Picasso and added Coil
- Supprot Chinese


## Customizable Styles
Expand Down Expand Up @@ -121,15 +122,14 @@ Setting up _FishBun_ requires to add this Gradle configuration:

dependencies {
// Under the Android Plugin 3.0.0.
compile 'com.sangcomz:FishBun:1.0.0-alpha02'
compile 'com.sangcomz:FishBun:1.0.0-alpha04'
compile 'com.squareup.picasso:picasso:2.71828'
compile 'io.coil-kt:coil:0.11.0'
or
compile 'com.github.bumptech.glide:glide:4.9.0'
// Android plugin 3.0.0 or higher.
implementation 'com.sangcomz:FishBun:1.0.0-alpha03'
implementation 'com.sangcomz:FishBun:1.0.0-alpha04'
implementation 'io.coil-kt:coil:0.11.0'
or
Expand All @@ -142,6 +142,13 @@ and to allow the following permissions in your `Manifest`:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

If your app targets Android 11 with compileSdk/targetSdk >= 30 then you will need to add this to the manifest (outside of the application block) in order to capture pictures with the device camera. [Android documentation here](https://developer.android.com/about/versions/11/privacy/package-visibility):

<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>

## How to Use

Expand All @@ -151,7 +158,7 @@ Use _FishBun_ in an activity:

or in a fragment:

FishBun.with(YourFragment).setImageAdapter(new PicassoAdapter()).startAlbum();
FishBun.with(YourFragment).setImageAdapter(new CoilAdapter()).startAlbum();

and implement `OnActivityResult`:

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
kotlin_version = '1.3.50'
androidx_version = '1.1.0'
recyclerview_version = '1.1.0'
material_version = '1.1.0'
material_version = '1.2.1'
coil_version = '0.11.0'
glide_version = '4.11.0'
constraint_version = '1.1.3'
Expand Down
8 changes: 4 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include ':FishBunDemo', ':FishBun'

gradle.ext.versionCode = 31
gradle.ext.versionName = '1.0.0-alpha03'
gradle.ext.versionCode = 32
gradle.ext.versionName = '1.0.0-alpha04'

gradle.ext.set('minSdk', 15)
gradle.ext.set('targetSdk', 29)
gradle.ext.set('compileSdk', 29)
gradle.ext.set('targetSdk', 30)
gradle.ext.set('compileSdk', 30)

0 comments on commit f7721be

Please sign in to comment.