Made getOffsetForPosition public in TextView.
Bug 4443839
Change-Id: I3e5d6f0fe3a45b068166f682daf3c4163903306e
diff --git a/api/current.txt b/api/current.txt
index 3339497..d8fabaa 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -25207,6 +25207,7 @@
method public final android.content.res.ColorStateList getLinkTextColors();
method public final boolean getLinksClickable();
method public final android.text.method.MovementMethod getMovementMethod();
+ method public int getOffsetForPosition(float, float);
method public android.text.TextPaint getPaint();
method public int getPaintFlags();
method public java.lang.String getPrivateImeOptions();
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index d6c8b2b..ccb875e 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -9689,14 +9689,13 @@
}
/**
- * Get the offset character closest to the specified absolute position.
+ * Get the character offset closest to the specified absolute position. A typical use case is to
+ * pass the result of {@link MotionEvent#getX()} and {@link MotionEvent#getY()} to this method.
*
* @param x The horizontal absolute position of a point on screen
* @param y The vertical absolute position of a point on screen
* @return the character offset for the character whose position is closest to the specified
* position. Returns -1 if there is no layout.
- *
- * @hide
*/
public int getOffsetForPosition(float x, float y) {
if (getLayout() == null) return -1;