summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-05-27 14:04:56 -0700
committerAndrew Lee <anwlee@google.com>2014-05-27 14:04:56 -0700
commita84cefa7670c7805a0e12228ab8666460b722543 (patch)
treeda32a5c662e8ef3a5dc20ee73a4134b60c5ced30 /InCallUI
parent6af73542e5a50b30cd62214d27d2d4ad88fa4982 (diff)
Show elapsed time in InCallUI.
Before, this was getting owned at the end of animation, for some reason (perhaps the visibility was being set improperly?). In any case, the newer AnimUtils in contacts common handles this properly, so here we delete the hide/show helpers in AnimationUtils which are now no longer needed and use these more common utilities instead. Bug: 15281475 Change-Id: I86558d51b14605fff70945c3a97df05ddc45f1ca
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/AnimationUtils.java99
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java9
2 files changed, 4 insertions, 104 deletions
diff --git a/InCallUI/src/com/android/incallui/AnimationUtils.java b/InCallUI/src/com/android/incallui/AnimationUtils.java
index d214c8569..b5546de14 100644
--- a/InCallUI/src/com/android/incallui/AnimationUtils.java
+++ b/InCallUI/src/com/android/incallui/AnimationUtils.java
@@ -48,105 +48,6 @@ public class AnimationUtils {
}
/**
- * Simple Utility class that runs fading animations on specified views.
- */
- public static class Fade {
-
- // View tag that's set during the fade-out animation; see hide() and
- // isFadingOut().
- private static final int FADE_STATE_KEY = R.id.fadeState;
- private static final String FADING_OUT = "fading_out";
-
- /**
- * Sets the visibility of the specified view to View.VISIBLE and then
- * fades it in. If the view is already visible (and not in the middle
- * of a fade-out animation), this method will return without doing
- * anything.
- *
- * @param view The view to be faded in
- */
- public static void show(final View view) {
- if (FADE_DBG) log("Fade: SHOW view " + view + "...");
- if (FADE_DBG) log("Fade: - visibility = " + view.getVisibility());
- if ((view.getVisibility() != View.VISIBLE) || isFadingOut(view)) {
- view.animate().cancel();
- // ...and clear the FADE_STATE_KEY tag in case we just
- // canceled an in-progress fade-out animation.
- view.setTag(FADE_STATE_KEY, null);
-
- view.setAlpha(0);
- view.setVisibility(View.VISIBLE);
- view.animate().setDuration(ANIMATION_DURATION);
- view.animate().alpha(1);
- if (FADE_DBG) log("Fade: ==> SHOW " + view
- + " DONE. Set visibility = " + View.VISIBLE);
- } else {
- if (FADE_DBG) log("Fade: ==> Ignoring, already visible AND not fading out.");
- }
- }
-
- /**
- * Fades out the specified view and then sets its visibility to the
- * specified value (either View.INVISIBLE or View.GONE). If the view
- * is not currently visibile, the method will return without doing
- * anything.
- *
- * Note that *during* the fade-out the view itself will still have
- * visibility View.VISIBLE, although the isFadingOut() method will
- * return true (in case the UI code needs to detect this state.)
- *
- * @param view The view to be hidden
- * @param visibility The value to which the view's visibility will be
- * set after it fades out.
- * Must be either View.INVISIBLE or View.GONE.
- */
- public static void hide(final View view, final int visibility) {
- if (FADE_DBG) log("Fade: HIDE view " + view + "...");
- if (view.getVisibility() == View.VISIBLE &&
- (visibility == View.INVISIBLE || visibility == View.GONE)) {
-
- // Use a view tag to mark this view as being in the middle
- // of a fade-out animation.
- view.setTag(FADE_STATE_KEY, FADING_OUT);
-
- view.animate().cancel();
- view.animate().setDuration(ANIMATION_DURATION);
- view.animate().alpha(0f).setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- view.setAlpha(1);
- view.setVisibility(visibility);
- view.animate().setListener(null);
- // ...and we're done with the fade-out, so clear the view tag.
- view.setTag(FADE_STATE_KEY, null);
- if (FADE_DBG) log("Fade: HIDE " + view
- + " DONE. Set visibility = " + visibility);
- }
- });
- }
- }
-
- /**
- * @return true if the specified view is currently in the middle
- * of a fade-out animation. (During the fade-out, the view's
- * visibility is still VISIBLE, although in many cases the UI
- * should behave as if it's already invisible or gone. This
- * method allows the UI code to detect that state.)
- *
- * @see #hide(View, int)
- */
- public static boolean isFadingOut(final View view) {
- if (FADE_DBG) {
- log("Fade: isFadingOut view " + view + "...");
- log("Fade: - getTag() returns: " + view.getTag(FADE_STATE_KEY));
- log("Fade: - returning: " + (view.getTag(FADE_STATE_KEY) == FADING_OUT));
- }
- return (view.getTag(FADE_STATE_KEY) == FADING_OUT);
- }
-
- }
-
- /**
* Drawable achieving cross-fade, just like TransitionDrawable. We can have
* call-backs via animator object (see also {@link CrossFadeDrawable#getAnimator()}).
*/
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index ad549bc52..5209df2ed 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -31,9 +31,7 @@ import android.text.TextUtils;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.accessibility.AccessibilityEvent;
@@ -43,6 +41,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
+import com.android.contacts.common.animation.AnimUtils;
import com.android.contacts.common.util.ViewUtil;
import java.util.List;
@@ -325,12 +324,12 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
public void setPrimaryCallElapsedTime(boolean show, String callTimeElapsed) {
if (show) {
if (mElapsedTime.getVisibility() != View.VISIBLE) {
- AnimationUtils.Fade.show(mElapsedTime);
+ AnimUtils.fadeIn(mElapsedTime, AnimUtils.DEFAULT_DURATION);
}
mElapsedTime.setText(callTimeElapsed);
} else {
// hide() animation has no effect if it is already hidden.
- AnimationUtils.Fade.hide(mElapsedTime, View.INVISIBLE);
+ AnimUtils.fadeOut(mElapsedTime, AnimUtils.DEFAULT_DURATION);
}
}
@@ -342,7 +341,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
final Drawable current = view.getDrawable();
if (current == null) {
view.setImageDrawable(photo);
- AnimationUtils.Fade.show(view);
+ AnimUtils.fadeIn(mElapsedTime, AnimUtils.DEFAULT_DURATION);
} else {
AnimationUtils.startCrossFade(view, current, photo);
view.setVisibility(View.VISIBLE);