diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2013-11-07 04:15:10 +0100 |
---|---|---|
committer | Jorge Ruesga <jorge@ruesga.com> | 2013-11-07 04:15:10 +0100 |
commit | 72aedd7b2fd64c593de971fa9d89c0251930b72d (patch) | |
tree | 6a3f1c33365d71565b6613d57e805667b09c14bd | |
parent | 759a39f9b41a71a3eda502241f527e182e09936a (diff) | |
download | android_packages_wallpapers_PhotoPhase-72aedd7b2fd64c593de971fa9d89c0251930b72d.tar.gz android_packages_wallpapers_PhotoPhase-72aedd7b2fd64c593de971fa9d89c0251930b72d.tar.bz2 android_packages_wallpapers_PhotoPhase-72aedd7b2fd64c593de971fa9d89c0251930b72d.zip |
Fix disposition view-in animation on aosp 4.4
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
-rw-r--r-- | res/anim/display_with_bounce.xml | 34 | ||||
-rw-r--r-- | res/values/integers.xml | 2 | ||||
-rw-r--r-- | src/org/cyanogenmod/wallpapers/photophase/widgets/DispositionView.java | 28 |
3 files changed, 14 insertions, 50 deletions
diff --git a/res/anim/display_with_bounce.xml b/res/anim/display_with_bounce.xml deleted file mode 100644 index 0a51b53..0000000 --- a/res/anim/display_with_bounce.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2013 The CyanogenMod Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<set xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@android:anim/bounce_interpolator" > - - <scale - android:duration="@integer/disposition_show_anim" - android:fromXScale="0.0" - android:fromYScale="0.0" - android:toXScale="1.0" - android:toYScale="1.0" - android:pivotX="50%" - android:pivotY="50%" /> - - <alpha - android:duration="@integer/disposition_show_anim" - android:fromAlpha="0.0" - android:toAlpha="1.0" /> - -</set>
\ No newline at end of file diff --git a/res/values/integers.xml b/res/values/integers.xml index 25e3088..be92e90 100644 --- a/res/values/integers.xml +++ b/res/values/integers.xml @@ -19,7 +19,7 @@ <integer name="cards_rotate_anim">800</integer> <integer name="pictures_anim_in">600</integer> <integer name="pictures_anim_out">400</integer> - <integer name="disposition_show_anim">600</integer> + <integer name="disposition_show_anim">800</integer> <integer name="disposition_hide_anim">400</integer> <integer name="disposition_advise_lines">2</integer> </resources> diff --git a/src/org/cyanogenmod/wallpapers/photophase/widgets/DispositionView.java b/src/org/cyanogenmod/wallpapers/photophase/widgets/DispositionView.java index 87e3999..a2a3abc 100644 --- a/src/org/cyanogenmod/wallpapers/photophase/widgets/DispositionView.java +++ b/src/org/cyanogenmod/wallpapers/photophase/widgets/DispositionView.java @@ -29,8 +29,7 @@ import android.view.Gravity; import android.view.View; import android.view.View.OnLongClickListener; import android.view.animation.AccelerateInterpolator; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; +import android.view.animation.BounceInterpolator; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.RelativeLayout; @@ -376,23 +375,22 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen v.setX(r.left + padding); v.setY(r.top + padding); v.setOnLongClickListener(this); - if (animate) { - v.setVisibility(View.INVISIBLE); - } addView(v, params); // Animate the view if (animate) { - post(new Runnable() { - @Override - public void run() { - Animation anim = AnimationUtils.loadAnimation( - getContext(), R.anim.display_with_bounce); - anim.setFillBefore(true); - anim.setFillAfter(true); - v.startAnimation(anim); - } - }); + List<Animator> animators = new ArrayList<Animator>(); + animators.add(ObjectAnimator.ofFloat(v, "scaleX", 0.0f, 1.0f)); + animators.add(ObjectAnimator.ofFloat(v, "scaleY", 0.0f, 1.0f)); + animators.add(ObjectAnimator.ofFloat(v, "alpha", 0.0f, 1.0f)); + animators.add(ObjectAnimator.ofFloat(v, "alpha", 0.0f, 1.0f)); + + AnimatorSet animSet = new AnimatorSet(); + animSet.playTogether(animators); + animSet.setDuration(getResources().getInteger(R.integer.disposition_show_anim)); + animSet.setInterpolator(new BounceInterpolator()); + animSet.setTarget(v); + animSet.start(); } return v; |