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.
420 lines
15 KiB
420 lines
15 KiB
package androidx.appcompat.widget;
|
|
|
|
import android.content.Context;
|
|
import android.text.TextUtils;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import androidx.appcompat.view.menu.C0103e;
|
|
import p007c.C0485a;
|
|
import p007c.C0490f;
|
|
import p007c.C0491g;
|
|
import p007c.C0494j;
|
|
import p022h.AbstractC0743b;
|
|
import p023h0.C0829h1;
|
|
import p023h0.C0875k4;
|
|
import p028j.AbstractC1061a;
|
|
import p028j.C1106g3;
|
|
import p028j.C1187q3;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ActionBarContextView extends AbstractC1061a {
|
|
|
|
/* renamed from: l */
|
|
public CharSequence f418l;
|
|
|
|
/* renamed from: m */
|
|
public CharSequence f419m;
|
|
|
|
/* renamed from: n */
|
|
public View f420n;
|
|
|
|
/* renamed from: o */
|
|
public View f421o;
|
|
|
|
/* renamed from: p */
|
|
public View f422p;
|
|
|
|
/* renamed from: q */
|
|
public LinearLayout f423q;
|
|
|
|
/* renamed from: r */
|
|
public TextView f424r;
|
|
|
|
/* renamed from: s */
|
|
public TextView f425s;
|
|
|
|
/* renamed from: t */
|
|
public int f426t;
|
|
|
|
/* renamed from: u */
|
|
public int f427u;
|
|
|
|
/* renamed from: v */
|
|
public boolean f428v;
|
|
|
|
/* renamed from: w */
|
|
public int f429w;
|
|
|
|
/* renamed from: androidx.appcompat.widget.ActionBarContextView$a */
|
|
/* loaded from: classes.dex */
|
|
public class View$OnClickListenerC0121a implements View.OnClickListener {
|
|
|
|
/* renamed from: d */
|
|
public final /* synthetic */ AbstractC0743b f430d;
|
|
|
|
public View$OnClickListenerC0121a(AbstractC0743b abstractC0743b) {
|
|
this.f430d = abstractC0743b;
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
this.f430d.mo3007c();
|
|
}
|
|
}
|
|
|
|
public ActionBarContextView(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public ActionBarContextView(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, C0485a.actionModeStyle);
|
|
}
|
|
|
|
public ActionBarContextView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
C1106g3 m2160u = C1106g3.m2160u(context, attributeSet, C0494j.f1921y, i, 0);
|
|
C0829h1.m2845R(this, m2160u.m2175f(C0494j.f1926z));
|
|
this.f426t = m2160u.m2168m(C0494j.f1706D, 0);
|
|
this.f427u = m2160u.m2168m(C0494j.f1701C, 0);
|
|
this.f2607h = m2160u.m2169l(C0494j.f1696B, 0);
|
|
this.f429w = m2160u.m2168m(C0494j.f1691A, C0491g.abc_action_mode_close_item_material);
|
|
m2160u.m2159v();
|
|
}
|
|
|
|
@Override // p028j.AbstractC1061a
|
|
/* renamed from: f */
|
|
public /* bridge */ /* synthetic */ C0875k4 mo2294f(int i, long j) {
|
|
return super.mo2294f(i, j);
|
|
}
|
|
|
|
/* renamed from: g */
|
|
public void m4806g() {
|
|
if (this.f420n == null) {
|
|
m4802k();
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public ViewGroup.LayoutParams generateDefaultLayoutParams() {
|
|
return new ViewGroup.MarginLayoutParams(-1, -2);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
|
return new ViewGroup.MarginLayoutParams(getContext(), attributeSet);
|
|
}
|
|
|
|
@Override // p028j.AbstractC1061a
|
|
public /* bridge */ /* synthetic */ int getAnimatedVisibility() {
|
|
return super.getAnimatedVisibility();
|
|
}
|
|
|
|
@Override // p028j.AbstractC1061a
|
|
public /* bridge */ /* synthetic */ int getContentHeight() {
|
|
return super.getContentHeight();
|
|
}
|
|
|
|
public CharSequence getSubtitle() {
|
|
return this.f419m;
|
|
}
|
|
|
|
public CharSequence getTitle() {
|
|
return this.f418l;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:11:0x003e */
|
|
/* renamed from: h */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
*/
|
|
public void m4805h(AbstractC0743b abstractC0743b) {
|
|
View view;
|
|
C0163a c0163a;
|
|
View view2 = this.f420n;
|
|
if (view2 != null) {
|
|
if (view2.getParent() == null) {
|
|
view = this.f420n;
|
|
}
|
|
View findViewById = this.f420n.findViewById(C0490f.action_mode_close_button);
|
|
this.f421o = findViewById;
|
|
findViewById.setOnClickListener(new View$OnClickListenerC0121a(abstractC0743b));
|
|
C0103e c0103e = (C0103e) abstractC0743b.mo3005e();
|
|
c0163a = this.f2606g;
|
|
if (c0163a != null) {
|
|
c0163a.m4633y();
|
|
}
|
|
C0163a c0163a2 = new C0163a(getContext());
|
|
this.f2606g = c0163a2;
|
|
c0163a2.m4651J(true);
|
|
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-2, -1);
|
|
c0103e.m4887c(this.f2606g, this.f2604e);
|
|
ActionMenuView actionMenuView = (ActionMenuView) this.f2606g.mo4642o(this);
|
|
this.f2605f = actionMenuView;
|
|
C0829h1.m2845R(actionMenuView, null);
|
|
addView(this.f2605f, layoutParams);
|
|
}
|
|
view = LayoutInflater.from(getContext()).inflate(this.f429w, (ViewGroup) this, false);
|
|
this.f420n = view;
|
|
addView(view);
|
|
View findViewById2 = this.f420n.findViewById(C0490f.action_mode_close_button);
|
|
this.f421o = findViewById2;
|
|
findViewById2.setOnClickListener(new View$OnClickListenerC0121a(abstractC0743b));
|
|
C0103e c0103e2 = (C0103e) abstractC0743b.mo3005e();
|
|
c0163a = this.f2606g;
|
|
if (c0163a != null) {
|
|
}
|
|
C0163a c0163a22 = new C0163a(getContext());
|
|
this.f2606g = c0163a22;
|
|
c0163a22.m4651J(true);
|
|
ViewGroup.LayoutParams layoutParams2 = new ViewGroup.LayoutParams(-2, -1);
|
|
c0103e2.m4887c(this.f2606g, this.f2604e);
|
|
ActionMenuView actionMenuView2 = (ActionMenuView) this.f2606g.mo4642o(this);
|
|
this.f2605f = actionMenuView2;
|
|
C0829h1.m2845R(actionMenuView2, null);
|
|
addView(this.f2605f, layoutParams2);
|
|
}
|
|
|
|
/* renamed from: i */
|
|
public final void m4804i() {
|
|
if (this.f423q == null) {
|
|
LayoutInflater.from(getContext()).inflate(C0491g.abc_action_bar_title_item, this);
|
|
LinearLayout linearLayout = (LinearLayout) getChildAt(getChildCount() - 1);
|
|
this.f423q = linearLayout;
|
|
this.f424r = (TextView) linearLayout.findViewById(C0490f.action_bar_title);
|
|
this.f425s = (TextView) this.f423q.findViewById(C0490f.action_bar_subtitle);
|
|
if (this.f426t != 0) {
|
|
this.f424r.setTextAppearance(getContext(), this.f426t);
|
|
}
|
|
if (this.f427u != 0) {
|
|
this.f425s.setTextAppearance(getContext(), this.f427u);
|
|
}
|
|
}
|
|
this.f424r.setText(this.f418l);
|
|
this.f425s.setText(this.f419m);
|
|
boolean z = !TextUtils.isEmpty(this.f418l);
|
|
boolean z2 = !TextUtils.isEmpty(this.f419m);
|
|
int i = 0;
|
|
this.f425s.setVisibility(z2 ? 0 : 8);
|
|
LinearLayout linearLayout2 = this.f423q;
|
|
if (!z && !z2) {
|
|
i = 8;
|
|
}
|
|
linearLayout2.setVisibility(i);
|
|
if (this.f423q.getParent() == null) {
|
|
addView(this.f423q);
|
|
}
|
|
}
|
|
|
|
/* renamed from: j */
|
|
public boolean m4803j() {
|
|
return this.f428v;
|
|
}
|
|
|
|
/* renamed from: k */
|
|
public void m4802k() {
|
|
removeAllViews();
|
|
this.f422p = null;
|
|
this.f2605f = null;
|
|
this.f2606g = null;
|
|
View view = this.f421o;
|
|
if (view != null) {
|
|
view.setOnClickListener(null);
|
|
}
|
|
}
|
|
|
|
/* renamed from: l */
|
|
public boolean m4801l() {
|
|
C0163a c0163a = this.f2606g;
|
|
if (c0163a != null) {
|
|
return c0163a.m4650K();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onDetachedFromWindow() {
|
|
super.onDetachedFromWindow();
|
|
C0163a c0163a = this.f2606g;
|
|
if (c0163a != null) {
|
|
c0163a.m4659B();
|
|
this.f2606g.m4658C();
|
|
}
|
|
}
|
|
|
|
@Override // p028j.AbstractC1061a, android.view.View
|
|
public /* bridge */ /* synthetic */ boolean onHoverEvent(MotionEvent motionEvent) {
|
|
return super.onHoverEvent(motionEvent);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
|
boolean m1905b = C1187q3.m1905b(this);
|
|
int paddingRight = m1905b ? (i3 - i) - getPaddingRight() : getPaddingLeft();
|
|
int paddingTop = getPaddingTop();
|
|
int paddingTop2 = ((i4 - i2) - getPaddingTop()) - getPaddingBottom();
|
|
View view = this.f420n;
|
|
if (view != null && view.getVisibility() != 8) {
|
|
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.f420n.getLayoutParams();
|
|
int i5 = m1905b ? marginLayoutParams.rightMargin : marginLayoutParams.leftMargin;
|
|
int i6 = m1905b ? marginLayoutParams.leftMargin : marginLayoutParams.rightMargin;
|
|
int m2296d = AbstractC1061a.m2296d(paddingRight, i5, m1905b);
|
|
paddingRight = AbstractC1061a.m2296d(m2296d + m2295e(this.f420n, m2296d, paddingTop, paddingTop2, m1905b), i6, m1905b);
|
|
}
|
|
int i7 = paddingRight;
|
|
LinearLayout linearLayout = this.f423q;
|
|
if (linearLayout != null && this.f422p == null && linearLayout.getVisibility() != 8) {
|
|
i7 += m2295e(this.f423q, i7, paddingTop, paddingTop2, m1905b);
|
|
}
|
|
int i8 = i7;
|
|
View view2 = this.f422p;
|
|
if (view2 != null) {
|
|
m2295e(view2, i8, paddingTop, paddingTop2, m1905b);
|
|
}
|
|
int paddingLeft = m1905b ? getPaddingLeft() : (i3 - i) - getPaddingRight();
|
|
ActionMenuView actionMenuView = this.f2605f;
|
|
if (actionMenuView != null) {
|
|
m2295e(actionMenuView, paddingLeft, paddingTop, paddingTop2, !m1905b);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onMeasure(int i, int i2) {
|
|
if (View.MeasureSpec.getMode(i) != 1073741824) {
|
|
throw new IllegalStateException(getClass().getSimpleName() + " can only be used with android:layout_width=\"match_parent\" (or fill_parent)");
|
|
} else if (View.MeasureSpec.getMode(i2) == 0) {
|
|
throw new IllegalStateException(getClass().getSimpleName() + " can only be used with android:layout_height=\"wrap_content\"");
|
|
} else {
|
|
int size = View.MeasureSpec.getSize(i);
|
|
int i3 = this.f2607h;
|
|
if (i3 <= 0) {
|
|
i3 = View.MeasureSpec.getSize(i2);
|
|
}
|
|
int paddingTop = getPaddingTop() + getPaddingBottom();
|
|
int paddingLeft = (size - getPaddingLeft()) - getPaddingRight();
|
|
int i4 = i3 - paddingTop;
|
|
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i4, Integer.MIN_VALUE);
|
|
View view = this.f420n;
|
|
if (view != null) {
|
|
int m2297c = m2297c(view, paddingLeft, makeMeasureSpec, 0);
|
|
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.f420n.getLayoutParams();
|
|
paddingLeft = m2297c - (marginLayoutParams.leftMargin + marginLayoutParams.rightMargin);
|
|
}
|
|
ActionMenuView actionMenuView = this.f2605f;
|
|
if (actionMenuView != null && actionMenuView.getParent() == this) {
|
|
paddingLeft = m2297c(this.f2605f, paddingLeft, makeMeasureSpec, 0);
|
|
}
|
|
LinearLayout linearLayout = this.f423q;
|
|
if (linearLayout != null && this.f422p == null) {
|
|
if (this.f428v) {
|
|
this.f423q.measure(View.MeasureSpec.makeMeasureSpec(0, 0), makeMeasureSpec);
|
|
int measuredWidth = this.f423q.getMeasuredWidth();
|
|
boolean z = measuredWidth <= paddingLeft;
|
|
if (z) {
|
|
paddingLeft -= measuredWidth;
|
|
}
|
|
this.f423q.setVisibility(z ? 0 : 8);
|
|
} else {
|
|
paddingLeft = m2297c(linearLayout, paddingLeft, makeMeasureSpec, 0);
|
|
}
|
|
}
|
|
View view2 = this.f422p;
|
|
if (view2 != null) {
|
|
ViewGroup.LayoutParams layoutParams = view2.getLayoutParams();
|
|
int i5 = layoutParams.width;
|
|
int i6 = i5 != -2 ? 1073741824 : Integer.MIN_VALUE;
|
|
if (i5 >= 0) {
|
|
paddingLeft = Math.min(i5, paddingLeft);
|
|
}
|
|
int i7 = layoutParams.height;
|
|
int i8 = i7 == -2 ? Integer.MIN_VALUE : 1073741824;
|
|
if (i7 >= 0) {
|
|
i4 = Math.min(i7, i4);
|
|
}
|
|
this.f422p.measure(View.MeasureSpec.makeMeasureSpec(paddingLeft, i6), View.MeasureSpec.makeMeasureSpec(i4, i8));
|
|
}
|
|
if (this.f2607h > 0) {
|
|
setMeasuredDimension(size, i3);
|
|
return;
|
|
}
|
|
int childCount = getChildCount();
|
|
int i9 = 0;
|
|
for (int i10 = 0; i10 < childCount; i10++) {
|
|
int measuredHeight = getChildAt(i10).getMeasuredHeight() + paddingTop;
|
|
if (measuredHeight > i9) {
|
|
i9 = measuredHeight;
|
|
}
|
|
}
|
|
setMeasuredDimension(size, i9);
|
|
}
|
|
}
|
|
|
|
@Override // p028j.AbstractC1061a, android.view.View
|
|
public /* bridge */ /* synthetic */ boolean onTouchEvent(MotionEvent motionEvent) {
|
|
return super.onTouchEvent(motionEvent);
|
|
}
|
|
|
|
@Override // p028j.AbstractC1061a
|
|
public void setContentHeight(int i) {
|
|
this.f2607h = i;
|
|
}
|
|
|
|
public void setCustomView(View view) {
|
|
LinearLayout linearLayout;
|
|
View view2 = this.f422p;
|
|
if (view2 != null) {
|
|
removeView(view2);
|
|
}
|
|
this.f422p = view;
|
|
if (view != null && (linearLayout = this.f423q) != null) {
|
|
removeView(linearLayout);
|
|
this.f423q = null;
|
|
}
|
|
if (view != null) {
|
|
addView(view);
|
|
}
|
|
requestLayout();
|
|
}
|
|
|
|
public void setSubtitle(CharSequence charSequence) {
|
|
this.f419m = charSequence;
|
|
m4804i();
|
|
}
|
|
|
|
public void setTitle(CharSequence charSequence) {
|
|
this.f418l = charSequence;
|
|
m4804i();
|
|
C0829h1.m2846Q(this, charSequence);
|
|
}
|
|
|
|
public void setTitleOptional(boolean z) {
|
|
if (z != this.f428v) {
|
|
requestLayout();
|
|
}
|
|
this.f428v = z;
|
|
}
|
|
|
|
@Override // p028j.AbstractC1061a, android.view.View
|
|
public /* bridge */ /* synthetic */ void setVisibility(int i) {
|
|
super.setVisibility(i);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean shouldDelayChildPressedState() {
|
|
return false;
|
|
}
|
|
} |