package o;

import android.content.Context;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import androidx.appcompat.widget.ActionBarContextView;
import java.lang.ref.WeakReference;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.hl0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1415hl0 extends AbstractC1918n1 implements AO {
    public final Context n;

    /* renamed from: o, reason: collision with root package name */
    public final CO f568o;
    public Gm0 p;
    public WeakReference q;
    public final /* synthetic */ C1510il0 r;

    public C1415hl0(C1510il0 c1510il0, Context context, Gm0 gm0) {
        this.r = c1510il0;
        this.n = context;
        this.p = gm0;
        CO co = new CO(context);
        co.l = 1;
        this.f568o = co;
        co.e = this;
    }

    @Override // o.AbstractC1918n1
    public final void a() {
        C1510il0 c1510il0 = this.r;
        if (c1510il0.i != this) {
            return;
        }
        if (c1510il0.p) {
            c1510il0.j = this;
            c1510il0.k = this.p;
        } else {
            this.p.d(this);
        }
        this.p = null;
        c1510il0.p(false);
        ActionBarContextView actionBarContextView = c1510il0.f;
        if (actionBarContextView.v == null) {
            actionBarContextView.e();
        }
        c1510il0.c.setHideOnContentScrollEnabled(c1510il0.u);
        c1510il0.i = null;
    }

    @Override // o.AbstractC1918n1
    public final View b() {
        WeakReference weakReference = this.q;
        if (weakReference != null) {
            return (View) weakReference.get();
        }
        return null;
    }

    @Override // o.AbstractC1918n1
    public final CO c() {
        return this.f568o;
    }

    @Override // o.AbstractC1918n1
    public final MenuInflater d() {
        return new Db0(this.n);
    }

    @Override // o.AbstractC1918n1
    public final CharSequence e() {
        return this.r.f.getSubtitle();
    }

    @Override // o.AbstractC1918n1
    public final CharSequence f() {
        return this.r.f.getTitle();
    }

    @Override // o.AbstractC1918n1
    public final void g() {
        if (this.r.i != this) {
            return;
        }
        CO co = this.f568o;
        co.w();
        try {
            this.p.g(this, co);
        } finally {
            co.v();
        }
    }

    @Override // o.AbstractC1918n1
    public final boolean h() {
        return this.r.f.D;
    }

    @Override // o.AbstractC1918n1
    public final void i(View view) {
        this.r.f.setCustomView(view);
        this.q = new WeakReference(view);
    }

    @Override // o.AbstractC1918n1
    public final void j(int i) {
        k(this.r.a.getResources().getString(i));
    }

    @Override // o.AbstractC1918n1
    public final void k(CharSequence charSequence) {
        this.r.f.setSubtitle(charSequence);
    }

    @Override // o.AO
    public final boolean l(CO co, MenuItem menuItem) {
        Gm0 gm0 = this.p;
        if (gm0 != null) {
            return ((InterfaceC1823m1) gm0.m).e(this, menuItem);
        }
        return false;
    }

    @Override // o.AbstractC1918n1
    public final void m(int i) {
        n(this.r.a.getResources().getString(i));
    }

    @Override // o.AbstractC1918n1
    public final void n(CharSequence charSequence) {
        this.r.f.setTitle(charSequence);
    }

    @Override // o.AbstractC1918n1
    public final void o(boolean z) {
        this.m = z;
        this.r.f.setTitleOptional(z);
    }

    @Override // o.AO
    public final void s(CO co) {
        if (this.p == null) {
            return;
        }
        g();
        C1444i1 c1444i1 = this.r.f.f2o;
        if (c1444i1 != null) {
            c1444i1.l();
        }
    }
}
