diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 9bc1db0..ff08d92 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ 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 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/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 eccff49..8196eb7 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.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -19,6 +17,7 @@ allprojects { repositories { google() jcenter() + maven { url 'https://jitpack.io' } } } 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/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 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 @@ - -