Style new popup widgets.
Change-Id: I208ed292afd9919071778baa9ea61d7ca9e7743c
This commit is contained in:
110
api/current.xml
110
api/current.xml
@@ -6840,6 +6840,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="listPopupWindowStyle"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843584"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="listPreferredItemHeight"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -7709,6 +7720,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="popupMenuStyle"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843585"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="popupWindowStyle"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -9744,6 +9766,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="textAppearanceLargePopupMenu"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843586"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="textAppearanceMedium"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -9810,6 +9843,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="textAppearanceSmallPopupMenu"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843587"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="textCheckMark"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16724,6 +16768,28 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="TextAppearance_Widget_PopupMenu_Large"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16973984"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="TextAppearance_Widget_PopupMenu_Small"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16973985"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="TextAppearance_Widget_TabWidget"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -17153,6 +17219,28 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ActionButton_CloseMode"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16973983"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ActionButton_Overflow"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16973982"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_AutoCompleteTextView"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -17351,6 +17439,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ListPopupWindow"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16973980"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ListView"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -17395,6 +17494,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_PopupMenu"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16973981"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_PopupWindow"
|
||||
type="int"
|
||||
transient="false"
|
||||
|
||||
@@ -163,7 +163,7 @@ public class ListPopupWindow {
|
||||
* @param attrs Attributes from inflating parent views used to style the popup.
|
||||
*/
|
||||
public ListPopupWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0, 0);
|
||||
this(context, attrs, com.android.internal.R.attr.listPopupWindowStyle, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -104,7 +104,7 @@ public class MenuBuilder implements Menu {
|
||||
com.android.internal.R.layout.list_menu_item_layout,
|
||||
com.android.internal.R.layout.list_menu_item_layout,
|
||||
com.android.internal.R.layout.action_menu_item_layout,
|
||||
com.android.internal.R.layout.list_menu_item_layout,
|
||||
com.android.internal.R.layout.popup_menu_item_layout,
|
||||
};
|
||||
|
||||
private static final int[] sCategoryToOrder = new int[] {
|
||||
|
||||
@@ -72,9 +72,7 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
|
||||
}
|
||||
|
||||
public void show() {
|
||||
// TODO Use a style from the theme here
|
||||
mPopup = new ListPopupWindow(mContext, null, 0,
|
||||
com.android.internal.R.style.Widget_Spinner);
|
||||
mPopup = new ListPopupWindow(mContext, null, com.android.internal.R.attr.popupMenuStyle);
|
||||
mPopup.setOnItemClickListener(this);
|
||||
mPopup.setOnDismissListener(mDismissListener);
|
||||
|
||||
|
||||
59
core/res/res/layout/popup_menu_item_layout.xml
Normal file
59
core/res/res/layout/popup_menu_item_layout.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<com.android.internal.view.menu.ListMenuItemView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight">
|
||||
|
||||
<!-- Icon will be inserted here. -->
|
||||
|
||||
<!-- The title and summary have some gap between them, and this 'group' should be centered vertically. -->
|
||||
<RelativeLayout
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:duplicateParentState="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLargePopupMenu"
|
||||
android:singleLine="true"
|
||||
android:duplicateParentState="true"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shortcut"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmallPopupMenu"
|
||||
android:singleLine="true"
|
||||
android:duplicateParentState="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- Checkbox, and/or radio button will be inserted here. -->
|
||||
|
||||
</com.android.internal.view.menu.ListMenuItemView>
|
||||
@@ -127,6 +127,12 @@
|
||||
<!-- Text color, typeface, size, and style for the text inside of a button. -->
|
||||
<attr name="textAppearanceButton" format="reference" />
|
||||
|
||||
<!-- Text color, typeface, size, and style for the text inside of a popup menu. -->
|
||||
<attr name="textAppearanceLargePopupMenu" format="reference" />
|
||||
|
||||
<!-- Text color, typeface, size, and style for small text inside of a popup menu. -->
|
||||
<attr name="textAppearanceSmallPopupMenu" format="reference" />
|
||||
|
||||
<!-- EditText text foreground color. -->
|
||||
<attr name="editTextColor" format="reference|color" />
|
||||
<!-- EditText background drawable. -->
|
||||
@@ -460,6 +466,10 @@
|
||||
<attr name="quickContactBadgeStyleSmallWindowMedium" format="reference" />
|
||||
<!-- Default quickcontact badge style with large quickcontact window. -->
|
||||
<attr name="quickContactBadgeStyleSmallWindowLarge" format="reference" />
|
||||
<!-- Default ListPopupWindow style. -->
|
||||
<attr name="listPopupWindowStyle" format="reference" />
|
||||
<!-- Default PopupMenu style. -->
|
||||
<attr name="popupMenuStyle" format="reference" />
|
||||
|
||||
<!-- =================== -->
|
||||
<!-- Action bar styles -->
|
||||
|
||||
@@ -1348,6 +1348,10 @@
|
||||
<public type="attr" name="actionViewClass" />
|
||||
<public type="attr" name="activatedBackgroundIndicator" />
|
||||
<public type="attr" name="state_activated" />
|
||||
<public type="attr" name="listPopupWindowStyle" />
|
||||
<public type="attr" name="popupMenuStyle" />
|
||||
<public type="attr" name="textAppearanceLargePopupMenu" />
|
||||
<public type="attr" name="textAppearanceSmallPopupMenu" />
|
||||
|
||||
<public type="anim" name="animator_fade_in" />
|
||||
<public type="anim" name="animator_fade_out" />
|
||||
@@ -1380,6 +1384,13 @@
|
||||
<public type="style" name="Theme.Light.Holo.NoActionBar" />
|
||||
<public type="style" name="Theme.Light.Holo.NoActionBar.Fullscreen" />
|
||||
|
||||
<public type="style" name="Widget.ListPopupWindow" />
|
||||
<public type="style" name="Widget.PopupMenu" />
|
||||
<public type="style" name="Widget.ActionButton.Overflow" />
|
||||
<public type="style" name="Widget.ActionButton.CloseMode" />
|
||||
<public type="style" name="TextAppearance.Widget.PopupMenu.Large" />
|
||||
<public type="style" name="TextAppearance.Widget.PopupMenu.Small" />
|
||||
|
||||
<public type="string" name="selectTextMode" />
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -937,4 +937,32 @@
|
||||
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.ListPopupWindow">
|
||||
<item name="android:dropDownSelector">@android:drawable/list_selector_background</item>
|
||||
<item name="android:popupBackground">@android:drawable/spinner_dropdown_background</item>
|
||||
<item name="android:dropDownVerticalOffset">-10dip</item>
|
||||
<item name="android:dropDownHorizontalOffset">0dip</item>
|
||||
<item name="android:dropDownWidth">wrap_content</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.PopupMenu" parent="Widget.ListPopupWindow">
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Widget.PopupMenu">
|
||||
<item name="android:textColor">@android:color/primary_text_light</item>
|
||||
<item name="android:textColorHint">@android:color/hint_foreground_light</item>
|
||||
<item name="android:textColorHighlight">@android:color/highlighted_text_light</item>
|
||||
<item name="android:textColorLink">@android:color/link_text_light</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Widget.PopupMenu.Large">
|
||||
<item name="android:textSize">22sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Widget.PopupMenu.Small">
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textColor">@android:color/secondary_text_light</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -77,6 +77,9 @@
|
||||
<item name="textCheckMark">@android:drawable/indicator_check_mark_dark</item>
|
||||
<item name="textCheckMarkInverse">@android:drawable/indicator_check_mark_light</item>
|
||||
|
||||
<item name="textAppearanceLargePopupMenu">@android:style/TextAppearance.Widget.PopupMenu.Large</item>
|
||||
<item name="textAppearanceSmallPopupMenu">@android:style/TextAppearance.Widget.PopupMenu.Small</item>
|
||||
|
||||
<!-- Button styles -->
|
||||
<item name="buttonStyle">@android:style/Widget.Button</item>
|
||||
|
||||
@@ -198,6 +201,8 @@
|
||||
<item name="quickContactBadgeStyleSmallWindowSmall">@android:style/Widget.QuickContactBadgeSmall.WindowSmall</item>
|
||||
<item name="quickContactBadgeStyleSmallWindowMedium">@android:style/Widget.QuickContactBadgeSmall.WindowMedium</item>
|
||||
<item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.QuickContactBadgeSmall.WindowLarge</item>
|
||||
<item name="listPopupWindowStyle">@android:style/Widget.ListPopupWindow</item>
|
||||
<item name="popupMenuStyle">@android:style/Widget.PopupMenu</item>
|
||||
|
||||
<!-- Preference styles -->
|
||||
<item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>
|
||||
@@ -600,6 +605,7 @@
|
||||
<item name="editTextBackground">@android:drawable/edit_text_holo_dark</item>
|
||||
<item name="editTextColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:windowActionBar">true</item>
|
||||
<item name="android:spinnerStyle">?android:attr/dropDownSpinnerStyle</item>
|
||||
<item name="listChoiceIndicatorSingle">@android:drawable/btn_radio_holo_dark</item>
|
||||
<item name="listChoiceIndicatorMultiple">@android:drawable/btn_check_holo_dark</item>
|
||||
</style>
|
||||
@@ -612,6 +618,7 @@
|
||||
<style name="Theme.Light.Holo">
|
||||
<item name="editTextBackground">@android:drawable/edit_text_holo_light</item>
|
||||
<item name="android:windowActionBar">true</item>
|
||||
<item name="android:spinnerStyle">?android:attr/dropDownSpinnerStyle</item>
|
||||
<item name="listChoiceIndicatorSingle">@android:drawable/btn_radio_holo_light</item>
|
||||
<item name="listChoiceIndicatorMultiple">@android:drawable/btn_check_holo_light</item>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user