Lines Matching refs:view
26 import android.view.View;
27 import android.view.ViewPropertyAnimator;
55 // View tag that's set during the fade-out animation; see hide() and
61 * Sets the visibility of the specified view to View.VISIBLE and then
62 * fades it in. If the view is already visible (and not in the middle
66 * @param view The view to be faded in
68 public static void show(final View view) {
69 if (FADE_DBG) log("Fade: SHOW view " + view + "...");
70 if (FADE_DBG) log("Fade: - visibility = " + view.getVisibility());
71 if ((view.getVisibility() != View.VISIBLE) || isFadingOut(view)) {
72 view.animate().cancel();
75 view.setTag(FADE_STATE_KEY, null);
77 view.setAlpha(0);
78 view.setVisibility(View.VISIBLE);
79 view.animate().setDuration(ANIMATION_DURATION);
80 view.animate().alpha(1);
81 if (FADE_DBG) log("Fade: ==> SHOW " + view
82 + " DONE. Set visibility = " + View.VISIBLE);
89 * Fades out the specified view and then sets its visibility to the
90 * specified value (either View.INVISIBLE or View.GONE). If the view
94 * Note that *during* the fade-out the view itself will still have
95 * visibility View.VISIBLE, although the isFadingOut() method will
98 * @param view The view to be hidden
99 * @param visibility The value to which the view's visibility will be
101 * Must be either View.INVISIBLE or View.GONE.
103 public static void hide(final View view, final int visibility) {
104 if (FADE_DBG) log("Fade: HIDE view " + view + "...");
105 if (view.getVisibility() == View.VISIBLE &&
106 (visibility == View.INVISIBLE || visibility == View.GONE)) {
108 // Use a view tag to mark this view as being in the middle
110 view.setTag(FADE_STATE_KEY, FADING_OUT);
112 view.animate().cancel();
113 view.animate().setDuration(ANIMATION_DURATION);
114 view.animate().alpha(0f).setListener(new AnimatorListenerAdapter() {
117 view.setAlpha(1);
118 view.setVisibility(visibility);
119 view.animate().setListener(null);
120 // ...and we're done with the fade-out, so clear the view tag.
121 view.setTag(FADE_STATE_KEY, null);
122 if (FADE_DBG) log("Fade: HIDE " + view
130 * @return true if the specified view is currently in the middle
131 * of a fade-out animation. (During the fade-out, the view's
136 * @see #hide(View, int)
138 public static boolean isFadingOut(final View view) {
140 log("Fade: isFadingOut view " + view + "...");
141 log("Fade: - getTag() returns: " + view.getTag(FADE_STATE_KEY));
142 log("Fade: - returning: " + (view.getTag(FADE_STATE_KEY) == FADING_OUT));
144 return (view.getTag(FADE_STATE_KEY) == FADING_OUT);