am 12b2dc23: Merge "Holo theme for error popups in TextViews." into honeycomb
* commit '12b2dc23cc3cdd9dcd6bac91adc8e4198502bab5': Holo theme for error popups in TextViews.
This commit is contained in:
@@ -3508,6 +3508,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
private static class ErrorPopup extends PopupWindow {
|
||||
private boolean mAbove = false;
|
||||
private final TextView mView;
|
||||
private int mPopupInlineErrorBackgroundId = 0;
|
||||
private int mPopupInlineErrorAboveBackgroundId = 0;
|
||||
|
||||
ErrorPopup(TextView v, int width, int height) {
|
||||
super(v, width, height);
|
||||
@@ -3518,10 +3520,23 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
mAbove = above;
|
||||
|
||||
if (above) {
|
||||
mView.setBackgroundResource(com.android.internal.R.drawable.popup_inline_error_above);
|
||||
mPopupInlineErrorAboveBackgroundId =
|
||||
getResourceId(mPopupInlineErrorAboveBackgroundId, com.android.internal.R.styleable.Theme_errorMessageAboveBackground);
|
||||
} else {
|
||||
mView.setBackgroundResource(com.android.internal.R.drawable.popup_inline_error);
|
||||
mPopupInlineErrorBackgroundId =
|
||||
getResourceId(mPopupInlineErrorBackgroundId, com.android.internal.R.styleable.Theme_errorMessageBackground);
|
||||
}
|
||||
|
||||
mView.setBackgroundResource(above ? mPopupInlineErrorAboveBackgroundId : mPopupInlineErrorBackgroundId);
|
||||
}
|
||||
|
||||
private int getResourceId(int currentId, int index) {
|
||||
if (currentId == 0) {
|
||||
TypedArray styledAttributes = mView.getContext().obtainStyledAttributes(R.styleable.Theme);
|
||||
currentId = styledAttributes.getResourceId(index, 0);
|
||||
styledAttributes.recycle();
|
||||
}
|
||||
return currentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
core/res/res/drawable-mdpi/popup_inline_error_holo_dark.9.png
Executable file
BIN
core/res/res/drawable-mdpi/popup_inline_error_holo_dark.9.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
core/res/res/drawable-mdpi/popup_inline_error_holo_light.9.png
Executable file
BIN
core/res/res/drawable-mdpi/popup_inline_error_holo_light.9.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -17,7 +17,6 @@
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/popup_inline_error"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/primary_text_light"
|
||||
/>
|
||||
|
||||
@@ -142,6 +142,11 @@
|
||||
<!-- EditText background drawable. -->
|
||||
<attr name="editTextBackground" format="reference" />
|
||||
|
||||
<!-- Popup text displayed in TextView when setError is used. -->
|
||||
<attr name="errorMessageBackground" format="reference" />
|
||||
<!-- Background used instead of errorMessageBackground when the popup has to be above. -->
|
||||
<attr name="errorMessageAboveBackground" format="reference" />
|
||||
|
||||
<!-- A styled string, specifying the style to be used for showing
|
||||
inline candidate text when composing with an input method. The
|
||||
text itself will be ignored, but the style spans will be applied
|
||||
|
||||
@@ -217,6 +217,8 @@
|
||||
<item name="starStyle">@android:style/Widget.CompoundButton.Star</item>
|
||||
<item name="tabWidgetStyle">@android:style/Widget.TabWidget</item>
|
||||
<item name="textViewStyle">@android:style/Widget.TextView</item>
|
||||
<item name="errorMessageBackground">@android:drawable/popup_inline_error</item>
|
||||
<item name="errorMessageAboveBackground">@android:drawable/popup_inline_error_above</item>
|
||||
<item name="webTextViewStyle">@android:style/Widget.WebTextView</item>
|
||||
<item name="webViewStyle">@android:style/Widget.WebView</item>
|
||||
<item name="dropDownItemStyle">@android:style/Widget.DropDownItem</item>
|
||||
@@ -934,6 +936,8 @@
|
||||
<item name="starStyle">@android:style/Widget.Holo.CompoundButton.Star</item>
|
||||
<item name="tabWidgetStyle">@android:style/Widget.Holo.TabWidget</item>
|
||||
<item name="textViewStyle">@android:style/Widget.Holo.TextView</item>
|
||||
<item name="errorMessageBackground">@android:drawable/popup_inline_error_holo_dark</item>
|
||||
<item name="errorMessageAboveBackground">@android:drawable/popup_inline_error_above_holo_dark</item>
|
||||
<item name="webTextViewStyle">@android:style/Widget.Holo.WebTextView</item>
|
||||
<item name="webViewStyle">@android:style/Widget.Holo.WebView</item>
|
||||
<item name="dropDownItemStyle">@android:style/Widget.Holo.DropDownItem</item>
|
||||
@@ -1207,6 +1211,8 @@
|
||||
<item name="starStyle">@android:style/Widget.Holo.Light.CompoundButton.Star</item>
|
||||
<item name="tabWidgetStyle">@android:style/Widget.Holo.Light.TabWidget</item>
|
||||
<item name="textViewStyle">@android:style/Widget.Holo.Light.TextView</item>
|
||||
<item name="errorMessageBackground">@android:drawable/popup_inline_error_holo_light</item>
|
||||
<item name="errorMessageAboveBackground">@android:drawable/popup_inline_error_above_holo_light</item>
|
||||
<item name="webTextViewStyle">@android:style/Widget.Holo.Light.WebTextView</item>
|
||||
<item name="webViewStyle">@android:style/Widget.Holo.Light.WebView</item>
|
||||
<item name="dropDownItemStyle">@android:style/Widget.Holo.Light.DropDownItem</item>
|
||||
|
||||
Reference in New Issue
Block a user