Merge "Fxi initial error popup dialog in TextEdit and refreshed assets." into honeycomb
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index eee042a..e7c33ab 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -3489,8 +3489,7 @@
                     com.android.internal.R.layout.textview_hint, null);
 
             final float scale = getResources().getDisplayMetrics().density;
-            mPopup = new ErrorPopup(err, (int) (200 * scale + 0.5f),
-                    (int) (50 * scale + 0.5f));
+            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.
@@ -3514,6 +3513,12 @@
         ErrorPopup(TextView v, int width, int height) {
             super(v, width, height);
             mView = v;
+            // Make sure the TextView has a background set as it will be used the first time it is
+            // shown and positionned. Initialized with below background, which should have
+            // dimensions identical to the above version for this to work (and is more likely).
+            mPopupInlineErrorBackgroundId = getResourceId(mPopupInlineErrorBackgroundId,
+                    com.android.internal.R.styleable.Theme_errorMessageBackground);
+            mView.setBackgroundResource(mPopupInlineErrorBackgroundId);
         }
 
         void fixDirection(boolean above) {
@@ -3521,18 +3526,21 @@
 
             if (above) {
                 mPopupInlineErrorAboveBackgroundId =
-                    getResourceId(mPopupInlineErrorAboveBackgroundId, com.android.internal.R.styleable.Theme_errorMessageAboveBackground);
+                    getResourceId(mPopupInlineErrorAboveBackgroundId,
+                            com.android.internal.R.styleable.Theme_errorMessageAboveBackground);
             } else {
-                mPopupInlineErrorBackgroundId =
-                    getResourceId(mPopupInlineErrorBackgroundId, com.android.internal.R.styleable.Theme_errorMessageBackground);
+                mPopupInlineErrorBackgroundId = getResourceId(mPopupInlineErrorBackgroundId,
+                        com.android.internal.R.styleable.Theme_errorMessageBackground);
             }
 
-            mView.setBackgroundResource(above ? mPopupInlineErrorAboveBackgroundId : mPopupInlineErrorBackgroundId);
+            mView.setBackgroundResource(above ? mPopupInlineErrorAboveBackgroundId :
+                mPopupInlineErrorBackgroundId);
         }
 
         private int getResourceId(int currentId, int index) {
             if (currentId == 0) {
-                TypedArray styledAttributes = mView.getContext().obtainStyledAttributes(R.styleable.Theme);
+                TypedArray styledAttributes = mView.getContext().obtainStyledAttributes(
+                        R.styleable.Theme);
                 currentId = styledAttributes.getResourceId(index, 0);
                 styledAttributes.recycle();
             }
@@ -3562,9 +3570,8 @@
         final float scale = getResources().getDisplayMetrics().density;
 
         final Drawables dr = mDrawables;
-        return getWidth() - mPopup.getWidth()
-                - getPaddingRight()
-                - (dr != null ? dr.mDrawableSizeRight : 0) / 2 + (int) (25 * scale + 0.5f);
+        return getWidth() - mPopup.getWidth() - getPaddingRight() -
+                (dr != null ? dr.mDrawableSizeRight : 0) / 2 + (int) (25 * scale + 0.5f);
     }
 
     /**
@@ -3576,20 +3583,20 @@
          * Compound, not extended, because the icon is not clipped
          * if the text height is smaller.
          */
-        int vspace = mBottom - mTop -
-                     getCompoundPaddingBottom() - getCompoundPaddingTop();
+        final int compoundPaddingTop = getCompoundPaddingTop();
+        int vspace = mBottom - mTop - getCompoundPaddingBottom() - compoundPaddingTop;
 
         final Drawables dr = mDrawables;
-        int icontop = getCompoundPaddingTop()
-                + (vspace - (dr != null ? dr.mDrawableHeightRight : 0)) / 2;
+        int icontop = compoundPaddingTop +
+                (vspace - (dr != null ? dr.mDrawableHeightRight : 0)) / 2;
 
         /*
          * The "2" is the distance between the point and the top edge
          * of the background.
          */
-
-        return icontop + (dr != null ? dr.mDrawableHeightRight : 0)
-                - getHeight() - 2;
+        final float scale = getResources().getDisplayMetrics().density;
+        return icontop + (dr != null ? dr.mDrawableHeightRight : 0) - getHeight() -
+                (int) (2 * scale + 0.5f);
     }
 
     private void hideError() {
diff --git a/core/res/res/drawable-hdpi/indicator_input_error.png b/core/res/res/drawable-hdpi/indicator_input_error.png
index 213976c..8785376 100644
--- a/core/res/res/drawable-hdpi/indicator_input_error.png
+++ b/core/res/res/drawable-hdpi/indicator_input_error.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/popup_inline_error_above_holo_dark.9.png b/core/res/res/drawable-hdpi/popup_inline_error_above_holo_dark.9.png
new file mode 100644
index 0000000..61ea2b0
--- /dev/null
+++ b/core/res/res/drawable-hdpi/popup_inline_error_above_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/popup_inline_error_above_holo_light.9.png b/core/res/res/drawable-hdpi/popup_inline_error_above_holo_light.9.png
new file mode 100644
index 0000000..83b2bce
--- /dev/null
+++ b/core/res/res/drawable-hdpi/popup_inline_error_above_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/popup_inline_error_holo_dark.9.png b/core/res/res/drawable-hdpi/popup_inline_error_holo_dark.9.png
new file mode 100644
index 0000000..daa47b7
--- /dev/null
+++ b/core/res/res/drawable-hdpi/popup_inline_error_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/popup_inline_error_holo_light.9.png b/core/res/res/drawable-hdpi/popup_inline_error_holo_light.9.png
new file mode 100644
index 0000000..6c45935
--- /dev/null
+++ b/core/res/res/drawable-hdpi/popup_inline_error_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/indicator_input_error.png b/core/res/res/drawable-mdpi/indicator_input_error.png
index ee60165..775e417 100755
--- a/core/res/res/drawable-mdpi/indicator_input_error.png
+++ b/core/res/res/drawable-mdpi/indicator_input_error.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/popup_inline_error_above_holo_dark.9.png b/core/res/res/drawable-mdpi/popup_inline_error_above_holo_dark.9.png
index dd4af6d..c03e658 100644
--- a/core/res/res/drawable-mdpi/popup_inline_error_above_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/popup_inline_error_above_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/popup_inline_error_above_holo_light.9.png b/core/res/res/drawable-mdpi/popup_inline_error_above_holo_light.9.png
index 8925112..19b153b 100644
--- a/core/res/res/drawable-mdpi/popup_inline_error_above_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/popup_inline_error_above_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/popup_inline_error_holo_dark.9.png b/core/res/res/drawable-mdpi/popup_inline_error_holo_dark.9.png
index 66c2c09..4092728 100755
--- a/core/res/res/drawable-mdpi/popup_inline_error_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/popup_inline_error_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/popup_inline_error_holo_light.9.png b/core/res/res/drawable-mdpi/popup_inline_error_holo_light.9.png
index c5113f2..67a2cd4 100755
--- a/core/res/res/drawable-mdpi/popup_inline_error_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/popup_inline_error_holo_light.9.png
Binary files differ
diff --git a/core/res/res/layout/textview_hint.xml b/core/res/res/layout/textview_hint.xml
index f9c4406..b94dfc9 100644
--- a/core/res/res/layout/textview_hint.xml
+++ b/core/res/res/layout/textview_hint.xml
@@ -18,5 +18,5 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:textAppearance="?android:attr/textAppearanceSmall"
-    android:textColor="@color/primary_text_light"
+    android:textColor="?android:attr/textColorPrimaryInverse"
 />