am 705a27a9: Merge "Non-editable TextViews should not display a cursor." into honeycomb

* commit '705a27a97ccd8e363944083d948b7f5204916b85':
  Non-editable TextViews should not display a cursor.
This commit is contained in:
Gilles Debunne
2011-01-24 14:48:21 -08:00
committed by Android Git Automerger

View File

@@ -4334,7 +4334,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
selStart = getSelectionStart(); selStart = getSelectionStart();
selEnd = getSelectionEnd(); selEnd = getSelectionEnd();
if ((mCursorVisible || mTextIsSelectable) && selStart >= 0 && isEnabled()) { if ((isCursorVisible() || mTextIsSelectable) && selStart >= 0 && isEnabled()) {
if (mHighlightPath == null) if (mHighlightPath == null)
mHighlightPath = new Path(); mHighlightPath = new Path();
@@ -6491,6 +6491,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
prepareCursorControllers(); prepareCursorControllers();
} }
private boolean isCursorVisible() {
return mCursorVisible && isTextEditable();
}
private boolean canMarquee() { private boolean canMarquee() {
int width = (mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight()); int width = (mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight());
return width > 0 && mLayout.getLineWidth(0) > width; return width > 0 && mLayout.getLineWidth(0) > width;
@@ -6979,7 +6983,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
private void makeBlink() { private void makeBlink() {
if (!mCursorVisible || !isTextEditable()) { if (!isCursorVisible()) {
if (mBlink != null) { if (mBlink != null) {
mBlink.removeCallbacks(mBlink); mBlink.removeCallbacks(mBlink);
} }
@@ -7373,8 +7377,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|| windowParams.type > WindowManager.LayoutParams.LAST_SUB_WINDOW; || windowParams.type > WindowManager.LayoutParams.LAST_SUB_WINDOW;
} }
mInsertionControllerEnabled = windowSupportsHandles && isTextEditable() && mCursorVisible && mInsertionControllerEnabled = windowSupportsHandles && isCursorVisible() && mLayout != null;
mLayout != null;
mSelectionControllerEnabled = windowSupportsHandles && textCanBeSelected() && mSelectionControllerEnabled = windowSupportsHandles && textCanBeSelected() &&
mLayout != null; mLayout != null;