Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
package com.google.android.material.snackbar;
import android.view.MotionEvent;
import android.view.View;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.behavior.SwipeDismissBehavior;
/* loaded from: classes.dex */
public class BaseTransientBottomBar$Behavior extends SwipeDismissBehavior<View> {
private final BaseTransientBottomBar$BehaviorDelegate k = new BaseTransientBottomBar$BehaviorDelegate(this);
@Override // com.google.android.material.behavior.SwipeDismissBehavior
public boolean a(View view) {
return this.k.a(view);
}
@Override // com.google.android.material.behavior.SwipeDismissBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
public boolean a(CoordinatorLayout coordinatorLayout, View view, MotionEvent motionEvent) {
this.k.a(coordinatorLayout, view, motionEvent);
return super.a(coordinatorLayout, (CoordinatorLayout) view, motionEvent);
}
}

View File

@@ -0,0 +1,33 @@
package com.google.android.material.snackbar;
import android.view.MotionEvent;
import android.view.View;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.behavior.SwipeDismissBehavior;
import com.google.android.material.snackbar.SnackbarManager;
/* loaded from: classes.dex */
public class BaseTransientBottomBar$BehaviorDelegate {
private SnackbarManager.Callback a;
public BaseTransientBottomBar$BehaviorDelegate(SwipeDismissBehavior<?> swipeDismissBehavior) {
swipeDismissBehavior.b(0.1f);
swipeDismissBehavior.a(0.6f);
swipeDismissBehavior.a(0);
}
public boolean a(View view) {
return view instanceof BaseTransientBottomBar$SnackbarBaseLayout;
}
public void a(CoordinatorLayout coordinatorLayout, View view, MotionEvent motionEvent) {
int actionMasked = motionEvent.getActionMasked();
if (actionMasked == 0) {
if (coordinatorLayout.a(view, (int) motionEvent.getX(), (int) motionEvent.getY())) {
SnackbarManager.a().a(this.a);
}
} else if (actionMasked == 1 || actionMasked == 3) {
SnackbarManager.a().b(this.a);
}
}
}

View File

@@ -0,0 +1,10 @@
package com.google.android.material.snackbar;
import android.view.View;
/* loaded from: classes.dex */
public interface BaseTransientBottomBar$OnAttachStateChangeListener {
void onViewAttachedToWindow(View view);
void onViewDetachedFromWindow(View view);
}

View File

@@ -0,0 +1,8 @@
package com.google.android.material.snackbar;
import android.view.View;
/* loaded from: classes.dex */
public interface BaseTransientBottomBar$OnLayoutChangeListener {
void a(View view, int i, int i2, int i3, int i4);
}

View File

@@ -0,0 +1,83 @@
package com.google.android.material.snackbar;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.accessibility.AccessibilityManager;
import android.widget.FrameLayout;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityManagerCompat;
import com.google.android.material.R$styleable;
/* loaded from: classes.dex */
public class BaseTransientBottomBar$SnackbarBaseLayout extends FrameLayout {
private final AccessibilityManager a;
private final AccessibilityManagerCompat.TouchExplorationStateChangeListener b;
private BaseTransientBottomBar$OnLayoutChangeListener c;
private BaseTransientBottomBar$OnAttachStateChangeListener d;
protected BaseTransientBottomBar$SnackbarBaseLayout(Context context) {
this(context, null);
}
/* JADX INFO: Access modifiers changed from: private */
public void setClickableOrFocusableBasedOnAccessibility(boolean z) {
setClickable(!z);
setFocusable(z);
}
@Override // android.view.ViewGroup, android.view.View
protected void onAttachedToWindow() {
super.onAttachedToWindow();
BaseTransientBottomBar$OnAttachStateChangeListener baseTransientBottomBar$OnAttachStateChangeListener = this.d;
if (baseTransientBottomBar$OnAttachStateChangeListener != null) {
baseTransientBottomBar$OnAttachStateChangeListener.onViewAttachedToWindow(this);
}
ViewCompat.B(this);
}
@Override // android.view.ViewGroup, android.view.View
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
BaseTransientBottomBar$OnAttachStateChangeListener baseTransientBottomBar$OnAttachStateChangeListener = this.d;
if (baseTransientBottomBar$OnAttachStateChangeListener != null) {
baseTransientBottomBar$OnAttachStateChangeListener.onViewDetachedFromWindow(this);
}
AccessibilityManagerCompat.b(this.a, this.b);
}
@Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
BaseTransientBottomBar$OnLayoutChangeListener baseTransientBottomBar$OnLayoutChangeListener = this.c;
if (baseTransientBottomBar$OnLayoutChangeListener != null) {
baseTransientBottomBar$OnLayoutChangeListener.a(this, i, i2, i3, i4);
}
}
void setOnAttachStateChangeListener(BaseTransientBottomBar$OnAttachStateChangeListener baseTransientBottomBar$OnAttachStateChangeListener) {
this.d = baseTransientBottomBar$OnAttachStateChangeListener;
}
void setOnLayoutChangeListener(BaseTransientBottomBar$OnLayoutChangeListener baseTransientBottomBar$OnLayoutChangeListener) {
this.c = baseTransientBottomBar$OnLayoutChangeListener;
}
protected BaseTransientBottomBar$SnackbarBaseLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.SnackbarLayout);
if (obtainStyledAttributes.hasValue(R$styleable.SnackbarLayout_elevation)) {
ViewCompat.b(this, obtainStyledAttributes.getDimensionPixelSize(R$styleable.SnackbarLayout_elevation, 0));
}
obtainStyledAttributes.recycle();
this.a = (AccessibilityManager) context.getSystemService("accessibility");
this.b = new AccessibilityManagerCompat.TouchExplorationStateChangeListener() { // from class: com.google.android.material.snackbar.BaseTransientBottomBar$SnackbarBaseLayout.1
@Override // androidx.core.view.accessibility.AccessibilityManagerCompat.TouchExplorationStateChangeListener
public void onTouchExplorationStateChanged(boolean z) {
BaseTransientBottomBar$SnackbarBaseLayout.this.setClickableOrFocusableBasedOnAccessibility(z);
}
};
AccessibilityManagerCompat.a(this.a, this.b);
setClickableOrFocusableBasedOnAccessibility(this.a.isTouchExplorationEnabled());
}
}

