Merge change 8121 into donut
* changes: Fixes #1818201. Do not attempt to display the popup until after the first layout.
This commit is contained in:
@@ -2443,7 +2443,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ss.error != null) {
|
if (ss.error != null) {
|
||||||
setError(ss.error);
|
final CharSequence error = ss.error;
|
||||||
|
// Display the error later, after the first layout pass
|
||||||
|
post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
setError(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3263,7 +3269,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
final TextView err = (TextView) inflater.inflate(com.android.internal.R.layout.textview_hint,
|
final TextView err = (TextView) inflater.inflate(com.android.internal.R.layout.textview_hint,
|
||||||
null);
|
null);
|
||||||
|
|
||||||
mPopup = new ErrorPopup(err, 200, 50);
|
final float scale = getResources().getDisplayMetrics().density;
|
||||||
|
mPopup = new ErrorPopup(err, (int) (200 * scale + 0.5f),
|
||||||
|
(int) (50 * scale + 0.5f));
|
||||||
mPopup.setFocusable(false);
|
mPopup.setFocusable(false);
|
||||||
// The user is entering text, so the input method is needed. We
|
// The user is entering text, so the input method is needed. We
|
||||||
// don't want the popup to be displayed on top of it.
|
// don't want the popup to be displayed on top of it.
|
||||||
@@ -3317,11 +3325,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
* The "25" is the distance between the point and the right edge
|
* The "25" is the distance between the point and the right edge
|
||||||
* of the background
|
* of the background
|
||||||
*/
|
*/
|
||||||
|
final float scale = getResources().getDisplayMetrics().density;
|
||||||
|
|
||||||
final Drawables dr = mDrawables;
|
final Drawables dr = mDrawables;
|
||||||
return getWidth() - mPopup.getWidth()
|
return getWidth() - mPopup.getWidth()
|
||||||
- getPaddingRight()
|
- getPaddingRight()
|
||||||
- (dr != null ? dr.mDrawableSizeRight : 0) / 2 + 25;
|
- (dr != null ? dr.mDrawableSizeRight : 0) / 2 + (int) (25 * scale + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user