Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8dc38941 authored by Adam Powell's avatar Adam Powell Committed by Android Git Automerger
Browse files

am 7f30f8ab: am 93d35f77: Merge "Fix bug 2587373 - awaken scrollbars when a...

am 7f30f8ab: am 93d35f77: Merge "Fix bug 2587373 - awaken scrollbars when a scrolling view becomes visible." into froyo

Merge commit '7f30f8ab' into kraken

* commit '7f30f8ab':
  Fix bug 2587373 - awaken scrollbars when a scrolling view becomes visible.
parents 3d27a2e6 7f30f8ab
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -1513,6 +1513,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     */
    static final int CANCEL_NEXT_UP_EVENT = 0x04000000;
    
    /**
     * Indicates that we should awaken scroll bars once attached
     * 
     * @hide
     */
    private static final int AWAKEN_SCROLL_BARS_ON_ATTACH = 0x08000000;

    /**
     * The parent this view is attached to.
     * {@hide}
@@ -3838,6 +3845,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * {@link #INVISIBLE} or {@link #GONE}.
     */
    protected void onVisibilityChanged(View changedView, int visibility) {
        if (visibility == VISIBLE) {
            if (mAttachInfo != null) {
                initialAwakenScrollBars();
            } else {
                mPrivateFlags |= AWAKEN_SCROLL_BARS_ON_ATTACH;
            }
        }
    }

    /**
@@ -3888,6 +3902,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * @param visibility The new visibility of the window.
     */
    protected void onWindowVisibilityChanged(int visibility) {
        if (visibility == VISIBLE) {
            initialAwakenScrollBars();
        }
    }

    /**
@@ -4908,6 +4925,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
                awakenScrollBars(mScrollCache.scrollBarDefaultDelayBeforeFade, true);
    }

    /**
     * Trigger the scrollbars to draw.
     * This method differs from awakenScrollBars() only in its default duration.
     * initialAwakenScrollBars() will show the scroll bars for longer than
     * usual to give the user more of a chance to notice them.
     *
     * @return true if the animation is played, false otherwise.
     */
    private boolean initialAwakenScrollBars() {
        return mScrollCache != null &&
                awakenScrollBars(mScrollCache.scrollBarDefaultDelayBeforeFade * 4, true);
    }

    /**
     * <p>
     * Trigger the scrollbars to draw. When invoked this method starts an
@@ -5900,6 +5930,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
            mParent.requestTransparentRegion(this);
        }
        if ((mPrivateFlags & AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) {
            initialAwakenScrollBars();
            mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH;
        }
    }

    /**