summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-07-21 16:57:29 -0700
committerRomain Guy <romainguy@android.com>2009-07-21 17:05:09 -0700
commit9bc9fa1538e3a5be0b80a8f6900d147f0ad3f9e5 (patch)
tree453db1e84157fc9a8025698abfc93aa8c3b3f023 /core/java/android
parent8ece3445e8c95d02a47737ea2ac2d52a696143cd (diff)
downloadframeworks_base-9bc9fa1538e3a5be0b80a8f6900d147f0ad3f9e5.zip
frameworks_base-9bc9fa1538e3a5be0b80a8f6900d147f0ad3f9e5.tar.gz
frameworks_base-9bc9fa1538e3a5be0b80a8f6900d147f0ad3f9e5.tar.bz2
Fixes #1818201. Do not attempt to display the popup until after the first layout.
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/widget/TextView.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index d8ed4f0..3fab692 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -2443,7 +2443,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
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,
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);
// The user is entering text, so the input method is needed. We
// 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
* of the background
*/
+ final float scale = getResources().getDisplayMetrics().density;
final Drawables dr = mDrawables;
return getWidth() - mPopup.getWidth()
- getPaddingRight()
- - (dr != null ? dr.mDrawableSizeRight : 0) / 2 + 25;
+ - (dr != null ? dr.mDrawableSizeRight : 0) / 2 + (int) (25 * scale + 0.5f);
}
/**