| Chunk |
|---|
| Conflicting content |
|---|
}
}
<<<<<<< HEAD
/**
* Get the offset character closest to the specified absolute position.
*
* @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 getOffset(int x, int y) {
x -= getTotalPaddingLeft();
y -= getTotalPaddingTop();
// Clamp the position to inside of the view.
if (x < 0) {
x = 0;
} else if (x >= (getWidth() - getTotalPaddingRight())) {
x = getWidth()-getTotalPaddingRight() - 1;
}
if (y < 0) {
y = 0;
} else if (y >= (getHeight() - getTotalPaddingBottom())) {
y = getHeight()-getTotalPaddingBottom() - 1;
}
x += getScrollX();
y += getScrollY();
Layout layout = getLayout();
if (layout != null) {
final int line = layout.getLineForVertical(y);
final int offset = layout.getOffsetForHorizontal(line, x);
return offset;
} else {
return -1;
}
}
@ViewDebug.ExportedProperty
=======
@ViewDebug.ExportedProperty(category = "text")
>>>>>>> f00ee0f76260a660cd9648d3bda9863e133cb401
private CharSequence mText;
private CharSequence mTransformed;
private BufferType mBufferType = BufferType.NORMAL; |
| Solution content |
|---|
return -1;
}
}
/**
* Get the offset character closest to the specified absolute position.
*
* @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 getOffset(int x, int y) {
x -= getTotalPaddingLeft();
y -= getTotalPaddingTop();
// Clamp the position to inside of the view.
if (x < 0) {
x = 0;
} else if (x >= (getWidth() - getTotalPaddingRight())) {
x = getWidth()-getTotalPaddingRight() - 1;
}
if (y < 0) {
y = 0;
} else if (y >= (getHeight() - getTotalPaddingBottom())) {
y = getHeight()-getTotalPaddingBottom() - 1;
}
x += getScrollX();
y += getScrollY();
Layout layout = getLayout();
if (layout != null) {
final int line = layout.getLineForVertical(y);
final int offset = layout.getOffsetForHorizontal(line, x);
return offset;
} else {
}
}
@ViewDebug.ExportedProperty(category = "text")
private CharSequence mText;
private CharSequence mTransformed;
private BufferType mBufferType = BufferType.NORMAL; |
| File |
|---|
| TextView.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |