Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc234a19 authored by Adam Powell's avatar Adam Powell
Browse files

Clean up action bar styles

Change-Id: Ib19698e08d643994c4416aac29a43e9197bbe1f3
parent ad8f2191
Loading
Loading
Loading
Loading
+67 −23
Original line number Diff line number Diff line
@@ -2088,6 +2088,28 @@
 visibility="public"
>
</field>
<field name="actionBarSize"
 type="int"
 transient="false"
 volatile="false"
 value="16843563"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="actionBarStyle"
 type="int"
 transient="false"
 volatile="false"
 value="16843535"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="actionBarTabBarStyle"
 type="int"
 transient="false"
@@ -3078,6 +3100,17 @@
 visibility="public"
>
</field>
<field name="closeButtonStyle"
 type="int"
 transient="false"
 volatile="false"
 value="16843576"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="codes"
 type="int"
 transient="false"
@@ -5388,6 +5421,17 @@
 visibility="public"
>
</field>
<field name="itemPadding"
 type="int"
 transient="false"
 volatile="false"
 value="16843575"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="itemTextAppearance"
 type="int"
 transient="false"
@@ -9260,6 +9304,17 @@
 visibility="public"
>
</field>
<field name="subtitleTextStyle"
 type="int"
 transient="false"
 volatile="false"
 value="16843578"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="suggestActionMsg"
 type="int"
 transient="false"
@@ -10096,6 +10151,17 @@
 visibility="public"
>
</field>
<field name="titleTextStyle"
 type="int"
 transient="false"
 volatile="false"
 value="16843577"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="to"
 type="int"
 transient="false"
@@ -10723,28 +10789,6 @@
 visibility="public"
>
</field>
<field name="windowActionBarSize"
 type="int"
 transient="false"
 volatile="false"
 value="16843563"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="windowActionBarStyle"
 type="int"
 transient="false"
 volatile="false"
 value="16843535"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="windowActionModeOverlay"
 type="int"
 transient="false"
@@ -239819,7 +239863,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="arg0" type="T">
<parameter name="t" type="T">
</parameter>
</method>
</interface>
+22 −15
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.widget.TextView;
 */
public class ActionBarContextView extends ViewGroup {
    private int mItemPadding;
    private int mItemMargin;
    private int mActionSpacing;
    private int mContentHeight;
    
@@ -49,32 +48,36 @@ public class ActionBarContextView extends ViewGroup {
    private LinearLayout mTitleLayout;
    private TextView mTitleView;
    private TextView mSubtitleView;
    private Drawable mCloseDrawable;
    private int mCloseButtonStyle;
    private int mTitleStyleRes;
    private int mSubtitleStyleRes;
    private ActionMenuView mMenuView;
    
    public ActionBarContextView(Context context) {
        this(context, null, 0);
        this(context, null);
    }
    
    public ActionBarContextView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
        this(context, attrs, com.android.internal.R.attr.actionModeStyle);
    }
    
    public ActionBarContextView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        
        TypedArray a = context.obtainStyledAttributes(attrs,
                com.android.internal.R.styleable.Theme);
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionMode, defStyle, 0);
        mItemPadding = a.getDimensionPixelOffset(
                com.android.internal.R.styleable.Theme_actionButtonPadding, 0);
                com.android.internal.R.styleable.ActionMode_itemPadding, 0);
        setBackgroundDrawable(a.getDrawable(
                com.android.internal.R.styleable.Theme_actionModeBackground));
        mCloseDrawable = a.getDrawable(
                com.android.internal.R.styleable.Theme_actionModeCloseDrawable);
        mItemMargin = mItemPadding / 2;
                com.android.internal.R.styleable.ActionMode_background));
        mCloseButtonStyle = a.getResourceId(
                com.android.internal.R.styleable.ActionMode_closeButtonStyle, 0);
        mTitleStyleRes = a.getResourceId(
                com.android.internal.R.styleable.ActionMode_titleTextStyle, 0);
        mSubtitleStyleRes = a.getResourceId(
                com.android.internal.R.styleable.ActionMode_subtitleTextStyle, 0);

        mContentHeight = a.getLayoutDimension(
                com.android.internal.R.styleable.Theme_windowActionBarSize, 0);
                com.android.internal.R.styleable.ActionMode_height, 0);
        a.recycle();
    }
    
@@ -129,9 +132,15 @@ public class ActionBarContextView extends ViewGroup {
            mSubtitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_subtitle);
            if (mTitle != null) {
                mTitleView.setText(mTitle);
                if (mTitleStyleRes != 0) {
                    mTitleView.setTextAppearance(mContext, mTitleStyleRes);
                }
            }
            if (mSubtitle != null) {
                mSubtitleView.setText(mSubtitle);
                if (mSubtitleStyleRes != 0) {
                    mSubtitleView.setTextAppearance(mContext, mSubtitleStyleRes);
                }
                mSubtitleView.setVisibility(VISIBLE);
            }
            addView(mTitleLayout);
@@ -147,9 +156,7 @@ public class ActionBarContextView extends ViewGroup {

    public void initForMode(final ActionMode mode) {
        if (mCloseButton == null) {
            mCloseButton = new ImageButton(getContext());
            mCloseButton.setImageDrawable(mCloseDrawable);
            mCloseButton.setBackgroundDrawable(null);
            mCloseButton = new ImageButton(getContext(), null, mCloseButtonStyle);
        }
        mCloseButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
+3 −2
Original line number Diff line number Diff line
@@ -30,11 +30,12 @@ This is an optimized layout for a screen with the Action Bar enabled.
            android:id="@+id/action_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="?android:attr/windowActionBarStyle" />
            style="?android:attr/actionBarStyle" />
        <com.android.internal.widget.ActionBarContextView
            android:id="@+id/action_context_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
            android:layout_height="wrap_content"
            style="?android:attr/actionModeStyle" />
    </ViewAnimator>
    <FrameLayout android:id="@android:id/content"
        android:layout_width="match_parent"
+3 −2
Original line number Diff line number Diff line
@@ -34,11 +34,12 @@ the Action Bar enabled overlaying application content.
            android:id="@+id/action_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="?android:attr/windowActionBarStyle" />
            style="?android:attr/actionBarStyle" />
        <com.android.internal.widget.ActionBarContextView
            android:id="@+id/action_context_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
            android:layout_height="wrap_content"
            style="?android:attr/actionModeStyle" />
    </ViewAnimator>
    <ImageView android:src="?android:attr/windowContentOverlay"
               android:scaleType="fitXY"
+2 −4
Original line number Diff line number Diff line
@@ -22,12 +22,10 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:ellipsize="end"
        android:textAppearance="?android:attr/textAppearanceMediumInverse" />
        android:ellipsize="end" />
    <TextView android:id="@+id/action_bar_subtitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:ellipsize="end"
        android:textAppearance="?android:attr/textAppearanceSmallInverse" />
        android:ellipsize="end" />
</LinearLayout>
Loading