Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animate background shadow #26

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea
.DS_Store
/build
/captures
Expand Down
Binary file removed .idea/caches/build_file_checksums.ser
Binary file not shown.
29 changes: 0 additions & 29 deletions .idea/codeStyles/Project.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

19 changes: 0 additions & 19 deletions .idea/gradle.xml

This file was deleted.

34 changes: 0 additions & 34 deletions .idea/misc.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
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'

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'

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
40 changes: 32 additions & 8 deletions zoomy/src/main/java/com/ablanco/zoomy/ZoomableTouchListener.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down