diff options
-rw-r--r-- | api/current.txt | 3 | ||||
-rw-r--r-- | core/java/android/view/FocusFinder.java | 4 | ||||
-rw-r--r-- | core/java/android/view/View.java | 12 |
3 files changed, 17 insertions, 2 deletions
diff --git a/api/current.txt b/api/current.txt index cd4592b..5b22bef 100644 --- a/api/current.txt +++ b/api/current.txt @@ -3697,6 +3697,8 @@ package android.app { ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet); ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet, int); method public int getRouteTypes(); + method public void onAttachedToWindow(); + method public void onDetachedFromWindow(); method public void setExtendedSettingsClickListener(android.view.View.OnClickListener); method public void setRouteTypes(int); method public void showDialog(); @@ -24122,6 +24124,7 @@ package android.view { method public long getDrawingTime(); method public boolean getFilterTouchesWhenObscured(); method public boolean getFitsSystemWindows(); + method public void getFocusRect(android.graphics.Rect); method public java.util.ArrayList<android.view.View> getFocusables(int); method public void getFocusedRect(android.graphics.Rect); method public boolean getGlobalVisibleRect(android.graphics.Rect, android.graphics.Point); diff --git a/core/java/android/view/FocusFinder.java b/core/java/android/view/FocusFinder.java index 9063cea..31a9f05 100644 --- a/core/java/android/view/FocusFinder.java +++ b/core/java/android/view/FocusFinder.java @@ -250,8 +250,8 @@ public class FocusFinder { // only interested in other non-root views if (focusable == focused || focusable == root) continue; - // get visible bounds of other view in same coordinate system - focusable.getDrawingRect(mOtherRect); + // get focus bounds of other view in same coordinate system + focusable.getFocusRect(mOtherRect); root.offsetDescendantRectToMyCoords(focusable, mOtherRect); if (isBetterCandidate(direction, focusedRect, mOtherRect, mBestCandidateRect)) { diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 25f6516..a6a5427 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8726,6 +8726,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** + * When searching for a view to focus this rectangle is used when considering if this view is + * a good candidate for receiving focus. + * + * By default, the rectangle is the {@link #getDrawingRect}) of the view. + * + * @param r The rectangle to fill in, in this view's coordinates. + */ + public void getFocusRect(Rect r) { + getDrawingRect(r); + } + + /** * Utility method to retrieve the inverse of the current mMatrix property. * We cache the matrix to avoid recalculating it when transform properties * have not changed. |