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

Commit 1a264ce3 authored by Adam Powell's avatar Adam Powell
Browse files

Add Toolbar methods to set title text colors

Bug 15836670

Change-Id: If62da4104853c772790597be44f7a1efde2505ef
parent cd6331e4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -38211,9 +38211,11 @@ package android.widget {
    method public void setSubtitle(int);
    method public void setSubtitle(java.lang.CharSequence);
    method public void setSubtitleTextAppearance(android.content.Context, int);
    method public void setSubtitleTextColor(int);
    method public void setTitle(int);
    method public void setTitle(java.lang.CharSequence);
    method public void setTitleTextAppearance(android.content.Context, int);
    method public void setTitleTextColor(int);
    method public boolean showOverflowMenu();
  }
+39 −2
Original line number Diff line number Diff line
@@ -124,6 +124,9 @@ public class Toolbar extends ViewGroup {
    private CharSequence mTitleText;
    private CharSequence mSubtitleText;

    private int mTitleTextColor;
    private int mSubtitleTextColor;

    // Clear me after use.
    private final ArrayList<View> mTempViews = new ArrayList<View>();

@@ -498,8 +501,13 @@ public class Toolbar extends ViewGroup {
                mTitleTextView = new TextView(context);
                mTitleTextView.setSingleLine();
                mTitleTextView.setEllipsize(TextUtils.TruncateAt.END);
                if (mTitleTextAppearance != 0) {
                    mTitleTextView.setTextAppearance(context, mTitleTextAppearance);
                }
                if (mTitleTextColor != 0) {
                    mTitleTextView.setTextColor(mTitleTextColor);
                }
            }
            if (mTitleTextView.getParent() == null) {
                addSystemView(mTitleTextView);
            }
@@ -546,8 +554,13 @@ public class Toolbar extends ViewGroup {
                mSubtitleTextView = new TextView(context);
                mSubtitleTextView.setSingleLine();
                mSubtitleTextView.setEllipsize(TextUtils.TruncateAt.END);
                if (mSubtitleTextAppearance != 0) {
                    mSubtitleTextView.setTextAppearance(context, mSubtitleTextAppearance);
                }
                if (mSubtitleTextColor != 0) {
                    mSubtitleTextView.setTextColor(mSubtitleTextColor);
                }
            }
            if (mSubtitleTextView.getParent() == null) {
                addSystemView(mSubtitleTextView);
            }
@@ -582,6 +595,30 @@ public class Toolbar extends ViewGroup {
        }
    }

    /**
     * Sets the text color of the title, if present.
     *
     * @param color The new text color in 0xAARRGGBB format
     */
    public void setTitleTextColor(int color) {
        mTitleTextColor = color;
        if (mTitleTextView != null) {
            mTitleTextView.setTextColor(color);
        }
    }

    /**
     * Sets the text color of the subtitle, if present.
     *
     * @param color The new text color in 0xAARRGGBB format
     */
    public void setSubtitleTextColor(int color) {
        mSubtitleTextColor = color;
        if (mSubtitleTextView != null) {
            mSubtitleTextView.setTextColor(color);
        }
    }

    /**
     * Set the icon to use for the toolbar's navigation button.
     *