jimu-decompiled/sources/androidx/appcompat/view/StandaloneActionMode.java
2025-05-13 19:24:51 +02:00

124 lines
3.4 KiB
Java

package androidx.appcompat.view;
import android.content.Context;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import androidx.appcompat.view.ActionMode;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.widget.ActionBarContextView;
import java.lang.ref.WeakReference;
/* loaded from: classes.dex */
public class StandaloneActionMode extends ActionMode implements MenuBuilder.Callback {
private Context c;
private ActionBarContextView d;
private ActionMode.Callback e;
private WeakReference<View> f;
private boolean g;
private MenuBuilder h;
public StandaloneActionMode(Context context, ActionBarContextView actionBarContextView, ActionMode.Callback callback, boolean z) {
this.c = context;
this.d = actionBarContextView;
this.e = callback;
MenuBuilder menuBuilder = new MenuBuilder(actionBarContextView.getContext());
menuBuilder.c(1);
this.h = menuBuilder;
this.h.a(this);
}
@Override // androidx.appcompat.view.ActionMode
public void a(CharSequence charSequence) {
this.d.setSubtitle(charSequence);
}
@Override // androidx.appcompat.view.ActionMode
public void b(CharSequence charSequence) {
this.d.setTitle(charSequence);
}
@Override // androidx.appcompat.view.ActionMode
public Menu c() {
return this.h;
}
@Override // androidx.appcompat.view.ActionMode
public MenuInflater d() {
return new SupportMenuInflater(this.d.getContext());
}
@Override // androidx.appcompat.view.ActionMode
public CharSequence e() {
return this.d.getSubtitle();
}
@Override // androidx.appcompat.view.ActionMode
public CharSequence g() {
return this.d.getTitle();
}
@Override // androidx.appcompat.view.ActionMode
public void i() {
this.e.b(this, this.h);
}
@Override // androidx.appcompat.view.ActionMode
public boolean j() {
return this.d.b();
}
@Override // androidx.appcompat.view.ActionMode
public void a(int i) {
a((CharSequence) this.c.getString(i));
}
@Override // androidx.appcompat.view.ActionMode
public void b(int i) {
b(this.c.getString(i));
}
@Override // androidx.appcompat.view.ActionMode
public void a(boolean z) {
super.a(z);
this.d.setTitleOptional(z);
}
@Override // androidx.appcompat.view.ActionMode
public View b() {
WeakReference<View> weakReference = this.f;
if (weakReference != null) {
return weakReference.get();
}
return null;
}
@Override // androidx.appcompat.view.ActionMode
public void a(View view) {
this.d.setCustomView(view);
this.f = view != null ? new WeakReference<>(view) : null;
}
@Override // androidx.appcompat.view.ActionMode
public void a() {
if (this.g) {
return;
}
this.g = true;
this.d.sendAccessibilityEvent(32);
this.e.a(this);
}
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
public boolean a(MenuBuilder menuBuilder, MenuItem menuItem) {
return this.e.a(this, menuItem);
}
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
public void a(MenuBuilder menuBuilder) {
i();
this.d.d();
}
}