diff --git a/FishBun/build.gradle b/FishBun/build.gradle index cfdfcbb0..c73c9d20 100644 --- a/FishBun/build.gradle +++ b/FishBun/build.gradle @@ -45,7 +45,7 @@ dependencies { compile "com.android.support:recyclerview-v7:$rootProject.support_version" testImplementation 'junit:junit:4.12' - testImplementation 'org.mockito:mockito-core:2.2.27' + testImplementation 'org.mockito:mockito-core:2.8.9' compileOnly "com.squareup.picasso:picasso:$rootProject.picasso_version" compileOnly "com.github.bumptech.glide:glide:$rootProject.glide_version" diff --git a/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/ImageAdapter.java b/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/ImageAdapter.java index c699199b..f09db3be 100644 --- a/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/ImageAdapter.java +++ b/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/ImageAdapter.java @@ -10,4 +10,5 @@ public interface ImageAdapter { void loadImage(Context context, ImageView target, Uri loadUrl); + void loadDetailImage(Context context, ImageView target, Uri loadUrl); } diff --git a/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/impl/GlideAdapter.java b/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/impl/GlideAdapter.java index d5b3094f..5a13724c 100644 --- a/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/impl/GlideAdapter.java +++ b/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/impl/GlideAdapter.java @@ -14,7 +14,9 @@ public class GlideAdapter implements ImageAdapter { @Override - public void loadImage(Context context, ImageView target, Uri loadUrl) { + public void loadImage(Context context, + ImageView target, + Uri loadUrl) { RequestOptions options = new RequestOptions(); options.centerCrop(); Glide @@ -23,4 +25,15 @@ public void loadImage(Context context, ImageView target, Uri loadUrl) { .apply(options) .into(target); } + + @Override + public void loadDetailImage(Context context, ImageView target, Uri loadUrl) { + RequestOptions options = new RequestOptions(); + options.centerInside(); + Glide + .with(context) + .load(loadUrl) + .apply(options) + .into(target); + } } diff --git a/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/impl/PicassoAdapter.java b/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/impl/PicassoAdapter.java index 450232e5..190afc19 100644 --- a/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/impl/PicassoAdapter.java +++ b/FishBun/src/main/java/com/sangcomz/fishbun/adapter/image/impl/PicassoAdapter.java @@ -21,4 +21,14 @@ public void loadImage(Context context, ImageView target, Uri loadUrl) { .centerCrop() .into(target); } + + @Override + public void loadDetailImage(Context context, ImageView target, Uri loadUrl) { + Picasso + .with(context) + .load(loadUrl) + .fit() + .centerInside() + .into(target); + } } diff --git a/FishBun/src/main/java/com/sangcomz/fishbun/adapter/view/DetailViewPagerAdapter.java b/FishBun/src/main/java/com/sangcomz/fishbun/adapter/view/DetailViewPagerAdapter.java index d97e172e..726c797c 100644 --- a/FishBun/src/main/java/com/sangcomz/fishbun/adapter/view/DetailViewPagerAdapter.java +++ b/FishBun/src/main/java/com/sangcomz/fishbun/adapter/view/DetailViewPagerAdapter.java @@ -8,21 +8,24 @@ import android.view.View; import android.view.ViewGroup; +import com.sangcomz.fishbun.Fishton; import com.sangcomz.fishbun.R; import com.sangcomz.fishbun.util.TouchImageView; -import com.squareup.picasso.Picasso; /** * Created by sangcomz on 15/06/2017. */ public class DetailViewPagerAdapter extends PagerAdapter { + + private Fishton fishton; private LayoutInflater inflater; private Uri[] images; public DetailViewPagerAdapter(LayoutInflater inflater, Uri[] images) { this.inflater = inflater; this.images = images; + fishton = Fishton.getInstance(); } @@ -34,11 +37,12 @@ public Object instantiateItem(ViewGroup container, int position) { TouchImageView imageView = itemView.findViewById(R.id.img_detail_image); - Picasso.with(itemView.getContext()) - .load(images[position]) - .fit() - .centerInside() - .into(imageView); + fishton + .imageAdapter + .loadDetailImage(itemView.getContext(), + imageView, + images[position]); + return itemView; } diff --git a/FishBunDemo/src/main/java/com/sangcomz/fishbundemo/WithActivityActivity.java b/FishBunDemo/src/main/java/com/sangcomz/fishbundemo/WithActivityActivity.java index ade3607b..5d838bf2 100644 --- a/FishBunDemo/src/main/java/com/sangcomz/fishbundemo/WithActivityActivity.java +++ b/FishBunDemo/src/main/java/com/sangcomz/fishbundemo/WithActivityActivity.java @@ -74,7 +74,6 @@ public boolean onOptionsItemSelected(MenuItem item) { case 0: { FishBun.with(WithActivityActivity.this) .setImageAdapter(new GlideAdapter()) - .setIsUseDetailView(false) .startAlbum(); break; } diff --git a/README.md b/README.md index 03b9ead2..f9b56cc6 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,9 @@ _FishBun_ is a highly customizable image picker for Android. -## What's New in _FishBun_ 0.8.4? +## What's New in _FishBun_ 0.8.6? -- Fix TransactionTooLargeException ([#107](https://github.com/sangcomz/FishBun/issues/107)) -- Add Image Adapter (Picasso, Glide) (Remove MultiPageMode())[Check How to Use](#how-to-use) +- Crash without Picasso ([#113](https://github.com/sangcomz/FishBun/issues/113)) @@ -112,13 +111,15 @@ Setting up _FishBun_ requires to add this Gradle configuration: dependencies { // Under the Android Plugin 3.0.0. - compile 'com.sangcomz:FishBun:0.8.4' + compile 'com.sangcomz:FishBun:0.8.6' + compile 'com.squareup.picasso:picasso:2.5.2' or compile 'com.github.bumptech.glide:glide:4.5.0' // Android plugin 3.0.0 or higher. - implementation 'com.sangcomz:FishBun:0.8.4' + implementation 'com.sangcomz:FishBun:0.8.6' + implementation 'com.squareup.picasso:picasso:2.5.2' or implementation 'com.github.bumptech.glide:glide:4.5.0' diff --git a/gradle/release.gradle b/gradle/release.gradle index 6715669f..8bb7d90f 100644 --- a/gradle/release.gradle +++ b/gradle/release.gradle @@ -99,8 +99,7 @@ if (project.rootProject.file('local.properties').isFile()) { tagName = version targetCommitish = 'master' body = """## Release Note -* Fix TransactionTooLargeException (#107) -* Add Image Adapter (Picasso, Glide)""" +* Fix Deitail ImageView (#113)""" name = version } } diff --git a/settings.gradle b/settings.gradle index c9436c7c..084f0002 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,7 @@ include ':FishBunDemo', ':FishBun' -gradle.ext.versionCode = 19 -gradle.ext.versionName = '0.8.4' +gradle.ext.versionCode = 20 +gradle.ext.versionName = '0.8.6' gradle.ext.set('minSdk', 15) gradle.ext.set('targetSdk', 27)