diff --git a/.gitignore b/.gitignore index 39fb081..fc83475 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /local.properties /.idea/workspace.xml /.idea/libraries +/.idea .DS_Store /build /captures diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser deleted file mode 100644 index 20e79e4..0000000 Binary files a/.idea/caches/build_file_checksums.ser and /dev/null differ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 30aa626..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file 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/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 5f40751..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 99202cc..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index e992ffa..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3597555..24e6798 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { ext.compileSdkVersion = 27 - ext.buildToolsVersion = '27.0.3' + ext.buildToolsVersion = '28.0.3' ext.minSdkVersion = 16 ext.targetSdkVersion = 27 ext.supportVersion = '27.1.1' @@ -11,9 +11,10 @@ buildscript { repositories { jcenter() google() + maven { url "https://maven.google.com" } } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.3.2' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1e83583..51eb0e0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 03 23:04:03 CEST 2018 +#Thu Apr 11 12:47:04 IRDT 2019 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.10.1-all.zip diff --git a/zoomy/src/main/java/com/ablanco/zoomy/ZoomableTouchListener.java b/zoomy/src/main/java/com/ablanco/zoomy/ZoomableTouchListener.java index 059d67f..2110731 100644 --- a/zoomy/src/main/java/com/ablanco/zoomy/ZoomableTouchListener.java +++ b/zoomy/src/main/java/com/ablanco/zoomy/ZoomableTouchListener.java @@ -1,5 +1,8 @@ package com.ablanco.zoomy; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; import android.graphics.Color; import android.graphics.Point; import android.graphics.PointF; @@ -170,17 +173,38 @@ public boolean onTouch(View v, MotionEvent ev) { return true; } - private void endZoomingView() { if (mConfig.isZoomAnimationEnabled()) { mAnimatingZoomEnding = true; - mZoomableView.animate() - .x(mTargetViewCords.x) - .y(mTargetViewCords.y) - .scaleX(1) - .scaleY(1) - .setInterpolator(mEndZoomingInterpolator) - .withEndAction(mEndingZoomAction).start(); + ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f); + animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + float xStart = mZoomableView.getX(); + float yStart = mZoomableView.getY(); + float scaleStart = mZoomableView.getScaleX(); + + @Override + public void onAnimationUpdate(ValueAnimator animation) { + mZoomableView.setX(xStart + animation.getAnimatedFraction() * (mTargetViewCords.x - xStart)); + mZoomableView.setY(yStart + animation.getAnimatedFraction() * (mTargetViewCords.y - yStart)); + mScaleFactor = scaleStart + animation.getAnimatedFraction() * (1f - scaleStart); + mZoomableView.setScaleX(mScaleFactor); + mZoomableView.setScaleY(mScaleFactor); + obscureDecorView(mScaleFactor >= 1 ? mScaleFactor: 1); + } + }); + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationCancel(Animator animation) { + mEndingZoomAction.run(); + } + + @Override + public void onAnimationEnd(Animator animation) { + mEndingZoomAction.run(); + } + }); + animator.setInterpolator(mEndZoomingInterpolator); + animator.start(); } else mEndingZoomAction.run(); }