Merge "Fix bug 2587373 - awaken scrollbars when a scrolling view becomes visible." into froyo
This commit is contained in:
@@ -1512,6 +1512,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
static final int CANCEL_NEXT_UP_EVENT = 0x04000000;
|
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.
|
* The parent this view is attached to.
|
||||||
@@ -3838,6 +3845,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
|
|||||||
* {@link #INVISIBLE} or {@link #GONE}.
|
* {@link #INVISIBLE} or {@link #GONE}.
|
||||||
*/
|
*/
|
||||||
protected void onVisibilityChanged(View changedView, int visibility) {
|
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.
|
* @param visibility The new visibility of the window.
|
||||||
*/
|
*/
|
||||||
protected void onWindowVisibilityChanged(int visibility) {
|
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);
|
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>
|
* <p>
|
||||||
* Trigger the scrollbars to draw. When invoked this method starts an
|
* 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) {
|
if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
|
||||||
mParent.requestTransparentRegion(this);
|
mParent.requestTransparentRegion(this);
|
||||||
}
|
}
|
||||||
|
if ((mPrivateFlags & AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) {
|
||||||
|
initialAwakenScrollBars();
|
||||||
|
mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user