package androidx.appcompat.widget;

import P.Q;
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.widget.FrameLayout;
import com.riyaz.zvytour.R;
import h.AbstractC0617a;
import java.lang.reflect.Field;
import m.AbstractC0891x0;
import m.C0845a;

/* JADX INFO: loaded from: classes.dex */
public class ActionBarContainer extends FrameLayout {

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public boolean f3698k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public View f3699l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public View f3700m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public Drawable f3701n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public Drawable f3702o;
    public Drawable p;
    public final boolean q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public boolean f3703r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final int f3704s;

    public ActionBarContainer(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        C0845a c0845a = new C0845a(this);
        Field field = Q.f2392a;
        setBackground(c0845a);
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, AbstractC0617a.f6469a);
        boolean z5 = false;
        this.f3701n = typedArrayObtainStyledAttributes.getDrawable(0);
        this.f3702o = typedArrayObtainStyledAttributes.getDrawable(2);
        this.f3704s = typedArrayObtainStyledAttributes.getDimensionPixelSize(13, -1);
        if (getId() == R.id.split_action_bar) {
            this.q = true;
            this.p = typedArrayObtainStyledAttributes.getDrawable(1);
        }
        typedArrayObtainStyledAttributes.recycle();
        if (!this.q ? !(this.f3701n != null || this.f3702o != null) : this.p == null) {
            z5 = true;
        }
        setWillNotDraw(z5);
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void drawableStateChanged() {
        super.drawableStateChanged();
        Drawable drawable = this.f3701n;
        if (drawable != null && drawable.isStateful()) {
            this.f3701n.setState(getDrawableState());
        }
        Drawable drawable2 = this.f3702o;
        if (drawable2 != null && drawable2.isStateful()) {
            this.f3702o.setState(getDrawableState());
        }
        Drawable drawable3 = this.p;
        if (drawable3 == null || !drawable3.isStateful()) {
            return;
        }
        this.p.setState(getDrawableState());
    }

    public View getTabContainer() {
        return null;
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();
        Drawable drawable = this.f3701n;
        if (drawable != null) {
            drawable.jumpToCurrentState();
        }
        Drawable drawable2 = this.f3702o;
        if (drawable2 != null) {
            drawable2.jumpToCurrentState();
        }
        Drawable drawable3 = this.p;
        if (drawable3 != null) {
            drawable3.jumpToCurrentState();
        }
    }

    @Override // android.view.View
    public final void onFinishInflate() {
        super.onFinishInflate();
        this.f3699l = findViewById(R.id.action_bar);
        this.f3700m = findViewById(R.id.action_context_bar);
    }

    @Override // android.view.View
    public final boolean onHoverEvent(MotionEvent motionEvent) {
        super.onHoverEvent(motionEvent);
        return true;
    }

    @Override // android.view.ViewGroup
    public final boolean onInterceptTouchEvent(MotionEvent motionEvent) {
        return this.f3698k || super.onInterceptTouchEvent(motionEvent);
    }

    @Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
    public final void onLayout(boolean z5, int i, int i5, int i6, int i7) {
        super.onLayout(z5, i, i5, i6, i7);
        boolean z6 = true;
        if (this.q) {
            Drawable drawable = this.p;
            if (drawable != null) {
                drawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
            } else {
                z6 = false;
            }
        } else {
            if (this.f3701n == null) {
                z6 = false;
            } else if (this.f3699l.getVisibility() == 0) {
                this.f3701n.setBounds(this.f3699l.getLeft(), this.f3699l.getTop(), this.f3699l.getRight(), this.f3699l.getBottom());
            } else {
                View view = this.f3700m;
                if (view == null || view.getVisibility() != 0) {
                    this.f3701n.setBounds(0, 0, 0, 0);
                } else {
                    this.f3701n.setBounds(this.f3700m.getLeft(), this.f3700m.getTop(), this.f3700m.getRight(), this.f3700m.getBottom());
                }
            }
            this.f3703r = false;
        }
        if (z6) {
            invalidate();
        }
    }

