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

Commit 781104d8 authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Don't apply the ActionBar style to a Toolbar as a result of setActionBar" into lmp-dev

parents 92a12ead 2aa09a94
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1593,7 +1593,7 @@ public class Toolbar extends ViewGroup {
    /** @hide */
    public DecorToolbar getWrapper() {
        if (mWrapper == null) {
            mWrapper = new ToolbarWidgetWrapper(this);
            mWrapper = new ToolbarWidgetWrapper(this, true);
        }
        return mWrapper;
    }
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public class ToolbarActionBar extends ActionBar {

    public ToolbarActionBar(Toolbar toolbar, CharSequence title, Window.Callback windowCallback) {
        mToolbar = toolbar;
        mDecorToolbar = new ToolbarWidgetWrapper(toolbar);
        mDecorToolbar = new ToolbarWidgetWrapper(toolbar, false);
        mWindowCallback = windowCallback;
        mDecorToolbar.setWindowCallback(mWindowCallback);
        toolbar.setOnMenuItemClickListener(mMenuClicker);
+57 −53
Original line number Diff line number Diff line
@@ -81,13 +81,14 @@ public class ToolbarWidgetWrapper implements DecorToolbar {

    private int mNavigationMode = ActionBar.NAVIGATION_MODE_STANDARD;

    public ToolbarWidgetWrapper(Toolbar toolbar) {
    public ToolbarWidgetWrapper(Toolbar toolbar, boolean style) {
        mToolbar = toolbar;

        mTitle = toolbar.getTitle();
        mSubtitle = toolbar.getSubtitle();
        mTitleSet = !TextUtils.isEmpty(mTitle);

        if (style) {
            final TypedArray a = toolbar.getContext().obtainStyledAttributes(null,
                    R.styleable.ActionBar, R.attr.actionBarStyle, 0);

@@ -118,7 +119,8 @@ public class ToolbarWidgetWrapper implements DecorToolbar {

            setDisplayOptions(a.getInt(R.styleable.ActionBar_displayOptions, 0));

        final int customNavId = a.getResourceId(R.styleable.ActionBar_customNavigationLayout, 0);
            final int customNavId = a.getResourceId(
                    R.styleable.ActionBar_customNavigationLayout, 0);
            if (customNavId != 0) {
                setCustomView(LayoutInflater.from(mToolbar.getContext()).inflate(customNavId,
                        mToolbar, false));
@@ -146,12 +148,14 @@ public class ToolbarWidgetWrapper implements DecorToolbar {
                mToolbar.setTitleTextAppearance(mToolbar.getContext(), titleTextStyle);
            }

        final int subtitleTextStyle = a.getResourceId(R.styleable.ActionBar_subtitleTextStyle, 0);
            final int subtitleTextStyle = a.getResourceId(
                    R.styleable.ActionBar_subtitleTextStyle, 0);
            if (subtitleTextStyle != 0) {
                mToolbar.setSubtitleTextAppearance(mToolbar.getContext(), subtitleTextStyle);
            }

            a.recycle();
        }

        if (TextUtils.isEmpty(mToolbar.getNavigationContentDescription())) {
            mToolbar.setNavigationContentDescription(