View File

@@ -0,0 +1,5 @@
package com.google.android.material.snackbar;
/* loaded from: classes.dex */
public interface ContentViewCallback {
}

View File

@@ -0,0 +1,29 @@
package com.google.android.material.snackbar;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
/* loaded from: classes.dex */
public final class Snackbar$SnackbarLayout extends BaseTransientBottomBar$SnackbarBaseLayout {
public Snackbar$SnackbarLayout(Context context) {
super(context);
}
@Override // android.widget.FrameLayout, android.view.View
protected void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
int childCount = getChildCount();
int measuredWidth = (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight();
for (int i3 = 0; i3 < childCount; i3++) {
View childAt = getChildAt(i3);
if (childAt.getLayoutParams().width == -1) {
childAt.measure(View.MeasureSpec.makeMeasureSpec(measuredWidth, 1073741824), View.MeasureSpec.makeMeasureSpec(childAt.getMeasuredHeight(), 1073741824));
}
}
}
public Snackbar$SnackbarLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
}

View File

@@ -0,0 +1,148 @@
package com.google.android.material.snackbar;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import com.google.android.material.R$id;
import com.google.android.material.R$styleable;
/* loaded from: classes.dex */
public class SnackbarContentLayout extends LinearLayout implements ContentViewCallback {
private TextView a;
private Button b;
private int c;
private int d;
public SnackbarContentLayout(Context context) {
this(context, null);
}
private boolean a(int i, int i2, int i3) {
boolean z;
if (i != getOrientation()) {
setOrientation(i);
z = true;
} else {
z = false;
}
if (this.a.getPaddingTop() == i2 && this.a.getPaddingBottom() == i3) {
return z;
}
a(this.a, i2, i3);
return true;
}
public Button getActionView() {
return this.b;
}
public TextView getMessageView() {
return this.a;
}
@Override // android.view.View
protected void onFinishInflate() {
super.onFinishInflate();
this.a = (TextView) findViewById(R$id.snackbar_text);
this.b = (Button) findViewById(R$id.snackbar_action);
}
/* JADX WARN: Code restructure failed: missing block: B:15:0x0053, code lost:
if (a(1, r0, r0 - r1) != false) goto L26;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x0061, code lost:
r4 = false;
*/
/* JADX WARN: Code restructure failed: missing block: B:25:0x005e, code lost:
if (a(0, r0, r0) != false) goto L26;
*/
@Override // android.widget.LinearLayout, android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
protected void onMeasure(int r8, int r9) {
/*
r7 = this;
super.onMeasure(r8, r9)
int r0 = r7.c
if (r0 <= 0) goto L18
int r0 = r7.getMeasuredWidth()
int r1 = r7.c
if (r0 <= r1) goto L18
r8 = 1073741824(0x40000000, float:2.0)
int r8 = android.view.View.MeasureSpec.makeMeasureSpec(r1, r8)
super.onMeasure(r8, r9)
L18:
android.content.res.Resources r0 = r7.getResources()
int r1 = com.google.android.material.R$dimen.design_snackbar_padding_vertical_2lines
int r0 = r0.getDimensionPixelSize(r1)
android.content.res.Resources r1 = r7.getResources()
int r2 = com.google.android.material.R$dimen.design_snackbar_padding_vertical
int r1 = r1.getDimensionPixelSize(r2)
android.widget.TextView r2 = r7.a
android.text.Layout r2 = r2.getLayout()
int r2 = r2.getLineCount()
r3 = 0
r4 = 1
if (r2 <= r4) goto L3c
r2 = 1
goto L3d
L3c:
r2 = 0
L3d:
if (r2 == 0) goto L56
int r5 = r7.d
if (r5 <= 0) goto L56
android.widget.Button r5 = r7.b
int r5 = r5.getMeasuredWidth()
int r6 = r7.d
if (r5 <= r6) goto L56
int r1 = r0 - r1
boolean r0 = r7.a(r4, r0, r1)
if (r0 == 0) goto L61
goto L62
L56:
if (r2 == 0) goto L59
goto L5a
L59:
r0 = r1
L5a:
boolean r0 = r7.a(r3, r0, r0)
if (r0 == 0) goto L61
goto L62
L61:
r4 = 0
L62:
if (r4 == 0) goto L67
super.onMeasure(r8, r9)
L67:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.snackbar.SnackbarContentLayout.onMeasure(int, int):void");
}
public SnackbarContentLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.SnackbarLayout);
this.c = obtainStyledAttributes.getDimensionPixelSize(R$styleable.SnackbarLayout_android_maxWidth, -1);
this.d = obtainStyledAttributes.getDimensionPixelSize(R$styleable.SnackbarLayout_maxActionInlineWidth, -1);
obtainStyledAttributes.recycle();
}
private static void a(View view, int i, int i2) {
if (ViewCompat.z(view)) {
ViewCompat.a(view, ViewCompat.o(view), i, ViewCompat.n(view), i2);
} else {
view.setPadding(view.getPaddingLeft(), i, view.getPaddingRight(), i2);
}
}
}

View File

@@ -0,0 +1,103 @@
package com.google.android.material.snackbar;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import com.google.android.gms.common.ConnectionResult;
import java.lang.ref.WeakReference;
/* loaded from: classes.dex */
class SnackbarManager {
private static SnackbarManager e;
private final Object a = new Object();
private final Handler b = new Handler(Looper.getMainLooper(), new Handler.Callback() { // from class: com.google.android.material.snackbar.SnackbarManager.1
@Override // android.os.Handler.Callback
public boolean handleMessage(Message message) {
if (message.what != 0) {
return false;
}
SnackbarManager.this.a((SnackbarRecord) message.obj);
return true;
}
});
private SnackbarRecord c;
private SnackbarRecord d;
interface Callback {
void a(int i);
}
private static class SnackbarRecord {
final WeakReference<Callback> a;
int b;
boolean c;
boolean a(Callback callback) {
return callback != null && this.a.get() == callback;
}
}
private SnackbarManager() {
}
static SnackbarManager a() {
if (e == null) {
e = new SnackbarManager();
}
return e;
}
private boolean c(Callback callback) {
SnackbarRecord snackbarRecord = this.c;
return snackbarRecord != null && snackbarRecord.a(callback);
}
public void b(Callback callback) {
synchronized (this.a) {
if (c(callback) && this.c.c) {
this.c.c = false;
b(this.c);
}
}
}
public void a(Callback callback) {
synchronized (this.a) {
if (c(callback) && !this.c.c) {
this.c.c = true;
this.b.removeCallbacksAndMessages(this.c);
}
}
}
private void b(SnackbarRecord snackbarRecord) {
int i = snackbarRecord.b;
if (i == -2) {
return;
}
if (i <= 0) {
i = i == -1 ? ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED : 2750;
}
this.b.removeCallbacksAndMessages(snackbarRecord);
Handler handler = this.b;
handler.sendMessageDelayed(Message.obtain(handler, 0, snackbarRecord), i);
}
private boolean a(SnackbarRecord snackbarRecord, int i) {
Callback callback = snackbarRecord.a.get();
if (callback == null) {
return false;
}
this.b.removeCallbacksAndMessages(snackbarRecord);
callback.a(i);
return true;
}
void a(SnackbarRecord snackbarRecord) {
synchronized (this.a) {
if (this.c == snackbarRecord || this.d == snackbarRecord) {
a(snackbarRecord, 2);
}
}
}
}