what-the-bank/sources/androidx/appcompat/widget/ActionBarContainer.java

369 lines
13 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package androidx.appcompat.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.core.view.ViewCompat;
import o.SYO;
import o.rQx;
/* loaded from: classes.dex */
public class ActionBarContainer extends FrameLayout {
public boolean a;
public Drawable b;
public Drawable c;
public boolean d;
public Drawable e;
private int f;
private View g;
private boolean h;
View i;
private View j;
@Override // android.view.ViewGroup, android.view.ViewParent
public ActionMode startActionModeForChild(View view, ActionMode.Callback callback) {
return null;
}
public ActionBarContainer(Context context) {
this(context, null);
}
public ActionBarContainer(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
ViewCompat.sn_(this, new rQx(this));
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, SYO.ZqN.ActionBar);
this.e = obtainStyledAttributes.getDrawable(SYO.ZqN.ActionBar_background);
this.c = obtainStyledAttributes.getDrawable(SYO.ZqN.ActionBar_backgroundStacked);
this.f = obtainStyledAttributes.getDimensionPixelSize(SYO.ZqN.ActionBar_height, -1);
boolean z = true;
if (getId() == SYO.saX.split_action_bar) {
this.d = true;
this.b = obtainStyledAttributes.getDrawable(SYO.ZqN.ActionBar_backgroundSplit);
}
obtainStyledAttributes.recycle();
if (!this.d ? this.e != null || this.c != null : this.b != null) {
z = false;
}
setWillNotDraw(z);
}
@Override // android.view.View
public void onFinishInflate() {
super.onFinishInflate();
this.j = findViewById(SYO.saX.action_bar);
this.g = findViewById(SYO.saX.action_context_bar);
}
public void setPrimaryBackground(Drawable drawable) {
Drawable drawable2 = this.e;
if (drawable2 != null) {
drawable2.setCallback(null);
unscheduleDrawable(this.e);
}
this.e = drawable;
if (drawable != null) {
drawable.setCallback(this);
View view = this.j;
if (view != null) {
this.e.setBounds(view.getLeft(), this.j.getTop(), this.j.getRight(), this.j.getBottom());
}
}
setWillNotDraw(!this.d ? !(this.e == null && this.c == null) : this.b != null);
invalidate();
RVV.e(this);
}
public void setStackedBackground(Drawable drawable) {
Drawable drawable2;
Drawable drawable3 = this.c;
if (drawable3 != null) {
drawable3.setCallback(null);
unscheduleDrawable(this.c);
}
this.c = drawable;
if (drawable != null) {
drawable.setCallback(this);
if (this.a && (drawable2 = this.c) != null) {
drawable2.setBounds(this.i.getLeft(), this.i.getTop(), this.i.getRight(), this.i.getBottom());
}
}
setWillNotDraw(!this.d ? !(this.e == null && this.c == null) : this.b != null);
invalidate();
RVV.e(this);
}
public void setSplitBackground(Drawable drawable) {
Drawable drawable2;
Drawable drawable3 = this.b;
if (drawable3 != null) {
drawable3.setCallback(null);
unscheduleDrawable(this.b);
}
this.b = drawable;
boolean z = false;
if (drawable != null) {
drawable.setCallback(this);
if (this.d && (drawable2 = this.b) != null) {
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
}
}
if (!this.d ? !(this.e != null || this.c != null) : this.b == null) {
z = true;
}
setWillNotDraw(z);
invalidate();
RVV.e(this);
}
@Override // android.view.View
public void setVisibility(int i) {
super.setVisibility(i);
boolean z = i == 0;
Drawable drawable = this.e;
if (drawable != null) {
drawable.setVisible(z, false);
}
Drawable drawable2 = this.c;
if (drawable2 != null) {
drawable2.setVisible(z, false);
}
Drawable drawable3 = this.b;
if (drawable3 != null) {
drawable3.setVisible(z, false);
}
}
@Override // android.view.View
protected boolean verifyDrawable(Drawable drawable) {
return (drawable == this.e && !this.d) || (drawable == this.c && this.a) || ((drawable == this.b && this.d) || super.verifyDrawable(drawable));
}
@Override // android.view.ViewGroup, android.view.View
protected void drawableStateChanged() {
super.drawableStateChanged();
Drawable drawable = this.e;
if (drawable != null && drawable.isStateful()) {
this.e.setState(getDrawableState());
}
Drawable drawable2 = this.c;
if (drawable2 != null && drawable2.isStateful()) {
this.c.setState(getDrawableState());
}
Drawable drawable3 = this.b;
if (drawable3 == null || !drawable3.isStateful()) {
return;
}
this.b.setState(getDrawableState());
}
@Override // android.view.ViewGroup, android.view.View
public void jumpDrawablesToCurrentState() {
super.jumpDrawablesToCurrentState();
Drawable drawable = this.e;
if (drawable != null) {
drawable.jumpToCurrentState();
}
Drawable drawable2 = this.c;
if (drawable2 != null) {
drawable2.jumpToCurrentState();
}
Drawable drawable3 = this.b;
if (drawable3 != null) {
drawable3.jumpToCurrentState();
}
}
public void setTransitioning(boolean z) {
this.h = z;
setDescendantFocusability(z ? 393216 : 262144);
}
@Override // android.view.ViewGroup
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
return this.h || super.onInterceptTouchEvent(motionEvent);
}
@Override // android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
super.onTouchEvent(motionEvent);
return true;
}
@Override // android.view.View
public boolean onHoverEvent(MotionEvent motionEvent) {
super.onHoverEvent(motionEvent);
return true;
}
public void setTabContainer(ScrollingTabContainerView scrollingTabContainerView) {
View view = this.i;
if (view != null) {
removeView(view);
}
this.i = scrollingTabContainerView;
if (scrollingTabContainerView != null) {
addView(scrollingTabContainerView);
ViewGroup.LayoutParams layoutParams = scrollingTabContainerView.getLayoutParams();
layoutParams.width = -1;
layoutParams.height = -2;
scrollingTabContainerView.setAllowCollapse(false);
}
}
@Override // android.view.ViewGroup, android.view.ViewParent
public ActionMode startActionModeForChild(View view, ActionMode.Callback callback, int i) {
if (i != 0) {
return super.startActionModeForChild(view, callback, i);
}
return null;
}
/* JADX WARN: Removed duplicated region for block: B:27:0x0080 */
/* JADX WARN: Removed duplicated region for block: B:30:0x0085 */
@Override // android.widget.FrameLayout, android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void onMeasure(int r5, int r6) {
/*
r4 = this;
android.view.View r0 = r4.j
r1 = -2147483648(0xffffffff80000000, float:-0.0)
if (r0 != 0) goto L1c
int r0 = android.view.View.MeasureSpec.getMode(r6)
if (r0 != r1) goto L1c
int r0 = r4.f
if (r0 < 0) goto L1c
int r6 = android.view.View.MeasureSpec.getSize(r6)
int r6 = java.lang.Math.min(r0, r6)
int r6 = android.view.View.MeasureSpec.makeMeasureSpec(r6, r1)
L1c:
super.onMeasure(r5, r6)
android.view.View r5 = r4.j
if (r5 != 0) goto L24
return
L24:
int r5 = android.view.View.MeasureSpec.getMode(r6)
android.view.View r0 = r4.i
if (r0 == 0) goto La6
int r0 = r0.getVisibility()
r2 = 8
if (r0 == r2) goto La6
r0 = 1073741824(0x40000000, float:2.0)
if (r5 == r0) goto La6
android.view.View r0 = r4.j
if (r0 == 0) goto L5b
int r3 = r0.getVisibility()
if (r3 == r2) goto L5b
int r0 = r0.getMeasuredHeight()
if (r0 == 0) goto L5b
android.view.View r0 = r4.j
android.view.ViewGroup$LayoutParams r2 = r0.getLayoutParams()
android.widget.FrameLayout$LayoutParams r2 = (android.widget.FrameLayout.LayoutParams) r2
int r0 = r0.getMeasuredHeight()
int r3 = r2.topMargin
int r0 = r0 + r3
int r2 = r2.bottomMargin
L59:
int r0 = r0 + r2
goto L7e
L5b:
android.view.View r0 = r4.g
if (r0 == 0) goto L7d
int r3 = r0.getVisibility()
if (r3 == r2) goto L7d
int r0 = r0.getMeasuredHeight()
if (r0 == 0) goto L7d
android.view.View r0 = r4.g
android.view.ViewGroup$LayoutParams r2 = r0.getLayoutParams()
android.widget.FrameLayout$LayoutParams r2 = (android.widget.FrameLayout.LayoutParams) r2
int r0 = r0.getMeasuredHeight()
int r3 = r2.topMargin
int r0 = r0 + r3
int r2 = r2.bottomMargin
goto L59
L7d:
r0 = 0
L7e:
if (r5 != r1) goto L85
int r5 = android.view.View.MeasureSpec.getSize(r6)
goto L88
L85:
r5 = 2147483647(0x7fffffff, float:NaN)
L88:
int r6 = r4.getMeasuredWidth()
android.view.View r1 = r4.i
android.view.ViewGroup$LayoutParams r2 = r1.getLayoutParams()
android.widget.FrameLayout$LayoutParams r2 = (android.widget.FrameLayout.LayoutParams) r2
int r1 = r1.getMeasuredHeight()
int r3 = r2.topMargin
int r1 = r1 + r3
int r2 = r2.bottomMargin
int r1 = r1 + r2
int r0 = r0 + r1
int r5 = java.lang.Math.min(r0, r5)
r4.setMeasuredDimension(r6, r5)
La6:
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActionBarContainer.onMeasure(int, int):void");
}
@Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
Drawable drawable;
super.onLayout(z, i, i2, i3, i4);
View view = this.i;
boolean z2 = true;
boolean z3 = (view == null || view.getVisibility() == 8) ? false : true;
if (view != null && view.getVisibility() != 8) {
int measuredHeight = getMeasuredHeight();
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
view.layout(i, (measuredHeight - view.getMeasuredHeight()) - ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin, i3, measuredHeight - ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin);
}
if (this.d) {
Drawable drawable2 = this.b;
if (drawable2 == null) {
return;
} else {
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
}
} else {
if (this.e == null) {
z2 = false;
} else if (this.j.getVisibility() == 0) {
this.e.setBounds(this.j.getLeft(), this.j.getTop(), this.j.getRight(), this.j.getBottom());
} else {
View view2 = this.g;
if (view2 != null && view2.getVisibility() == 0) {
this.e.setBounds(this.g.getLeft(), this.g.getTop(), this.g.getRight(), this.g.getBottom());
} else {
this.e.setBounds(0, 0, 0, 0);
}
}
this.a = z3;
if (z3 && (drawable = this.c) != null) {
drawable.setBounds(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
} else if (!z2) {
return;
}
}
invalidate();
}
/* loaded from: classes.dex */
static class RVV {
public static void e(ActionBarContainer actionBarContainer) {
actionBarContainer.invalidateOutline();
}
}
}