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

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

Allow the theme to affect action bar menus

Change-Id: Ie914881de626415886289e830fb1ff166ce13159
parent bc234a19
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -78,12 +78,15 @@ public class MenuBuilder implements Menu {
    private static final String VIEWS_TAG = "android:views";

    // Order must be the same order as the TYPE_*
    // Special values:
    // 0: Use the system default theme
    // -1: Use the app's own theme
    static final int THEME_RES_FOR_TYPE[] = new int[] {
        com.android.internal.R.style.Theme_IconMenu,
        com.android.internal.R.style.Theme_ExpandedMenu,
        0,
        0,
        0,
        -1,
        -1,
    };
    
    // Order must be the same order as the TYPE_*
@@ -220,8 +223,9 @@ public class MenuBuilder implements Menu {
        LayoutInflater getInflater() {
            // Create an inflater that uses the given theme for the Views it inflates
            if (mInflater == null) {
                Context wrappedContext = new ContextThemeWrapper(mContext,
                        THEME_RES_FOR_TYPE[mMenuType]); 
                int themeResForType = THEME_RES_FOR_TYPE[mMenuType];
                Context wrappedContext = themeResForType < 0 ? mContext :
                        new ContextThemeWrapper(mContext, themeResForType);
                mInflater = (LayoutInflater) wrappedContext
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            }