mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
resolved conflicts for d687245e to master
Change-Id: I245e42a399585bd1788db6ba09486ef1c1a6b691 GitOrigin-RevId=c0d908fa15305aa1efe58738c74d54933772186c PiperOrigin-RevId: 140551108
This commit is contained in:
parent
3dcbbb143f
commit
81ff1336dd
@ -98,6 +98,10 @@ package android.support.design.widget {
|
||||
method public android.graphics.Typeface getCollapsedTitleTypeface();
|
||||
method public android.graphics.drawable.Drawable getContentScrim();
|
||||
method public int getExpandedTitleGravity();
|
||||
method public int getExpandedTitleMarginBottom();
|
||||
method public int getExpandedTitleMarginEnd();
|
||||
method public int getExpandedTitleMarginStart();
|
||||
method public int getExpandedTitleMarginTop();
|
||||
method public android.graphics.Typeface getExpandedTitleTypeface();
|
||||
method public android.graphics.drawable.Drawable getStatusBarScrim();
|
||||
method public java.lang.CharSequence getTitle();
|
||||
@ -111,6 +115,11 @@ package android.support.design.widget {
|
||||
method public void setContentScrimResource(int);
|
||||
method public void setExpandedTitleColor(int);
|
||||
method public void setExpandedTitleGravity(int);
|
||||
method public void setExpandedTitleMargin(int, int, int, int);
|
||||
method public void setExpandedTitleMarginBottom(int);
|
||||
method public void setExpandedTitleMarginEnd(int);
|
||||
method public void setExpandedTitleMarginStart(int);
|
||||
method public void setExpandedTitleMarginTop(int);
|
||||
method public void setExpandedTitleTextAppearance(int);
|
||||
method public void setExpandedTitleTypeface(android.graphics.Typeface);
|
||||
method public void setScrimsShown(boolean);
|
||||
|
||||
@ -96,9 +96,9 @@ public class CollapsingToolbarLayout extends FrameLayout {
|
||||
private Toolbar mToolbar;
|
||||
private View mDummyView;
|
||||
|
||||
private int mExpandedMarginLeft;
|
||||
private int mExpandedMarginStart;
|
||||
private int mExpandedMarginTop;
|
||||
private int mExpandedMarginRight;
|
||||
private int mExpandedMarginEnd;
|
||||
private int mExpandedMarginBottom;
|
||||
|
||||
private final Rect mTmpRect = new Rect();
|
||||
@ -145,28 +145,16 @@ public class CollapsingToolbarLayout extends FrameLayout {
|
||||
a.getInt(R.styleable.CollapsingToolbarLayout_collapsedTitleGravity,
|
||||
GravityCompat.START | Gravity.CENTER_VERTICAL));
|
||||
|
||||
mExpandedMarginLeft = mExpandedMarginTop = mExpandedMarginRight = mExpandedMarginBottom =
|
||||
mExpandedMarginStart = mExpandedMarginTop = mExpandedMarginEnd = mExpandedMarginBottom =
|
||||
a.getDimensionPixelSize(R.styleable.CollapsingToolbarLayout_expandedTitleMargin, 0);
|
||||
|
||||
final boolean isRtl = ViewCompat.getLayoutDirection(this)
|
||||
== ViewCompat.LAYOUT_DIRECTION_RTL;
|
||||
if (a.hasValue(R.styleable.CollapsingToolbarLayout_expandedTitleMarginStart)) {
|
||||
final int marginStart = a.getDimensionPixelSize(
|
||||
mExpandedMarginStart = a.getDimensionPixelSize(
|
||||
R.styleable.CollapsingToolbarLayout_expandedTitleMarginStart, 0);
|
||||
if (isRtl) {
|
||||
mExpandedMarginRight = marginStart;
|
||||
} else {
|
||||
mExpandedMarginLeft = marginStart;
|
||||
}
|
||||
}
|
||||
if (a.hasValue(R.styleable.CollapsingToolbarLayout_expandedTitleMarginEnd)) {
|
||||
final int marginEnd = a.getDimensionPixelSize(
|
||||
mExpandedMarginEnd = a.getDimensionPixelSize(
|
||||
R.styleable.CollapsingToolbarLayout_expandedTitleMarginEnd, 0);
|
||||
if (isRtl) {
|
||||
mExpandedMarginLeft = marginEnd;
|
||||
} else {
|
||||
mExpandedMarginRight = marginEnd;
|
||||
}
|
||||
}
|
||||
if (a.hasValue(R.styleable.CollapsingToolbarLayout_expandedTitleMarginTop)) {
|
||||
mExpandedMarginTop = a.getDimensionPixelSize(
|
||||
@ -197,7 +185,6 @@ public class CollapsingToolbarLayout extends FrameLayout {
|
||||
mCollapsingTextHelper.setCollapsedTextAppearance(
|
||||
a.getResourceId(
|
||||
R.styleable.CollapsingToolbarLayout_collapsedTitleTextAppearance, 0));
|
||||
|
||||
}
|
||||
|
||||
setContentScrim(a.getDrawable(R.styleable.CollapsingToolbarLayout_contentScrim));
|
||||
@ -389,9 +376,9 @@ public class CollapsingToolbarLayout extends FrameLayout {
|
||||
bottom - mToolbar.getTitleMarginBottom());
|
||||
// Update the expanded bounds
|
||||
mCollapsingTextHelper.setExpandedBounds(
|
||||
mExpandedMarginLeft,
|
||||
isRtl ? mExpandedMarginEnd : mExpandedMarginStart,
|
||||
mTmpRect.bottom + mExpandedMarginTop,
|
||||
right - left - mExpandedMarginRight,
|
||||
right - left - (isRtl ? mExpandedMarginStart : mExpandedMarginEnd),
|
||||
bottom - top - mExpandedMarginBottom);
|
||||
// Now recalculate using the new bounds
|
||||
mCollapsingTextHelper.recalculate();
|
||||
@ -787,6 +774,113 @@ public class CollapsingToolbarLayout extends FrameLayout {
|
||||
return mCollapsingTextHelper.getExpandedTypeface();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the expanded title margins.
|
||||
*
|
||||
* @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 #getExpandedTitleMarginStart()
|
||||
* @see #getExpandedTitleMarginTop()
|
||||
* @see #getExpandedTitleMarginEnd()
|
||||
* @see #getExpandedTitleMarginBottom()
|
||||
* @attr ref android.support.design.R.styleable#CollapsingToolbarLayout_expandedTitleMargin
|
||||
*/
|
||||
public void setExpandedTitleMargin(int start, int top, int end, int bottom) {
|
||||
mExpandedMarginStart = start;
|
||||
mExpandedMarginTop = top;
|
||||
mExpandedMarginEnd = end;
|
||||
mExpandedMarginBottom = bottom;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the starting expanded title margin in pixels
|
||||
*
|
||||
* @see #setExpandedTitleMarginStart(int)
|
||||
* @attr ref android.support.design.R.styleable#CollapsingToolbarLayout_expandedTitleMarginStart
|
||||
*/
|
||||
public int getExpandedTitleMarginStart() {
|
||||
return mExpandedMarginStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the starting expanded title margin in pixels.
|
||||
*
|
||||
* @param margin the starting title margin in pixels
|
||||
* @see #getExpandedTitleMarginStart()
|
||||
* @attr ref android.support.design.R.styleable#CollapsingToolbarLayout_expandedTitleMarginStart
|
||||
*/
|
||||
public void setExpandedTitleMarginStart(int margin) {
|
||||
mExpandedMarginStart = margin;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the top expanded title margin in pixels
|
||||
* @see #setExpandedTitleMarginTop(int)
|
||||
* @attr ref android.support.design.R.styleable#CollapsingToolbarLayout_expandedTitleMarginTop
|
||||
*/
|
||||
public int getExpandedTitleMarginTop() {
|
||||
return mExpandedMarginTop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the top expanded title margin in pixels.
|
||||
*
|
||||
* @param margin the top title margin in pixels
|
||||
* @see #getExpandedTitleMarginTop()
|
||||
* @attr ref android.support.design.R.styleable#CollapsingToolbarLayout_expandedTitleMarginTop
|
||||
*/
|
||||
public void setExpandedTitleMarginTop(int margin) {
|
||||
mExpandedMarginTop = margin;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ending expanded title margin in pixels
|
||||
* @see #setExpandedTitleMarginEnd(int)
|
||||
* @attr ref android.support.design.R.styleable#CollapsingToolbarLayout_expandedTitleMarginEnd
|
||||
*/
|
||||
public int getExpandedTitleMarginEnd() {
|
||||
return mExpandedMarginEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ending expanded title margin in pixels.
|
||||
*
|
||||
* @param margin the ending title margin in pixels
|
||||
* @see #getExpandedTitleMarginEnd()
|
||||
* @attr ref android.support.design.R.styleable#CollapsingToolbarLayout_expandedTitleMarginEnd
|
||||
*/
|
||||
public void setExpandedTitleMarginEnd(int margin) {
|
||||
mExpandedMarginEnd = margin;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bottom expanded title margin in pixels
|
||||
* @see #setExpandedTitleMarginBottom(int)
|
||||
* @attr ref android.support.design.R.styleable#CollapsingToolbarLayout_expandedTitleMarginBottom
|
||||
*/
|
||||
public int getExpandedTitleMarginBottom() {
|
||||
return mExpandedMarginBottom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the bottom expanded title margin in pixels.
|
||||
*
|
||||
* @param margin the bottom title margin in pixels
|
||||
* @see #getExpandedTitleMarginBottom()
|
||||
* @attr ref android.support.design.R.styleable#CollapsingToolbarLayout_expandedTitleMarginBottom
|
||||
*/
|
||||
public void setExpandedTitleMarginBottom(int margin) {
|
||||
mExpandedMarginBottom = margin;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* The additional offset used to define when to trigger the scrim visibility change.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user