Skip to content

Commit 8dd8ace

Browse files
johan12345dsn5ft
authored andcommitted
Mutate gravity horizontal value on setExpandedTextGravity and setCollapsedTextGravity, so the code can assume they are set.
PiperOrigin-RevId: 286392235
1 parent b2deaa3 commit 8dd8ace

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/java/com/google/android/material/internal/CollapsingTextHelper.java

+6
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ void onBoundsChanged() {
272272
}
273273

274274
public void setExpandedTextGravity(int gravity) {
275+
if ((gravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {
276+
gravity |= GravityCompat.START;
277+
}
275278
if (expandedTextGravity != gravity) {
276279
expandedTextGravity = gravity;
277280
recalculate();
@@ -283,6 +286,9 @@ public int getExpandedTextGravity() {
283286
}
284287

285288
public void setCollapsedTextGravity(int gravity) {
289+
if ((gravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {
290+
gravity |= GravityCompat.START;
291+
}
286292
if (collapsedTextGravity != gravity) {
287293
collapsedTextGravity = gravity;
288294
recalculate();

0 commit comments

Comments
 (0)