package o; import android.content.Context; import android.content.res.Configuration; import android.graphics.drawable.Drawable; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import androidx.appcompat.app.AppCompatDelegateImpl; import androidx.appcompat.widget.Toolbar; import androidx.core.view.ViewCompat; import java.util.ArrayList; import o.InterfaceC15933jjG; import o.NoP; import o.pwE; /* loaded from: classes.dex */ public final class WNf extends pwE { final InterfaceC15489grq a; private boolean b; final Window.Callback c; public final AppCompatDelegateImpl.Sts d; boolean e; private final Toolbar.HBt g; private boolean h; private ArrayList i = new ArrayList<>(); private final Runnable f = new Runnable(this) { // from class: o.WNf.1 final WNf b; { this.b = this; } @Override // java.lang.Runnable public final void run() { WNf wNf = this.b; Menu dE_ = wNf.dE_(); NoP noP = dE_ instanceof NoP ? (NoP) dE_ : null; if (noP != null && !noP.t) { noP.t = true; noP.n = false; noP.p = false; } try { dE_.clear(); if (!wNf.c.onCreatePanelMenu(0, dE_) || !wNf.c.onPreparePanel(0, null, dE_)) { dE_.clear(); } } finally { if (noP != null) { noP.t = false; if (noP.n) { noP.n = false; noP.c(noP.p); } } } } }; @Override // o.pwE public final void b(boolean z) { } @Override // o.pwE public final void e(boolean z) { } public WNf(Toolbar toolbar, CharSequence charSequence, Window.Callback callback) { Toolbar.HBt hBt = new Toolbar.HBt(this) { // from class: o.WNf.2 final WNf d; { this.d = this; } @Override // androidx.appcompat.widget.Toolbar.HBt public final boolean awL_(MenuItem menuItem) { return this.d.c.onMenuItemSelected(0, menuItem); } }; this.g = hBt; C0926Rry c0926Rry = new C0926Rry(toolbar, false); this.a = c0926Rry; this.c = callback; c0926Rry.ka_(callback); toolbar.setOnMenuItemClickListener(hBt); c0926Rry.c(charSequence); this.d = new RVV(this); } @Override // o.pwE public final void c(View view) { pwE.HBt hBt = new pwE.HBt(); if (view != null) { view.setLayoutParams(hBt); } this.a.e(view); } @Override // o.pwE public final void i() { View inflate = LayoutInflater.from(this.a.c()).inflate(com.scb.phone.R.layout.2131558903, this.a.jW_(), false); pwE.HBt hBt = new pwE.HBt(); if (inflate != null) { inflate.setLayoutParams(hBt); } this.a.e(inflate); } @Override // o.pwE public final void e(float f) { ViewCompat.e(this.a.jW_(), f); } @Override // o.pwE public final Context e() { return this.a.c(); } @Override // o.pwE public final void dO_(Drawable drawable) { this.a.jZ_(drawable); } @Override // o.pwE public final void o() { this.a.c(com.scb.phone.R.string.action_home_or_up_content_description); } @Override // o.pwE public final void dM_(Configuration configuration) { super.dM_(configuration); } @Override // o.pwE public final void d(CharSequence charSequence) { this.a.a(charSequence); } @Override // o.pwE public final void e(CharSequence charSequence) { this.a.c(charSequence); } @Override // o.pwE public final void d(int i) { this.a.b(); this.a.e(i); } @Override // o.pwE public final void d(boolean z) { this.a.e(((z ? 4 : 0) & 4) | (this.a.b() & (-5))); } @Override // o.pwE public final void f() { this.a.e((this.a.b() & (-17)) | 16); } @Override // o.pwE public final int c() { return this.a.b(); } @Override // o.pwE public final void d() { this.a.b(8); } @Override // o.pwE public final boolean h() { return this.a.n(); } @Override // o.pwE public final boolean b() { return this.a.h(); } @Override // o.pwE public final boolean j() { this.a.jW_().removeCallbacks(this.f); ViewCompat.e(this.a.jW_(), this.f); return true; } @Override // o.pwE public final boolean a() { if (!this.a.f()) { return false; } this.a.d(); return true; } @Override // o.pwE public final boolean dH_(KeyEvent keyEvent) { if (keyEvent.getAction() == 1) { this.a.n(); } return true; } @Override // o.pwE public final boolean dN_(int i, KeyEvent keyEvent) { Menu dE_ = dE_(); if (dE_ == null) { return false; } dE_.setQwertyMode(KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() != 1); return dE_.performShortcut(i, keyEvent, 0); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.pwE public final void g() { this.a.jW_().removeCallbacks(this.f); } @Override // o.pwE public final void a(boolean z) { if (z == this.b) { return; } this.b = z; int size = this.i.size(); for (int i = 0; i < size; i++) { this.i.get(i); } } /* loaded from: classes.dex */ class RVV implements AppCompatDelegateImpl.Sts { final WNf d; RVV(WNf wNf) { this.d = wNf; } @Override // androidx.appcompat.app.AppCompatDelegateImpl.Sts public final boolean d(int i) { if (i != 0 || this.d.e) { return false; } this.d.a.l(); this.d.e = true; return false; } @Override // androidx.appcompat.app.AppCompatDelegateImpl.Sts public final View c(int i) { if (i == 0) { return new View(this.d.a.c()); } return null; } } final Menu dE_() { if (!this.h) { this.a.d(new LWm(this), new Sts(this)); this.h = true; } return this.a.jV_(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public final class LWm implements InterfaceC15933jjG.Sts { final WNf b; private boolean d; LWm(WNf wNf) { this.b = wNf; } @Override // o.InterfaceC15933jjG.Sts public final boolean d(NoP noP) { this.b.c.onMenuOpened(108, noP); return true; } @Override // o.InterfaceC15933jjG.Sts public final void e(NoP noP, boolean z) { if (this.d) { return; } this.d = true; this.b.a.e(); this.b.c.onPanelClosed(108, noP); this.d = false; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public final class Sts implements NoP.Sts { final WNf a; @Override // o.NoP.Sts public final boolean Ko_(NoP noP, MenuItem menuItem) { return false; } Sts(WNf wNf) { this.a = wNf; } @Override // o.NoP.Sts public final void b(NoP noP) { if (this.a.a.k()) { this.a.c.onPanelClosed(108, noP); } else if (this.a.c.onPreparePanel(0, null, noP)) { this.a.c.onMenuOpened(108, noP); } } } }