    @Override // android.widget.FrameLayout, android.view.View
    public final void onMeasure(int i, int i5) {
        int i6;
        if (this.f3699l == null && View.MeasureSpec.getMode(i5) == Integer.MIN_VALUE && (i6 = this.f3704s) >= 0) {
            i5 = View.MeasureSpec.makeMeasureSpec(Math.min(i6, View.MeasureSpec.getSize(i5)), Integer.MIN_VALUE);
        }
        super.onMeasure(i, i5);
        if (this.f3699l == null) {
            return;
        }
        View.MeasureSpec.getMode(i5);
    }

    @Override // android.view.View
    public final boolean onTouchEvent(MotionEvent motionEvent) {
        super.onTouchEvent(motionEvent);
        return true;
    }

    public void setPrimaryBackground(Drawable drawable) {
        Drawable drawable2 = this.f3701n;
        if (drawable2 != null) {
            drawable2.setCallback(null);
            unscheduleDrawable(this.f3701n);
        }
        this.f3701n = drawable;
        if (drawable != null) {
            drawable.setCallback(this);
            View view = this.f3699l;
            if (view != null) {
                this.f3701n.setBounds(view.getLeft(), this.f3699l.getTop(), this.f3699l.getRight(), this.f3699l.getBottom());
            }
        }
        boolean z5 = false;
        if (!this.q ? !(this.f3701n != null || this.f3702o != null) : this.p == null) {
            z5 = true;
        }
        setWillNotDraw(z5);
        invalidate();
        invalidateOutline();
    }

    public void setSplitBackground(Drawable drawable) {
        Drawable drawable2;
        Drawable drawable3 = this.p;
        if (drawable3 != null) {
            drawable3.setCallback(null);
            unscheduleDrawable(this.p);
        }
        this.p = drawable;
        boolean z5 = this.q;
        boolean z6 = false;
        if (drawable != null) {
            drawable.setCallback(this);
            if (z5 && (drawable2 = this.p) != null) {
                drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
            }
        }
        if (!z5 ? !(this.f3701n != null || this.f3702o != null) : this.p == null) {
            z6 = true;
        }
        setWillNotDraw(z6);
        invalidate();
        invalidateOutline();
    }

    public void setStackedBackground(Drawable drawable) {
        Drawable drawable2 = this.f3702o;
        if (drawable2 != null) {
            drawable2.setCallback(null);
            unscheduleDrawable(this.f3702o);
        }
        this.f3702o = drawable;
        if (drawable != null) {
            drawable.setCallback(this);
            if (this.f3703r && this.f3702o != null) {
                throw null;
            }
        }
        boolean z5 = false;
        if (!this.q ? !(this.f3701n != null || this.f3702o != null) : this.p == null) {
            z5 = true;
        }
        setWillNotDraw(z5);
        invalidate();
        invalidateOutline();
    }

    public void setTransitioning(boolean z5) {
        this.f3698k = z5;
        setDescendantFocusability(z5 ? 393216 : 262144);
    }

    @Override // android.view.View
    public void setVisibility(int i) {
        super.setVisibility(i);
        boolean z5 = i == 0;
        Drawable drawable = this.f3701n;
        if (drawable != null) {
            drawable.setVisible(z5, false);
        }
        Drawable drawable2 = this.f3702o;
        if (drawable2 != null) {
            drawable2.setVisible(z5, false);
        }
        Drawable drawable3 = this.p;
        if (drawable3 != null) {
            drawable3.setVisible(z5, false);
        }
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public final ActionMode startActionModeForChild(View view, ActionMode.Callback callback) {
        return null;
    }

    @Override // android.view.View
    public final boolean verifyDrawable(Drawable drawable) {
        Drawable drawable2 = this.f3701n;
        boolean z5 = this.q;
        if (drawable == drawable2 && !z5) {
            return true;
        }
        if (drawable == this.f3702o && this.f3703r) {
            return true;
        }
        return (drawable == this.p && z5) || super.verifyDrawable(drawable);
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public final ActionMode startActionModeForChild(View view, ActionMode.Callback callback, int i) {
        if (i != 0) {
            return super.startActionModeForChild(view, callback, i);
        }
        return null;
    }

    public void setTabContainer(AbstractC0891x0 abstractC0891x0) {
    }
}
