diff --git a/app/build.gradle b/app/build.gradle index 78bb09b..b14964a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,15 +1,14 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 23 - buildToolsVersion '23.0.2' + compileSdkVersion 27 defaultConfig { applicationId "net.yazeed44.imagepicker.sample" minSdkVersion 15 - targetSdkVersion 23 - versionCode 3 - versionName "1.3.1" + targetSdkVersion 27 + versionCode 5 + versionName "1.3.3" } buildTypes { release { @@ -33,11 +32,12 @@ repositories { dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - compile project(':imagepicker') - compile('com.github.afollestad.material-dialogs:core:0.8.5.3@aar') { + implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation project(':imagepicker') + implementation('com.github.afollestad.material-dialogs:core:0.8.5.3@aar') { transitive = true } + implementation 'com.github.bumptech.glide:glide:4.9.0' } // Remove comment to exclude cwac-cam2 dependency to make the capture feature unavailable diff --git a/app/src/main/java/net/yazeed44/multiimagepicker/MainActivity.java b/app/src/main/java/net/yazeed44/multiimagepicker/MainActivity.java index 956cd7f..50e18ad 100644 --- a/app/src/main/java/net/yazeed44/multiimagepicker/MainActivity.java +++ b/app/src/main/java/net/yazeed44/multiimagepicker/MainActivity.java @@ -67,6 +67,7 @@ public void onClickPickImageMultipleWithLimit(View view) { new Picker.Builder(this, this, R.style.MIP_theme) .setPickMode(Picker.PickMode.MULTIPLE_IMAGES) .setLimit(6) + .setMessageForLimit("You can't check more than 6 images") .build() .startActivity(); } @@ -177,7 +178,6 @@ private void loadImage(final String path, final ImageView imageView) { Glide.with(MainActivity.this) .load(path) - .asBitmap() .into(imageView); diff --git a/build.gradle b/build.gradle index ac702f5..a9039ef 100644 --- a/build.gradle +++ b/build.gradle @@ -3,15 +3,18 @@ buildscript { repositories { + maven { + url 'https://maven.google.com/' + name 'Google' + } jcenter() - } dependencies { - classpath 'com.android.tools.build:gradle:1.3.0' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -22,11 +25,15 @@ buildscript { allprojects { repositories { + maven { + url 'https://maven.google.com/' + name 'Google' + } jcenter() - maven { - url "https://repo.commonsware.com.s3.amazonaws.com" + url "https://s3.amazonaws.com/repo.commonsware.com" } + } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac5e5e3..207473f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Jul 22 16:23:45 AST 2015 +#Tue May 28 09:22:12 IST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/imagepicker/build.gradle b/imagepicker/build.gradle index fecb1a3..0742eeb 100644 --- a/imagepicker/build.gradle +++ b/imagepicker/build.gradle @@ -26,12 +26,11 @@ ext { android { - compileSdkVersion 23 - buildToolsVersion '23.0.2' + compileSdkVersion 27 defaultConfig { minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 27 } buildTypes { @@ -51,17 +50,18 @@ repositories { dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - compile 'com.android.support:support-annotations:23.1.1' - compile 'com.android.support:recyclerview-v7:23.1.1' - compile 'com.android.support:appcompat-v7:23.1.1' - compile 'com.android.support:design:23.1.1' - compile 'com.github.bumptech.glide:glide:3.6.1' - compile 'com.octo.android.robospice:robospice:1.4.14' - compile 'com.melnykov:floatingactionbutton:1.3.0' - compile 'de.greenrobot:eventbus:2.4.0' - compile 'com.github.chrisbanes.photoview:library:1.2.3' - compile 'com.commonsware.cwac:cam2:0.2.3' + implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation 'com.android.support:support-annotations:28.0.0' + implementation 'com.android.support:recyclerview-v7:27.1.1' + implementation 'com.android.support:appcompat-v7:27.1.1' + implementation "com.android.support:support-v4:27.1.1" + implementation 'com.android.support:design:27.1.1' + implementation 'com.github.bumptech.glide:glide:4.9.0' + implementation 'com.octo.android.robospice:robospice:1.4.14' + implementation 'com.melnykov:floatingactionbutton:1.3.0' + implementation 'de.greenrobot:eventbus:2.4.0' + implementation 'com.github.chrisbanes.photoview:library:1.2.3' + implementation 'com.commonsware.cwac:cam2:0.2.3' } apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' diff --git a/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/AlbumsAdapter.java b/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/AlbumsAdapter.java index 844e0cd..dd2e02b 100644 --- a/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/AlbumsAdapter.java +++ b/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/AlbumsAdapter.java @@ -93,7 +93,6 @@ public void setupAlbum(final AlbumViewHolder holder, final AlbumEntry album) { Glide.with(mFragment) .load(album.coverImage.path) - .asBitmap() .centerCrop() .into(holder.thumbnail); diff --git a/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/ImagePagerAdapter.java b/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/ImagePagerAdapter.java index 064fdcd..780d72f 100644 --- a/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/ImagePagerAdapter.java +++ b/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/ImagePagerAdapter.java @@ -49,7 +49,6 @@ public Object instantiateItem(ViewGroup container, int position) { Glide.with(mFragment) .load(imageEntry.path) - .asBitmap() .into(view); container.addView(view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); diff --git a/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/ImagesThumbnailAdapter.java b/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/ImagesThumbnailAdapter.java index cae7b02..7a54027 100644 --- a/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/ImagesThumbnailAdapter.java +++ b/imagepicker/src/main/java/net/yazeed44/imagepicker/ui/ImagesThumbnailAdapter.java @@ -35,6 +35,7 @@ public class ImagesThumbnailAdapter extends RecyclerView.Adapter mPickOptions.limit) { //Hit the limit - Toast.makeText(this, R.string.you_cant_check_more_images, Toast.LENGTH_SHORT).show(); + Toast.makeText(this,mPickOptions.limitMessage, Toast.LENGTH_SHORT).show(); break; } @@ -539,7 +537,7 @@ private void handleMultipleModeAddition(final ImageEntry imageEntry) { imageEntry.isPicked = true; sCheckedImages.add(imageEntry); } else { - Toast.makeText(this, R.string.you_cant_check_more_images, Toast.LENGTH_SHORT).show(); + Toast.makeText(this, mPickOptions.limitMessage, Toast.LENGTH_SHORT).show(); Log.i("onPickImage", "You can't check more images"); } @@ -586,7 +584,6 @@ private void handleToolbarVisibility(final boolean show) { } - public void onEvent(final Events.OnClickAlbumEvent albumEvent) { mSelectedAlbum = albumEvent.albumEntry; @@ -687,6 +684,4 @@ public void onEvent(final Events.OnHidingToolbarEvent hidingToolbarEvent) { } - - } diff --git a/imagepicker/src/main/java/net/yazeed44/imagepicker/util/Picker.java b/imagepicker/src/main/java/net/yazeed44/imagepicker/util/Picker.java index 3fcbdd8..e203d0e 100644 --- a/imagepicker/src/main/java/net/yazeed44/imagepicker/util/Picker.java +++ b/imagepicker/src/main/java/net/yazeed44/imagepicker/util/Picker.java @@ -25,6 +25,7 @@ public final class Picker { public final int limit; + public final String limitMessage; public final Context context; public final int fabBackgroundColor; public final int fabBackgroundColorWhenPressed; @@ -43,6 +44,7 @@ public final class Picker { public final int doneFabIconTintColor; public final boolean shouldShowCaptureMenuItem; public final int checkIconTintColor; + public final int checkIconUncheckedTintColor; public final boolean videosEnabled; public final int videoLengthLimit; public final int videoThumbnailOverlayColor; @@ -52,6 +54,7 @@ public final class Picker { private Picker(final Builder builder) { context = builder.mContext; limit = builder.mLimit; + limitMessage = builder.mLimitMessage; fabBackgroundColor = builder.mFabBackgroundColor; fabBackgroundColorWhenPressed = builder.mFabBackgroundColorWhenPressed; imageBackgroundColorWhenChecked = builder.mImageBackgroundColorWhenChecked; @@ -69,6 +72,7 @@ private Picker(final Builder builder) { doneFabIconTintColor = builder.mDoneFabIconTintColor; shouldShowCaptureMenuItem = builder.mShouldShowCaptureMenuItem; checkIconTintColor = builder.mCheckIconTintColor; + checkIconUncheckedTintColor = builder.mCheckIconUncheckedTintColor; videosEnabled = builder.mVideosEnabled; videoLengthLimit = builder.mVideoLengthLimit; videoThumbnailOverlayColor = builder.mVideoThumbnailOverlayColor; @@ -106,6 +110,7 @@ public static class Builder { private final PickListener mPickListener; private final int mThemeResId; private int mLimit = PickerActivity.NO_LIMIT; + private String mLimitMessage; private int mFabBackgroundColor; private int mFabBackgroundColorWhenPressed; private int mImageBackgroundColorWhenChecked; @@ -121,6 +126,7 @@ public static class Builder { private int mCaptureItemIconTintColor; private boolean mShouldShowCaptureMenuItem; private int mCheckIconTintColor; + private int mCheckIconUncheckedTintColor; private boolean mVideosEnabled; private int mVideoLengthLimit; private int mVideoThumbnailOverlayColor; @@ -169,6 +175,8 @@ private void init() { mShouldShowCaptureMenuItem = true; mCheckIconTintColor = Color.WHITE; + mCheckIconUncheckedTintColor = Color.WHITE; + mVideosEnabled = false; mVideoLengthLimit = 0; // No limit @@ -195,6 +203,16 @@ public Picker.Builder setLimit(final int limit) { return this; } + public Picker.Builder setMessageForLimit(final int resId) { + mLimitMessage = mContext.getString(resId); + return this; + } + + public Picker.Builder setMessageForLimit(final String message) { + mLimitMessage = message; + return this; + } + public Picker.Builder setFabBackgroundColor(@ColorInt final int color) { mFabBackgroundColor = color; return this; @@ -271,6 +289,11 @@ public Picker.Builder setCheckIconTintColor(@ColorInt final int color) { return this; } + public Picker.Builder setCheckIconUncheckedTintColor(@ColorInt final int color) { + mCheckIconUncheckedTintColor = color; + return this; + } + public Picker.Builder setBackBtnInMainActivity(final boolean backBtn) { mBackBtnInMainActivity = backBtn; return this;