112 lines
3.9 KiB
Java
112 lines
3.9 KiB
Java
|
package com.google.android.material.snackbar;
|
||
|
|
||
|
import android.animation.TimeInterpolator;
|
||
|
import android.content.Context;
|
||
|
import android.text.Layout;
|
||
|
import android.util.AttributeSet;
|
||
|
import android.widget.Button;
|
||
|
import android.widget.LinearLayout;
|
||
|
import android.widget.TextView;
|
||
|
import androidx.core.view.ViewCompat;
|
||
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||
|
import o.C17052tZT;
|
||
|
import o.C6217cMa;
|
||
|
import o.DAZ;
|
||
|
import o.InterfaceC15708htK;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class SnackbarContentLayout extends LinearLayout implements InterfaceC15708htK {
|
||
|
private int a;
|
||
|
private final TimeInterpolator b;
|
||
|
TextView c;
|
||
|
Button d;
|
||
|
|
||
|
public SnackbarContentLayout(Context context) {
|
||
|
this(context, null);
|
||
|
}
|
||
|
|
||
|
public SnackbarContentLayout(Context context, AttributeSet attributeSet) {
|
||
|
super(context, attributeSet);
|
||
|
this.b = DAZ.Kh_(context, C17052tZT.IeS.motionEasingEmphasizedInterpolator, C6217cMa.d);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected void onFinishInflate() {
|
||
|
super.onFinishInflate();
|
||
|
this.c = (TextView) findViewById(C17052tZT.ZqN.snackbar_text);
|
||
|
this.d = (Button) findViewById(C17052tZT.ZqN.snackbar_action);
|
||
|
}
|
||
|
|
||
|
@Override // android.widget.LinearLayout, android.view.View
|
||
|
protected void onMeasure(int i, int i2) {
|
||
|
super.onMeasure(i, i2);
|
||
|
if (getOrientation() == 1) {
|
||
|
return;
|
||
|
}
|
||
|
int dimensionPixelSize = getResources().getDimensionPixelSize(C17052tZT.HBt.design_snackbar_padding_vertical_2lines);
|
||
|
int dimensionPixelSize2 = getResources().getDimensionPixelSize(C17052tZT.HBt.design_snackbar_padding_vertical);
|
||
|
Layout layout = this.c.getLayout();
|
||
|
boolean z = layout != null && layout.getLineCount() > 1;
|
||
|
if (z && this.a > 0 && this.d.getMeasuredWidth() > this.a) {
|
||
|
if (!b(1, dimensionPixelSize, dimensionPixelSize - dimensionPixelSize2)) {
|
||
|
return;
|
||
|
}
|
||
|
} else {
|
||
|
if (!z) {
|
||
|
dimensionPixelSize = dimensionPixelSize2;
|
||
|
}
|
||
|
if (!b(0, dimensionPixelSize, dimensionPixelSize)) {
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
super.onMeasure(i, i2);
|
||
|
}
|
||
|
|
||
|
private boolean b(int i, int i2, int i3) {
|
||
|
boolean z;
|
||
|
if (i != getOrientation()) {
|
||
|
setOrientation(i);
|
||
|
z = true;
|
||
|
} else {
|
||
|
z = false;
|
||
|
}
|
||
|
if (this.c.getPaddingTop() == i2 && this.c.getPaddingBottom() == i3) {
|
||
|
return z;
|
||
|
}
|
||
|
TextView textView = this.c;
|
||
|
if (ViewCompat.E(textView)) {
|
||
|
ViewCompat.a(textView, ViewCompat.q(textView), i2, ViewCompat.r(textView), i3);
|
||
|
return true;
|
||
|
}
|
||
|
textView.setPadding(textView.getPaddingLeft(), i2, textView.getPaddingRight(), i3);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15708htK
|
||
|
public final void d(int i, int i2) {
|
||
|
this.c.setAlpha(BitmapDescriptorFactory.HUE_RED);
|
||
|
long j = i2;
|
||
|
long j2 = i;
|
||
|
this.c.animate().alpha(1.0f).setDuration(j).setInterpolator(this.b).setStartDelay(j2).start();
|
||
|
if (this.d.getVisibility() == 0) {
|
||
|
this.d.setAlpha(BitmapDescriptorFactory.HUE_RED);
|
||
|
this.d.animate().alpha(1.0f).setDuration(j).setInterpolator(this.b).setStartDelay(j2).start();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15708htK
|
||
|
public final void c(int i) {
|
||
|
this.c.setAlpha(1.0f);
|
||
|
long j = i;
|
||
|
this.c.animate().alpha(BitmapDescriptorFactory.HUE_RED).setDuration(j).setInterpolator(this.b).setStartDelay(0L).start();
|
||
|
if (this.d.getVisibility() == 0) {
|
||
|
this.d.setAlpha(1.0f);
|
||
|
this.d.animate().alpha(BitmapDescriptorFactory.HUE_RED).setDuration(j).setInterpolator(this.b).setStartDelay(0L).start();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setMaxInlineActionWidth(int i) {
|
||
|
this.a = i;
|
||
|
}
|
||
|
}
|