Fix bug #2246815 Error popups on EditText should span the width of the screen instead of the width of the EditText field
Part 2
- use "textview_error_popup_default_width" as a dimension resource instead of a basic constant
Change-Id: Ieb89fc416105716ab491749a82390a7e784b1755
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index b93c140a..8d3bbfe 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -4050,8 +4050,8 @@
int wid = tv.getPaddingLeft() + tv.getPaddingRight();
int ht = tv.getPaddingTop() + tv.getPaddingBottom();
- int defaultWidthInPixels = (int) (DEFAULT_ERROR_POPUP_MAX_WIDTH_IN_DP *
- getResources().getDisplayMetrics().density);
+ int defaultWidthInPixels = getResources().getDimensionPixelSize(
+ com.android.internal.R.dimen.textview_error_popup_default_width);
Layout l = new StaticLayout(text, tv.getPaint(), defaultWidthInPixels,
Layout.Alignment.ALIGN_NORMAL, 1, 0, true);
float max = 0;
@@ -11417,6 +11417,4 @@
private CorrectionHighlighter mCorrectionHighlighter;
// New state used to change background based on whether this TextView is multiline.
private static final int[] MULTILINE_STATE_SET = { R.attr.state_multiline };
-
- private static final int DEFAULT_ERROR_POPUP_MAX_WIDTH_IN_DP = 240;
}
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 2753eab..4f162f2 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -175,4 +175,7 @@
<!-- Width of the icon in a dropdown list -->
<dimen name="dropdownitem_icon_width">32dip</dimen>
+ <!-- Default width for a textview error popup -->
+ <dimen name="textview_error_popup_default_width">240dip</dimen>
+
</resources>