diff options
18 files changed, 627 insertions, 202 deletions
diff --git a/api/current.xml b/api/current.xml index f4eefae2da80..375448c69e73 100644 --- a/api/current.xml +++ b/api/current.xml @@ -2114,7 +2114,7 @@ type="int" transient="false" volatile="false" - value="16843567" + value="16843566" static="true" final="true" deprecated="not deprecated" @@ -2136,7 +2136,7 @@ type="int" transient="false" volatile="false" - value="16843576" + value="16843575" static="true" final="true" deprecated="not deprecated" @@ -2147,7 +2147,7 @@ type="int" transient="false" volatile="false" - value="16843575" + value="16843574" static="true" final="true" deprecated="not deprecated" @@ -2158,18 +2158,7 @@ type="int" transient="false" volatile="false" - value="16843577" - static="true" - final="true" - deprecated="not deprecated" - visibility="public" -> -</field> -<field name="actionButtonPadding" - type="int" - transient="false" - volatile="false" - value="16843547" + value="16843576" static="true" final="true" deprecated="not deprecated" @@ -2202,7 +2191,7 @@ type="int" transient="false" volatile="false" - value="16843584" + value="16843582" static="true" final="true" deprecated="not deprecated" @@ -2213,7 +2202,7 @@ type="int" transient="false" volatile="false" - value="16843549" + value="16843548" static="true" final="true" deprecated="not deprecated" @@ -2224,7 +2213,7 @@ type="int" transient="false" volatile="false" - value="16843580" + value="16843578" static="true" final="true" deprecated="not deprecated" @@ -2235,7 +2224,7 @@ type="int" transient="false" volatile="false" - value="16843550" + value="16843549" static="true" final="true" deprecated="not deprecated" @@ -2246,7 +2235,7 @@ type="int" transient="false" volatile="false" - value="16843578" + value="16843577" static="true" final="true" deprecated="not deprecated" @@ -2257,7 +2246,7 @@ type="int" transient="false" volatile="false" - value="16843585" + value="16843583" static="true" final="true" deprecated="not deprecated" @@ -2268,7 +2257,7 @@ type="int" transient="false" volatile="false" - value="16843586" + value="16843584" static="true" final="true" deprecated="not deprecated" @@ -2367,7 +2356,7 @@ type="int" transient="false" volatile="false" - value="16843598" + value="16843596" static="true" final="true" deprecated="not deprecated" @@ -2488,7 +2477,7 @@ type="int" transient="false" volatile="false" - value="16843574" + value="16843573" static="true" final="true" deprecated="not deprecated" @@ -2829,7 +2818,7 @@ type="int" transient="false" volatile="false" - value="16843593" + value="16843591" static="true" final="true" deprecated="not deprecated" @@ -2840,7 +2829,7 @@ type="int" transient="false" volatile="false" - value="16843592" + value="16843590" static="true" final="true" deprecated="not deprecated" @@ -2869,6 +2858,17 @@ visibility="public" > </field> +<field name="buttonGroupStyle" + type="int" + transient="false" + volatile="false" + value="16843599" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="buttonStyle" type="int" transient="false" @@ -3643,7 +3643,7 @@ type="int" transient="false" volatile="false" - value="16843597" + value="16843595" static="true" final="true" deprecated="not deprecated" @@ -3760,6 +3760,17 @@ visibility="public" > </field> +<field name="dividerVertical" + type="int" + transient="false" + volatile="false" + value="16843598" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="drawSelectorOnTop" type="int" transient="false" @@ -4501,7 +4512,7 @@ type="int" transient="false" volatile="false" - value="16843557" + value="16843556" static="true" final="true" deprecated="not deprecated" @@ -4512,7 +4523,7 @@ type="int" transient="false" volatile="false" - value="16843561" + value="16843560" static="true" final="true" deprecated="not deprecated" @@ -4523,7 +4534,7 @@ type="int" transient="false" volatile="false" - value="16843562" + value="16843561" static="true" final="true" deprecated="not deprecated" @@ -4534,7 +4545,7 @@ type="int" transient="false" volatile="false" - value="16843563" + value="16843562" static="true" final="true" deprecated="not deprecated" @@ -4545,7 +4556,7 @@ type="int" transient="false" volatile="false" - value="16843564" + value="16843563" static="true" final="true" deprecated="not deprecated" @@ -4556,7 +4567,7 @@ type="int" transient="false" volatile="false" - value="16843559" + value="16843558" static="true" final="true" deprecated="not deprecated" @@ -4567,7 +4578,7 @@ type="int" transient="false" volatile="false" - value="16843560" + value="16843559" static="true" final="true" deprecated="not deprecated" @@ -4578,7 +4589,7 @@ type="int" transient="false" volatile="false" - value="16843565" + value="16843564" static="true" final="true" deprecated="not deprecated" @@ -4589,7 +4600,7 @@ type="int" transient="false" volatile="false" - value="16843566" + value="16843565" static="true" final="true" deprecated="not deprecated" @@ -5073,7 +5084,7 @@ type="int" transient="false" volatile="false" - value="16843583" + value="16843581" static="true" final="true" deprecated="not deprecated" @@ -5194,7 +5205,7 @@ type="int" transient="false" volatile="false" - value="16843570" + value="16843569" static="true" final="true" deprecated="not deprecated" @@ -5205,7 +5216,7 @@ type="int" transient="false" volatile="false" - value="16843568" + value="16843567" static="true" final="true" deprecated="not deprecated" @@ -5216,7 +5227,7 @@ type="int" transient="false" volatile="false" - value="16843569" + value="16843568" static="true" final="true" deprecated="not deprecated" @@ -5575,17 +5586,6 @@ visibility="public" > </field> -<field name="itemPadding" - type="int" - transient="false" - volatile="false" - value="16843579" - static="true" - final="true" - deprecated="not deprecated" - visibility="public" -> -</field> <field name="itemTextAppearance" type="int" transient="false" @@ -6855,7 +6855,7 @@ type="int" transient="false" volatile="false" - value="16843572" + value="16843571" static="true" final="true" deprecated="not deprecated" @@ -6899,7 +6899,7 @@ type="int" transient="false" volatile="false" - value="16843594" + value="16843592" static="true" final="true" deprecated="not deprecated" @@ -6910,7 +6910,7 @@ type="int" transient="false" volatile="false" - value="16843588" + value="16843586" static="true" final="true" deprecated="not deprecated" @@ -6998,7 +6998,7 @@ type="int" transient="false" volatile="false" - value="16843596" + value="16843594" static="true" final="true" deprecated="not deprecated" @@ -7482,7 +7482,7 @@ type="int" transient="false" volatile="false" - value="16843556" + value="16843555" static="true" final="true" deprecated="not deprecated" @@ -7812,7 +7812,7 @@ type="int" transient="false" volatile="false" - value="16843589" + value="16843587" static="true" final="true" deprecated="not deprecated" @@ -7911,7 +7911,7 @@ type="int" transient="false" volatile="false" - value="16843548" + value="16843547" static="true" final="true" deprecated="not deprecated" @@ -8076,7 +8076,7 @@ type="int" transient="false" volatile="false" - value="16843555" + value="16843554" static="true" final="true" deprecated="not deprecated" @@ -9121,7 +9121,7 @@ type="int" transient="false" volatile="false" - value="16843573" + value="16843572" static="true" final="true" deprecated="not deprecated" @@ -9143,7 +9143,7 @@ type="int" transient="false" volatile="false" - value="16843571" + value="16843570" static="true" final="true" deprecated="not deprecated" @@ -9242,7 +9242,7 @@ type="int" transient="false" volatile="false" - value="16843587" + value="16843585" static="true" final="true" deprecated="not deprecated" @@ -9473,7 +9473,7 @@ type="int" transient="false" volatile="false" - value="16843582" + value="16843580" static="true" final="true" deprecated="not deprecated" @@ -9858,7 +9858,7 @@ type="int" transient="false" volatile="false" - value="16843590" + value="16843588" static="true" final="true" deprecated="not deprecated" @@ -9935,7 +9935,7 @@ type="int" transient="false" volatile="false" - value="16843591" + value="16843589" static="true" final="true" deprecated="not deprecated" @@ -9979,7 +9979,7 @@ type="int" transient="false" volatile="false" - value="16843595" + value="16843593" static="true" final="true" deprecated="not deprecated" @@ -10173,6 +10173,17 @@ visibility="public" > </field> +<field name="textLineHeight" + type="int" + transient="false" + volatile="false" + value="16843597" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="textOff" type="int" transient="false" @@ -10397,7 +10408,7 @@ type="int" transient="false" volatile="false" - value="16843581" + value="16843579" static="true" final="true" deprecated="not deprecated" @@ -10672,7 +10683,7 @@ type="int" transient="false" volatile="false" - value="16843552" + value="16843551" static="true" final="true" deprecated="not deprecated" @@ -10683,7 +10694,7 @@ type="int" transient="false" volatile="false" - value="16843553" + value="16843552" static="true" final="true" deprecated="not deprecated" @@ -10694,7 +10705,7 @@ type="int" transient="false" volatile="false" - value="16843554" + value="16843553" static="true" final="true" deprecated="not deprecated" @@ -11024,7 +11035,7 @@ type="int" transient="false" volatile="false" - value="16843558" + value="16843557" static="true" final="true" deprecated="not deprecated" @@ -11035,7 +11046,7 @@ type="int" transient="false" volatile="false" - value="16843551" + value="16843550" static="true" final="true" deprecated="not deprecated" @@ -16937,7 +16948,7 @@ type="int" transient="false" volatile="false" - value="16973984" + value="16973987" static="true" final="true" deprecated="not deprecated" @@ -16948,7 +16959,7 @@ type="int" transient="false" volatile="false" - value="16973985" + value="16973988" static="true" final="true" deprecated="not deprecated" @@ -17087,6 +17098,39 @@ visibility="public" > </field> +<field name="Theme_Holo_Dialog" + type="int" + transient="false" + volatile="false" + value="16973981" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="Theme_Holo_Light" + type="int" + transient="false" + volatile="false" + value="16973980" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="Theme_Holo_Light_Dialog" + type="int" + transient="false" + volatile="false" + value="16973982" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="Theme_Holo_NoActionBar" type="int" transient="false" @@ -17388,7 +17432,7 @@ type="int" transient="false" volatile="false" - value="16973983" + value="16973986" static="true" final="true" deprecated="not deprecated" @@ -17399,7 +17443,7 @@ type="int" transient="false" volatile="false" - value="16973982" + value="16973985" static="true" final="true" deprecated="not deprecated" @@ -17553,7 +17597,7 @@ type="int" transient="false" volatile="false" - value="16973986" + value="16973989" static="true" final="true" deprecated="not deprecated" @@ -17619,7 +17663,7 @@ type="int" transient="false" volatile="false" - value="16973980" + value="16973983" static="true" final="true" deprecated="not deprecated" @@ -17674,7 +17718,7 @@ type="int" transient="false" volatile="false" - value="16973981" + value="16973984" static="true" final="true" deprecated="not deprecated" @@ -228700,6 +228744,51 @@ </parameter> </constructor> </class> +<class name="ButtonGroup" + extends="android.widget.LinearLayout" + abstract="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<constructor name="ButtonGroup" + type="android.widget.ButtonGroup" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="context" type="android.content.Context"> +</parameter> +</constructor> +<constructor name="ButtonGroup" + type="android.widget.ButtonGroup" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="context" type="android.content.Context"> +</parameter> +<parameter name="attrs" type="android.util.AttributeSet"> +</parameter> +</constructor> +<constructor name="ButtonGroup" + type="android.widget.ButtonGroup" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="context" type="android.content.Context"> +</parameter> +<parameter name="attrs" type="android.util.AttributeSet"> +</parameter> +<parameter name="defStyleRes" type="int"> +</parameter> +</constructor> +</class> <class name="CheckBox" extends="android.widget.CompoundButton" abstract="false" @@ -242958,6 +243047,19 @@ <parameter name="input" type="android.text.method.KeyListener"> </parameter> </method> +<method name="setLineHeight" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="lineHeight" type="int"> +</parameter> +</method> <method name="setLineSpacing" return="void" abstract="false" diff --git a/core/java/android/widget/ButtonGroup.java b/core/java/android/widget/ButtonGroup.java new file mode 100644 index 000000000000..a23ea07a9bb0 --- /dev/null +++ b/core/java/android/widget/ButtonGroup.java @@ -0,0 +1,72 @@ +/* + * 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. + */ + +package android.widget; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.View; +import android.view.ViewGroup; + +public class ButtonGroup extends LinearLayout { + private Drawable mDivider; + private Drawable mButtonBackground; + + public ButtonGroup(Context context) { + this(context, null); + } + + public ButtonGroup(Context context, AttributeSet attrs) { + this(context, attrs, com.android.internal.R.attr.buttonGroupStyle); + } + + public ButtonGroup(Context context, AttributeSet attrs, int defStyleRes) { + super(context, attrs, defStyleRes); + + TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.ButtonGroup); + + mDivider = a.getDrawable(com.android.internal.R.styleable.ButtonGroup_divider); + mButtonBackground = a.getDrawable( + com.android.internal.R.styleable.ButtonGroup_buttonBackground); + a.recycle(); + } + + @Override + public void addView(View child, int index, ViewGroup.LayoutParams params) { + if (getChildCount() > 0) { + super.addView(makeDividerView(), index, makeDividerLayoutParams()); + if (index >= 0) { + index++; + } + } + child.setBackgroundDrawable(mButtonBackground); + super.addView(child, index, params); + } + + private ImageView makeDividerView() { + ImageView result = new ImageView(mContext); + result.setImageDrawable(mDivider); + result.setScaleType(ImageView.ScaleType.FIT_XY); + return result; + } + + private LayoutParams makeDividerLayoutParams() { + return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + } +} diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java index c0cbb198e76f..b51d21af038f 100644 --- a/core/java/android/widget/Spinner.java +++ b/core/java/android/widget/Spinner.java @@ -589,7 +589,7 @@ public class Spinner extends AbsSpinner implements OnClickListener { setAnchorView(Spinner.this); setModal(true); - setPromptPosition(POSITION_PROMPT_BELOW); + setPromptPosition(POSITION_PROMPT_ABOVE); setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View v, int position, long id) { Spinner.this.setSelection(position); diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index e32c899fa2d5..051ef7f4581e 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -734,6 +734,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener case com.android.internal.R.styleable.TextView_textSelectHandle: mTextSelectHandleRes = a.getResourceId(attr, 0); break; + + case com.android.internal.R.styleable.TextView_textLineHeight: + int lineHeight = a.getDimensionPixelSize(attr, 0); + if (lineHeight != 0) { + setLineHeight(lineHeight); + } } } a.recycle(); @@ -1063,6 +1069,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * or last-line padding. */ public int getLineHeight() { + if (mLineHeight != 0) { + return mLineHeight; + } return FastMath.round(mTextPaint.getFontMetricsInt(null) * mSpacingMult + mSpacingAdd); } @@ -1655,10 +1664,27 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener TextAppearance_textStyle, -1); setTypefaceByIndex(typefaceIndex, styleIndex); + + int lineHeight = appearance.getDimensionPixelSize( + com.android.internal.R.styleable.TextAppearance_textLineHeight, 0); + if (lineHeight != 0) { + setLineHeight(lineHeight); + } + appearance.recycle(); } /** + * Set the height of a line of text in pixels. This value will override line height + * values stored in the font modified by lineSpacingExtra and lineSpacingMultiplier. + * + * @param lineHeight Desired height of a single line of text in pixels + */ + public void setLineHeight(int lineHeight) { + mLineHeight = lineHeight; + } + + /** * @return the size (in pixels) of the default text size in this TextView. */ public float getTextSize() { @@ -8449,6 +8475,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private float mSpacingMult = 1; private float mSpacingAdd = 0; + private int mLineHeight = 0; private static final int LINES = 1; private static final int EMS = LINES; diff --git a/core/java/com/android/internal/view/menu/ActionMenuItemView.java b/core/java/com/android/internal/view/menu/ActionMenuItemView.java index af0438c60676..f97bfb4c9287 100644 --- a/core/java/com/android/internal/view/menu/ActionMenuItemView.java +++ b/core/java/com/android/internal/view/menu/ActionMenuItemView.java @@ -43,7 +43,7 @@ public class ActionMenuItemView extends FrameLayout } public ActionMenuItemView(Context context, AttributeSet attrs) { - this(context, attrs, com.android.internal.R.attr.actionButtonStyle); + super(context, attrs); } public ActionMenuItemView(Context context, AttributeSet attrs, int defStyle) { @@ -113,6 +113,10 @@ public class ActionMenuItemView extends FrameLayout mImageButton.setVisibility(GONE); } } + + public boolean hasText() { + return mTextButton.getVisibility() != GONE; + } public void setShortcut(boolean showShortcut, char shortcutKey) { // Action buttons don't show text for shortcut keys. diff --git a/core/java/com/android/internal/view/menu/ActionMenuView.java b/core/java/com/android/internal/view/menu/ActionMenuView.java index 20939ab481dd..3b34b7e7b4a8 100644 --- a/core/java/com/android/internal/view/menu/ActionMenuView.java +++ b/core/java/com/android/internal/view/menu/ActionMenuView.java @@ -19,12 +19,15 @@ import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; +import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.LinearLayout.LayoutParams; import java.util.ArrayList; @@ -33,15 +36,22 @@ import java.util.ArrayList; */ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvoker, MenuView { private static final String TAG = "ActionMenuView"; + + // TODO Theme/style this. + private static final int DIVIDER_PADDING = 12; // dips private MenuBuilder mMenu; - private int mItemPadding; - private int mItemMargin; private int mMaxItems; private boolean mReserveOverflow; private OverflowMenuButton mOverflowButton; private MenuPopupHelper mOverflowPopup; + + private float mButtonPaddingLeft; + private float mButtonPaddingRight; + private float mDividerPadding; + + private Drawable mDivider; private Runnable mShowOverflow = new Runnable() { public void run() { @@ -56,20 +66,34 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo public ActionMenuView(Context context, AttributeSet attrs) { super(context, attrs); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.Theme); - mItemPadding = a.getDimensionPixelOffset( - com.android.internal.R.styleable.Theme_actionButtonPadding, 0); - mItemMargin = mItemPadding / 2; - a.recycle(); + final Resources res = getResources(); // Measure for initial configuration - mMaxItems = measureMaxActionButtons(); + mMaxItems = getMaxActionButtons(); // TODO There has to be a better way to indicate that we don't have a hard menu key. - final int screen = getResources().getConfiguration().screenLayout; + final int screen = res.getConfiguration().screenLayout; mReserveOverflow = (screen & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE; + + TypedArray a = context.obtainStyledAttributes(com.android.internal.R.styleable.Theme); + final int buttonStyle = a.getResourceId( + com.android.internal.R.styleable.Theme_actionButtonStyle, 0); + final int groupStyle = a.getResourceId( + com.android.internal.R.styleable.Theme_buttonGroupStyle, 0); + a.recycle(); + + a = context.obtainStyledAttributes(buttonStyle, com.android.internal.R.styleable.View); + mButtonPaddingLeft = a.getDimension(com.android.internal.R.styleable.View_paddingLeft, 0); + mButtonPaddingRight = a.getDimension(com.android.internal.R.styleable.View_paddingRight, 0); + a.recycle(); + + a = context.obtainStyledAttributes(groupStyle, + com.android.internal.R.styleable.ButtonGroup); + mDivider = a.getDrawable(com.android.internal.R.styleable.ButtonGroup_divider); + a.recycle(); + + mDividerPadding = DIVIDER_PADDING * res.getDisplayMetrics().density; } @Override @@ -77,7 +101,7 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo final int screen = newConfig.screenLayout; mReserveOverflow = (screen & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE; - mMaxItems = measureMaxActionButtons(); + mMaxItems = getMaxActionButtons(); if (mMenu != null) { mMenu.setMaxActionItems(mMaxItems); updateChildren(false); @@ -89,13 +113,8 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo } } - private int measureMaxActionButtons() { - final Resources res = getResources(); - final int size = res.getDimensionPixelSize(com.android.internal.R.dimen.action_icon_size); - final int spaceAvailable = res.getDisplayMetrics().widthPixels / 2; - final int itemSpace = size + mItemPadding; - - return spaceAvailable / (itemSpace > 0 ? itemSpace : 1); + private int getMaxActionButtons() { + return getResources().getInteger(com.android.internal.R.integer.max_action_buttons); } public boolean isOverflowReserved() { @@ -105,24 +124,11 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo public void setOverflowReserved(boolean reserveOverflow) { mReserveOverflow = reserveOverflow; } - - @Override - protected boolean checkLayoutParams(ViewGroup.LayoutParams p) { - if (p instanceof LayoutParams) { - LayoutParams lp = (LayoutParams) p; - return lp.leftMargin == mItemMargin && lp.rightMargin == mItemMargin && - lp.gravity == Gravity.CENTER_VERTICAL && - lp.width == LayoutParams.WRAP_CONTENT && lp.height == LayoutParams.WRAP_CONTENT; - } - return false; - } @Override protected LayoutParams generateDefaultLayoutParams() { LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - params.leftMargin = mItemMargin; - params.rightMargin = mItemMargin; params.gravity = Gravity.CENTER_VERTICAL; return params; } @@ -131,10 +137,6 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { return generateDefaultLayoutParams(); } - - public int getItemMargin() { - return mItemMargin; - } public boolean invokeItem(MenuItemImpl item) { return mMenu.performItemAction(item, 0); @@ -157,14 +159,19 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo final ArrayList<MenuItemImpl> itemsToShow = mMenu.getActionItems(reserveOverflow); final int itemCount = itemsToShow.size(); + boolean needsDivider = false; for (int i = 0; i < itemCount; i++) { + if (needsDivider) { + addView(makeDividerView(), makeDividerLayoutParams()); + } final MenuItemImpl itemData = itemsToShow.get(i); final View actionView = itemData.getActionView(); if (actionView != null) { - addView(actionView); + addView(actionView, makeActionViewLayoutParams()); } else { - addItemView((ActionMenuItemView) itemData.getItemView( - MenuBuilder.TYPE_ACTION_BUTTON, this)); + needsDivider = addItemView(i == 0 || !needsDivider, + (ActionMenuItemView) itemData.getItemView( + MenuBuilder.TYPE_ACTION_BUTTON, this)); } } @@ -212,16 +219,43 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo return false; } - private void addItemView(ActionMenuItemView view) { + private boolean addItemView(boolean needsDivider, ActionMenuItemView view) { view.setItemInvoker(this); + boolean hasText = view.hasText(); + + if (hasText && needsDivider) { + addView(makeDividerView(), makeDividerLayoutParams()); + } addView(view); + return hasText; + } + + private ImageView makeDividerView() { + ImageView result = new ImageView(mContext); + result.setImageDrawable(mDivider); + result.setScaleType(ImageView.ScaleType.FIT_XY); + return result; + } + + private LayoutParams makeDividerLayoutParams() { + LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.MATCH_PARENT); + params.topMargin = (int) mDividerPadding; + params.bottomMargin = (int) mDividerPadding; + return params; + } + + private LayoutParams makeActionViewLayoutParams() { + LayoutParams params = generateDefaultLayoutParams(); + params.leftMargin = (int) mButtonPaddingLeft; + params.rightMargin = (int) mButtonPaddingRight; + return params; } private class OverflowMenuButton extends ImageButton { public OverflowMenuButton(Context context) { super(context, null, com.android.internal.R.attr.actionOverflowButtonStyle); - final Resources res = context.getResources(); setClickable(true); setFocusable(true); setVisibility(VISIBLE); diff --git a/core/java/com/android/internal/view/menu/MenuBuilder.java b/core/java/com/android/internal/view/menu/MenuBuilder.java index eaeb67f2d3fa..d0faea6a4cbf 100644 --- a/core/java/com/android/internal/view/menu/MenuBuilder.java +++ b/core/java/com/android/internal/view/menu/MenuBuilder.java @@ -236,14 +236,14 @@ public class MenuBuilder implements Menu { int themeResForType = THEME_RES_FOR_TYPE[mMenuType]; switch (themeResForType) { case THEME_APPLICATION: - wrappedContext = new ContextThemeWrapper(mContext, themeResForType); + wrappedContext = mContext; break; case THEME_ALERT_DIALOG: wrappedContext = new ContextThemeWrapper(mContext, getAlertDialogTheme(mContext)); break; default: - wrappedContext = mContext; + wrappedContext = new ContextThemeWrapper(mContext, themeResForType); break; } mInflater = (LayoutInflater) wrappedContext diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java index b5e57c22c919..a824e926f87c 100644 --- a/core/java/com/android/internal/widget/ActionBarContextView.java +++ b/core/java/com/android/internal/widget/ActionBarContextView.java @@ -36,8 +36,6 @@ import android.widget.TextView; * @hide */ public class ActionBarContextView extends ViewGroup { - private int mItemPadding; - private int mActionSpacing; private int mContentHeight; private CharSequence mTitle; @@ -64,8 +62,6 @@ public class ActionBarContextView extends ViewGroup { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionMode, defStyle, 0); - mItemPadding = a.getDimensionPixelOffset( - com.android.internal.R.styleable.ActionMode_itemPadding, 0); setBackgroundDrawable(a.getDrawable( com.android.internal.R.styleable.ActionMode_background)); mTitleStyleRes = a.getResourceId( @@ -219,7 +215,6 @@ public class ActionBarContextView extends ViewGroup { } final int contentWidth = MeasureSpec.getSize(widthMeasureSpec); - final int itemMargin = mItemPadding; int maxHeight = mContentHeight > 0 ? mContentHeight : MeasureSpec.getSize(heightMeasureSpec); @@ -230,13 +225,11 @@ public class ActionBarContextView extends ViewGroup { final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST); if (mCloseButton != null) { - availableWidth = measureChildView(mCloseButton, availableWidth, - childSpecHeight, itemMargin); + availableWidth = measureChildView(mCloseButton, availableWidth, childSpecHeight, 0); } if (mTitleLayout != null && mCustomView == null) { - availableWidth = measureChildView(mTitleLayout, availableWidth, - childSpecHeight, itemMargin); + availableWidth = measureChildView(mTitleLayout, availableWidth, childSpecHeight, 0); } final int childCount = getChildCount(); @@ -246,7 +239,7 @@ public class ActionBarContextView extends ViewGroup { continue; } - availableWidth = measureChildView(child, availableWidth, childSpecHeight, itemMargin); + availableWidth = measureChildView(child, availableWidth, childSpecHeight, 0); } if (mCustomView != null) { @@ -284,25 +277,23 @@ public class ActionBarContextView extends ViewGroup { int x = getPaddingLeft(); final int y = getPaddingTop(); final int contentHeight = b - t - getPaddingTop() - getPaddingBottom(); - final int itemMargin = mItemPadding; if (mCloseButton != null && mCloseButton.getVisibility() != GONE) { x += positionChild(mCloseButton, x, y, contentHeight); } if (mTitleLayout != null && mCustomView == null) { - x += positionChild(mTitleLayout, x, y, contentHeight) + itemMargin; + x += positionChild(mTitleLayout, x, y, contentHeight); } if (mCustomView != null) { - x += positionChild(mCustomView, x, y, contentHeight) + itemMargin; + x += positionChild(mCustomView, x, y, contentHeight); } x = r - l - getPaddingRight(); if (mMenuView != null) { - x -= positionChildInverse(mMenuView, x + mActionSpacing, y, contentHeight) - - mActionSpacing; + x -= positionChildInverse(mMenuView, x, y, contentHeight); } } diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java index 308a709c6589..054423ccc09f 100644 --- a/core/java/com/android/internal/widget/ActionBarView.java +++ b/core/java/com/android/internal/widget/ActionBarView.java @@ -53,12 +53,7 @@ import android.widget.TextView; */ public class ActionBarView extends ViewGroup { private static final String TAG = "ActionBarView"; - - // TODO: This must be defined in the default theme - private static final int CONTENT_PADDING_DIP = 3; - private static final int CONTENT_SPACING_DIP = 6; - private static final int CONTENT_ACTION_SPACING_DIP = 12; - + /** * Display options applied by default */ @@ -75,12 +70,11 @@ public class ActionBarView extends ViewGroup { private int mNavigationMode; private int mDisplayOptions; - private int mSpacing; - private int mActionSpacing; private CharSequence mTitle; private CharSequence mSubtitle; private Drawable mIcon; private Drawable mLogo; + private Drawable mDivider; private ImageView mIconView; private ImageView mLogoView; @@ -126,8 +120,6 @@ public class ActionBarView extends ViewGroup { public ActionBarView(Context context, AttributeSet attrs) { super(context, attrs); - final DisplayMetrics metrics = context.getResources().getDisplayMetrics(); - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionBar); final int colorFilter = a.getColor(R.styleable.ActionBar_colorFilter, 0); @@ -171,12 +163,10 @@ public class ActionBarView extends ViewGroup { } mContentHeight = a.getLayoutDimension(R.styleable.ActionBar_height, 0); + + mDivider = a.getDrawable(R.styleable.ActionBar_divider); a.recycle(); - - // TODO: Set this in the theme - mSpacing = (int) (CONTENT_SPACING_DIP * metrics.density + 0.5f); - mActionSpacing = (int) (CONTENT_ACTION_SPACING_DIP * metrics.density + 0.5f); if (mLogo != null || mIcon != null || mTitle != null) { mLogoNavItem = new ActionMenuItem(context, 0, android.R.id.home, 0, 0, mTitle); @@ -210,7 +200,6 @@ public class ActionBarView extends ViewGroup { } final ActionMenuView menuView = (ActionMenuView) builder.getMenuView( MenuBuilder.TYPE_ACTION_BUTTON, null); - mActionSpacing = menuView.getItemMargin(); final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); menuView.setLayoutParams(layoutParams); @@ -452,7 +441,8 @@ public class ActionBarView extends ViewGroup { if ((mDisplayOptions & ActionBar.DISPLAY_HIDE_HOME) == 0) { if (mLogo != null && (mDisplayOptions & ActionBar.DISPLAY_USE_LOGO) != 0) { - mLogoView = new ImageView(getContext()); + mLogoView = new ImageView(getContext(), null, + com.android.internal.R.attr.actionButtonStyle); mLogoView.setAdjustViewBounds(true); mLogoView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); @@ -462,7 +452,8 @@ public class ActionBarView extends ViewGroup { mLogoView.setOnClickListener(mHomeClickListener); addView(mLogoView); } else if (mIcon != null) { - mIconView = new ImageView(getContext()); + mIconView = new ImageView(getContext(), null, + com.android.internal.R.attr.actionButtonStyle); mIconView.setAdjustViewBounds(true); mIconView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); @@ -558,10 +549,10 @@ public class ActionBarView extends ViewGroup { final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST); if (mLogoView != null && mLogoView.getVisibility() != GONE) { - availableWidth = measureChildView(mLogoView, availableWidth, childSpecHeight, mSpacing); + availableWidth = measureChildView(mLogoView, availableWidth, childSpecHeight, 0); } if (mIconView != null && mIconView.getVisibility() != GONE) { - availableWidth = measureChildView(mIconView, availableWidth, childSpecHeight, mSpacing); + availableWidth = measureChildView(mIconView, availableWidth, childSpecHeight, 0); } if (mMenuView != null) { @@ -572,7 +563,7 @@ public class ActionBarView extends ViewGroup { switch (mNavigationMode) { case ActionBar.NAVIGATION_MODE_STANDARD: if (mTitleLayout != null) { - measureChildView(mTitleLayout, availableWidth, childSpecHeight, mSpacing); + measureChildView(mTitleLayout, availableWidth, childSpecHeight, 0); } break; case ActionBar.NAVIGATION_MODE_DROPDOWN_LIST: @@ -652,39 +643,38 @@ public class ActionBarView extends ViewGroup { final int contentHeight = b - t - getPaddingTop() - getPaddingBottom(); if (mLogoView != null && mLogoView.getVisibility() != GONE) { - x += positionChild(mLogoView, x, y, contentHeight) + mSpacing; + x += positionChild(mLogoView, x, y, contentHeight); } if (mIconView != null && mIconView.getVisibility() != GONE) { - x += positionChild(mIconView, x, y, contentHeight) + mSpacing; + x += positionChild(mIconView, x, y, contentHeight); } switch (mNavigationMode) { case ActionBar.NAVIGATION_MODE_STANDARD: if (mTitleLayout != null) { - x += positionChild(mTitleLayout, x, y, contentHeight) + mSpacing; + x += positionChild(mTitleLayout, x, y, contentHeight); } break; case ActionBar.NAVIGATION_MODE_DROPDOWN_LIST: if (mSpinner != null) { - x += positionChild(mSpinner, x, y, contentHeight) + mSpacing; + x += positionChild(mSpinner, x, y, contentHeight); } break; case ActionBar.NAVIGATION_MODE_CUSTOM: if (mCustomNavView != null) { - x += positionChild(mCustomNavView, x, y, contentHeight) + mSpacing; + x += positionChild(mCustomNavView, x, y, contentHeight); } break; case ActionBar.NAVIGATION_MODE_TABS: if (mTabScrollView != null) { - x += positionChild(mTabScrollView, x, y, contentHeight) + mSpacing; + x += positionChild(mTabScrollView, x, y, contentHeight); } } x = r - l - getPaddingRight(); if (mMenuView != null) { - x -= positionChildInverse(mMenuView, x + mActionSpacing, y, contentHeight) - - mActionSpacing; + x -= positionChildInverse(mMenuView, x, y, contentHeight); } } diff --git a/core/res/res/drawable/list_selector_holo_dark.xml b/core/res/res/drawable/list_selector_holo_dark.xml index ee59904ece21..a046831fb592 100644 --- a/core/res/res/drawable/list_selector_holo_dark.xml +++ b/core/res/res/drawable/list_selector_holo_dark.xml @@ -24,6 +24,6 @@ <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" /> <item android:state_focused="true" android:drawable="@drawable/list_selector_focused_holo_dark" /> - <item android:drawable="@drawable/list_selector_focused_holo_dark" /> + <item android:drawable="@color/transparent" /> </selector> diff --git a/core/res/res/drawable/list_selector_holo_light.xml b/core/res/res/drawable/list_selector_holo_light.xml index 2dc39f6059ad..e0a3bec6f0e1 100644 --- a/core/res/res/drawable/list_selector_holo_light.xml +++ b/core/res/res/drawable/list_selector_holo_light.xml @@ -24,6 +24,6 @@ <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" /> <item android:state_focused="true" android:drawable="@drawable/list_selector_focused_holo_light" /> - <item android:drawable="@drawable/list_selector_focused_holo_light" /> + <item android:drawable="@color/transparent" /> </selector> diff --git a/core/res/res/layout-xlarge/alert_dialog_holo.xml b/core/res/res/layout-xlarge/alert_dialog_holo.xml new file mode 100644 index 000000000000..a01e03ab02a8 --- /dev/null +++ b/core/res/res/layout-xlarge/alert_dialog_holo.xml @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 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.widget.WeightedLinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/parentPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingTop="9dip" + android:paddingBottom="3dip" + android:paddingLeft="3dip" + android:paddingRight="1dip" + android:majorWeightMin="0.45" + android:minorWeightMin="0.72" + android:majorWeightMax="0.45" + android:minorWeightMax="0.72"> + + <LinearLayout android:id="@+id/topPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="48dip" + android:orientation="vertical"> + <LinearLayout android:id="@+id/title_template" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="center_vertical" + android:layout_marginTop="8dip" + android:layout_marginBottom="8dip" + android:layout_marginLeft="32dip" + android:layout_marginRight="32dip"> + <ImageView android:id="@+id/icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingRight="16dip" + android:src="@null" /> + <com.android.internal.widget.DialogTitle android:id="@+id/alertTitle" + style="?android:attr/textAppearanceMedium" + android:singleLine="true" + android:ellipsize="end" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + </LinearLayout> + <ImageView android:id="@+id/titleDivider" + android:layout_width="match_parent" + android:layout_height="1dip" + android:visibility="gone" + android:scaleType="fitXY" + android:gravity="fill_horizontal" + android:src="@android:drawable/divider_horizontal_dark" /> + <!-- If the client uses a customTitle, it will be added here. --> + </LinearLayout> + + <LinearLayout android:id="@+id/contentPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:orientation="vertical"> + <ScrollView android:id="@+id/scrollView" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="32dip" + android:paddingBottom="32dip" + android:paddingLeft="32dip" + android:paddingRight="32dip"> + <TextView android:id="@+id/message" + style="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + </ScrollView> + </LinearLayout> + + <FrameLayout android:id="@+id/customPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1"> + <FrameLayout android:id="@+android:id/custom" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dip" + android:paddingBottom="8dip" /> + </FrameLayout> + + <LinearLayout android:id="@+id/buttonPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="54dip" + android:orientation="vertical" > + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingTop="4dip" + android:paddingLeft="2dip" + android:paddingRight="2dip" + android:measureWithLargestChild="true"> + <LinearLayout android:id="@+id/leftSpacer" + android:layout_weight="0.25" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:visibility="gone" /> + <Button android:id="@+id/button1" + android:layout_width="0dip" + android:layout_gravity="left" + android:layout_weight="1" + android:maxLines="2" + android:layout_height="wrap_content" /> + <Button android:id="@+id/button3" + android:layout_width="0dip" + android:layout_gravity="center_horizontal" + android:layout_weight="1" + android:maxLines="2" + android:layout_height="wrap_content" /> + <Button android:id="@+id/button2" + android:layout_width="0dip" + android:layout_gravity="right" + android:layout_weight="1" + android:maxLines="2" + android:layout_height="wrap_content" /> + <LinearLayout android:id="@+id/rightSpacer" + android:layout_width="0dip" + android:layout_weight="0.25" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:visibility="gone" /> + </LinearLayout> + </LinearLayout> +</com.android.internal.widget.WeightedLinearLayout> diff --git a/core/res/res/layout/action_menu_item_layout.xml b/core/res/res/layout/action_menu_item_layout.xml index 0d3cce54682b..e7b8a25020da 100644 --- a/core/res/res/layout/action_menu_item_layout.xml +++ b/core/res/res/layout/action_menu_item_layout.xml @@ -20,10 +20,13 @@ <ImageButton android:id="@+id/imageButton" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_gravity="center" android:visibility="gone" style="?attr/actionButtonStyle" /> <Button android:id="@+id/textButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:visibility="gone" /> + android:layout_gravity="center" + android:visibility="gone" + android:background="?attr/listChoiceBackgroundIndicator" /> </com.android.internal.view.menu.ActionMenuItemView> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index d9f00394c004..461fb5f087fc 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -483,8 +483,6 @@ <!-- Action bar styles --> <!-- =================== --> <eat-comment /> - <!-- Default amount of padding to use between action buttons. --> - <attr name="actionButtonPadding" format="dimension" /> <!-- Default style for tabs within an action bar --> <attr name="actionBarTabStyle" format="reference" /> <attr name="actionBarTabBarStyle" format="reference" /> @@ -555,6 +553,12 @@ <attr name="dialogTheme" format="reference" /> <!-- Theme to use for alert dialogs spawned from this theme. --> <attr name="alertDialogTheme" format="reference" /> + + <!-- Drawable to use for vertical dividers. --> + <attr name="dividerVertical" format="reference" /> + + <!-- Style for button groups --> + <attr name="buttonGroupStyle" format="reference" /> </declare-styleable> <!-- **************************************************************** --> @@ -600,6 +604,9 @@ <!-- Color of link text (URLs). --> <attr name="textColorLink" format="reference|color" /> + <!-- Height of a line of text. --> + <attr name="textLineHeight" format="dimension" /> + <!-- Where to ellipsize text. --> <attr name="ellipsize"> <enum name="none" value="0" /> @@ -2076,6 +2083,8 @@ <attr name="textColorHint" /> <!-- Color of the links. --> <attr name="textColorLink" /> + <!-- Height of a single line of text. --> + <attr name="textLineHeight" /> </declare-styleable> <declare-styleable name="TextSwitcher"> </declare-styleable> @@ -2312,6 +2321,9 @@ <!-- Reference to a drawable that will be used to display a text selection anchor for positioning the cursor within text. --> <attr name="textSelectHandle" /> + + <!-- Height of a line of text. --> + <attr name="textLineHeight" /> </declare-styleable> <!-- An <code>input-extras</code> is a container for extra data to supply to an input method. Contains @@ -4177,8 +4189,6 @@ <attr name="background" /> <!-- Specifies a fixed height for the action mode bar. --> <attr name="height" /> - <!-- Specifies a padding to use between elements on the bar. --> - <attr name="itemPadding" format="dimension" /> </declare-styleable> <declare-styleable name="SearchView"> @@ -4186,4 +4196,11 @@ use and expanded when clicked. --> <attr name="iconifiedByDefault" format="boolean"/> </declare-styleable> + + <declare-styleable name="ButtonGroup"> + <!-- Drawable to use as a vertical divider between buttons. --> + <attr name="divider" /> + <!-- Drawable to use as a background for buttons added to this group. --> + <attr name="buttonBackground" format="reference" /> + </declare-styleable> </resources> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 171bb45ddde0..6ec80174b3ac 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -25,9 +25,10 @@ <!-- The standard size (both width and height) of an application icon that will be displayed in the app launcher and elsewhere. --> <dimen name="app_icon_size">48dip</dimen> - <!-- The standard size (both width and height) of an action icon that will - be displayed in application action bars. --> - <dimen name="action_icon_size">48dip</dimen> + <!-- The maximum number of action buttons that should be permitted within + an action bar/action mode. This will be used to determine how many + showAsAction="ifRoom" items can fit. "always" items can override this. --> + <integer name="max_action_buttons">5</integer> <dimen name="toast_y_offset">64dip</dimen> <!-- Height of the status bar --> <dimen name="status_bar_height">25dip</dimen> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index ae257159dc1f..10801876be27 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1316,7 +1316,6 @@ <public type="attr" name="actionDropDownStyle" /> <public type="attr" name="actionButtonStyle" /> <public type="attr" name="showAsAction" /> - <public type="attr" name="actionButtonPadding" /> <public type="attr" name="previewImage" /> <public type="attr" name="actionModeBackground" /> <public type="attr" name="actionModeCloseDrawable" /> @@ -1348,7 +1347,6 @@ <public type="attr" name="actionBarTabBarStyle" /> <public type="attr" name="actionBarTabTextStyle" /> <public type="attr" name="actionOverflowButtonStyle" /> - <public type="attr" name="itemPadding" /> <public type="attr" name="actionModeCloseButtonStyle" /> <public type="attr" name="titleTextStyle" /> <public type="attr" name="subtitleTextStyle" /> @@ -1368,6 +1366,9 @@ <public type="attr" name="loopViews" /> <public type="attr" name="dialogTheme" /> <public type="attr" name="alertDialogTheme" /> + <public type="attr" name="textLineHeight" /> + <public type="attr" name="dividerVertical" /> + <public type="attr" name="buttonGroupStyle" /> <public type="anim" name="animator_fade_in" /> <public type="anim" name="animator_fade_out" /> @@ -1409,6 +1410,9 @@ <public type="style" name="Theme.Holo.NoActionBar.Fullscreen" /> <public type="style" name="Theme.Light.Holo.NoActionBar" /> <public type="style" name="Theme.Light.Holo.NoActionBar.Fullscreen" /> + <public type="style" name="Theme.Holo.Light" /> + <public type="style" name="Theme.Holo.Dialog" /> + <public type="style" name="Theme.Holo.Light.Dialog" /> <public type="style" name="Widget.ListPopupWindow" /> <public type="style" name="Widget.PopupMenu" /> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 8f7ace94994f..fdc8c47f1181 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -905,9 +905,9 @@ <item name="android:displayOptions">useLogo</item> <item name="android:divider">@android:drawable/action_bar_divider</item> <item name="android:height">?android:attr/actionBarSize</item> - <item name="android:paddingLeft">3dip</item> + <item name="android:paddingLeft">0dip</item> <item name="android:paddingTop">0dip</item> - <item name="android:paddingRight">3dip</item> + <item name="android:paddingRight">0dip</item> <item name="android:paddingBottom">0dip</item> <item name="android:titleTextStyle">@android:style/TextAppearance.Widget.ActionBar.Title</item> <item name="android:subtitleTextStyle">@android:style/TextAppearance.Widget.ActionBar.Subtitle</item> @@ -916,7 +916,6 @@ <style name="Widget.ActionMode"> <item name="android:background">?android:attr/actionModeBackground</item> <item name="android:height">?android:attr/actionBarSize</item> - <item name="android:itemPadding">?android:attr/actionButtonPadding</item> <item name="android:titleTextStyle">@android:style/TextAppearance.Widget.ActionMode.Title</item> <item name="android:subtitleTextStyle">@android:style/TextAppearance.Widget.ActionMode.Subtitle</item> </style> @@ -939,6 +938,8 @@ <style name="Widget.ActionButton"> <item name="android:background">@null</item> + <item name="android:paddingLeft">16dip</item> + <item name="android:paddingRight">16dip</item> </style> <style name="Widget.ActionButton.Overflow"> @@ -992,6 +993,11 @@ <item name="android:textColor">@android:color/secondary_text_light</item> </style> + <style name="Widget.ButtonGroup"> + <item name="divider">?android:attr/dividerVertical</item> + <item name="buttonBackground">?android:attr/listChoiceBackgroundIndicator</item> + </style> + <!-- Begin Holo theme styles --> <!-- Text Styles --> @@ -1009,6 +1015,7 @@ </style> <style name="TextAppearance.Holo.Medium" parent="TextAppearance.Medium"> + <item name="android:textLineHeight">24dip</item> </style> <style name="TextAppearance.Holo.Small" parent="TextAppearance.Small"> @@ -1073,16 +1080,16 @@ </style> <style name="TextAppearance.Holo.Widget.DropDownHint"> - <item name="android:textColor">?textColorPrimaryInverse</item> + <item name="android:textColor">?textColorPrimary</item> <item name="android:textSize">14sp</item> </style> <style name="TextAppearance.Holo.Widget.DropDownItem"> - <item name="android:textColor">@android:color/primary_text_light_disable_only</item> + <item name="android:textColor">?textColorPrimaryDisableOnly</item> </style> <style name="TextAppearance.Holo.Widget.TextView.SpinnerItem"> - <item name="android:textColor">@android:color/primary_text_light_disable_only</item> + <item name="android:textColor">?textColorPrimaryDisableOnly</item> </style> <style name="TextAppearance.Holo.Widget.EditText"> @@ -1142,13 +1149,13 @@ <item name="android:textColorLink">?textColorLinkInverse</item> </style> - <style name="TextAppearance.Holo.Light.Large" parent="TextAppearance.Large"> + <style name="TextAppearance.Holo.Light.Large" parent="TextAppearance.Holo.Large"> </style> - <style name="TextAppearance.Holo.Light.Medium" parent="TextAppearance.Medium"> + <style name="TextAppearance.Holo.Light.Medium" parent="TextAppearance.Holo.Medium"> </style> - <style name="TextAppearance.Holo.Light.Small" parent="TextAppearance.Small"> + <style name="TextAppearance.Holo.Light.Small" parent="TextAppearance.Holo.Small"> </style> <style name="TextAppearance.Holo.Light.Large.Inverse"> @@ -1260,6 +1267,9 @@ <item name="android:paddingRight">24dip</item> </style> + <style name="Widget.Holo.ButtonGroup" parent="Widget.ButtonGroup"> + </style> + <style name="Widget.Holo.TextView" parent="Widget.TextView"> </style> @@ -1393,12 +1403,14 @@ </style> <style name="Widget.Holo.DropDownItem" parent="Widget.DropDownItem"> + <item name="android:textAppearance">@style/TextAppearance.Holo.Widget.DropDownItem</item> </style> <style name="Widget.Holo.DropDownItem.Spinner"> </style> <style name="Widget.Holo.TextView.SpinnerItem" parent="Widget.TextView.SpinnerItem"> + <item name="android:textAppearance">@style/TextAppearance.Holo.Widget.TextView.SpinnerItem</item> </style> <style name="Widget.Holo.KeyboardView" parent="Widget.KeyboardView"> @@ -1433,13 +1445,27 @@ <style name="Widget.Holo.PopupMenu" parent="Widget.Holo.ListPopupWindow"> </style> + <style name="Widget.Holo.ButtonBar"> + <item name="android:divider">?android:attr/dividerVertical</item> + </style> + + <style name="Widget.Holo.ButtonBar.Button"> + </style> + <style name="Widget.Holo.ActionButton" parent="Widget.ActionButton"> + <item name="android:paddingLeft">16dip</item> + <item name="android:paddingRight">16dip</item> + <item name="android:minWidth">64dip</item> + <item name="android:minHeight">56dip</item> </style> - <style name="Widget.Holo.ActionButton.Overflow" parent="Widget.ActionButton.Overflow"> + <style name="Widget.Holo.ActionButton.Overflow"> <item name="android:src">@android:drawable/ic_menu_moreoverflow_holo_dark</item> </style> + <style name="Widget.Holo.ActionButton.TextButton" parent="Widget.Holo.ButtonBar.Button"> + </style> + <style name="Widget.Holo.ActionBarView_TabView" parent="Widget.ActionBarView_TabView"> </style> @@ -1458,7 +1484,7 @@ <item name="android:subtitleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionMode.Subtitle</item> </style> - <style name="Widget.Holo.ActionButton.CloseMode" parent="Widget.ActionButton.CloseMode"> + <style name="Widget.Holo.ActionButton.CloseMode"> <item name="android:src">@drawable/cab_ic_close_holo</item> </style> @@ -1466,6 +1492,7 @@ <item name="android:titleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionBar.Title</item> <item name="android:subtitleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle</item> <item name="android:background">@null</item> + <item name="android:divider">?android:attr/dividerVertical</item> </style> <!-- Light widget styles --> @@ -1493,6 +1520,9 @@ <item name="android:paddingRight">24dip</item> </style> + <style name="Widget.Holo.Light.ButtonGroup" parent="Widget.Holo.ButtonGroup"> + </style> + <style name="Widget.Holo.Light.TextView" parent="Widget.TextView"> </style> @@ -1619,13 +1649,13 @@ <style name="Widget.Holo.Light.WebView" parent="Widget.WebView"> </style> - <style name="Widget.Holo.Light.DropDownItem" parent="Widget.DropDownItem"> + <style name="Widget.Holo.Light.DropDownItem" parent="Widget.Holo.DropDownItem"> </style> <style name="Widget.Holo.Light.DropDownItem.Spinner"> </style> - <style name="Widget.Holo.Light.TextView.SpinnerItem" parent="Widget.TextView.SpinnerItem"> + <style name="Widget.Holo.Light.TextView.SpinnerItem" parent="Widget.Holo.TextView.SpinnerItem"> </style> <style name="Widget.Holo.Light.KeyboardView" parent="Widget.KeyboardView"> @@ -1660,10 +1690,10 @@ <style name="Widget.Holo.Light.PopupMenu" parent="Widget.Holo.Light.ListPopupWindow"> </style> - <style name="Widget.Holo.Light.ActionButton" parent="Widget.ActionButton"> + <style name="Widget.Holo.Light.ActionButton" parent="Widget.Holo.ActionButton"> </style> - <style name="Widget.Holo.Light.ActionButton.Overflow" parent="Widget.ActionButton.Overflow"> + <style name="Widget.Holo.Light.ActionButton.Overflow"> <item name="android:src">@android:drawable/ic_menu_moreoverflow_holo_light</item> </style> @@ -1676,16 +1706,16 @@ <style name="Widget.Holo.Light.ActionBarView_TabText" parent="Widget.ActionBarView_TabText"> </style> - <style name="Widget.Holo.Light.ActionMode" parent="Widget.ActionMode"> + <style name="Widget.Holo.Light.ActionMode" parent="Widget.Holo.ActionMode"> <item name="android:background">@android:drawable/cab_holo_light</item> <item name="android:titleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionMode.Title</item> <item name="android:subtitleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionMode.Subtitle</item> </style> - <style name="Widget.Holo.Light.ActionButton.CloseMode" parent="Widget.ActionButton.CloseMode"> + <style name="Widget.Holo.Light.ActionButton.CloseMode"> </style> - <style name="Widget.Holo.Light.ActionBar" parent="Widget.ActionBar"> + <style name="Widget.Holo.Light.ActionBar" parent="Widget.Holo.ActionBar"> <item name="android:titleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionBar.Title</item> <item name="android:subtitleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle</item> <item name="android:background">@null</item> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index 8daa802d4d33..5948a5b105f5 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -234,7 +234,6 @@ <item name="actionDropDownStyle">@android:style/Widget.Spinner.DropDown</item> <item name="actionButtonStyle">@android:style/Widget.ActionButton</item> <item name="actionOverflowButtonStyle">@android:style/Widget.ActionButton.Overflow</item> - <item name="actionButtonPadding">12dip</item> <item name="actionModeBackground">@android:drawable/action_bar_context_background</item> <item name="actionModeCloseDrawable">@android:drawable/ic_menu_close_clear_cancel</item> <item name="actionBarTabStyle">@style/Widget.ActionBarView_TabView</item> @@ -243,7 +242,10 @@ <item name="actionModeStyle">@style/Widget.ActionMode</item> <item name="actionModeCloseButtonStyle">@style/Widget.ActionButton.CloseMode</item> <item name="actionBarStyle">@android:style/Widget.ActionBar</item> - <item name="actionBarSize">50dip</item> + <item name="actionBarSize">56dip</item> + + <item name="dividerVertical">@drawable/divider_vertical_dark</item> + <item name="buttonGroupStyle">@android:style/Widget.ButtonGroup</item> </style> <!-- Variant of the default (dark) theme with no title bar --> @@ -826,7 +828,6 @@ <item name="actionDropDownStyle">@android:style/Widget.Holo.Spinner.DropDown</item> <item name="actionButtonStyle">@android:style/Widget.Holo.ActionButton</item> <item name="actionOverflowButtonStyle">@android:style/Widget.Holo.ActionButton.Overflow</item> - <item name="actionButtonPadding">12dip</item> <item name="actionModeBackground">@android:drawable/cab_holo_dark</item> <item name="actionModeCloseDrawable">@android:drawable/cab_ic_close_holo</item> <item name="actionBarTabStyle">@style/Widget.Holo.ActionBarView_TabView</item> @@ -835,8 +836,10 @@ <item name="actionModeStyle">@style/Widget.Holo.ActionMode</item> <item name="actionModeCloseButtonStyle">@style/Widget.Holo.ActionButton.CloseMode</item> <item name="actionBarStyle">@android:style/Widget.Holo.ActionBar</item> - <item name="actionBarSize">50dip</item> + <item name="actionBarSize">56dip</item> + <item name="dividerVertical">@drawable/divider_vertical_holo_dark</item> + <item name="buttonGroupStyle">@android:style/Widget.Holo.ButtonGroup</item> </style> <!-- New Honeycomb holographic theme. Light version. The widgets in the @@ -1052,7 +1055,6 @@ <item name="actionDropDownStyle">@android:style/Widget.Holo.Spinner.DropDown</item> <item name="actionButtonStyle">@android:style/Widget.Holo.ActionButton</item> <item name="actionOverflowButtonStyle">@android:style/Widget.Holo.ActionButton.Overflow</item> - <item name="actionButtonPadding">12dip</item> <item name="actionModeBackground">@android:drawable/cab_holo_light</item> <item name="actionModeCloseDrawable">@android:drawable/cab_ic_close_holo</item> <item name="actionBarTabStyle">@style/Widget.Holo.ActionBarView_TabView</item> @@ -1061,8 +1063,10 @@ <item name="actionModeStyle">@style/Widget.Holo.Light.ActionMode</item> <item name="actionModeCloseButtonStyle">@style/Widget.Holo.ActionButton.CloseMode</item> <item name="actionBarStyle">@android:style/Widget.Holo.ActionBar</item> - <item name="actionBarSize">50dip</item> + <item name="actionBarSize">56dip</item> + <item name="dividerVertical">@drawable/divider_vertical_holo_light</item> + <item name="buttonGroupStyle">@android:style/Widget.Holo.Light.ButtonGroup</item> </style> <!-- Development legacy name; if you're using this, switch. --> |