From ee3aa963f626d17c2567f53554452070616b4722 Mon Sep 17 00:00:00 2001 From: Nico Saycon Date: Wed, 3 Oct 2018 17:55:23 +0800 Subject: [PATCH 1/4] Update Photo Viewer Version --- .idea/caches/build_file_checksums.ser | Bin 598 -> 591 bytes .idea/misc.xml | 10 +++++++--- .idea/vcs.xml | 2 +- build.gradle | 1 + imagepreview/build.gradle | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 9bc1db082da948c18775821f63dfc24f29b69cbd..c43c19952255cebf8968fb7862a8a22415342c44 100644 GIT binary patch delta 98 zcmV-o0GE0Vlf<2jmfS01T5a0u~U?6pgu= zX~K^y?lU`Vo2=-QfdL&Ml#Y%1`}?lO!S7oM*;sVBbO0zXRdZ!>b1!XkVR>V3Zj;6V EkS9VbEdT%j delta 122 zcmV-=0EPe01l9zQmjz4RJXL4a= zY-M$E0Db@l0000G@>ja_Zdtpg#4Wb4C7;cKlYs#pC~fA#!$Ni_I<3Hs16S~@5Oe@9 cFKBOVWiM%MZ(?L+b}eXWZDDR_X_LPJkU3E__W%F@ diff --git a/.idea/misc.xml b/.idea/misc.xml index c0f68ed..17426a4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,27 +5,31 @@ - + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/build.gradle b/build.gradle index eccff49..a0844db 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,7 @@ buildscript { allprojects { repositories { + maven { url 'https://jitpack.io' } google() jcenter() } diff --git a/imagepreview/build.gradle b/imagepreview/build.gradle index 1e028c3..45304c7 100644 --- a/imagepreview/build.gradle +++ b/imagepreview/build.gradle @@ -33,7 +33,7 @@ dependencies { implementation 'com.github.bumptech.glide:glide:4.4.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0' testImplementation 'junit:junit:4.12' - implementation 'com.github.chrisbanes:PhotoView:2.0.0' + implementation 'com.github.chrisbanes:PhotoView:2.2.0' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } From fd09bedfdc6becd1e4f249782bb6ecfdf6bd3c1c Mon Sep 17 00:00:00 2001 From: Nico Saycon Date: Wed, 3 Oct 2018 17:56:00 +0800 Subject: [PATCH 2/4] Delete File --- .idea/encodings.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/encodings.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 8fbee4d1e521833227b4369fb8f51af94e2928c7 Mon Sep 17 00:00:00 2001 From: Nico Saycon Date: Wed, 3 Oct 2018 18:20:57 +0800 Subject: [PATCH 3/4] Update Gradel Files --- .idea/caches/build_file_checksums.ser | Bin 591 -> 591 bytes build.gradle | 6 ++---- gradle/wrapper/gradle-wrapper.properties | 4 ++-- imagepreview/build.gradle | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index c43c19952255cebf8968fb7862a8a22415342c44..9dcf22abce7633a0a57c8b8d28b87376250bbfaa 100644 GIT binary patch delta 75 zcmV-R0JQ(l1kVJJnFDZ`qmi7fInxqv%DbEuYRX{B6AvY|>~sJOVs&Y3WG-iNVPtG& hb#VZG00sa601%awic-qa8Xls0+EE35m=u$N0nW6O9ykC1 delta 75 zcmV-R0JQ(l1kVJJnFCpCr;(hjIn>jk9NAOaF9rc8yATKD5p)0yVs&Y3WG-iNVPtG& hb#VZG00sa601(a;jk%d=!jCKNGdpaXtmu=00nT!=9t8jZ diff --git a/build.gradle b/build.gradle index a0844db..207a8d2 100644 --- a/build.gradle +++ b/build.gradle @@ -7,9 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.1' - - + classpath 'com.android.tools.build:gradle:3.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -17,9 +15,9 @@ buildscript { allprojects { repositories { - maven { url 'https://jitpack.io' } google() jcenter() + maven { url 'https://jitpack.io' } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 92ff23c..8059cee 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Apr 20 11:44:40 IST 2018 +#Wed Oct 03 18:15:55 PHT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip diff --git a/imagepreview/build.gradle b/imagepreview/build.gradle index 45304c7..1e028c3 100644 --- a/imagepreview/build.gradle +++ b/imagepreview/build.gradle @@ -33,7 +33,7 @@ dependencies { implementation 'com.github.bumptech.glide:glide:4.4.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0' testImplementation 'junit:junit:4.12' - implementation 'com.github.chrisbanes:PhotoView:2.2.0' + implementation 'com.github.chrisbanes:PhotoView:2.0.0' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } From 38203ae0c73bbb826decaf24be66ef77214b11bf Mon Sep 17 00:00:00 2001 From: Nico Saycon Date: Tue, 27 Nov 2018 10:11:56 +0800 Subject: [PATCH 4/4] fix crashes when zooming, migrate to android x --- .idea/caches/build_file_checksums.ser | Bin 591 -> 591 bytes app/build.gradle | 16 ++++----- .../ExampleInstrumentedTest.java | 4 +-- .../imagepreviewdemo/MainActivity.java | 2 +- app/src/main/res/layout/activity_main.xml | 14 ++++---- build.gradle | 2 +- gradle.properties | 2 ++ imagepreview/build.gradle | 31 +++++++++--------- .../imagepreview/ExampleInstrumentedTest.java | 4 +-- imagepreview/src/main/AndroidManifest.xml | 7 ++-- .../himangi/imagepreview/CheckPermission.java | 4 +-- .../imagepreview/ImagePreviewActivity.java | 24 +++++++++----- .../himangi/imagepreview/ImageViewPager.java | 26 +++++++++++++++ .../himangi/imagepreview/SlideAdapter.java | 4 +-- .../res/layout/activity_image_preview.xml | 6 ++-- 15 files changed, 90 insertions(+), 56 deletions(-) create mode 100644 imagepreview/src/main/java/com/himangi/imagepreview/ImageViewPager.java diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 9dcf22abce7633a0a57c8b8d28b87376250bbfaa..ff08d9299513e072810833716717566f8e2477fd 100644 GIT binary patch delta 136 zcmV;30C)e-1kVJJmj!21=bI>zoUA!SU1{6Dco&ofjdpA*?qDNy01RSvX>4RJXL4a= zY-M$E0Db@l0000G&I!;Q%%;Q^ARp=06hbF7lYs#p5F_KLR8@lqoq41xaZc|?aFeb9 qV-TD=Y_iIo9+}GS#I$#l!l9EP0v-@AUe4ZecRxq{9A$In2h@0QdN>FG delta 136 zcmV;30C)e-1kVJJmjz}yaG0Z!oUA$15^u`8oE2)yV9FB@CAI8y01RSvX>4RJXL4a= zY-M$E0Db@l0000Gm6VE7%F!AgqI%j<1%8+mlYs#p5R{IM`uqE?#=-Af3E5b5xs$E| qV-OI#c2LjlDfl?5K*4bGVlR^+0v-^3NYqUoL?h764S*#Ij97Se**UiW diff --git a/app/build.gradle b/app/build.gradle index aa3c59e..de622b2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 27 + compileSdkVersion 28 defaultConfig { applicationId "com.himangi.imagepreviewdemo" - minSdkVersion 15 - targetSdkVersion 27 + minSdkVersion 21 + targetSdkVersion 28 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { @@ -20,10 +20,10 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support.constraint:constraint-layout:1.1.0' + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.1' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + androidTestImplementation 'androidx.test:runner:1.1.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' implementation project(':imagepreview') } diff --git a/app/src/androidTest/java/com/himangi/imagepreviewdemo/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/himangi/imagepreviewdemo/ExampleInstrumentedTest.java index 95484d3..85cc880 100644 --- a/app/src/androidTest/java/com/himangi/imagepreviewdemo/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/com/himangi/imagepreviewdemo/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package com.himangi.imagepreviewdemo; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/app/src/main/java/com/himangi/imagepreviewdemo/MainActivity.java b/app/src/main/java/com/himangi/imagepreviewdemo/MainActivity.java index 2d26136..133c907 100644 --- a/app/src/main/java/com/himangi/imagepreviewdemo/MainActivity.java +++ b/app/src/main/java/com/himangi/imagepreviewdemo/MainActivity.java @@ -2,7 +2,7 @@ import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import com.himangi.imagepreview.ImagePreviewActivity; import com.himangi.imagepreview.PreviewFile; diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 84f1951..12b366a 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,10 +1,10 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 207a8d2..8196eb7 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.0' + classpath 'com.android.tools.build:gradle:3.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/gradle.properties b/gradle.properties index 743d692..8de5058 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,8 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/imagepreview/build.gradle b/imagepreview/build.gradle index 1e028c3..e540be4 100644 --- a/imagepreview/build.gradle +++ b/imagepreview/build.gradle @@ -1,18 +1,14 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 27 - - + compileSdkVersion 28 defaultConfig { - minSdkVersion 15 - targetSdkVersion 27 + minSdkVersion 21 + targetSdkVersion 28 versionCode 1 versionName "1.0" - - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -27,13 +23,16 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support.constraint:constraint-layout:1.1.0' - //// //Glide - implementation 'com.github.bumptech.glide:glide:4.4.0' - annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0' + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' + testImplementation 'junit:junit:4.12' - implementation 'com.github.chrisbanes:PhotoView:2.0.0' - androidTestImplementation 'com.android.support.test:runner:1.0.1' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + + implementation 'com.github.bumptech.glide:glide:4.8.0' + annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0' + + implementation 'com.github.chrisbanes:PhotoView:2.2.0' + + androidTestImplementation 'androidx.test:runner:1.1.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' } diff --git a/imagepreview/src/androidTest/java/com/himangi/imagepreview/ExampleInstrumentedTest.java b/imagepreview/src/androidTest/java/com/himangi/imagepreview/ExampleInstrumentedTest.java index 4efd892..517a8b6 100644 --- a/imagepreview/src/androidTest/java/com/himangi/imagepreview/ExampleInstrumentedTest.java +++ b/imagepreview/src/androidTest/java/com/himangi/imagepreview/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package com.himangi.imagepreview; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/imagepreview/src/main/AndroidManifest.xml b/imagepreview/src/main/AndroidManifest.xml index eace187..057c856 100644 --- a/imagepreview/src/main/AndroidManifest.xml +++ b/imagepreview/src/main/AndroidManifest.xml @@ -1,13 +1,16 @@ + xmlns:tools="http://schemas.android.com/tools" + package="com.himangi.imagepreview"> + + + - \ No newline at end of file diff --git a/imagepreview/src/main/java/com/himangi/imagepreview/CheckPermission.java b/imagepreview/src/main/java/com/himangi/imagepreview/CheckPermission.java index 739a78a..9e476dd 100644 --- a/imagepreview/src/main/java/com/himangi/imagepreview/CheckPermission.java +++ b/imagepreview/src/main/java/com/himangi/imagepreview/CheckPermission.java @@ -4,8 +4,8 @@ import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; -import android.support.annotation.RequiresApi; -import android.support.v4.content.ContextCompat; +import androidx.annotation.RequiresApi; +import androidx.core.content.ContextCompat; /** * Created by Himangi on 20/4/18 diff --git a/imagepreview/src/main/java/com/himangi/imagepreview/ImagePreviewActivity.java b/imagepreview/src/main/java/com/himangi/imagepreview/ImagePreviewActivity.java index cf60db8..7cb1e8a 100644 --- a/imagepreview/src/main/java/com/himangi/imagepreview/ImagePreviewActivity.java +++ b/imagepreview/src/main/java/com/himangi/imagepreview/ImagePreviewActivity.java @@ -9,12 +9,6 @@ import android.os.Build; import android.os.Bundle; import android.provider.Settings; -import android.support.annotation.NonNull; -import android.support.annotation.RequiresApi; -import android.support.v4.view.ViewPager; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -26,22 +20,32 @@ import java.util.List; -public class ImagePreviewActivity extends AppCompatActivity implements OnItemClickListener { +import androidx.annotation.NonNull; +import androidx.annotation.RequiresApi; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.viewpager.widget.ViewPager; +public class ImagePreviewActivity extends AppCompatActivity implements OnItemClickListener { public static String IMAGE_LIST = "intent_image_item"; + public static String CURRENT_ITEM = "current_item"; public Toolbar toolbar; - ViewPager vPager; + + ImageViewPager vPager; + private List mUriList; + private Bitmap mBitmap; + private String view; @Override protected void onCreate(Bundle savedInstanceState) { // requestWindowFeature(Window.FEATURE_NO_TITLE); - super.onCreate(savedInstanceState); setContentView(R.layout.activity_image_preview); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); @@ -61,6 +65,8 @@ public void onClick(View v) { } }); setUpViews(); + + super.onCreate(savedInstanceState); } private void setUpViews() { diff --git a/imagepreview/src/main/java/com/himangi/imagepreview/ImageViewPager.java b/imagepreview/src/main/java/com/himangi/imagepreview/ImageViewPager.java new file mode 100644 index 0000000..25b906a --- /dev/null +++ b/imagepreview/src/main/java/com/himangi/imagepreview/ImageViewPager.java @@ -0,0 +1,26 @@ +package com.himangi.imagepreview; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.viewpager.widget.ViewPager; + +public class ImageViewPager extends ViewPager { + + public ImageViewPager(@NonNull Context context,@Nullable AttributeSet attrs) { + super(context, attrs); + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + try { + return super.onInterceptTouchEvent(ev); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + return false; + } + } +} diff --git a/imagepreview/src/main/java/com/himangi/imagepreview/SlideAdapter.java b/imagepreview/src/main/java/com/himangi/imagepreview/SlideAdapter.java index 7af13bf..c89e4f3 100644 --- a/imagepreview/src/main/java/com/himangi/imagepreview/SlideAdapter.java +++ b/imagepreview/src/main/java/com/himangi/imagepreview/SlideAdapter.java @@ -1,8 +1,8 @@ package com.himangi.imagepreview; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.v4.view.PagerAdapter; +import androidx.annotation.NonNull; +import androidx.viewpager.widget.PagerAdapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/imagepreview/src/main/res/layout/activity_image_preview.xml b/imagepreview/src/main/res/layout/activity_image_preview.xml index 6807cfb..1b67eb1 100644 --- a/imagepreview/src/main/res/layout/activity_image_preview.xml +++ b/imagepreview/src/main/res/layout/activity_image_preview.xml @@ -1,19 +1,17 @@ - -