package p022h;

import android.content.Context;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import java.util.ArrayList;
import p005b0.InterfaceMenuC0468a;
import p005b0.InterfaceMenuItemC0469b;
import p022h.AbstractC0743b;
import p025i.MenuC1014f;
import p025i.MenuItemC1006c;
import p037m.C1457g;

/* renamed from: h.f */
/* loaded from: classes.dex */
public class C0749f extends ActionMode {

    /* renamed from: a */
    public final Context f2345a;

    /* renamed from: b */
    public final AbstractC0743b f2346b;

    /* renamed from: h.f$a */
    /* loaded from: classes.dex */
    public static class C0750a implements AbstractC0743b.InterfaceC0744a {

        /* renamed from: a */
        public final ActionMode.Callback f2347a;

        /* renamed from: b */
        public final Context f2348b;

        /* renamed from: c */
        public final ArrayList<C0749f> f2349c = new ArrayList<>();

        /* renamed from: d */
        public final C1457g<Menu, Menu> f2350d = new C1457g<>();

        public C0750a(Context context, ActionMode.Callback callback) {
            this.f2348b = context;
            this.f2347a = callback;
        }

        @Override // p022h.AbstractC0743b.InterfaceC0744a
        /* renamed from: a */
        public boolean mo2993a(AbstractC0743b abstractC0743b, MenuItem menuItem) {
            return this.f2347a.onActionItemClicked(m2989e(abstractC0743b), new MenuItemC1006c(this.f2348b, (InterfaceMenuItemC0469b) menuItem));
        }

        @Override // p022h.AbstractC0743b.InterfaceC0744a
        /* renamed from: b */
        public boolean mo2992b(AbstractC0743b abstractC0743b, Menu menu) {
            return this.f2347a.onCreateActionMode(m2989e(abstractC0743b), m2988f(menu));
        }

        @Override // p022h.AbstractC0743b.InterfaceC0744a
        /* renamed from: c */
        public boolean mo2991c(AbstractC0743b abstractC0743b, Menu menu) {
            return this.f2347a.onPrepareActionMode(m2989e(abstractC0743b), m2988f(menu));
        }

        @Override // p022h.AbstractC0743b.InterfaceC0744a
        /* renamed from: d */
        public void mo2990d(AbstractC0743b abstractC0743b) {
            this.f2347a.onDestroyActionMode(m2989e(abstractC0743b));
        }

        /* renamed from: e */
        public ActionMode m2989e(AbstractC0743b abstractC0743b) {
            int size = this.f2349c.size();
            for (int i = 0; i < size; i++) {
                C0749f c0749f = this.f2349c.get(i);
                if (c0749f != null && c0749f.f2346b == abstractC0743b) {
                    return c0749f;
                }
            }
            C0749f c0749f2 = new C0749f(this.f2348b, abstractC0743b);
            this.f2349c.add(c0749f2);
            return c0749f2;
        }

        /* renamed from: f */
        public final Menu m2988f(Menu menu) {
            Menu menu2 = this.f2350d.get(menu);
            if (menu2 == null) {
                MenuC1014f menuC1014f = new MenuC1014f(this.f2348b, (InterfaceMenuC0468a) menu);
                this.f2350d.put(menu, menuC1014f);
                return menuC1014f;
            }
            return menu2;
        }
    }

    public C0749f(Context context, AbstractC0743b abstractC0743b) {
        this.f2345a = context;
        this.f2346b = abstractC0743b;
    }

    @Override // android.view.ActionMode
    public void finish() {
        this.f2346b.mo3007c();
    }

    @Override // android.view.ActionMode
    public View getCustomView() {
        return this.f2346b.mo3006d();
    }

    @Override // android.view.ActionMode
    public Menu getMenu() {
        return new MenuC1014f(this.f2345a, (InterfaceMenuC0468a) this.f2346b.mo3005e());
    }

    @Override // android.view.ActionMode
    public MenuInflater getMenuInflater() {
        return this.f2346b.mo3004f();
    }

    @Override // android.view.ActionMode
    public CharSequence getSubtitle() {
        return this.f2346b.mo3003g();
    }

    @Override // android.view.ActionMode
    public Object getTag() {
        return this.f2346b.m3019h();
    }

    @Override // android.view.ActionMode
    public CharSequence getTitle() {
        return this.f2346b.mo3002i();
    }

    @Override // android.view.ActionMode
    public boolean getTitleOptionalHint() {
        return this.f2346b.m3018j();
    }

    @Override // android.view.ActionMode
    public void invalidate() {
        this.f2346b.mo3001k();
    }

    @Override // android.view.ActionMode
    public boolean isTitleOptional() {
        return this.f2346b.mo3000l();
    }

    @Override // android.view.ActionMode
    public void setCustomView(View view) {
        this.f2346b.mo2999m(view);
    }

    @Override // android.view.ActionMode
    public void setSubtitle(int i) {
        this.f2346b.mo2998n(i);
    }

    @Override // android.view.ActionMode
    public void setSubtitle(CharSequence charSequence) {
        this.f2346b.mo2997o(charSequence);
    }

    @Override // android.view.ActionMode
    public void setTag(Object obj) {
        this.f2346b.m3017p(obj);
    }

    @Override // android.view.ActionMode
    public void setTitle(int i) {
        this.f2346b.mo2996q(i);
    }

    @Override // android.view.ActionMode
    public void setTitle(CharSequence charSequence) {
        this.f2346b.mo2995r(charSequence);
    }

    @Override // android.view.ActionMode
    public void setTitleOptionalHint(boolean z) {
        this.f2346b.mo2994s(z);
    }
}