diff options
| author | Alan Viverette <alanv@google.com> | 2014-07-13 17:49:39 -0700 |
|---|---|---|
| committer | Alan Viverette <alanv@google.com> | 2014-07-16 00:06:14 +0000 |
| commit | 7068c39526459c18a020e29c1ebfa6aed54e2d0f (patch) | |
| tree | 82a88b511a75b0ce26fca637efd01abba14c27b5 /core/java/android/view/View.java | |
| parent | 67eb5bbd5374fe96209cf7b68543cb48ee959b96 (diff) | |
Fix hotspot movement on focus change
BUG: 15726988
Change-Id: I97f88e5f7e404ecfcd5c254fddd18c8f6616064e
Diffstat (limited to 'core/java/android/view/View.java')
| -rw-r--r-- | core/java/android/view/View.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index a09a0619fbbc..fdbc61966127 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -4852,8 +4852,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ private void manageFocusHotspot(boolean focused, View v) { final Rect r = new Rect(); - if (!focused && v != null && mAttachInfo != null) { - v.getBoundsOnScreen(r); + if (v != null && mAttachInfo != null) { + v.getHotspotBounds(r); final int[] location = mAttachInfo.mTmpLocation; getLocationOnScreen(location); r.offset(-location[0], -location[1]); @@ -4867,6 +4867,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** + * Populates <code>outRect</code> with the hotspot bounds. By default, + * the hotspot bounds are identical to the screen bounds. + * + * @param outRect rect to populate with hotspot bounds + * @hide Only for internal use by views and widgets. + */ + public void getHotspotBounds(Rect outRect) { + final Drawable background = getBackground(); + if (background != null) { + background.getHotspotBounds(outRect); + } else { + getBoundsOnScreen(outRect); + } + } + + /** * Request that a rectangle of this view be visible on the screen, * scrolling if necessary just enough. * |
