summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-05-16 22:41:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-16 22:41:13 +0000
commit2239ec70b0733d655968b10176562f1aee4ad7a8 (patch)
tree0b64cf8491ec0f41436ae54e25969697b392486c /src
parent90374a77ce339f30a04fbb5d3c5faa0c84901c71 (diff)
parentc26986ec0380030e4938ea29a5535854e5b5bf9e (diff)
Merge "Cleaning up shadowing and animation of call log expansion."
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 2b2d43c82..6caa25cf3 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -17,6 +17,8 @@
package com.android.dialer.calllog;
import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.animation.Animator.AnimatorListener;
import android.app.Activity;
@@ -541,9 +543,33 @@ public class CallLogFragment extends ListFragment
if (!isExpand) {
viewHolder.actionsView.setVisibility(View.VISIBLE);
}
+
+ // Set up the fade effect for the action buttons.
+ if (isExpand) {
+ int fadeDuration = getResources().getInteger(
+ R.integer.call_log_actions_fade_in_duration);
+ int startDelay = getResources().getInteger(
+ R.integer.call_log_actions_fade_start);
+ // Start the fade in after the expansion has partly completed, otherwise it
+ // will be mostly over before the expansion completes.
+ viewHolder.actionsView.setAlpha(0f);
+ viewHolder.actionsView.animate()
+ .alpha(1f)
+ .setStartDelay(startDelay)
+ .setDuration(fadeDuration)
+ .start();
+ } else {
+ int fadeDuration = getResources().getInteger(
+ R.integer.call_log_actions_fade_out_duration);
+ viewHolder.actionsView.setAlpha(1f);
+ viewHolder.actionsView.animate()
+ .alpha(0f)
+ .setDuration(fadeDuration)
+ .start();
+ }
view.requestLayout();
- // Set up the animator to animate the expansion.
+ // Set up the animator to animate the expansion and shadow depth.
ValueAnimator animator = isExpand ? ValueAnimator.ofFloat(0f, 1f)
: ValueAnimator.ofFloat(1f, 0f);
@@ -555,7 +581,8 @@ public class CallLogFragment extends ListFragment
// For each value from 0 to 1, animate the various parts of the layout.
view.getLayoutParams().height =
(int) (value * distance + baseHeight);
- view.setElevation(mExpandedItemElevation * value);
+ viewHolder.callLogEntryView
+ .setElevation(mExpandedItemElevation * value);
view.requestLayout();
}
});
@@ -564,6 +591,7 @@ public class CallLogFragment extends ListFragment
@Override
public void onAnimationEnd(Animator animation) {
view.getLayoutParams().height = LayoutParams.WRAP_CONTENT;
+
if (!isExpand) {
viewHolder.actionsView.setVisibility(View.GONE);
}
@@ -576,6 +604,11 @@ public class CallLogFragment extends ListFragment
@Override
public void onAnimationStart(Animator animation) { }
});
+
+ final int expandCollapseDuration = getResources().getInteger(
+ R.integer.call_log_expand_collapse_duration);
+
+ animator.setDuration(expandCollapseDuration);
animator.start();
// Return false so this draw does not occur to prevent the final frame from