You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
378 lines
13 KiB
378 lines
13 KiB
package androidx.appcompat.widget;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Build;
|
|
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 p007c.C0490f;
|
|
import p007c.C0494j;
|
|
import p023h0.C0829h1;
|
|
import p028j.C1068b;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ActionBarContainer extends FrameLayout {
|
|
|
|
/* renamed from: d */
|
|
public boolean f408d;
|
|
|
|
/* renamed from: e */
|
|
public View f409e;
|
|
|
|
/* renamed from: f */
|
|
public View f410f;
|
|
|
|
/* renamed from: g */
|
|
public View f411g;
|
|
|
|
/* renamed from: h */
|
|
public Drawable f412h;
|
|
|
|
/* renamed from: i */
|
|
public Drawable f413i;
|
|
|
|
/* renamed from: j */
|
|
public Drawable f414j;
|
|
|
|
/* renamed from: k */
|
|
public boolean f415k;
|
|
|
|
/* renamed from: l */
|
|
public boolean f416l;
|
|
|
|
/* renamed from: m */
|
|
public int f417m;
|
|
|
|
/* renamed from: androidx.appcompat.widget.ActionBarContainer$a */
|
|
/* loaded from: classes.dex */
|
|
public static class C0120a {
|
|
/* renamed from: a */
|
|
public static void m4807a(ActionBarContainer actionBarContainer) {
|
|
actionBarContainer.invalidateOutline();
|
|
}
|
|
}
|
|
|
|
public ActionBarContainer(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
C0829h1.m2845R(this, new C1068b(this));
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C0494j.f1801a);
|
|
this.f412h = obtainStyledAttributes.getDrawable(C0494j.f1806b);
|
|
this.f413i = obtainStyledAttributes.getDrawable(C0494j.f1816d);
|
|
this.f417m = obtainStyledAttributes.getDimensionPixelSize(C0494j.f1846j, -1);
|
|
boolean z = true;
|
|
if (getId() == C0490f.split_action_bar) {
|
|
this.f415k = true;
|
|
this.f414j = obtainStyledAttributes.getDrawable(C0494j.f1811c);
|
|
}
|
|
obtainStyledAttributes.recycle();
|
|
if (!this.f415k ? this.f412h != null || this.f413i != null : this.f414j != null) {
|
|
z = false;
|
|
}
|
|
setWillNotDraw(z);
|
|
}
|
|
|
|
/* renamed from: a */
|
|
public final int m4809a(View view) {
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
|
|
return view.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
|
|
}
|
|
|
|
/* renamed from: b */
|
|
public final boolean m4808b(View view) {
|
|
return view == null || view.getVisibility() == 8 || view.getMeasuredHeight() == 0;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void drawableStateChanged() {
|
|
super.drawableStateChanged();
|
|
Drawable drawable = this.f412h;
|
|
if (drawable != null && drawable.isStateful()) {
|
|
this.f412h.setState(getDrawableState());
|
|
}
|
|
Drawable drawable2 = this.f413i;
|
|
if (drawable2 != null && drawable2.isStateful()) {
|
|
this.f413i.setState(getDrawableState());
|
|
}
|
|
Drawable drawable3 = this.f414j;
|
|
if (drawable3 == null || !drawable3.isStateful()) {
|
|
return;
|
|
}
|
|
this.f414j.setState(getDrawableState());
|
|
}
|
|
|
|
public View getTabContainer() {
|
|
return this.f409e;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void jumpDrawablesToCurrentState() {
|
|
super.jumpDrawablesToCurrentState();
|
|
Drawable drawable = this.f412h;
|
|
if (drawable != null) {
|
|
drawable.jumpToCurrentState();
|
|
}
|
|
Drawable drawable2 = this.f413i;
|
|
if (drawable2 != null) {
|
|
drawable2.jumpToCurrentState();
|
|
}
|
|
Drawable drawable3 = this.f414j;
|
|
if (drawable3 != null) {
|
|
drawable3.jumpToCurrentState();
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onFinishInflate() {
|
|
super.onFinishInflate();
|
|
this.f410f = findViewById(C0490f.action_bar);
|
|
this.f411g = findViewById(C0490f.action_context_bar);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean onHoverEvent(MotionEvent motionEvent) {
|
|
super.onHoverEvent(motionEvent);
|
|
return true;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
|
return this.f408d || super.onInterceptTouchEvent(motionEvent);
|
|
}
|
|
|
|
@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;
|
|
Drawable drawable2;
|
|
int left;
|
|
int top;
|
|
int right;
|
|
View view;
|
|
super.onLayout(z, i, i2, i3, i4);
|
|
View view2 = this.f409e;
|
|
boolean z2 = true;
|
|
boolean z3 = false;
|
|
boolean z4 = (view2 == null || view2.getVisibility() == 8) ? false : true;
|
|
if (view2 != null && view2.getVisibility() != 8) {
|
|
int measuredHeight = getMeasuredHeight();
|
|
int i5 = ((FrameLayout.LayoutParams) view2.getLayoutParams()).bottomMargin;
|
|
view2.layout(i, (measuredHeight - view2.getMeasuredHeight()) - i5, i3, measuredHeight - i5);
|
|
}
|
|
if (this.f415k) {
|
|
Drawable drawable3 = this.f414j;
|
|
if (drawable3 != null) {
|
|
drawable3.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
|
} else {
|
|
z2 = false;
|
|
}
|
|
} else {
|
|
if (this.f412h != null) {
|
|
if (this.f410f.getVisibility() == 0) {
|
|
drawable2 = this.f412h;
|
|
left = this.f410f.getLeft();
|
|
top = this.f410f.getTop();
|
|
right = this.f410f.getRight();
|
|
view = this.f410f;
|
|
} else {
|
|
View view3 = this.f411g;
|
|
if (view3 == null || view3.getVisibility() != 0) {
|
|
this.f412h.setBounds(0, 0, 0, 0);
|
|
z3 = true;
|
|
} else {
|
|
drawable2 = this.f412h;
|
|
left = this.f411g.getLeft();
|
|
top = this.f411g.getTop();
|
|
right = this.f411g.getRight();
|
|
view = this.f411g;
|
|
}
|
|
}
|
|
drawable2.setBounds(left, top, right, view.getBottom());
|
|
z3 = true;
|
|
}
|
|
this.f416l = z4;
|
|
if (!z4 || (drawable = this.f413i) == null) {
|
|
z2 = z3;
|
|
} else {
|
|
drawable.setBounds(view2.getLeft(), view2.getTop(), view2.getRight(), view2.getBottom());
|
|
}
|
|
}
|
|
if (z2) {
|
|
invalidate();
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:27:0x0055 */
|
|
/* JADX WARN: Removed duplicated region for block: B:28:0x005a */
|
|
@Override // android.widget.FrameLayout, android.view.View
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
*/
|
|
public void onMeasure(int i, int i2) {
|
|
int i3;
|
|
View view;
|
|
int i4;
|
|
if (this.f410f == null && View.MeasureSpec.getMode(i2) == Integer.MIN_VALUE && (i4 = this.f417m) >= 0) {
|
|
i2 = View.MeasureSpec.makeMeasureSpec(Math.min(i4, View.MeasureSpec.getSize(i2)), Integer.MIN_VALUE);
|
|
}
|
|
super.onMeasure(i, i2);
|
|
if (this.f410f == null) {
|
|
return;
|
|
}
|
|
int mode = View.MeasureSpec.getMode(i2);
|
|
View view2 = this.f409e;
|
|
if (view2 == null || view2.getVisibility() == 8 || mode == 1073741824) {
|
|
return;
|
|
}
|
|
if (!m4808b(this.f410f)) {
|
|
view = this.f410f;
|
|
} else if (m4808b(this.f411g)) {
|
|
i3 = 0;
|
|
setMeasuredDimension(getMeasuredWidth(), Math.min(i3 + m4809a(this.f409e), mode != Integer.MIN_VALUE ? View.MeasureSpec.getSize(i2) : Integer.MAX_VALUE));
|
|
} else {
|
|
view = this.f411g;
|
|
}
|
|
i3 = m4809a(view);
|
|
setMeasuredDimension(getMeasuredWidth(), Math.min(i3 + m4809a(this.f409e), mode != Integer.MIN_VALUE ? View.MeasureSpec.getSize(i2) : Integer.MAX_VALUE));
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean onTouchEvent(MotionEvent motionEvent) {
|
|
super.onTouchEvent(motionEvent);
|
|
return true;
|
|
}
|
|
|
|
public void setPrimaryBackground(Drawable drawable) {
|
|
Drawable drawable2 = this.f412h;
|
|
if (drawable2 != null) {
|
|
drawable2.setCallback(null);
|
|
unscheduleDrawable(this.f412h);
|
|
}
|
|
this.f412h = drawable;
|
|
if (drawable != null) {
|
|
drawable.setCallback(this);
|
|
View view = this.f410f;
|
|
if (view != null) {
|
|
this.f412h.setBounds(view.getLeft(), this.f410f.getTop(), this.f410f.getRight(), this.f410f.getBottom());
|
|
}
|
|
}
|
|
boolean z = true;
|
|
if (!this.f415k ? this.f412h != null || this.f413i != null : this.f414j != null) {
|
|
z = false;
|
|
}
|
|
setWillNotDraw(z);
|
|
invalidate();
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
C0120a.m4807a(this);
|
|
}
|
|
}
|
|
|
|
public void setSplitBackground(Drawable drawable) {
|
|
Drawable drawable2;
|
|
Drawable drawable3 = this.f414j;
|
|
if (drawable3 != null) {
|
|
drawable3.setCallback(null);
|
|
unscheduleDrawable(this.f414j);
|
|
}
|
|
this.f414j = drawable;
|
|
boolean z = false;
|
|
if (drawable != null) {
|
|
drawable.setCallback(this);
|
|
if (this.f415k && (drawable2 = this.f414j) != null) {
|
|
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
|
}
|
|
}
|
|
if (!this.f415k ? !(this.f412h != null || this.f413i != null) : this.f414j == null) {
|
|
z = true;
|
|
}
|
|
setWillNotDraw(z);
|
|
invalidate();
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
C0120a.m4807a(this);
|
|
}
|
|
}
|
|
|
|
public void setStackedBackground(Drawable drawable) {
|
|
Drawable drawable2;
|
|
Drawable drawable3 = this.f413i;
|
|
if (drawable3 != null) {
|
|
drawable3.setCallback(null);
|
|
unscheduleDrawable(this.f413i);
|
|
}
|
|
this.f413i = drawable;
|
|
if (drawable != null) {
|
|
drawable.setCallback(this);
|
|
if (this.f416l && (drawable2 = this.f413i) != null) {
|
|
drawable2.setBounds(this.f409e.getLeft(), this.f409e.getTop(), this.f409e.getRight(), this.f409e.getBottom());
|
|
}
|
|
}
|
|
boolean z = true;
|
|
if (!this.f415k ? this.f412h != null || this.f413i != null : this.f414j != null) {
|
|
z = false;
|
|
}
|
|
setWillNotDraw(z);
|
|
invalidate();
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
C0120a.m4807a(this);
|
|
}
|
|
}
|
|
|
|
public void setTabContainer(C0175d c0175d) {
|
|
View view = this.f409e;
|
|
if (view != null) {
|
|
removeView(view);
|
|
}
|
|
this.f409e = c0175d;
|
|
if (c0175d != null) {
|
|
addView(c0175d);
|
|
ViewGroup.LayoutParams layoutParams = c0175d.getLayoutParams();
|
|
layoutParams.width = -1;
|
|
layoutParams.height = -2;
|
|
c0175d.setAllowCollapse(false);
|
|
}
|
|
}
|
|
|
|
public void setTransitioning(boolean z) {
|
|
this.f408d = z;
|
|
setDescendantFocusability(z ? 393216 : 262144);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setVisibility(int i) {
|
|
super.setVisibility(i);
|
|
boolean z = i == 0;
|
|
Drawable drawable = this.f412h;
|
|
if (drawable != null) {
|
|
drawable.setVisible(z, false);
|
|
}
|
|
Drawable drawable2 = this.f413i;
|
|
if (drawable2 != null) {
|
|
drawable2.setVisible(z, false);
|
|
}
|
|
Drawable drawable3 = this.f414j;
|
|
if (drawable3 != null) {
|
|
drawable3.setVisible(z, false);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public ActionMode startActionModeForChild(View view, ActionMode.Callback callback) {
|
|
return null;
|
|
}
|
|
|
|
@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;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean verifyDrawable(Drawable drawable) {
|
|
return (drawable == this.f412h && !this.f415k) || (drawable == this.f413i && this.f416l) || ((drawable == this.f414j && this.f415k) || super.verifyDrawable(drawable));
|
|
}
|
|
} |