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

Commit 7b9bfaf7 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Add accessor methods for Toolbar title margins"

parents 70125f70 4db9d1b4
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -323,6 +323,7 @@ package android {
    field public static final int buttonBarNeutralButtonStyle = 16843914; // 0x101048a
    field public static final int buttonBarPositiveButtonStyle = 16843913; // 0x1010489
    field public static final int buttonBarStyle = 16843566; // 0x101032e
    field public static final int buttonGravity = 16844029; // 0x10104fd
    field public static final int buttonStyle = 16842824; // 0x1010048
    field public static final int buttonStyleInset = 16842826; // 0x101004a
    field public static final int buttonStyleSmall = 16842825; // 0x1010049
@@ -372,6 +373,7 @@ package android {
    field public static final int codes = 16843330; // 0x1010242
    field public static final int collapseColumns = 16843083; // 0x101014b
    field public static final int collapseContentDescription = 16843984; // 0x10104d0
    field public static final int collapseIcon = 16844030; // 0x10104fe
    field public static final int color = 16843173; // 0x10101a5
    field public static final int colorAccent = 16843829; // 0x1010435
    field public static final int colorActivatedHighlight = 16843664; // 0x1010390
@@ -809,6 +811,7 @@ package android {
    field public static final int marqueeRepeatLimit = 16843293; // 0x101021d
    field public static final int matchOrder = 16843855; // 0x101044f
    field public static final int max = 16843062; // 0x1010136
    field public static final int maxButtonHeight = 16844028; // 0x10104fc
    field public static final int maxDate = 16843584; // 0x1010340
    field public static final int maxEms = 16843095; // 0x1010157
    field public static final int maxHeight = 16843040; // 0x1010120
@@ -1284,6 +1287,11 @@ package android {
    field public static final int tintMode = 16843771; // 0x10103fb
    field public static final int title = 16843233; // 0x10101e1
    field public static final int titleCondensed = 16843234; // 0x10101e2
    field public static final int titleMargin = 16844023; // 0x10104f7
    field public static final int titleMarginBottom = 16844027; // 0x10104fb
    field public static final int titleMarginEnd = 16844025; // 0x10104f9
    field public static final int titleMarginStart = 16844024; // 0x10104f8
    field public static final int titleMarginTop = 16844026; // 0x10104fa
    field public static final int titleTextAppearance = 16843822; // 0x101042e
    field public static final int titleTextColor = 16844003; // 0x10104e3
    field public static final int titleTextStyle = 16843512; // 0x10102f8
@@ -41946,6 +41954,10 @@ package android.widget {
    method public int getPopupTheme();
    method public java.lang.CharSequence getSubtitle();
    method public java.lang.CharSequence getTitle();
    method public int getTitleMarginBottom();
    method public int getTitleMarginEnd();
    method public int getTitleMarginStart();
    method public int getTitleMarginTop();
    method public boolean hasExpandedActionView();
    method public boolean hideOverflowMenu();
    method public void inflateMenu(int);
@@ -41971,6 +41983,11 @@ package android.widget {
    method public void setSubtitleTextColor(int);
    method public void setTitle(int);
    method public void setTitle(java.lang.CharSequence);
    method public void setTitleMargin(int, int, int, int);
    method public void setTitleMarginBottom(int);
    method public void setTitleMarginEnd(int);
    method public void setTitleMarginStart(int);
    method public void setTitleMarginTop(int);
    method public void setTitleTextAppearance(android.content.Context, int);
    method public void setTitleTextColor(int);
    method public boolean showOverflowMenu();
+17 −0
Original line number Diff line number Diff line
@@ -415,6 +415,7 @@ package android {
    field public static final int buttonBarNeutralButtonStyle = 16843914; // 0x101048a
    field public static final int buttonBarPositiveButtonStyle = 16843913; // 0x1010489
    field public static final int buttonBarStyle = 16843566; // 0x101032e
    field public static final int buttonGravity = 16844029; // 0x10104fd
    field public static final int buttonStyle = 16842824; // 0x1010048
    field public static final int buttonStyleInset = 16842826; // 0x101004a
    field public static final int buttonStyleSmall = 16842825; // 0x1010049
@@ -464,6 +465,7 @@ package android {
    field public static final int codes = 16843330; // 0x1010242
    field public static final int collapseColumns = 16843083; // 0x101014b
    field public static final int collapseContentDescription = 16843984; // 0x10104d0
    field public static final int collapseIcon = 16844030; // 0x10104fe
    field public static final int color = 16843173; // 0x10101a5
    field public static final int colorAccent = 16843829; // 0x1010435
    field public static final int colorActivatedHighlight = 16843664; // 0x1010390
@@ -901,6 +903,7 @@ package android {
    field public static final int marqueeRepeatLimit = 16843293; // 0x101021d
    field public static final int matchOrder = 16843855; // 0x101044f
    field public static final int max = 16843062; // 0x1010136
    field public static final int maxButtonHeight = 16844028; // 0x10104fc
    field public static final int maxDate = 16843584; // 0x1010340
    field public static final int maxEms = 16843095; // 0x1010157
    field public static final int maxHeight = 16843040; // 0x1010120
@@ -1380,6 +1383,11 @@ package android {
    field public static final int tintMode = 16843771; // 0x10103fb
    field public static final int title = 16843233; // 0x10101e1
    field public static final int titleCondensed = 16843234; // 0x10101e2
    field public static final int titleMargin = 16844023; // 0x10104f7
    field public static final int titleMarginBottom = 16844027; // 0x10104fb
    field public static final int titleMarginEnd = 16844025; // 0x10104f9
    field public static final int titleMarginStart = 16844024; // 0x10104f8
    field public static final int titleMarginTop = 16844026; // 0x10104fa
    field public static final int titleTextAppearance = 16843822; // 0x101042e
    field public static final int titleTextColor = 16844003; // 0x10104e3
    field public static final int titleTextStyle = 16843512; // 0x10102f8
@@ -44554,6 +44562,10 @@ package android.widget {
    method public int getPopupTheme();
    method public java.lang.CharSequence getSubtitle();
    method public java.lang.CharSequence getTitle();
    method public int getTitleMarginBottom();
    method public int getTitleMarginEnd();
    method public int getTitleMarginStart();
    method public int getTitleMarginTop();
    method public boolean hasExpandedActionView();
    method public boolean hideOverflowMenu();
    method public void inflateMenu(int);
@@ -44579,6 +44591,11 @@ package android.widget {
    method public void setSubtitleTextColor(int);
    method public void setTitle(int);
    method public void setTitle(java.lang.CharSequence);
    method public void setTitleMargin(int, int, int, int);
    method public void setTitleMarginBottom(int);
    method public void setTitleMarginEnd(int);
    method public void setTitleMarginStart(int);
    method public void setTitleMarginTop(int);
    method public void setTitleTextAppearance(android.content.Context, int);
    method public void setTitleTextColor(int);
    method public boolean showOverflowMenu();
+137 −1
Original line number Diff line number Diff line
@@ -98,6 +98,32 @@ import java.util.List;
 * <p>In modern Android UIs developers should lean more on a visually distinct color scheme for
 * toolbars than on their application icon. The use of application icon plus title as a standard
 * layout is discouraged on API 21 devices and newer.</p>
 *
 * @attr ref android.R.styleable#Toolbar_buttonGravity
 * @attr ref android.R.styleable#Toolbar_collapseContentDescription
 * @attr ref android.R.styleable#Toolbar_collapseIcon
 * @attr ref android.R.styleable#Toolbar_contentInsetEnd
 * @attr ref android.R.styleable#Toolbar_contentInsetLeft
 * @attr ref android.R.styleable#Toolbar_contentInsetRight
 * @attr ref android.R.styleable#Toolbar_contentInsetStart
 * @attr ref android.R.styleable#Toolbar_gravity
 * @attr ref android.R.styleable#Toolbar_logo
 * @attr ref android.R.styleable#Toolbar_logoDescription
 * @attr ref android.R.styleable#Toolbar_maxButtonHeight
 * @attr ref android.R.styleable#Toolbar_navigationContentDescription
 * @attr ref android.R.styleable#Toolbar_navigationIcon
 * @attr ref android.R.styleable#Toolbar_popupTheme
 * @attr ref android.R.styleable#Toolbar_subtitle
 * @attr ref android.R.styleable#Toolbar_subtitleTextAppearance
 * @attr ref android.R.styleable#Toolbar_subtitleTextColor
 * @attr ref android.R.styleable#Toolbar_title
 * @attr ref android.R.styleable#Toolbar_titleMargin
 * @attr ref android.R.styleable#Toolbar_titleMarginBottom
 * @attr ref android.R.styleable#Toolbar_titleMarginEnd
 * @attr ref android.R.styleable#Toolbar_titleMarginStart
 * @attr ref android.R.styleable#Toolbar_titleMarginTop
 * @attr ref android.R.styleable#Toolbar_titleTextAppearance
 * @attr ref android.R.styleable#Toolbar_titleTextColor
 */
public class Toolbar extends ViewGroup {
    private static final String TAG = "Toolbar";
@@ -203,7 +229,7 @@ public class Toolbar extends ViewGroup {
        mGravity = a.getInteger(R.styleable.Toolbar_gravity, mGravity);
        mButtonGravity = a.getInteger(R.styleable.Toolbar_buttonGravity, Gravity.TOP);
        mTitleMarginStart = mTitleMarginEnd = mTitleMarginTop = mTitleMarginBottom =
                a.getDimensionPixelOffset(R.styleable.Toolbar_titleMargins, 0);
                a.getDimensionPixelOffset(R.styleable.Toolbar_titleMargin, 0);

        final int marginStart = a.getDimensionPixelOffset(R.styleable.Toolbar_titleMarginStart, -1);
        if (marginStart >= 0) {
@@ -321,6 +347,116 @@ public class Toolbar extends ViewGroup {
        return mPopupTheme;
    }

    /**
     * Sets the title margin.
     *
     * @param start the starting title margin in pixels
     * @param top the top title margin in pixels
     * @param end the ending title margin in pixels
     * @param bottom the bottom title margin in pixels
     * @see #getTitleMarginStart()
     * @see #getTitleMarginTop()
     * @see #getTitleMarginEnd()
     * @see #getTitleMarginBottom()
     * @attr ref android.R.styleable#Toolbar_titleMargin
     */
    public void setTitleMargin(int start, int top, int end, int bottom) {
        mTitleMarginStart = start;
        mTitleMarginTop = top;
        mTitleMarginEnd = end;
        mTitleMarginBottom = bottom;

        requestLayout();
    }

    /**
     * @return the starting title margin in pixels
     * @see #setTitleMarginStart(int)
     * @attr ref android.R.styleable#Toolbar_titleMarginStart
     */
    public int getTitleMarginStart() {
        return mTitleMarginStart;
    }

    /**
     * Sets the starting title margin in pixels.
     *
     * @param margin the starting title margin in pixels
     * @see #getTitleMarginStart()
     * @attr ref android.R.styleable#Toolbar_titleMarginStart
     */
    public void setTitleMarginStart(int margin) {
        mTitleMarginStart = margin;

        requestLayout();
    }

    /**
     * @return the top title margin in pixels
     * @see #setTitleMarginTop(int)
     * @attr ref android.R.styleable#Toolbar_titleMarginTop
     */
    public int getTitleMarginTop() {
        return mTitleMarginTop;
    }

    /**
     * Sets the top title margin in pixels.
     *
     * @param margin the top title margin in pixels
     * @see #getTitleMarginTop()
     * @attr ref android.R.styleable#Toolbar_titleMarginTop
     */
    public void setTitleMarginTop(int margin) {
        mTitleMarginTop = margin;

        requestLayout();
    }

    /**
     * @return the ending title margin in pixels
     * @see #setTitleMarginEnd(int)
     * @attr ref android.R.styleable#Toolbar_titleMarginEnd
     */
    public int getTitleMarginEnd() {
        return mTitleMarginEnd;
    }

    /**
     * Sets the ending title margin in pixels.
     *
     * @param margin the ending title margin in pixels
     * @see #getTitleMarginEnd()
     * @attr ref android.R.styleable#Toolbar_titleMarginEnd
     */
    public void setTitleMarginEnd(int margin) {
        mTitleMarginEnd = margin;

        requestLayout();
    }

    /**
     * @return the bottom title margin in pixels
     * @see #setTitleMarginBottom(int)
     * @attr ref android.R.styleable#Toolbar_titleMarginBottom
     */
    public int getTitleMarginBottom() {
        return mTitleMarginBottom;
    }

    /**
     * Sets the bottom title margin in pixels.
     *
     * @param margin the bottom title margin in pixels
     * @see #getTitleMarginBottom()
     * @attr ref android.R.styleable#Toolbar_titleMarginBottom
     */
    public void setTitleMarginBottom(int margin) {
        mTitleMarginBottom = margin;

        requestLayout();
    }

    @Override
    public void onRtlPropertiesChanged(@ResolvedLayoutDir int layoutDirection) {
        super.onRtlPropertiesChanged(layoutDirection);
+15 −1
Original line number Diff line number Diff line
@@ -7769,10 +7769,24 @@ i
        <attr name="title" />
        <attr name="subtitle" />
        <attr name="gravity" />
        <attr name="titleMargins" format="dimension" />
        <!--  Specifies extra space on the left, start, right and end sides
              of the toolbar's title. Margin values should be positive. -->
        <attr name="titleMargin" format="dimension" />
        <!--  Specifies extra space on the start side of the toolbar's title.
              If both this attribute and titleMargin are specified, then this
              attribute takes precedence. Margin values should be positive. -->
        <attr name="titleMarginStart" format="dimension" />
        <!--  Specifies extra space on the end side of the toolbar's title.
              If both this attribute and titleMargin are specified, then this
              attribute takes precedence. Margin values should be positive. -->
        <attr name="titleMarginEnd" format="dimension" />
        <!--  Specifies extra space on the top side of the toolbar's title.
              If both this attribute and titleMargin are specified, then this
              attribute takes precedence. Margin values should be positive. -->
        <attr name="titleMarginTop" format="dimension" />
        <!--  Specifies extra space on the bottom side of the toolbar's title.
              If both this attribute and titleMargin are specified, then this
              attribute takes precedence. Margin values should be positive. -->
        <attr name="titleMarginBottom" format="dimension" />
        <attr name="contentInsetStart" />
        <attr name="contentInsetEnd" />
+11 −3
Original line number Diff line number Diff line
@@ -2662,6 +2662,17 @@

    <public type="attr" name="listMenuViewStyle" />
    <public type="attr" name="subMenuArrow" />
    <public type="attr" name="activityWidth" />
    <public type="attr" name="activityHeight" />
    <public type="attr" name="resizeableActivity" />
    <public type="attr" name="titleMargin" />
    <public type="attr" name="titleMarginStart" />
    <public type="attr" name="titleMarginEnd" />
    <public type="attr" name="titleMarginTop" />
    <public type="attr" name="titleMarginBottom" />
    <public type="attr" name="maxButtonHeight" />
    <public type="attr" name="buttonGravity" />
    <public type="attr" name="collapseIcon" />

    <public type="style" name="Theme.Material.DayNight" />
    <public type="style" name="Theme.Material.DayNight.DarkActionBar" />
@@ -2682,8 +2693,5 @@
    <public type="style" name="Theme.Material.DayNight.DialogWhenLarge.DarkActionBar" />

    <public type="id" name="accessibilityActionSetProgress" />
    <public type="attr" name="activityWidth" />
    <public type="attr" name="activityHeight" />
    <public type="attr" name="resizeableActivity" />

</resources>
Loading