暫無描述

Hugo 7c75b0c04b Commit inicial 5 年之前
FishBun 7c75b0c04b Commit inicial 5 年之前
FishBunDemo 7c75b0c04b Commit inicial 5 年之前
gradle 7c75b0c04b Commit inicial 5 年之前
pic 7c75b0c04b Commit inicial 5 年之前
.gitignore 7c75b0c04b Commit inicial 5 年之前
.travis.yml 7c75b0c04b Commit inicial 5 年之前
CONTRIBUTING.md 7c75b0c04b Commit inicial 5 年之前
LICENSE 7c75b0c04b Commit inicial 5 年之前
README.md 7c75b0c04b Commit inicial 5 年之前
build.gradle 7c75b0c04b Commit inicial 5 年之前
gradle.properties 7c75b0c04b Commit inicial 5 年之前
gradlew 7c75b0c04b Commit inicial 5 年之前
gradlew.bat 7c75b0c04b Commit inicial 5 年之前
release.sh 7c75b0c04b Commit inicial 5 年之前
settings.gradle 7c75b0c04b Commit inicial 5 年之前

README.md

FishBun

Android Arsenal Build Status codecov Download

<img src="https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&amp;style=flat">

Get it on Google Play

FishBun is a highly customizable image picker for Android.

What's New in FishBun 0.9.1?

  • Use custom file provider to avoid collision with other plugins (#151)

Customizable Styles

FishBun supports various visual styles and allows fine-tuning for details. Just to show some examples:

Default

Code
FishBun.with(WithActivityActivity.this)
        .setImageAdapter(new GlideAdapter())
        .startAlbum();
Screenshots

Dark

Code
FishBun.with(WithActivityActivity.this)
        .setImageAdapter(new GlideAdapter())
        .setMaxCount(5)
        .setMinCount(3)
        .setPickerSpanCount(5)
        .setActionBarColor(Color.parseColor("#795548"), Color.parseColor("#5D4037"), false)
        .setActionBarTitleColor(Color.parseColor("#ffffff"))
        .setArrayPaths(path)
        .setAlbumSpanCount(2, 3)
        .setButtonInAlbumActivity(false)
        .setCamera(true)
        .exceptGif(true)
        .setReachLimitAutomaticClose(true)
        .setHomeAsUpIndicatorDrawable(ContextCompat.getDrawable(this, R.drawable.ic_custom_back_white))
        .setOkButtonDrawable(ContextCompat.getDrawable(this, R.drawable.ic_custom_ok))
        .setAllViewTitle("All")
        .setActionBarTitle("FishBun Dark")
        .textOnNothingSelected("Please select three or more!")
        .startAlbum();
Screenshots

Light

Code
FishBun.with(WithActivityActivity.this)
        .setImageAdapter(new GlideAdapter())
        .setPickerCount(50)
        .setPickerSpanCount(4)
        .setActionBarColor(Color.parseColor("#ffffff"), Color.parseColor("#ffffff"), true)
        .setActionBarTitleColor(Color.parseColor("#000000"))
        .setArrayPaths(path)
        .setAlbumSpanCount(1, 2)
        .setButtonInAlbumActivity(true)
        .setCamera(false)
        .exceptGif(true)
        .setReachLimitAutomaticClose(false)
        .setHomeAsUpIndicatorDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_back_black_24dp))
        .setOkButtonDrawable(ContextCompat.getDrawable(this, R.drawable.ic_check_black_24dp))
        .setAllViewTitle("All of your photos")
        .setActionBarTitle("FishBun Light")
        .textOnImagesSelectionLimitReached("You can't select any more.")
        .textOnNothingSelected("I need a photo!")
        .startAlbum();
Screenshots

How to Setup

Setting up FishBun requires to add this Gradle configuration:

repositories {
    jcenter()
}

dependencies {
    // Under the Android Plugin 3.0.0. 
    compile 'com.sangcomz:FishBun:0.9.1'

    compile 'com.squareup.picasso:picasso:2.71828'
    or
    compile 'com.github.bumptech.glide:glide:4.9.0'

    // Android plugin 3.0.0 or higher.
    implementation 'com.sangcomz:FishBun:0.9.1'

    implementation 'com.squareup.picasso:picasso:2.71828'
    or
    implementation 'com.github.bumptech.glide:glide:4.9.0'

} 

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" />

How to Use

Use FishBun in an activity:

FishBun.with(YourActivity).setImageAdapter(new GlideAdapter()).startAlbum();

or in a fragment:

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

and implement OnActivityResult:

protected void onActivityResult(int requestCode, int resultCode,
                                Intent imageData) {
    super.onActivityResult(requestCode, resultCode, imageData);
    switch (requestCode) {
        case Define.ALBUM_REQUEST_CODE:
            if (resultCode == RESULT_OK) {
                // path = imageData.getStringArrayListExtra(Define.INTENT_PATH);
                // you can get an image path(ArrayList<String>) on <0.6.2

                path = imageData.getParcelableArrayListExtra(Define.INTENT_PATH);
                // you can get an image path(ArrayList<Uri>) on 0.6.2 and later
                break;
            }
    }
}

Various customizable features can be controlled by chained methods as in:

FishBun.with(YourActivity or YourFragment)
        .setImageAdapter(new GlideAdapter())
        .setIsUseDetailView(false)
        .setPickerCount(5) //Deprecated
        .setMaxCount(5)
        .setMinCount(1)
        .setPickerSpanCount(6)
        .setActionBarColor(Color.parseColor("#795548"), Color.parseColor("#5D4037"), false)
        .setActionBarTitleColor(Color.parseColor("#ffffff"))
        .setArrayPaths(path)
        .setAlbumSpanCount(2, 4)
        .setButtonInAlbumActivity(false)
        .setCamera(true)
        .setReachLimitAutomaticClose(true)
        .setHomeAsUpIndicatorDrawable(ContextCompat.getDrawable(this, R.drawable.ic_custom_back_white))
        .setOkButtonDrawable(ContextCompat.getDrawable(this, R.drawable.ic_custom_ok))
        .setAllViewTitle("All")
        .setActionBarTitle("Image Library")
        .textOnImagesSelectionLimitReached("Limit Reached!")
        .textOnNothingSelected("Nothing Selected")
        .setSelectCircleStrokeColor(Color.BLACK)
        .isStartInAllView(false)
        .startAlbum();

Android M Permission

Running on Android M, FishBun checks if it has proper permission for you before reading an external storage.

Apps using FishBun

Project Name Result Screen
Pandaz

Get it on Google Play

Contribution

Any suggestions or contributions would be welcomed. CONTRIBUTING

License

Copyright 2019 Seokwon Jeong

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.