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

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

More fun with action bars and themes!

Fix bug 5144738 - Allow user to define pressed state asset for action
bar. Added android:actionBarItemBackground theme attribute. This
allows themes to define item pressed states for the action bar
independent of the standard selectableItemBackground.

Fix bug 5145416 - Custom view in action bar should use themed context
when inflating resource ID. Also applies to tab custom views.

Fix bug 5135550 - Tab divider height / Color should match spec. Added
actionBarDivider theme attribute. Similar to actionBarItemBackground
above, this allows apps to maintain proper contrast when the bar has a
different contrast profile than the rest of the activity.

Fix bug 5154778 - Theme.Holo.Light.DarkActionBar in themes.xml and
search_bar.xml are still referencing the deprecated title_bar_shadow
when we should be pointing to ab_solid_shadow_holo

Change-Id: I5ef0084de28a7c2d2fa02ae1752884feab0f8523
parent 1060dd20
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -190,6 +190,8 @@ package android {
    field public static final int accountPreferences = 16843423; // 0x101029f
    field public static final int accountType = 16843407; // 0x101028f
    field public static final int action = 16842797; // 0x101002d
    field public static final int actionBarDivider = 16843685; // 0x10103a5
    field public static final int actionBarItemBackground = 16843686; // 0x10103a6
    field public static final int actionBarSize = 16843499; // 0x10102eb
    field public static final int actionBarSplitStyle = 16843666; // 0x1010392
    field public static final int actionBarStyle = 16843470; // 0x10102ce
+6 −5
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ public class ActionBarImpl extends ActionBar {

    @Override
    public void setCustomView(int resId) {
        setCustomView(LayoutInflater.from(mContext).inflate(resId, mActionView, false));
        setCustomView(LayoutInflater.from(getThemedContext()).inflate(resId, mActionView, false));
    }

    @Override
@@ -630,14 +630,14 @@ public class ActionBarImpl extends ActionBar {
        
        public ActionModeImpl(ActionMode.Callback callback) {
            mCallback = callback;
            mMenu = new MenuBuilder(mActionView.getContext())
            mMenu = new MenuBuilder(getThemedContext())
                    .setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
            mMenu.setCallback(this);
        }

        @Override
        public MenuInflater getMenuInflater() {
            return new MenuInflater(mContext);
            return new MenuInflater(getThemedContext());
        }

        @Override
@@ -755,7 +755,7 @@ public class ActionBarImpl extends ActionBar {
                return true;
            }

            new MenuPopupHelper(mContext, subMenu).show();
            new MenuPopupHelper(getThemedContext(), subMenu).show();
            return true;
        }

@@ -819,7 +819,8 @@ public class ActionBarImpl extends ActionBar {

        @Override
        public Tab setCustomView(int layoutResId) {
            return setCustomView(LayoutInflater.from(mContext).inflate(layoutResId, null));
            return setCustomView(LayoutInflater.from(getThemedContext())
                    .inflate(layoutResId, null));
        }

        @Override
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
      class="com.android.internal.widget.ActionBarView$HomeView"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:background="?android:attr/selectableItemBackground" >
      android:background="?android:attr/actionBarItemBackground" >
    <ImageView android:id="@android:id/up"
               android:src="?android:attr/homeAsUpIndicator"
               android:layout_gravity="center_vertical|left"
+1 −1
Original line number Diff line number Diff line
@@ -75,5 +75,5 @@
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scaleType="fitXY"
        android:src="@drawable/title_bar_shadow"/>
        android:src="@drawable/ab_solid_shadow_holo"/>
</view>
+4 −0
Original line number Diff line number Diff line
@@ -633,6 +633,10 @@
        <attr name="actionBarSize" format="dimension" >
            <enum name="wrap_content" value="0" />
        </attr>
        <!-- Custom divider drawable to use for elements in the action bar. -->
        <attr name="actionBarDivider" format="reference" />
        <!-- Custom item state list drawable background for action bar items. -->
        <attr name="actionBarItemBackground" format="reference" />
        <!-- TextAppearance style that will be applied to text that
             appears within action menu items. -->
        <attr name="actionMenuTextAppearance" format="reference" />
Loading