ADD week 5
This commit is contained in:
1573
02-Easy5/E5/sources/androidx/appcompat/R.java
Normal file
1573
02-Easy5/E5/sources/androidx/appcompat/R.java
Normal file
File diff suppressed because one or more lines are too long
357
02-Easy5/E5/sources/androidx/appcompat/app/ActionBar.java
Normal file
357
02-Easy5/E5/sources/androidx/appcompat/app/ActionBar.java
Normal file
@@ -0,0 +1,357 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class ActionBar {
|
||||
public static final int DISPLAY_HOME_AS_UP = 4;
|
||||
public static final int DISPLAY_SHOW_CUSTOM = 16;
|
||||
public static final int DISPLAY_SHOW_HOME = 2;
|
||||
public static final int DISPLAY_SHOW_TITLE = 8;
|
||||
public static final int DISPLAY_USE_LOGO = 1;
|
||||
|
||||
@Deprecated
|
||||
public static final int NAVIGATION_MODE_LIST = 1;
|
||||
|
||||
@Deprecated
|
||||
public static final int NAVIGATION_MODE_STANDARD = 0;
|
||||
|
||||
@Deprecated
|
||||
public static final int NAVIGATION_MODE_TABS = 2;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface DisplayOptions {
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface NavigationMode {
|
||||
}
|
||||
|
||||
public interface OnMenuVisibilityListener {
|
||||
void onMenuVisibilityChanged(boolean z);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public interface OnNavigationListener {
|
||||
boolean onNavigationItemSelected(int i, long j);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static abstract class Tab {
|
||||
public static final int INVALID_POSITION = -1;
|
||||
|
||||
public abstract CharSequence getContentDescription();
|
||||
|
||||
public abstract View getCustomView();
|
||||
|
||||
public abstract Drawable getIcon();
|
||||
|
||||
public abstract int getPosition();
|
||||
|
||||
public abstract Object getTag();
|
||||
|
||||
public abstract CharSequence getText();
|
||||
|
||||
public abstract void select();
|
||||
|
||||
public abstract Tab setContentDescription(int i);
|
||||
|
||||
public abstract Tab setContentDescription(CharSequence charSequence);
|
||||
|
||||
public abstract Tab setCustomView(int i);
|
||||
|
||||
public abstract Tab setCustomView(View view);
|
||||
|
||||
public abstract Tab setIcon(int i);
|
||||
|
||||
public abstract Tab setIcon(Drawable drawable);
|
||||
|
||||
public abstract Tab setTabListener(TabListener tabListener);
|
||||
|
||||
public abstract Tab setTag(Object obj);
|
||||
|
||||
public abstract Tab setText(int i);
|
||||
|
||||
public abstract Tab setText(CharSequence charSequence);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public interface TabListener {
|
||||
void onTabReselected(Tab tab, FragmentTransaction fragmentTransaction);
|
||||
|
||||
void onTabSelected(Tab tab, FragmentTransaction fragmentTransaction);
|
||||
|
||||
void onTabUnselected(Tab tab, FragmentTransaction fragmentTransaction);
|
||||
}
|
||||
|
||||
public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener onMenuVisibilityListener);
|
||||
|
||||
@Deprecated
|
||||
public abstract void addTab(Tab tab);
|
||||
|
||||
@Deprecated
|
||||
public abstract void addTab(Tab tab, int i);
|
||||
|
||||
@Deprecated
|
||||
public abstract void addTab(Tab tab, int i, boolean z);
|
||||
|
||||
@Deprecated
|
||||
public abstract void addTab(Tab tab, boolean z);
|
||||
|
||||
public boolean closeOptionsMenu() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean collapseActionView() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void dispatchMenuVisibilityChanged(boolean z) {
|
||||
}
|
||||
|
||||
public abstract View getCustomView();
|
||||
|
||||
public abstract int getDisplayOptions();
|
||||
|
||||
public float getElevation() {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public abstract int getHeight();
|
||||
|
||||
public int getHideOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public abstract int getNavigationItemCount();
|
||||
|
||||
@Deprecated
|
||||
public abstract int getNavigationMode();
|
||||
|
||||
@Deprecated
|
||||
public abstract int getSelectedNavigationIndex();
|
||||
|
||||
@Deprecated
|
||||
public abstract Tab getSelectedTab();
|
||||
|
||||
public abstract CharSequence getSubtitle();
|
||||
|
||||
@Deprecated
|
||||
public abstract Tab getTabAt(int i);
|
||||
|
||||
@Deprecated
|
||||
public abstract int getTabCount();
|
||||
|
||||
public Context getThemedContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract CharSequence getTitle();
|
||||
|
||||
public abstract void hide();
|
||||
|
||||
public boolean invalidateOptionsMenu() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isHideOnContentScrollEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract boolean isShowing();
|
||||
|
||||
public boolean isTitleTruncated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public abstract Tab newTab();
|
||||
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
}
|
||||
|
||||
void onDestroy() {
|
||||
}
|
||||
|
||||
public boolean onKeyShortcut(int i, KeyEvent keyEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onMenuKeyEvent(KeyEvent keyEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean openOptionsMenu() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public abstract void removeAllTabs();
|
||||
|
||||
public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener onMenuVisibilityListener);
|
||||
|
||||
@Deprecated
|
||||
public abstract void removeTab(Tab tab);
|
||||
|
||||
@Deprecated
|
||||
public abstract void removeTabAt(int i);
|
||||
|
||||
boolean requestFocus() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public abstract void selectTab(Tab tab);
|
||||
|
||||
public abstract void setBackgroundDrawable(Drawable drawable);
|
||||
|
||||
public abstract void setCustomView(int i);
|
||||
|
||||
public abstract void setCustomView(View view);
|
||||
|
||||
public abstract void setCustomView(View view, LayoutParams layoutParams);
|
||||
|
||||
public void setDefaultDisplayHomeAsUpEnabled(boolean z) {
|
||||
}
|
||||
|
||||
public abstract void setDisplayHomeAsUpEnabled(boolean z);
|
||||
|
||||
public abstract void setDisplayOptions(int i);
|
||||
|
||||
public abstract void setDisplayOptions(int i, int i2);
|
||||
|
||||
public abstract void setDisplayShowCustomEnabled(boolean z);
|
||||
|
||||
public abstract void setDisplayShowHomeEnabled(boolean z);
|
||||
|
||||
public abstract void setDisplayShowTitleEnabled(boolean z);
|
||||
|
||||
public abstract void setDisplayUseLogoEnabled(boolean z);
|
||||
|
||||
public void setHomeActionContentDescription(int i) {
|
||||
}
|
||||
|
||||
public void setHomeActionContentDescription(CharSequence charSequence) {
|
||||
}
|
||||
|
||||
public void setHomeAsUpIndicator(int i) {
|
||||
}
|
||||
|
||||
public void setHomeAsUpIndicator(Drawable drawable) {
|
||||
}
|
||||
|
||||
public void setHomeButtonEnabled(boolean z) {
|
||||
}
|
||||
|
||||
public abstract void setIcon(int i);
|
||||
|
||||
public abstract void setIcon(Drawable drawable);
|
||||
|
||||
@Deprecated
|
||||
public abstract void setListNavigationCallbacks(SpinnerAdapter spinnerAdapter, OnNavigationListener onNavigationListener);
|
||||
|
||||
public abstract void setLogo(int i);
|
||||
|
||||
public abstract void setLogo(Drawable drawable);
|
||||
|
||||
@Deprecated
|
||||
public abstract void setNavigationMode(int i);
|
||||
|
||||
@Deprecated
|
||||
public abstract void setSelectedNavigationItem(int i);
|
||||
|
||||
public void setShowHideAnimationEnabled(boolean z) {
|
||||
}
|
||||
|
||||
public void setSplitBackgroundDrawable(Drawable drawable) {
|
||||
}
|
||||
|
||||
public void setStackedBackgroundDrawable(Drawable drawable) {
|
||||
}
|
||||
|
||||
public abstract void setSubtitle(int i);
|
||||
|
||||
public abstract void setSubtitle(CharSequence charSequence);
|
||||
|
||||
public abstract void setTitle(int i);
|
||||
|
||||
public abstract void setTitle(CharSequence charSequence);
|
||||
|
||||
public void setWindowTitle(CharSequence charSequence) {
|
||||
}
|
||||
|
||||
public abstract void show();
|
||||
|
||||
public ActionMode startActionMode(ActionMode.Callback callback) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setHideOnContentScrollEnabled(boolean z) {
|
||||
if (z) {
|
||||
throw new UnsupportedOperationException("Hide on content scroll is not supported in this action bar configuration.");
|
||||
}
|
||||
}
|
||||
|
||||
public void setHideOffset(int i) {
|
||||
if (i != 0) {
|
||||
throw new UnsupportedOperationException("Setting an explicit action bar hide offset is not supported in this action bar configuration.");
|
||||
}
|
||||
}
|
||||
|
||||
public void setElevation(float f) {
|
||||
if (f != 0.0f) {
|
||||
throw new UnsupportedOperationException("Setting a non-zero elevation is not supported in this action bar configuration.");
|
||||
}
|
||||
}
|
||||
|
||||
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
|
||||
public int gravity;
|
||||
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.gravity = 0;
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ActionBarLayout);
|
||||
this.gravity = obtainStyledAttributes.getInt(R.styleable.ActionBarLayout_android_layout_gravity, 0);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2) {
|
||||
super(i, i2);
|
||||
this.gravity = 8388627;
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2, int i3) {
|
||||
super(i, i2);
|
||||
this.gravity = i3;
|
||||
}
|
||||
|
||||
public LayoutParams(int i) {
|
||||
this(-2, -1, i);
|
||||
}
|
||||
|
||||
public LayoutParams(LayoutParams layoutParams) {
|
||||
super((ViewGroup.MarginLayoutParams) layoutParams);
|
||||
this.gravity = 0;
|
||||
this.gravity = layoutParams.gravity;
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
super(layoutParams);
|
||||
this.gravity = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.R;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggleHoneycomb;
|
||||
import androidx.appcompat.graphics.drawable.DrawerArrowDrawable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarDrawerToggle implements DrawerLayout.DrawerListener {
|
||||
private final Delegate mActivityImpl;
|
||||
private final int mCloseDrawerContentDescRes;
|
||||
boolean mDrawerIndicatorEnabled;
|
||||
private final DrawerLayout mDrawerLayout;
|
||||
private boolean mDrawerSlideAnimationEnabled;
|
||||
private boolean mHasCustomUpIndicator;
|
||||
private Drawable mHomeAsUpIndicator;
|
||||
private final int mOpenDrawerContentDescRes;
|
||||
private DrawerArrowDrawable mSlider;
|
||||
View.OnClickListener mToolbarNavigationClickListener;
|
||||
private boolean mWarnedForDisplayHomeAsUp;
|
||||
|
||||
public interface Delegate {
|
||||
Context getActionBarThemedContext();
|
||||
|
||||
Drawable getThemeUpIndicator();
|
||||
|
||||
boolean isNavigationVisible();
|
||||
|
||||
void setActionBarDescription(int i);
|
||||
|
||||
void setActionBarUpIndicator(Drawable drawable, int i);
|
||||
}
|
||||
|
||||
public interface DelegateProvider {
|
||||
Delegate getDrawerToggleDelegate();
|
||||
}
|
||||
|
||||
public DrawerArrowDrawable getDrawerArrowDrawable() {
|
||||
return this.mSlider;
|
||||
}
|
||||
|
||||
public View.OnClickListener getToolbarNavigationClickListener() {
|
||||
return this.mToolbarNavigationClickListener;
|
||||
}
|
||||
|
||||
public boolean isDrawerIndicatorEnabled() {
|
||||
return this.mDrawerIndicatorEnabled;
|
||||
}
|
||||
|
||||
public boolean isDrawerSlideAnimationEnabled() {
|
||||
return this.mDrawerSlideAnimationEnabled;
|
||||
}
|
||||
|
||||
@Override // androidx.drawerlayout.widget.DrawerLayout.DrawerListener
|
||||
public void onDrawerStateChanged(int i) {
|
||||
}
|
||||
|
||||
public void setToolbarNavigationClickListener(View.OnClickListener onClickListener) {
|
||||
this.mToolbarNavigationClickListener = onClickListener;
|
||||
}
|
||||
|
||||
public ActionBarDrawerToggle(Activity activity, DrawerLayout drawerLayout, int i, int i2) {
|
||||
this(activity, null, drawerLayout, null, i, i2);
|
||||
}
|
||||
|
||||
public ActionBarDrawerToggle(Activity activity, DrawerLayout drawerLayout, Toolbar toolbar, int i, int i2) {
|
||||
this(activity, toolbar, drawerLayout, null, i, i2);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
ActionBarDrawerToggle(Activity activity, Toolbar toolbar, DrawerLayout drawerLayout, DrawerArrowDrawable drawerArrowDrawable, int i, int i2) {
|
||||
this.mDrawerSlideAnimationEnabled = true;
|
||||
this.mDrawerIndicatorEnabled = true;
|
||||
this.mWarnedForDisplayHomeAsUp = false;
|
||||
if (toolbar != null) {
|
||||
this.mActivityImpl = new ToolbarCompatDelegate(toolbar);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() { // from class: androidx.appcompat.app.ActionBarDrawerToggle.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (ActionBarDrawerToggle.this.mDrawerIndicatorEnabled) {
|
||||
ActionBarDrawerToggle.this.toggle();
|
||||
} else if (ActionBarDrawerToggle.this.mToolbarNavigationClickListener != null) {
|
||||
ActionBarDrawerToggle.this.mToolbarNavigationClickListener.onClick(view);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (activity instanceof DelegateProvider) {
|
||||
this.mActivityImpl = ((DelegateProvider) activity).getDrawerToggleDelegate();
|
||||
} else {
|
||||
this.mActivityImpl = new FrameworkActionBarDelegate(activity);
|
||||
}
|
||||
this.mDrawerLayout = drawerLayout;
|
||||
this.mOpenDrawerContentDescRes = i;
|
||||
this.mCloseDrawerContentDescRes = i2;
|
||||
if (drawerArrowDrawable == null) {
|
||||
this.mSlider = new DrawerArrowDrawable(this.mActivityImpl.getActionBarThemedContext());
|
||||
} else {
|
||||
this.mSlider = drawerArrowDrawable;
|
||||
}
|
||||
this.mHomeAsUpIndicator = getThemeUpIndicator();
|
||||
}
|
||||
|
||||
public void syncState() {
|
||||
if (this.mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||
setPosition(1.0f);
|
||||
} else {
|
||||
setPosition(0.0f);
|
||||
}
|
||||
if (this.mDrawerIndicatorEnabled) {
|
||||
setActionBarUpIndicator(this.mSlider, this.mDrawerLayout.isDrawerOpen(GravityCompat.START) ? this.mCloseDrawerContentDescRes : this.mOpenDrawerContentDescRes);
|
||||
}
|
||||
}
|
||||
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
if (!this.mHasCustomUpIndicator) {
|
||||
this.mHomeAsUpIndicator = getThemeUpIndicator();
|
||||
}
|
||||
syncState();
|
||||
}
|
||||
|
||||
public boolean onOptionsItemSelected(MenuItem menuItem) {
|
||||
if (menuItem == null || menuItem.getItemId() != 16908332 || !this.mDrawerIndicatorEnabled) {
|
||||
return false;
|
||||
}
|
||||
toggle();
|
||||
return true;
|
||||
}
|
||||
|
||||
void toggle() {
|
||||
int drawerLockMode = this.mDrawerLayout.getDrawerLockMode(GravityCompat.START);
|
||||
if (this.mDrawerLayout.isDrawerVisible(GravityCompat.START) && drawerLockMode != 2) {
|
||||
this.mDrawerLayout.closeDrawer(GravityCompat.START);
|
||||
} else if (drawerLockMode != 1) {
|
||||
this.mDrawerLayout.openDrawer(GravityCompat.START);
|
||||
}
|
||||
}
|
||||
|
||||
public void setHomeAsUpIndicator(Drawable drawable) {
|
||||
if (drawable == null) {
|
||||
this.mHomeAsUpIndicator = getThemeUpIndicator();
|
||||
this.mHasCustomUpIndicator = false;
|
||||
} else {
|
||||
this.mHomeAsUpIndicator = drawable;
|
||||
this.mHasCustomUpIndicator = true;
|
||||
}
|
||||
if (this.mDrawerIndicatorEnabled) {
|
||||
return;
|
||||
}
|
||||
setActionBarUpIndicator(this.mHomeAsUpIndicator, 0);
|
||||
}
|
||||
|
||||
public void setHomeAsUpIndicator(int i) {
|
||||
setHomeAsUpIndicator(i != 0 ? this.mDrawerLayout.getResources().getDrawable(i) : null);
|
||||
}
|
||||
|
||||
public void setDrawerIndicatorEnabled(boolean z) {
|
||||
if (z != this.mDrawerIndicatorEnabled) {
|
||||
if (z) {
|
||||
setActionBarUpIndicator(this.mSlider, this.mDrawerLayout.isDrawerOpen(GravityCompat.START) ? this.mCloseDrawerContentDescRes : this.mOpenDrawerContentDescRes);
|
||||
} else {
|
||||
setActionBarUpIndicator(this.mHomeAsUpIndicator, 0);
|
||||
}
|
||||
this.mDrawerIndicatorEnabled = z;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDrawerArrowDrawable(DrawerArrowDrawable drawerArrowDrawable) {
|
||||
this.mSlider = drawerArrowDrawable;
|
||||
syncState();
|
||||
}
|
||||
|
||||
public void setDrawerSlideAnimationEnabled(boolean z) {
|
||||
this.mDrawerSlideAnimationEnabled = z;
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
setPosition(0.0f);
|
||||
}
|
||||
|
||||
@Override // androidx.drawerlayout.widget.DrawerLayout.DrawerListener
|
||||
public void onDrawerSlide(View view, float f) {
|
||||
if (this.mDrawerSlideAnimationEnabled) {
|
||||
setPosition(Math.min(1.0f, Math.max(0.0f, f)));
|
||||
} else {
|
||||
setPosition(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.drawerlayout.widget.DrawerLayout.DrawerListener
|
||||
public void onDrawerOpened(View view) {
|
||||
setPosition(1.0f);
|
||||
if (this.mDrawerIndicatorEnabled) {
|
||||
setActionBarDescription(this.mCloseDrawerContentDescRes);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.drawerlayout.widget.DrawerLayout.DrawerListener
|
||||
public void onDrawerClosed(View view) {
|
||||
setPosition(0.0f);
|
||||
if (this.mDrawerIndicatorEnabled) {
|
||||
setActionBarDescription(this.mOpenDrawerContentDescRes);
|
||||
}
|
||||
}
|
||||
|
||||
void setActionBarUpIndicator(Drawable drawable, int i) {
|
||||
if (!this.mWarnedForDisplayHomeAsUp && !this.mActivityImpl.isNavigationVisible()) {
|
||||
Log.w("ActionBarDrawerToggle", "DrawerToggle may not show up because NavigationIcon is not visible. You may need to call actionbar.setDisplayHomeAsUpEnabled(true);");
|
||||
this.mWarnedForDisplayHomeAsUp = true;
|
||||
}
|
||||
this.mActivityImpl.setActionBarUpIndicator(drawable, i);
|
||||
}
|
||||
|
||||
void setActionBarDescription(int i) {
|
||||
this.mActivityImpl.setActionBarDescription(i);
|
||||
}
|
||||
|
||||
Drawable getThemeUpIndicator() {
|
||||
return this.mActivityImpl.getThemeUpIndicator();
|
||||
}
|
||||
|
||||
private void setPosition(float f) {
|
||||
if (f == 1.0f) {
|
||||
this.mSlider.setVerticalMirror(true);
|
||||
} else if (f == 0.0f) {
|
||||
this.mSlider.setVerticalMirror(false);
|
||||
}
|
||||
this.mSlider.setProgress(f);
|
||||
}
|
||||
|
||||
private static class FrameworkActionBarDelegate implements Delegate {
|
||||
private final Activity mActivity;
|
||||
private ActionBarDrawerToggleHoneycomb.SetIndicatorInfo mSetIndicatorInfo;
|
||||
|
||||
FrameworkActionBarDelegate(Activity activity) {
|
||||
this.mActivity = activity;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate
|
||||
public Drawable getThemeUpIndicator() {
|
||||
TypedArray obtainStyledAttributes = getActionBarThemedContext().obtainStyledAttributes(null, new int[]{R.attr.homeAsUpIndicator}, R.attr.actionBarStyle, 0);
|
||||
Drawable drawable = obtainStyledAttributes.getDrawable(0);
|
||||
obtainStyledAttributes.recycle();
|
||||
return drawable;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate
|
||||
public Context getActionBarThemedContext() {
|
||||
android.app.ActionBar actionBar = this.mActivity.getActionBar();
|
||||
return actionBar != null ? actionBar.getThemedContext() : this.mActivity;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate
|
||||
public boolean isNavigationVisible() {
|
||||
android.app.ActionBar actionBar = this.mActivity.getActionBar();
|
||||
return (actionBar == null || (actionBar.getDisplayOptions() & 4) == 0) ? false : true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate
|
||||
public void setActionBarUpIndicator(Drawable drawable, int i) {
|
||||
android.app.ActionBar actionBar = this.mActivity.getActionBar();
|
||||
if (actionBar != null) {
|
||||
Api18Impl.setHomeAsUpIndicator(actionBar, drawable);
|
||||
Api18Impl.setHomeActionContentDescription(actionBar, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate
|
||||
public void setActionBarDescription(int i) {
|
||||
android.app.ActionBar actionBar = this.mActivity.getActionBar();
|
||||
if (actionBar != null) {
|
||||
Api18Impl.setHomeActionContentDescription(actionBar, i);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api18Impl {
|
||||
private Api18Impl() {
|
||||
}
|
||||
|
||||
static void setHomeActionContentDescription(android.app.ActionBar actionBar, int i) {
|
||||
actionBar.setHomeActionContentDescription(i);
|
||||
}
|
||||
|
||||
static void setHomeAsUpIndicator(android.app.ActionBar actionBar, Drawable drawable) {
|
||||
actionBar.setHomeAsUpIndicator(drawable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class ToolbarCompatDelegate implements Delegate {
|
||||
final CharSequence mDefaultContentDescription;
|
||||
final Drawable mDefaultUpIndicator;
|
||||
final Toolbar mToolbar;
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate
|
||||
public Drawable getThemeUpIndicator() {
|
||||
return this.mDefaultUpIndicator;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate
|
||||
public boolean isNavigationVisible() {
|
||||
return true;
|
||||
}
|
||||
|
||||
ToolbarCompatDelegate(Toolbar toolbar) {
|
||||
this.mToolbar = toolbar;
|
||||
this.mDefaultUpIndicator = toolbar.getNavigationIcon();
|
||||
this.mDefaultContentDescription = toolbar.getNavigationContentDescription();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate
|
||||
public void setActionBarUpIndicator(Drawable drawable, int i) {
|
||||
this.mToolbar.setNavigationIcon(drawable);
|
||||
setActionBarDescription(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate
|
||||
public void setActionBarDescription(int i) {
|
||||
if (i == 0) {
|
||||
this.mToolbar.setNavigationContentDescription(this.mDefaultContentDescription);
|
||||
} else {
|
||||
this.mToolbar.setNavigationContentDescription(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate
|
||||
public Context getActionBarThemedContext() {
|
||||
return this.mToolbar.getContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.R;
|
||||
import android.app.Activity;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ActionBarDrawerToggleHoneycomb {
|
||||
private static final String TAG = "ActionBarDrawerToggleHC";
|
||||
private static final int[] THEME_ATTRS = {R.attr.homeAsUpIndicator};
|
||||
|
||||
public static SetIndicatorInfo setActionBarUpIndicator(Activity activity, Drawable drawable, int i) {
|
||||
SetIndicatorInfo setIndicatorInfo = new SetIndicatorInfo(activity);
|
||||
if (setIndicatorInfo.setHomeAsUpIndicator != null) {
|
||||
try {
|
||||
android.app.ActionBar actionBar = activity.getActionBar();
|
||||
setIndicatorInfo.setHomeAsUpIndicator.invoke(actionBar, drawable);
|
||||
setIndicatorInfo.setHomeActionContentDescription.invoke(actionBar, Integer.valueOf(i));
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", e);
|
||||
}
|
||||
} else if (setIndicatorInfo.upIndicatorView != null) {
|
||||
setIndicatorInfo.upIndicatorView.setImageDrawable(drawable);
|
||||
} else {
|
||||
Log.w(TAG, "Couldn't set home-as-up indicator");
|
||||
}
|
||||
return setIndicatorInfo;
|
||||
}
|
||||
|
||||
public static SetIndicatorInfo setActionBarDescription(SetIndicatorInfo setIndicatorInfo, Activity activity, int i) {
|
||||
if (setIndicatorInfo == null) {
|
||||
setIndicatorInfo = new SetIndicatorInfo(activity);
|
||||
}
|
||||
if (setIndicatorInfo.setHomeAsUpIndicator != null) {
|
||||
try {
|
||||
setIndicatorInfo.setHomeActionContentDescription.invoke(activity.getActionBar(), Integer.valueOf(i));
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Couldn't set content description via JB-MR2 API", e);
|
||||
}
|
||||
}
|
||||
return setIndicatorInfo;
|
||||
}
|
||||
|
||||
public static Drawable getThemeUpIndicator(Activity activity) {
|
||||
TypedArray obtainStyledAttributes = activity.obtainStyledAttributes(THEME_ATTRS);
|
||||
Drawable drawable = obtainStyledAttributes.getDrawable(0);
|
||||
obtainStyledAttributes.recycle();
|
||||
return drawable;
|
||||
}
|
||||
|
||||
static class SetIndicatorInfo {
|
||||
public Method setHomeActionContentDescription;
|
||||
public Method setHomeAsUpIndicator;
|
||||
public ImageView upIndicatorView;
|
||||
|
||||
SetIndicatorInfo(Activity activity) {
|
||||
try {
|
||||
this.setHomeAsUpIndicator = android.app.ActionBar.class.getDeclaredMethod("setHomeAsUpIndicator", Drawable.class);
|
||||
this.setHomeActionContentDescription = android.app.ActionBar.class.getDeclaredMethod("setHomeActionContentDescription", Integer.TYPE);
|
||||
} catch (NoSuchMethodException unused) {
|
||||
View findViewById = activity.findViewById(R.id.home);
|
||||
if (findViewById == null) {
|
||||
return;
|
||||
}
|
||||
ViewGroup viewGroup = (ViewGroup) findViewById.getParent();
|
||||
if (viewGroup.getChildCount() != 2) {
|
||||
return;
|
||||
}
|
||||
View childAt = viewGroup.getChildAt(0);
|
||||
childAt = childAt.getId() == 16908332 ? viewGroup.getChildAt(1) : childAt;
|
||||
if (childAt instanceof ImageView) {
|
||||
this.upIndicatorView = (ImageView) childAt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ActionBarDrawerToggleHoneycomb() {
|
||||
}
|
||||
}
|
||||
864
02-Easy5/E5/sources/androidx/appcompat/app/AlertController.java
Normal file
864
02-Easy5/E5/sources/androidx/appcompat/app/AlertController.java
Normal file
@@ -0,0 +1,864 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.view.ViewStub;
|
||||
import android.view.Window;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckedTextView;
|
||||
import android.widget.CursorAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AlertController {
|
||||
ListAdapter mAdapter;
|
||||
private int mAlertDialogLayout;
|
||||
private final int mButtonIconDimen;
|
||||
Button mButtonNegative;
|
||||
private Drawable mButtonNegativeIcon;
|
||||
Message mButtonNegativeMessage;
|
||||
private CharSequence mButtonNegativeText;
|
||||
Button mButtonNeutral;
|
||||
private Drawable mButtonNeutralIcon;
|
||||
Message mButtonNeutralMessage;
|
||||
private CharSequence mButtonNeutralText;
|
||||
private int mButtonPanelSideLayout;
|
||||
Button mButtonPositive;
|
||||
private Drawable mButtonPositiveIcon;
|
||||
Message mButtonPositiveMessage;
|
||||
private CharSequence mButtonPositiveText;
|
||||
private final Context mContext;
|
||||
private View mCustomTitleView;
|
||||
final AppCompatDialog mDialog;
|
||||
Handler mHandler;
|
||||
private Drawable mIcon;
|
||||
private ImageView mIconView;
|
||||
int mListItemLayout;
|
||||
int mListLayout;
|
||||
ListView mListView;
|
||||
private CharSequence mMessage;
|
||||
private TextView mMessageView;
|
||||
int mMultiChoiceItemLayout;
|
||||
NestedScrollView mScrollView;
|
||||
private boolean mShowTitle;
|
||||
int mSingleChoiceItemLayout;
|
||||
private CharSequence mTitle;
|
||||
private TextView mTitleView;
|
||||
private View mView;
|
||||
private int mViewLayoutResId;
|
||||
private int mViewSpacingBottom;
|
||||
private int mViewSpacingLeft;
|
||||
private int mViewSpacingRight;
|
||||
private int mViewSpacingTop;
|
||||
private final Window mWindow;
|
||||
private boolean mViewSpacingSpecified = false;
|
||||
private int mIconId = 0;
|
||||
int mCheckedItem = -1;
|
||||
private int mButtonPanelLayoutHint = 0;
|
||||
private final View.OnClickListener mButtonHandler = new View.OnClickListener() { // from class: androidx.appcompat.app.AlertController.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
Message obtain;
|
||||
if (view == AlertController.this.mButtonPositive && AlertController.this.mButtonPositiveMessage != null) {
|
||||
obtain = Message.obtain(AlertController.this.mButtonPositiveMessage);
|
||||
} else if (view == AlertController.this.mButtonNegative && AlertController.this.mButtonNegativeMessage != null) {
|
||||
obtain = Message.obtain(AlertController.this.mButtonNegativeMessage);
|
||||
} else {
|
||||
obtain = (view != AlertController.this.mButtonNeutral || AlertController.this.mButtonNeutralMessage == null) ? null : Message.obtain(AlertController.this.mButtonNeutralMessage);
|
||||
}
|
||||
if (obtain != null) {
|
||||
obtain.sendToTarget();
|
||||
}
|
||||
AlertController.this.mHandler.obtainMessage(1, AlertController.this.mDialog).sendToTarget();
|
||||
}
|
||||
};
|
||||
|
||||
private int selectContentView() {
|
||||
int i = this.mButtonPanelSideLayout;
|
||||
return (i != 0 && this.mButtonPanelLayoutHint == 1) ? i : this.mAlertDialogLayout;
|
||||
}
|
||||
|
||||
public Button getButton(int i) {
|
||||
if (i == -3) {
|
||||
return this.mButtonNeutral;
|
||||
}
|
||||
if (i == -2) {
|
||||
return this.mButtonNegative;
|
||||
}
|
||||
if (i != -1) {
|
||||
return null;
|
||||
}
|
||||
return this.mButtonPositive;
|
||||
}
|
||||
|
||||
public ListView getListView() {
|
||||
return this.mListView;
|
||||
}
|
||||
|
||||
public void setButtonPanelLayoutHint(int i) {
|
||||
this.mButtonPanelLayoutHint = i;
|
||||
}
|
||||
|
||||
public void setCustomTitle(View view) {
|
||||
this.mCustomTitleView = view;
|
||||
}
|
||||
|
||||
public void setView(int i) {
|
||||
this.mView = null;
|
||||
this.mViewLayoutResId = i;
|
||||
this.mViewSpacingSpecified = false;
|
||||
}
|
||||
|
||||
public void setView(View view) {
|
||||
this.mView = view;
|
||||
this.mViewLayoutResId = 0;
|
||||
this.mViewSpacingSpecified = false;
|
||||
}
|
||||
|
||||
public void setView(View view, int i, int i2, int i3, int i4) {
|
||||
this.mView = view;
|
||||
this.mViewLayoutResId = 0;
|
||||
this.mViewSpacingSpecified = true;
|
||||
this.mViewSpacingLeft = i;
|
||||
this.mViewSpacingTop = i2;
|
||||
this.mViewSpacingRight = i3;
|
||||
this.mViewSpacingBottom = i4;
|
||||
}
|
||||
|
||||
private static final class ButtonHandler extends Handler {
|
||||
private static final int MSG_DISMISS_DIALOG = 1;
|
||||
private WeakReference<DialogInterface> mDialog;
|
||||
|
||||
public ButtonHandler(DialogInterface dialogInterface) {
|
||||
this.mDialog = new WeakReference<>(dialogInterface);
|
||||
}
|
||||
|
||||
@Override // android.os.Handler
|
||||
public void handleMessage(Message message) {
|
||||
int i = message.what;
|
||||
if (i == -3 || i == -2 || i == -1) {
|
||||
((DialogInterface.OnClickListener) message.obj).onClick(this.mDialog.get(), message.what);
|
||||
} else {
|
||||
if (i != 1) {
|
||||
return;
|
||||
}
|
||||
((DialogInterface) message.obj).dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean shouldCenterSingleButton(Context context) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
context.getTheme().resolveAttribute(R.attr.alertDialogCenterButtons, typedValue, true);
|
||||
return typedValue.data != 0;
|
||||
}
|
||||
|
||||
public AlertController(Context context, AppCompatDialog appCompatDialog, Window window) {
|
||||
this.mContext = context;
|
||||
this.mDialog = appCompatDialog;
|
||||
this.mWindow = window;
|
||||
this.mHandler = new ButtonHandler(appCompatDialog);
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(null, R.styleable.AlertDialog, R.attr.alertDialogStyle, 0);
|
||||
this.mAlertDialogLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_android_layout, 0);
|
||||
this.mButtonPanelSideLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_buttonPanelSideLayout, 0);
|
||||
this.mListLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_listLayout, 0);
|
||||
this.mMultiChoiceItemLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_multiChoiceItemLayout, 0);
|
||||
this.mSingleChoiceItemLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_singleChoiceItemLayout, 0);
|
||||
this.mListItemLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_listItemLayout, 0);
|
||||
this.mShowTitle = obtainStyledAttributes.getBoolean(R.styleable.AlertDialog_showTitle, true);
|
||||
this.mButtonIconDimen = obtainStyledAttributes.getDimensionPixelSize(R.styleable.AlertDialog_buttonIconDimen, 0);
|
||||
obtainStyledAttributes.recycle();
|
||||
appCompatDialog.supportRequestWindowFeature(1);
|
||||
}
|
||||
|
||||
static boolean canTextInput(View view) {
|
||||
if (view.onCheckIsTextEditor()) {
|
||||
return true;
|
||||
}
|
||||
if (!(view instanceof ViewGroup)) {
|
||||
return false;
|
||||
}
|
||||
ViewGroup viewGroup = (ViewGroup) view;
|
||||
int childCount = viewGroup.getChildCount();
|
||||
while (childCount > 0) {
|
||||
childCount--;
|
||||
if (canTextInput(viewGroup.getChildAt(childCount))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void installContent() {
|
||||
this.mDialog.setContentView(selectContentView());
|
||||
setupView();
|
||||
}
|
||||
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
this.mTitle = charSequence;
|
||||
TextView textView = this.mTitleView;
|
||||
if (textView != null) {
|
||||
textView.setText(charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMessage(CharSequence charSequence) {
|
||||
this.mMessage = charSequence;
|
||||
TextView textView = this.mMessageView;
|
||||
if (textView != null) {
|
||||
textView.setText(charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
public void setButton(int i, CharSequence charSequence, DialogInterface.OnClickListener onClickListener, Message message, Drawable drawable) {
|
||||
if (message == null && onClickListener != null) {
|
||||
message = this.mHandler.obtainMessage(i, onClickListener);
|
||||
}
|
||||
if (i == -3) {
|
||||
this.mButtonNeutralText = charSequence;
|
||||
this.mButtonNeutralMessage = message;
|
||||
this.mButtonNeutralIcon = drawable;
|
||||
} else if (i == -2) {
|
||||
this.mButtonNegativeText = charSequence;
|
||||
this.mButtonNegativeMessage = message;
|
||||
this.mButtonNegativeIcon = drawable;
|
||||
} else {
|
||||
if (i != -1) {
|
||||
throw new IllegalArgumentException("Button does not exist");
|
||||
}
|
||||
this.mButtonPositiveText = charSequence;
|
||||
this.mButtonPositiveMessage = message;
|
||||
this.mButtonPositiveIcon = drawable;
|
||||
}
|
||||
}
|
||||
|
||||
public void setIcon(int i) {
|
||||
this.mIcon = null;
|
||||
this.mIconId = i;
|
||||
ImageView imageView = this.mIconView;
|
||||
if (imageView != null) {
|
||||
if (i != 0) {
|
||||
imageView.setVisibility(0);
|
||||
this.mIconView.setImageResource(this.mIconId);
|
||||
} else {
|
||||
imageView.setVisibility(8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setIcon(Drawable drawable) {
|
||||
this.mIcon = drawable;
|
||||
this.mIconId = 0;
|
||||
ImageView imageView = this.mIconView;
|
||||
if (imageView != null) {
|
||||
if (drawable != null) {
|
||||
imageView.setVisibility(0);
|
||||
this.mIconView.setImageDrawable(drawable);
|
||||
} else {
|
||||
imageView.setVisibility(8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getIconAttributeResId(int i) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
this.mContext.getTheme().resolveAttribute(i, typedValue, true);
|
||||
return typedValue.resourceId;
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
NestedScrollView nestedScrollView = this.mScrollView;
|
||||
return nestedScrollView != null && nestedScrollView.executeKeyEvent(keyEvent);
|
||||
}
|
||||
|
||||
public boolean onKeyUp(int i, KeyEvent keyEvent) {
|
||||
NestedScrollView nestedScrollView = this.mScrollView;
|
||||
return nestedScrollView != null && nestedScrollView.executeKeyEvent(keyEvent);
|
||||
}
|
||||
|
||||
private ViewGroup resolvePanel(View view, View view2) {
|
||||
if (view == null) {
|
||||
if (view2 instanceof ViewStub) {
|
||||
view2 = ((ViewStub) view2).inflate();
|
||||
}
|
||||
return (ViewGroup) view2;
|
||||
}
|
||||
if (view2 != null) {
|
||||
ViewParent parent = view2.getParent();
|
||||
if (parent instanceof ViewGroup) {
|
||||
((ViewGroup) parent).removeView(view2);
|
||||
}
|
||||
}
|
||||
if (view instanceof ViewStub) {
|
||||
view = ((ViewStub) view).inflate();
|
||||
}
|
||||
return (ViewGroup) view;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private void setupView() {
|
||||
View findViewById;
|
||||
ListAdapter listAdapter;
|
||||
View findViewById2;
|
||||
View findViewById3 = this.mWindow.findViewById(R.id.parentPanel);
|
||||
View findViewById4 = findViewById3.findViewById(R.id.topPanel);
|
||||
View findViewById5 = findViewById3.findViewById(R.id.contentPanel);
|
||||
View findViewById6 = findViewById3.findViewById(R.id.buttonPanel);
|
||||
ViewGroup viewGroup = (ViewGroup) findViewById3.findViewById(R.id.customPanel);
|
||||
setupCustomContent(viewGroup);
|
||||
View findViewById7 = viewGroup.findViewById(R.id.topPanel);
|
||||
View findViewById8 = viewGroup.findViewById(R.id.contentPanel);
|
||||
View findViewById9 = viewGroup.findViewById(R.id.buttonPanel);
|
||||
ViewGroup resolvePanel = resolvePanel(findViewById7, findViewById4);
|
||||
ViewGroup resolvePanel2 = resolvePanel(findViewById8, findViewById5);
|
||||
ViewGroup resolvePanel3 = resolvePanel(findViewById9, findViewById6);
|
||||
setupContent(resolvePanel2);
|
||||
setupButtons(resolvePanel3);
|
||||
setupTitle(resolvePanel);
|
||||
boolean z = (viewGroup == null || viewGroup.getVisibility() == 8) ? false : true;
|
||||
boolean z2 = (resolvePanel == null || resolvePanel.getVisibility() == 8) ? 0 : 1;
|
||||
boolean z3 = (resolvePanel3 == null || resolvePanel3.getVisibility() == 8) ? false : true;
|
||||
if (!z3 && resolvePanel2 != null && (findViewById2 = resolvePanel2.findViewById(R.id.textSpacerNoButtons)) != null) {
|
||||
findViewById2.setVisibility(0);
|
||||
}
|
||||
if (z2 != 0) {
|
||||
NestedScrollView nestedScrollView = this.mScrollView;
|
||||
if (nestedScrollView != null) {
|
||||
nestedScrollView.setClipToPadding(true);
|
||||
}
|
||||
View findViewById10 = (this.mMessage == null && this.mListView == null) ? null : resolvePanel.findViewById(R.id.titleDividerNoCustom);
|
||||
if (findViewById10 != null) {
|
||||
findViewById10.setVisibility(0);
|
||||
}
|
||||
} else if (resolvePanel2 != null && (findViewById = resolvePanel2.findViewById(R.id.textSpacerNoTitle)) != null) {
|
||||
findViewById.setVisibility(0);
|
||||
}
|
||||
ListView listView = this.mListView;
|
||||
if (listView instanceof RecycleListView) {
|
||||
((RecycleListView) listView).setHasDecor(z2, z3);
|
||||
}
|
||||
if (!z) {
|
||||
View view = this.mListView;
|
||||
if (view == null) {
|
||||
view = this.mScrollView;
|
||||
}
|
||||
if (view != null) {
|
||||
setScrollIndicators(resolvePanel2, view, z2 | (z3 ? 2 : 0), 3);
|
||||
}
|
||||
}
|
||||
ListView listView2 = this.mListView;
|
||||
if (listView2 == null || (listAdapter = this.mAdapter) == null) {
|
||||
return;
|
||||
}
|
||||
listView2.setAdapter(listAdapter);
|
||||
int i = this.mCheckedItem;
|
||||
if (i > -1) {
|
||||
listView2.setItemChecked(i, true);
|
||||
listView2.setSelection(i);
|
||||
}
|
||||
}
|
||||
|
||||
private void setScrollIndicators(ViewGroup viewGroup, View view, int i, int i2) {
|
||||
final View findViewById = this.mWindow.findViewById(R.id.scrollIndicatorUp);
|
||||
final View findViewById2 = this.mWindow.findViewById(R.id.scrollIndicatorDown);
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
ViewCompat.setScrollIndicators(view, i, i2);
|
||||
if (findViewById != null) {
|
||||
viewGroup.removeView(findViewById);
|
||||
}
|
||||
if (findViewById2 != null) {
|
||||
viewGroup.removeView(findViewById2);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (findViewById != null && (i & 1) == 0) {
|
||||
viewGroup.removeView(findViewById);
|
||||
findViewById = null;
|
||||
}
|
||||
if (findViewById2 != null && (i & 2) == 0) {
|
||||
viewGroup.removeView(findViewById2);
|
||||
findViewById2 = null;
|
||||
}
|
||||
if (findViewById == null && findViewById2 == null) {
|
||||
return;
|
||||
}
|
||||
if (this.mMessage != null) {
|
||||
this.mScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() { // from class: androidx.appcompat.app.AlertController.2
|
||||
@Override // androidx.core.widget.NestedScrollView.OnScrollChangeListener
|
||||
public void onScrollChange(NestedScrollView nestedScrollView, int i3, int i4, int i5, int i6) {
|
||||
AlertController.manageScrollIndicators(nestedScrollView, findViewById, findViewById2);
|
||||
}
|
||||
});
|
||||
this.mScrollView.post(new Runnable() { // from class: androidx.appcompat.app.AlertController.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AlertController.manageScrollIndicators(AlertController.this.mScrollView, findViewById, findViewById2);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
ListView listView = this.mListView;
|
||||
if (listView != null) {
|
||||
listView.setOnScrollListener(new AbsListView.OnScrollListener() { // from class: androidx.appcompat.app.AlertController.4
|
||||
@Override // android.widget.AbsListView.OnScrollListener
|
||||
public void onScrollStateChanged(AbsListView absListView, int i3) {
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView.OnScrollListener
|
||||
public void onScroll(AbsListView absListView, int i3, int i4, int i5) {
|
||||
AlertController.manageScrollIndicators(absListView, findViewById, findViewById2);
|
||||
}
|
||||
});
|
||||
this.mListView.post(new Runnable() { // from class: androidx.appcompat.app.AlertController.5
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AlertController.manageScrollIndicators(AlertController.this.mListView, findViewById, findViewById2);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (findViewById != null) {
|
||||
viewGroup.removeView(findViewById);
|
||||
}
|
||||
if (findViewById2 != null) {
|
||||
viewGroup.removeView(findViewById2);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupCustomContent(ViewGroup viewGroup) {
|
||||
View view = this.mView;
|
||||
if (view == null) {
|
||||
view = this.mViewLayoutResId != 0 ? LayoutInflater.from(this.mContext).inflate(this.mViewLayoutResId, viewGroup, false) : null;
|
||||
}
|
||||
boolean z = view != null;
|
||||
if (!z || !canTextInput(view)) {
|
||||
this.mWindow.setFlags(131072, 131072);
|
||||
}
|
||||
if (z) {
|
||||
FrameLayout frameLayout = (FrameLayout) this.mWindow.findViewById(R.id.custom);
|
||||
frameLayout.addView(view, new ViewGroup.LayoutParams(-1, -1));
|
||||
if (this.mViewSpacingSpecified) {
|
||||
frameLayout.setPadding(this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom);
|
||||
}
|
||||
if (this.mListView != null) {
|
||||
((LinearLayoutCompat.LayoutParams) viewGroup.getLayoutParams()).weight = 0.0f;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
viewGroup.setVisibility(8);
|
||||
}
|
||||
|
||||
private void setupTitle(ViewGroup viewGroup) {
|
||||
if (this.mCustomTitleView != null) {
|
||||
viewGroup.addView(this.mCustomTitleView, 0, new ViewGroup.LayoutParams(-1, -2));
|
||||
this.mWindow.findViewById(R.id.title_template).setVisibility(8);
|
||||
return;
|
||||
}
|
||||
this.mIconView = (ImageView) this.mWindow.findViewById(android.R.id.icon);
|
||||
if ((!TextUtils.isEmpty(this.mTitle)) && this.mShowTitle) {
|
||||
TextView textView = (TextView) this.mWindow.findViewById(R.id.alertTitle);
|
||||
this.mTitleView = textView;
|
||||
textView.setText(this.mTitle);
|
||||
int i = this.mIconId;
|
||||
if (i != 0) {
|
||||
this.mIconView.setImageResource(i);
|
||||
return;
|
||||
}
|
||||
Drawable drawable = this.mIcon;
|
||||
if (drawable != null) {
|
||||
this.mIconView.setImageDrawable(drawable);
|
||||
return;
|
||||
} else {
|
||||
this.mTitleView.setPadding(this.mIconView.getPaddingLeft(), this.mIconView.getPaddingTop(), this.mIconView.getPaddingRight(), this.mIconView.getPaddingBottom());
|
||||
this.mIconView.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.mWindow.findViewById(R.id.title_template).setVisibility(8);
|
||||
this.mIconView.setVisibility(8);
|
||||
viewGroup.setVisibility(8);
|
||||
}
|
||||
|
||||
private void setupContent(ViewGroup viewGroup) {
|
||||
NestedScrollView nestedScrollView = (NestedScrollView) this.mWindow.findViewById(R.id.scrollView);
|
||||
this.mScrollView = nestedScrollView;
|
||||
nestedScrollView.setFocusable(false);
|
||||
this.mScrollView.setNestedScrollingEnabled(false);
|
||||
TextView textView = (TextView) viewGroup.findViewById(android.R.id.message);
|
||||
this.mMessageView = textView;
|
||||
if (textView == null) {
|
||||
return;
|
||||
}
|
||||
CharSequence charSequence = this.mMessage;
|
||||
if (charSequence != null) {
|
||||
textView.setText(charSequence);
|
||||
return;
|
||||
}
|
||||
textView.setVisibility(8);
|
||||
this.mScrollView.removeView(this.mMessageView);
|
||||
if (this.mListView != null) {
|
||||
ViewGroup viewGroup2 = (ViewGroup) this.mScrollView.getParent();
|
||||
int indexOfChild = viewGroup2.indexOfChild(this.mScrollView);
|
||||
viewGroup2.removeViewAt(indexOfChild);
|
||||
viewGroup2.addView(this.mListView, indexOfChild, new ViewGroup.LayoutParams(-1, -1));
|
||||
return;
|
||||
}
|
||||
viewGroup.setVisibility(8);
|
||||
}
|
||||
|
||||
static void manageScrollIndicators(View view, View view2, View view3) {
|
||||
if (view2 != null) {
|
||||
view2.setVisibility(view.canScrollVertically(-1) ? 0 : 4);
|
||||
}
|
||||
if (view3 != null) {
|
||||
view3.setVisibility(view.canScrollVertically(1) ? 0 : 4);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupButtons(ViewGroup viewGroup) {
|
||||
int i;
|
||||
Button button = (Button) viewGroup.findViewById(android.R.id.button1);
|
||||
this.mButtonPositive = button;
|
||||
button.setOnClickListener(this.mButtonHandler);
|
||||
if (TextUtils.isEmpty(this.mButtonPositiveText) && this.mButtonPositiveIcon == null) {
|
||||
this.mButtonPositive.setVisibility(8);
|
||||
i = 0;
|
||||
} else {
|
||||
this.mButtonPositive.setText(this.mButtonPositiveText);
|
||||
Drawable drawable = this.mButtonPositiveIcon;
|
||||
if (drawable != null) {
|
||||
int i2 = this.mButtonIconDimen;
|
||||
drawable.setBounds(0, 0, i2, i2);
|
||||
this.mButtonPositive.setCompoundDrawables(this.mButtonPositiveIcon, null, null, null);
|
||||
}
|
||||
this.mButtonPositive.setVisibility(0);
|
||||
i = 1;
|
||||
}
|
||||
Button button2 = (Button) viewGroup.findViewById(android.R.id.button2);
|
||||
this.mButtonNegative = button2;
|
||||
button2.setOnClickListener(this.mButtonHandler);
|
||||
if (TextUtils.isEmpty(this.mButtonNegativeText) && this.mButtonNegativeIcon == null) {
|
||||
this.mButtonNegative.setVisibility(8);
|
||||
} else {
|
||||
this.mButtonNegative.setText(this.mButtonNegativeText);
|
||||
Drawable drawable2 = this.mButtonNegativeIcon;
|
||||
if (drawable2 != null) {
|
||||
int i3 = this.mButtonIconDimen;
|
||||
drawable2.setBounds(0, 0, i3, i3);
|
||||
this.mButtonNegative.setCompoundDrawables(this.mButtonNegativeIcon, null, null, null);
|
||||
}
|
||||
this.mButtonNegative.setVisibility(0);
|
||||
i |= 2;
|
||||
}
|
||||
Button button3 = (Button) viewGroup.findViewById(android.R.id.button3);
|
||||
this.mButtonNeutral = button3;
|
||||
button3.setOnClickListener(this.mButtonHandler);
|
||||
if (TextUtils.isEmpty(this.mButtonNeutralText) && this.mButtonNeutralIcon == null) {
|
||||
this.mButtonNeutral.setVisibility(8);
|
||||
} else {
|
||||
this.mButtonNeutral.setText(this.mButtonNeutralText);
|
||||
Drawable drawable3 = this.mButtonNeutralIcon;
|
||||
if (drawable3 != null) {
|
||||
int i4 = this.mButtonIconDimen;
|
||||
drawable3.setBounds(0, 0, i4, i4);
|
||||
this.mButtonNeutral.setCompoundDrawables(this.mButtonNeutralIcon, null, null, null);
|
||||
}
|
||||
this.mButtonNeutral.setVisibility(0);
|
||||
i |= 4;
|
||||
}
|
||||
if (shouldCenterSingleButton(this.mContext)) {
|
||||
if (i == 1) {
|
||||
centerButton(this.mButtonPositive);
|
||||
} else if (i == 2) {
|
||||
centerButton(this.mButtonNegative);
|
||||
} else if (i == 4) {
|
||||
centerButton(this.mButtonNeutral);
|
||||
}
|
||||
}
|
||||
if (i != 0) {
|
||||
return;
|
||||
}
|
||||
viewGroup.setVisibility(8);
|
||||
}
|
||||
|
||||
private void centerButton(Button button) {
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) button.getLayoutParams();
|
||||
layoutParams.gravity = 1;
|
||||
layoutParams.weight = 0.5f;
|
||||
button.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
public static class RecycleListView extends ListView {
|
||||
private final int mPaddingBottomNoButtons;
|
||||
private final int mPaddingTopNoTitle;
|
||||
|
||||
public RecycleListView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public RecycleListView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.RecycleListView);
|
||||
this.mPaddingBottomNoButtons = obtainStyledAttributes.getDimensionPixelOffset(R.styleable.RecycleListView_paddingBottomNoButtons, -1);
|
||||
this.mPaddingTopNoTitle = obtainStyledAttributes.getDimensionPixelOffset(R.styleable.RecycleListView_paddingTopNoTitle, -1);
|
||||
}
|
||||
|
||||
public void setHasDecor(boolean z, boolean z2) {
|
||||
if (z2 && z) {
|
||||
return;
|
||||
}
|
||||
setPadding(getPaddingLeft(), z ? getPaddingTop() : this.mPaddingTopNoTitle, getPaddingRight(), z2 ? getPaddingBottom() : this.mPaddingBottomNoButtons);
|
||||
}
|
||||
}
|
||||
|
||||
public static class AlertParams {
|
||||
public ListAdapter mAdapter;
|
||||
public boolean[] mCheckedItems;
|
||||
public final Context mContext;
|
||||
public Cursor mCursor;
|
||||
public View mCustomTitleView;
|
||||
public boolean mForceInverseBackground;
|
||||
public Drawable mIcon;
|
||||
public final LayoutInflater mInflater;
|
||||
public String mIsCheckedColumn;
|
||||
public boolean mIsMultiChoice;
|
||||
public boolean mIsSingleChoice;
|
||||
public CharSequence[] mItems;
|
||||
public String mLabelColumn;
|
||||
public CharSequence mMessage;
|
||||
public Drawable mNegativeButtonIcon;
|
||||
public DialogInterface.OnClickListener mNegativeButtonListener;
|
||||
public CharSequence mNegativeButtonText;
|
||||
public Drawable mNeutralButtonIcon;
|
||||
public DialogInterface.OnClickListener mNeutralButtonListener;
|
||||
public CharSequence mNeutralButtonText;
|
||||
public DialogInterface.OnCancelListener mOnCancelListener;
|
||||
public DialogInterface.OnMultiChoiceClickListener mOnCheckboxClickListener;
|
||||
public DialogInterface.OnClickListener mOnClickListener;
|
||||
public DialogInterface.OnDismissListener mOnDismissListener;
|
||||
public AdapterView.OnItemSelectedListener mOnItemSelectedListener;
|
||||
public DialogInterface.OnKeyListener mOnKeyListener;
|
||||
public OnPrepareListViewListener mOnPrepareListViewListener;
|
||||
public Drawable mPositiveButtonIcon;
|
||||
public DialogInterface.OnClickListener mPositiveButtonListener;
|
||||
public CharSequence mPositiveButtonText;
|
||||
public CharSequence mTitle;
|
||||
public View mView;
|
||||
public int mViewLayoutResId;
|
||||
public int mViewSpacingBottom;
|
||||
public int mViewSpacingLeft;
|
||||
public int mViewSpacingRight;
|
||||
public int mViewSpacingTop;
|
||||
public int mIconId = 0;
|
||||
public int mIconAttrId = 0;
|
||||
public boolean mViewSpacingSpecified = false;
|
||||
public int mCheckedItem = -1;
|
||||
public boolean mRecycleOnMeasure = true;
|
||||
public boolean mCancelable = true;
|
||||
|
||||
public interface OnPrepareListViewListener {
|
||||
void onPrepareListView(ListView listView);
|
||||
}
|
||||
|
||||
public AlertParams(Context context) {
|
||||
this.mContext = context;
|
||||
this.mInflater = (LayoutInflater) context.getSystemService("layout_inflater");
|
||||
}
|
||||
|
||||
public void apply(AlertController alertController) {
|
||||
View view = this.mCustomTitleView;
|
||||
if (view != null) {
|
||||
alertController.setCustomTitle(view);
|
||||
} else {
|
||||
CharSequence charSequence = this.mTitle;
|
||||
if (charSequence != null) {
|
||||
alertController.setTitle(charSequence);
|
||||
}
|
||||
Drawable drawable = this.mIcon;
|
||||
if (drawable != null) {
|
||||
alertController.setIcon(drawable);
|
||||
}
|
||||
int i = this.mIconId;
|
||||
if (i != 0) {
|
||||
alertController.setIcon(i);
|
||||
}
|
||||
int i2 = this.mIconAttrId;
|
||||
if (i2 != 0) {
|
||||
alertController.setIcon(alertController.getIconAttributeResId(i2));
|
||||
}
|
||||
}
|
||||
CharSequence charSequence2 = this.mMessage;
|
||||
if (charSequence2 != null) {
|
||||
alertController.setMessage(charSequence2);
|
||||
}
|
||||
CharSequence charSequence3 = this.mPositiveButtonText;
|
||||
if (charSequence3 != null || this.mPositiveButtonIcon != null) {
|
||||
alertController.setButton(-1, charSequence3, this.mPositiveButtonListener, null, this.mPositiveButtonIcon);
|
||||
}
|
||||
CharSequence charSequence4 = this.mNegativeButtonText;
|
||||
if (charSequence4 != null || this.mNegativeButtonIcon != null) {
|
||||
alertController.setButton(-2, charSequence4, this.mNegativeButtonListener, null, this.mNegativeButtonIcon);
|
||||
}
|
||||
CharSequence charSequence5 = this.mNeutralButtonText;
|
||||
if (charSequence5 != null || this.mNeutralButtonIcon != null) {
|
||||
alertController.setButton(-3, charSequence5, this.mNeutralButtonListener, null, this.mNeutralButtonIcon);
|
||||
}
|
||||
if (this.mItems != null || this.mCursor != null || this.mAdapter != null) {
|
||||
createListView(alertController);
|
||||
}
|
||||
View view2 = this.mView;
|
||||
if (view2 != null) {
|
||||
if (this.mViewSpacingSpecified) {
|
||||
alertController.setView(view2, this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom);
|
||||
return;
|
||||
} else {
|
||||
alertController.setView(view2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
int i3 = this.mViewLayoutResId;
|
||||
if (i3 != 0) {
|
||||
alertController.setView(i3);
|
||||
}
|
||||
}
|
||||
|
||||
private void createListView(final AlertController alertController) {
|
||||
int i;
|
||||
ListAdapter listAdapter;
|
||||
final RecycleListView recycleListView = (RecycleListView) this.mInflater.inflate(alertController.mListLayout, (ViewGroup) null);
|
||||
if (!this.mIsMultiChoice) {
|
||||
if (this.mIsSingleChoice) {
|
||||
i = alertController.mSingleChoiceItemLayout;
|
||||
} else {
|
||||
i = alertController.mListItemLayout;
|
||||
}
|
||||
int i2 = i;
|
||||
if (this.mCursor != null) {
|
||||
listAdapter = new SimpleCursorAdapter(this.mContext, i2, this.mCursor, new String[]{this.mLabelColumn}, new int[]{android.R.id.text1});
|
||||
} else {
|
||||
listAdapter = this.mAdapter;
|
||||
if (listAdapter == null) {
|
||||
listAdapter = new CheckedItemAdapter(this.mContext, i2, android.R.id.text1, this.mItems);
|
||||
}
|
||||
}
|
||||
} else if (this.mCursor == null) {
|
||||
listAdapter = new ArrayAdapter<CharSequence>(this.mContext, alertController.mMultiChoiceItemLayout, android.R.id.text1, this.mItems) { // from class: androidx.appcompat.app.AlertController.AlertParams.1
|
||||
@Override // android.widget.ArrayAdapter, android.widget.Adapter
|
||||
public View getView(int i3, View view, ViewGroup viewGroup) {
|
||||
View view2 = super.getView(i3, view, viewGroup);
|
||||
if (AlertParams.this.mCheckedItems != null && AlertParams.this.mCheckedItems[i3]) {
|
||||
recycleListView.setItemChecked(i3, true);
|
||||
}
|
||||
return view2;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
listAdapter = new CursorAdapter(this.mContext, this.mCursor, false) { // from class: androidx.appcompat.app.AlertController.AlertParams.2
|
||||
private final int mIsCheckedIndex;
|
||||
private final int mLabelIndex;
|
||||
|
||||
{
|
||||
Cursor cursor = getCursor();
|
||||
this.mLabelIndex = cursor.getColumnIndexOrThrow(AlertParams.this.mLabelColumn);
|
||||
this.mIsCheckedIndex = cursor.getColumnIndexOrThrow(AlertParams.this.mIsCheckedColumn);
|
||||
}
|
||||
|
||||
@Override // android.widget.CursorAdapter
|
||||
public void bindView(View view, Context context, Cursor cursor) {
|
||||
((CheckedTextView) view.findViewById(android.R.id.text1)).setText(cursor.getString(this.mLabelIndex));
|
||||
recycleListView.setItemChecked(cursor.getPosition(), cursor.getInt(this.mIsCheckedIndex) == 1);
|
||||
}
|
||||
|
||||
@Override // android.widget.CursorAdapter
|
||||
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
|
||||
return AlertParams.this.mInflater.inflate(alertController.mMultiChoiceItemLayout, viewGroup, false);
|
||||
}
|
||||
};
|
||||
}
|
||||
OnPrepareListViewListener onPrepareListViewListener = this.mOnPrepareListViewListener;
|
||||
if (onPrepareListViewListener != null) {
|
||||
onPrepareListViewListener.onPrepareListView(recycleListView);
|
||||
}
|
||||
alertController.mAdapter = listAdapter;
|
||||
alertController.mCheckedItem = this.mCheckedItem;
|
||||
if (this.mOnClickListener != null) {
|
||||
recycleListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { // from class: androidx.appcompat.app.AlertController.AlertParams.3
|
||||
@Override // android.widget.AdapterView.OnItemClickListener
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i3, long j) {
|
||||
AlertParams.this.mOnClickListener.onClick(alertController.mDialog, i3);
|
||||
if (AlertParams.this.mIsSingleChoice) {
|
||||
return;
|
||||
}
|
||||
alertController.mDialog.dismiss();
|
||||
}
|
||||
});
|
||||
} else if (this.mOnCheckboxClickListener != null) {
|
||||
recycleListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { // from class: androidx.appcompat.app.AlertController.AlertParams.4
|
||||
@Override // android.widget.AdapterView.OnItemClickListener
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i3, long j) {
|
||||
if (AlertParams.this.mCheckedItems != null) {
|
||||
AlertParams.this.mCheckedItems[i3] = recycleListView.isItemChecked(i3);
|
||||
}
|
||||
AlertParams.this.mOnCheckboxClickListener.onClick(alertController.mDialog, i3, recycleListView.isItemChecked(i3));
|
||||
}
|
||||
});
|
||||
}
|
||||
AdapterView.OnItemSelectedListener onItemSelectedListener = this.mOnItemSelectedListener;
|
||||
if (onItemSelectedListener != null) {
|
||||
recycleListView.setOnItemSelectedListener(onItemSelectedListener);
|
||||
}
|
||||
if (this.mIsSingleChoice) {
|
||||
recycleListView.setChoiceMode(1);
|
||||
} else if (this.mIsMultiChoice) {
|
||||
recycleListView.setChoiceMode(2);
|
||||
}
|
||||
alertController.mListView = recycleListView;
|
||||
}
|
||||
}
|
||||
|
||||
private static class CheckedItemAdapter extends ArrayAdapter<CharSequence> {
|
||||
@Override // android.widget.ArrayAdapter, android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter, android.widget.Adapter
|
||||
public boolean hasStableIds() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public CheckedItemAdapter(Context context, int i, int i2, CharSequence[] charSequenceArr) {
|
||||
super(context, i, i2, charSequenceArr);
|
||||
}
|
||||
}
|
||||
}
|
||||
416
02-Easy5/E5/sources/androidx/appcompat/app/AlertDialog.java
Normal file
416
02-Easy5/E5/sources/androidx/appcompat/app/AlertDialog.java
Normal file
@@ -0,0 +1,416 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.app.AlertController;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AlertDialog extends AppCompatDialog implements DialogInterface {
|
||||
static final int LAYOUT_HINT_NONE = 0;
|
||||
static final int LAYOUT_HINT_SIDE = 1;
|
||||
final AlertController mAlert;
|
||||
|
||||
protected AlertDialog(Context context) {
|
||||
this(context, 0);
|
||||
}
|
||||
|
||||
protected AlertDialog(Context context, int i) {
|
||||
super(context, resolveDialogTheme(context, i));
|
||||
this.mAlert = new AlertController(getContext(), this, getWindow());
|
||||
}
|
||||
|
||||
protected AlertDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
|
||||
this(context, 0);
|
||||
setCancelable(z);
|
||||
setOnCancelListener(onCancelListener);
|
||||
}
|
||||
|
||||
static int resolveDialogTheme(Context context, int i) {
|
||||
if (((i >>> 24) & 255) >= 1) {
|
||||
return i;
|
||||
}
|
||||
TypedValue typedValue = new TypedValue();
|
||||
context.getTheme().resolveAttribute(R.attr.alertDialogTheme, typedValue, true);
|
||||
return typedValue.resourceId;
|
||||
}
|
||||
|
||||
public Button getButton(int i) {
|
||||
return this.mAlert.getButton(i);
|
||||
}
|
||||
|
||||
public ListView getListView() {
|
||||
return this.mAlert.getListView();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatDialog, android.app.Dialog
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
super.setTitle(charSequence);
|
||||
this.mAlert.setTitle(charSequence);
|
||||
}
|
||||
|
||||
public void setCustomTitle(View view) {
|
||||
this.mAlert.setCustomTitle(view);
|
||||
}
|
||||
|
||||
public void setMessage(CharSequence charSequence) {
|
||||
this.mAlert.setMessage(charSequence);
|
||||
}
|
||||
|
||||
public void setView(View view) {
|
||||
this.mAlert.setView(view);
|
||||
}
|
||||
|
||||
public void setView(View view, int i, int i2, int i3, int i4) {
|
||||
this.mAlert.setView(view, i, i2, i3, i4);
|
||||
}
|
||||
|
||||
void setButtonPanelLayoutHint(int i) {
|
||||
this.mAlert.setButtonPanelLayoutHint(i);
|
||||
}
|
||||
|
||||
public void setButton(int i, CharSequence charSequence, Message message) {
|
||||
this.mAlert.setButton(i, charSequence, null, message, null);
|
||||
}
|
||||
|
||||
public void setButton(int i, CharSequence charSequence, DialogInterface.OnClickListener onClickListener) {
|
||||
this.mAlert.setButton(i, charSequence, onClickListener, null, null);
|
||||
}
|
||||
|
||||
public void setButton(int i, CharSequence charSequence, Drawable drawable, DialogInterface.OnClickListener onClickListener) {
|
||||
this.mAlert.setButton(i, charSequence, onClickListener, null, drawable);
|
||||
}
|
||||
|
||||
public void setIcon(int i) {
|
||||
this.mAlert.setIcon(i);
|
||||
}
|
||||
|
||||
public void setIcon(Drawable drawable) {
|
||||
this.mAlert.setIcon(drawable);
|
||||
}
|
||||
|
||||
public void setIconAttribute(int i) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
getContext().getTheme().resolveAttribute(i, typedValue, true);
|
||||
this.mAlert.setIcon(typedValue.resourceId);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatDialog, androidx.activity.ComponentDialog, android.app.Dialog
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
this.mAlert.installContent();
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (this.mAlert.onKeyDown(i, keyEvent)) {
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog, android.view.KeyEvent.Callback
|
||||
public boolean onKeyUp(int i, KeyEvent keyEvent) {
|
||||
if (this.mAlert.onKeyUp(i, keyEvent)) {
|
||||
return true;
|
||||
}
|
||||
return super.onKeyUp(i, keyEvent);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final AlertController.AlertParams P;
|
||||
private final int mTheme;
|
||||
|
||||
public Builder(Context context) {
|
||||
this(context, AlertDialog.resolveDialogTheme(context, 0));
|
||||
}
|
||||
|
||||
public Builder(Context context, int i) {
|
||||
this.P = new AlertController.AlertParams(new ContextThemeWrapper(context, AlertDialog.resolveDialogTheme(context, i)));
|
||||
this.mTheme = i;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return this.P.mContext;
|
||||
}
|
||||
|
||||
public Builder setTitle(int i) {
|
||||
AlertController.AlertParams alertParams = this.P;
|
||||
alertParams.mTitle = alertParams.mContext.getText(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTitle(CharSequence charSequence) {
|
||||
this.P.mTitle = charSequence;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCustomTitle(View view) {
|
||||
this.P.mCustomTitleView = view;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMessage(int i) {
|
||||
AlertController.AlertParams alertParams = this.P;
|
||||
alertParams.mMessage = alertParams.mContext.getText(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMessage(CharSequence charSequence) {
|
||||
this.P.mMessage = charSequence;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setIcon(int i) {
|
||||
this.P.mIconId = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setIcon(Drawable drawable) {
|
||||
this.P.mIcon = drawable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setIconAttribute(int i) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
this.P.mContext.getTheme().resolveAttribute(i, typedValue, true);
|
||||
this.P.mIconId = typedValue.resourceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPositiveButton(int i, DialogInterface.OnClickListener onClickListener) {
|
||||
AlertController.AlertParams alertParams = this.P;
|
||||
alertParams.mPositiveButtonText = alertParams.mContext.getText(i);
|
||||
this.P.mPositiveButtonListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPositiveButton(CharSequence charSequence, DialogInterface.OnClickListener onClickListener) {
|
||||
this.P.mPositiveButtonText = charSequence;
|
||||
this.P.mPositiveButtonListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPositiveButtonIcon(Drawable drawable) {
|
||||
this.P.mPositiveButtonIcon = drawable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNegativeButton(int i, DialogInterface.OnClickListener onClickListener) {
|
||||
AlertController.AlertParams alertParams = this.P;
|
||||
alertParams.mNegativeButtonText = alertParams.mContext.getText(i);
|
||||
this.P.mNegativeButtonListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNegativeButton(CharSequence charSequence, DialogInterface.OnClickListener onClickListener) {
|
||||
this.P.mNegativeButtonText = charSequence;
|
||||
this.P.mNegativeButtonListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNegativeButtonIcon(Drawable drawable) {
|
||||
this.P.mNegativeButtonIcon = drawable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNeutralButton(int i, DialogInterface.OnClickListener onClickListener) {
|
||||
AlertController.AlertParams alertParams = this.P;
|
||||
alertParams.mNeutralButtonText = alertParams.mContext.getText(i);
|
||||
this.P.mNeutralButtonListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNeutralButton(CharSequence charSequence, DialogInterface.OnClickListener onClickListener) {
|
||||
this.P.mNeutralButtonText = charSequence;
|
||||
this.P.mNeutralButtonListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNeutralButtonIcon(Drawable drawable) {
|
||||
this.P.mNeutralButtonIcon = drawable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCancelable(boolean z) {
|
||||
this.P.mCancelable = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
|
||||
this.P.mOnCancelListener = onCancelListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
|
||||
this.P.mOnDismissListener = onDismissListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) {
|
||||
this.P.mOnKeyListener = onKeyListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setItems(int i, DialogInterface.OnClickListener onClickListener) {
|
||||
AlertController.AlertParams alertParams = this.P;
|
||||
alertParams.mItems = alertParams.mContext.getResources().getTextArray(i);
|
||||
this.P.mOnClickListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setItems(CharSequence[] charSequenceArr, DialogInterface.OnClickListener onClickListener) {
|
||||
this.P.mItems = charSequenceArr;
|
||||
this.P.mOnClickListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAdapter(ListAdapter listAdapter, DialogInterface.OnClickListener onClickListener) {
|
||||
this.P.mAdapter = listAdapter;
|
||||
this.P.mOnClickListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCursor(Cursor cursor, DialogInterface.OnClickListener onClickListener, String str) {
|
||||
this.P.mCursor = cursor;
|
||||
this.P.mLabelColumn = str;
|
||||
this.P.mOnClickListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMultiChoiceItems(int i, boolean[] zArr, DialogInterface.OnMultiChoiceClickListener onMultiChoiceClickListener) {
|
||||
AlertController.AlertParams alertParams = this.P;
|
||||
alertParams.mItems = alertParams.mContext.getResources().getTextArray(i);
|
||||
this.P.mOnCheckboxClickListener = onMultiChoiceClickListener;
|
||||
this.P.mCheckedItems = zArr;
|
||||
this.P.mIsMultiChoice = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMultiChoiceItems(CharSequence[] charSequenceArr, boolean[] zArr, DialogInterface.OnMultiChoiceClickListener onMultiChoiceClickListener) {
|
||||
this.P.mItems = charSequenceArr;
|
||||
this.P.mOnCheckboxClickListener = onMultiChoiceClickListener;
|
||||
this.P.mCheckedItems = zArr;
|
||||
this.P.mIsMultiChoice = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMultiChoiceItems(Cursor cursor, String str, String str2, DialogInterface.OnMultiChoiceClickListener onMultiChoiceClickListener) {
|
||||
this.P.mCursor = cursor;
|
||||
this.P.mOnCheckboxClickListener = onMultiChoiceClickListener;
|
||||
this.P.mIsCheckedColumn = str;
|
||||
this.P.mLabelColumn = str2;
|
||||
this.P.mIsMultiChoice = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSingleChoiceItems(int i, int i2, DialogInterface.OnClickListener onClickListener) {
|
||||
AlertController.AlertParams alertParams = this.P;
|
||||
alertParams.mItems = alertParams.mContext.getResources().getTextArray(i);
|
||||
this.P.mOnClickListener = onClickListener;
|
||||
this.P.mCheckedItem = i2;
|
||||
this.P.mIsSingleChoice = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSingleChoiceItems(Cursor cursor, int i, String str, DialogInterface.OnClickListener onClickListener) {
|
||||
this.P.mCursor = cursor;
|
||||
this.P.mOnClickListener = onClickListener;
|
||||
this.P.mCheckedItem = i;
|
||||
this.P.mLabelColumn = str;
|
||||
this.P.mIsSingleChoice = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSingleChoiceItems(CharSequence[] charSequenceArr, int i, DialogInterface.OnClickListener onClickListener) {
|
||||
this.P.mItems = charSequenceArr;
|
||||
this.P.mOnClickListener = onClickListener;
|
||||
this.P.mCheckedItem = i;
|
||||
this.P.mIsSingleChoice = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSingleChoiceItems(ListAdapter listAdapter, int i, DialogInterface.OnClickListener onClickListener) {
|
||||
this.P.mAdapter = listAdapter;
|
||||
this.P.mOnClickListener = onClickListener;
|
||||
this.P.mCheckedItem = i;
|
||||
this.P.mIsSingleChoice = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOnItemSelectedListener(AdapterView.OnItemSelectedListener onItemSelectedListener) {
|
||||
this.P.mOnItemSelectedListener = onItemSelectedListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setView(int i) {
|
||||
this.P.mView = null;
|
||||
this.P.mViewLayoutResId = i;
|
||||
this.P.mViewSpacingSpecified = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setView(View view) {
|
||||
this.P.mView = view;
|
||||
this.P.mViewLayoutResId = 0;
|
||||
this.P.mViewSpacingSpecified = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Builder setView(View view, int i, int i2, int i3, int i4) {
|
||||
this.P.mView = view;
|
||||
this.P.mViewLayoutResId = 0;
|
||||
this.P.mViewSpacingSpecified = true;
|
||||
this.P.mViewSpacingLeft = i;
|
||||
this.P.mViewSpacingTop = i2;
|
||||
this.P.mViewSpacingRight = i3;
|
||||
this.P.mViewSpacingBottom = i4;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Builder setInverseBackgroundForced(boolean z) {
|
||||
this.P.mForceInverseBackground = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setRecycleOnMeasureEnabled(boolean z) {
|
||||
this.P.mRecycleOnMeasure = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlertDialog create() {
|
||||
AlertDialog alertDialog = new AlertDialog(this.P.mContext, this.mTheme);
|
||||
this.P.apply(alertDialog.mAlert);
|
||||
alertDialog.setCancelable(this.P.mCancelable);
|
||||
if (this.P.mCancelable) {
|
||||
alertDialog.setCanceledOnTouchOutside(true);
|
||||
}
|
||||
alertDialog.setOnCancelListener(this.P.mOnCancelListener);
|
||||
alertDialog.setOnDismissListener(this.P.mOnDismissListener);
|
||||
if (this.P.mOnKeyListener != null) {
|
||||
alertDialog.setOnKeyListener(this.P.mOnKeyListener);
|
||||
}
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
public AlertDialog show() {
|
||||
AlertDialog create = create();
|
||||
create.show();
|
||||
return create;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,360 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import androidx.activity.ViewTreeOnBackPressedDispatcherOwner;
|
||||
import androidx.activity.contextaware.OnContextAvailableListener;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.appcompat.widget.VectorEnabledTintResources;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.NavUtils;
|
||||
import androidx.core.app.TaskStackBuilder;
|
||||
import androidx.core.os.LocaleListCompat;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.ViewTreeLifecycleOwner;
|
||||
import androidx.lifecycle.ViewTreeViewModelStoreOwner;
|
||||
import androidx.savedstate.SavedStateRegistry;
|
||||
import androidx.savedstate.ViewTreeSavedStateRegistryOwner;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatActivity extends FragmentActivity implements AppCompatCallback, TaskStackBuilder.SupportParentable, ActionBarDrawerToggle.DelegateProvider {
|
||||
private static final String DELEGATE_TAG = "androidx:appcompat";
|
||||
private AppCompatDelegate mDelegate;
|
||||
private Resources mResources;
|
||||
|
||||
protected void onLocalesChanged(LocaleListCompat localeListCompat) {
|
||||
}
|
||||
|
||||
protected void onNightModeChanged(int i) {
|
||||
}
|
||||
|
||||
public void onPrepareSupportNavigateUpTaskStack(TaskStackBuilder taskStackBuilder) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatCallback
|
||||
public void onSupportActionModeFinished(ActionMode actionMode) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatCallback
|
||||
public void onSupportActionModeStarted(ActionMode actionMode) {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void onSupportContentChanged() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatCallback
|
||||
public ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setSupportProgress(int i) {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setSupportProgressBarIndeterminate(boolean z) {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setSupportProgressBarIndeterminateVisibility(boolean z) {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setSupportProgressBarVisibility(boolean z) {
|
||||
}
|
||||
|
||||
public AppCompatActivity() {
|
||||
initDelegate();
|
||||
}
|
||||
|
||||
public AppCompatActivity(int i) {
|
||||
super(i);
|
||||
initDelegate();
|
||||
}
|
||||
|
||||
private void initDelegate() {
|
||||
getSavedStateRegistry().registerSavedStateProvider(DELEGATE_TAG, new SavedStateRegistry.SavedStateProvider() { // from class: androidx.appcompat.app.AppCompatActivity.1
|
||||
@Override // androidx.savedstate.SavedStateRegistry.SavedStateProvider
|
||||
public Bundle saveState() {
|
||||
Bundle bundle = new Bundle();
|
||||
AppCompatActivity.this.getDelegate().onSaveInstanceState(bundle);
|
||||
return bundle;
|
||||
}
|
||||
});
|
||||
addOnContextAvailableListener(new OnContextAvailableListener() { // from class: androidx.appcompat.app.AppCompatActivity.2
|
||||
@Override // androidx.activity.contextaware.OnContextAvailableListener
|
||||
public void onContextAvailable(Context context) {
|
||||
AppCompatDelegate delegate = AppCompatActivity.this.getDelegate();
|
||||
delegate.installViewFactory();
|
||||
delegate.onCreate(AppCompatActivity.this.getSavedStateRegistry().consumeRestoredStateForKey(AppCompatActivity.DELEGATE_TAG));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.ContextThemeWrapper, android.content.ContextWrapper
|
||||
protected void attachBaseContext(Context context) {
|
||||
super.attachBaseContext(getDelegate().attachBaseContext2(context));
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.ContextThemeWrapper, android.content.ContextWrapper, android.content.Context
|
||||
public void setTheme(int i) {
|
||||
super.setTheme(i);
|
||||
getDelegate().setTheme(i);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onPostCreate(Bundle bundle) {
|
||||
super.onPostCreate(bundle);
|
||||
getDelegate().onPostCreate(bundle);
|
||||
}
|
||||
|
||||
public ActionBar getSupportActionBar() {
|
||||
return getDelegate().getSupportActionBar();
|
||||
}
|
||||
|
||||
public void setSupportActionBar(Toolbar toolbar) {
|
||||
getDelegate().setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public MenuInflater getMenuInflater() {
|
||||
return getDelegate().getMenuInflater();
|
||||
}
|
||||
|
||||
@Override // androidx.activity.ComponentActivity, android.app.Activity
|
||||
public void setContentView(int i) {
|
||||
initViewTreeOwners();
|
||||
getDelegate().setContentView(i);
|
||||
}
|
||||
|
||||
@Override // androidx.activity.ComponentActivity, android.app.Activity
|
||||
public void setContentView(View view) {
|
||||
initViewTreeOwners();
|
||||
getDelegate().setContentView(view);
|
||||
}
|
||||
|
||||
@Override // androidx.activity.ComponentActivity, android.app.Activity
|
||||
public void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
|
||||
initViewTreeOwners();
|
||||
getDelegate().setContentView(view, layoutParams);
|
||||
}
|
||||
|
||||
@Override // androidx.activity.ComponentActivity, android.app.Activity
|
||||
public void addContentView(View view, ViewGroup.LayoutParams layoutParams) {
|
||||
initViewTreeOwners();
|
||||
getDelegate().addContentView(view, layoutParams);
|
||||
}
|
||||
|
||||
private void initViewTreeOwners() {
|
||||
ViewTreeLifecycleOwner.set(getWindow().getDecorView(), this);
|
||||
ViewTreeViewModelStoreOwner.set(getWindow().getDecorView(), this);
|
||||
ViewTreeSavedStateRegistryOwner.set(getWindow().getDecorView(), this);
|
||||
ViewTreeOnBackPressedDispatcherOwner.set(getWindow().getDecorView(), this);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, android.app.Activity, android.content.ComponentCallbacks
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
getDelegate().onConfigurationChanged(configuration);
|
||||
if (this.mResources != null) {
|
||||
this.mResources.updateConfiguration(super.getResources().getConfiguration(), super.getResources().getDisplayMetrics());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
getDelegate().onPostResume();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
getDelegate().onStart();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getDelegate().onStop();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public <T extends View> T findViewById(int i) {
|
||||
return (T) getDelegate().findViewById(i);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, android.app.Activity, android.view.Window.Callback
|
||||
public final boolean onMenuItemSelected(int i, MenuItem menuItem) {
|
||||
if (super.onMenuItemSelected(i, menuItem)) {
|
||||
return true;
|
||||
}
|
||||
ActionBar supportActionBar = getSupportActionBar();
|
||||
if (menuItem.getItemId() != 16908332 || supportActionBar == null || (supportActionBar.getDisplayOptions() & 4) == 0) {
|
||||
return false;
|
||||
}
|
||||
return onSupportNavigateUp();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
getDelegate().onDestroy();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onTitleChanged(CharSequence charSequence, int i) {
|
||||
super.onTitleChanged(charSequence, i);
|
||||
getDelegate().setTitle(charSequence);
|
||||
}
|
||||
|
||||
public boolean supportRequestWindowFeature(int i) {
|
||||
return getDelegate().requestWindowFeature(i);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity
|
||||
public void supportInvalidateOptionsMenu() {
|
||||
getDelegate().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void invalidateOptionsMenu() {
|
||||
getDelegate().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
public ActionMode startSupportActionMode(ActionMode.Callback callback) {
|
||||
return getDelegate().startSupportActionMode(callback);
|
||||
}
|
||||
|
||||
public void onCreateSupportNavigateUpTaskStack(TaskStackBuilder taskStackBuilder) {
|
||||
taskStackBuilder.addParentStack(this);
|
||||
}
|
||||
|
||||
public boolean onSupportNavigateUp() {
|
||||
Intent supportParentActivityIntent = getSupportParentActivityIntent();
|
||||
if (supportParentActivityIntent == null) {
|
||||
return false;
|
||||
}
|
||||
if (supportShouldUpRecreateTask(supportParentActivityIntent)) {
|
||||
TaskStackBuilder create = TaskStackBuilder.create(this);
|
||||
onCreateSupportNavigateUpTaskStack(create);
|
||||
onPrepareSupportNavigateUpTaskStack(create);
|
||||
create.startActivities();
|
||||
try {
|
||||
ActivityCompat.finishAffinity(this);
|
||||
return true;
|
||||
} catch (IllegalStateException unused) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
supportNavigateUpTo(supportParentActivityIntent);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.core.app.TaskStackBuilder.SupportParentable
|
||||
public Intent getSupportParentActivityIntent() {
|
||||
return NavUtils.getParentActivityIntent(this);
|
||||
}
|
||||
|
||||
public boolean supportShouldUpRecreateTask(Intent intent) {
|
||||
return NavUtils.shouldUpRecreateTask(this, intent);
|
||||
}
|
||||
|
||||
public void supportNavigateUpTo(Intent intent) {
|
||||
NavUtils.navigateUpTo(this, intent);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.Window.Callback
|
||||
public void onContentChanged() {
|
||||
onSupportContentChanged();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBarDrawerToggle.DelegateProvider
|
||||
public ActionBarDrawerToggle.Delegate getDrawerToggleDelegate() {
|
||||
return getDelegate().getDrawerToggleDelegate();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.Window.Callback
|
||||
public boolean onMenuOpened(int i, Menu menu) {
|
||||
return super.onMenuOpened(i, menu);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, android.app.Activity, android.view.Window.Callback
|
||||
public void onPanelClosed(int i, Menu menu) {
|
||||
super.onPanelClosed(i, menu);
|
||||
}
|
||||
|
||||
public AppCompatDelegate getDelegate() {
|
||||
if (this.mDelegate == null) {
|
||||
this.mDelegate = AppCompatDelegate.create(this, this);
|
||||
}
|
||||
return this.mDelegate;
|
||||
}
|
||||
|
||||
@Override // androidx.core.app.ComponentActivity, android.app.Activity, android.view.Window.Callback
|
||||
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
||||
int keyCode = keyEvent.getKeyCode();
|
||||
ActionBar supportActionBar = getSupportActionBar();
|
||||
if (keyCode == 82 && supportActionBar != null && supportActionBar.onMenuKeyEvent(keyEvent)) {
|
||||
return true;
|
||||
}
|
||||
return super.dispatchKeyEvent(keyEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.ContextThemeWrapper, android.content.ContextWrapper, android.content.Context
|
||||
public Resources getResources() {
|
||||
if (this.mResources == null && VectorEnabledTintResources.shouldBeUsed()) {
|
||||
this.mResources = new VectorEnabledTintResources(this, super.getResources());
|
||||
}
|
||||
Resources resources = this.mResources;
|
||||
return resources == null ? super.getResources() : resources;
|
||||
}
|
||||
|
||||
private boolean performMenuItemShortcut(KeyEvent keyEvent) {
|
||||
Window window;
|
||||
return (Build.VERSION.SDK_INT >= 26 || keyEvent.isCtrlPressed() || KeyEvent.metaStateHasNoModifiers(keyEvent.getMetaState()) || keyEvent.getRepeatCount() != 0 || KeyEvent.isModifierKey(keyEvent.getKeyCode()) || (window = getWindow()) == null || window.getDecorView() == null || !window.getDecorView().dispatchKeyShortcutEvent(keyEvent)) ? false : true;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (performMenuItemShortcut(keyEvent)) {
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void openOptionsMenu() {
|
||||
ActionBar supportActionBar = getSupportActionBar();
|
||||
if (getWindow().hasFeature(0)) {
|
||||
if (supportActionBar == null || !supportActionBar.openOptionsMenu()) {
|
||||
super.openOptionsMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void closeOptionsMenu() {
|
||||
ActionBar supportActionBar = getSupportActionBar();
|
||||
if (getWindow().hasFeature(0)) {
|
||||
if (supportActionBar == null || !supportActionBar.closeOptionsMenu()) {
|
||||
super.closeOptionsMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface AppCompatCallback {
|
||||
void onSupportActionModeFinished(ActionMode actionMode);
|
||||
|
||||
void onSupportActionModeStarted(ActionMode actionMode);
|
||||
|
||||
ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback);
|
||||
}
|
||||
@@ -0,0 +1,382 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.LocaleManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.LocaleList;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.window.OnBackInvokedDispatcher;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppLocalesStorageHelper;
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.appcompat.widget.VectorEnabledTintResources;
|
||||
import androidx.collection.ArraySet;
|
||||
import androidx.core.os.BuildCompat;
|
||||
import androidx.core.os.LocaleListCompat;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AppCompatDelegate {
|
||||
static final boolean DEBUG = false;
|
||||
public static final int FEATURE_ACTION_MODE_OVERLAY = 10;
|
||||
public static final int FEATURE_SUPPORT_ACTION_BAR = 108;
|
||||
public static final int FEATURE_SUPPORT_ACTION_BAR_OVERLAY = 109;
|
||||
|
||||
@Deprecated
|
||||
public static final int MODE_NIGHT_AUTO = 0;
|
||||
public static final int MODE_NIGHT_AUTO_BATTERY = 3;
|
||||
|
||||
@Deprecated
|
||||
public static final int MODE_NIGHT_AUTO_TIME = 0;
|
||||
public static final int MODE_NIGHT_FOLLOW_SYSTEM = -1;
|
||||
public static final int MODE_NIGHT_NO = 1;
|
||||
public static final int MODE_NIGHT_UNSPECIFIED = -100;
|
||||
public static final int MODE_NIGHT_YES = 2;
|
||||
static final String TAG = "AppCompatDelegate";
|
||||
static AppLocalesStorageHelper.SerialExecutor sSerialExecutorForLocalesStorage = new AppLocalesStorageHelper.SerialExecutor(new AppLocalesStorageHelper.ThreadPerTaskExecutor());
|
||||
private static int sDefaultNightMode = -100;
|
||||
private static LocaleListCompat sRequestedAppLocales = null;
|
||||
private static LocaleListCompat sStoredAppLocales = null;
|
||||
private static Boolean sIsAutoStoreLocalesOptedIn = null;
|
||||
private static boolean sIsFrameworkSyncChecked = false;
|
||||
private static final ArraySet<WeakReference<AppCompatDelegate>> sActivityDelegates = new ArraySet<>();
|
||||
private static final Object sActivityDelegatesLock = new Object();
|
||||
private static final Object sAppLocalesStorageSyncLock = new Object();
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface NightMode {
|
||||
}
|
||||
|
||||
public static int getDefaultNightMode() {
|
||||
return sDefaultNightMode;
|
||||
}
|
||||
|
||||
static LocaleListCompat getRequestedAppLocales() {
|
||||
return sRequestedAppLocales;
|
||||
}
|
||||
|
||||
static LocaleListCompat getStoredAppLocales() {
|
||||
return sStoredAppLocales;
|
||||
}
|
||||
|
||||
static void resetStaticRequestedAndStoredLocales() {
|
||||
sRequestedAppLocales = null;
|
||||
sStoredAppLocales = null;
|
||||
}
|
||||
|
||||
public abstract void addContentView(View view, ViewGroup.LayoutParams layoutParams);
|
||||
|
||||
boolean applyAppLocales() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract boolean applyDayNight();
|
||||
|
||||
@Deprecated
|
||||
public void attachBaseContext(Context context) {
|
||||
}
|
||||
|
||||
public abstract View createView(View view, String str, Context context, AttributeSet attributeSet);
|
||||
|
||||
public abstract <T extends View> T findViewById(int i);
|
||||
|
||||
public Context getContextForDelegate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract ActionBarDrawerToggle.Delegate getDrawerToggleDelegate();
|
||||
|
||||
public int getLocalNightMode() {
|
||||
return -100;
|
||||
}
|
||||
|
||||
public abstract MenuInflater getMenuInflater();
|
||||
|
||||
public abstract ActionBar getSupportActionBar();
|
||||
|
||||
public abstract boolean hasWindowFeature(int i);
|
||||
|
||||
public abstract void installViewFactory();
|
||||
|
||||
public abstract void invalidateOptionsMenu();
|
||||
|
||||
public abstract boolean isHandleNativeActionModesEnabled();
|
||||
|
||||
public abstract void onConfigurationChanged(Configuration configuration);
|
||||
|
||||
public abstract void onCreate(Bundle bundle);
|
||||
|
||||
public abstract void onDestroy();
|
||||
|
||||
public abstract void onPostCreate(Bundle bundle);
|
||||
|
||||
public abstract void onPostResume();
|
||||
|
||||
public abstract void onSaveInstanceState(Bundle bundle);
|
||||
|
||||
public abstract void onStart();
|
||||
|
||||
public abstract void onStop();
|
||||
|
||||
public abstract boolean requestWindowFeature(int i);
|
||||
|
||||
public abstract void setContentView(int i);
|
||||
|
||||
public abstract void setContentView(View view);
|
||||
|
||||
public abstract void setContentView(View view, ViewGroup.LayoutParams layoutParams);
|
||||
|
||||
public abstract void setHandleNativeActionModesEnabled(boolean z);
|
||||
|
||||
public abstract void setLocalNightMode(int i);
|
||||
|
||||
public void setOnBackInvokedDispatcher(OnBackInvokedDispatcher onBackInvokedDispatcher) {
|
||||
}
|
||||
|
||||
public abstract void setSupportActionBar(Toolbar toolbar);
|
||||
|
||||
public void setTheme(int i) {
|
||||
}
|
||||
|
||||
public abstract void setTitle(CharSequence charSequence);
|
||||
|
||||
public abstract ActionMode startSupportActionMode(ActionMode.Callback callback);
|
||||
|
||||
public static AppCompatDelegate create(Activity activity, AppCompatCallback appCompatCallback) {
|
||||
return new AppCompatDelegateImpl(activity, appCompatCallback);
|
||||
}
|
||||
|
||||
public static AppCompatDelegate create(Dialog dialog, AppCompatCallback appCompatCallback) {
|
||||
return new AppCompatDelegateImpl(dialog, appCompatCallback);
|
||||
}
|
||||
|
||||
public static AppCompatDelegate create(Context context, Window window, AppCompatCallback appCompatCallback) {
|
||||
return new AppCompatDelegateImpl(context, window, appCompatCallback);
|
||||
}
|
||||
|
||||
public static AppCompatDelegate create(Context context, Activity activity, AppCompatCallback appCompatCallback) {
|
||||
return new AppCompatDelegateImpl(context, activity, appCompatCallback);
|
||||
}
|
||||
|
||||
AppCompatDelegate() {
|
||||
}
|
||||
|
||||
public Context attachBaseContext2(Context context) {
|
||||
attachBaseContext(context);
|
||||
return context;
|
||||
}
|
||||
|
||||
public static void setDefaultNightMode(int i) {
|
||||
if (i != -1 && i != 0 && i != 1 && i != 2 && i != 3) {
|
||||
Log.d(TAG, "setDefaultNightMode() called with an unknown mode");
|
||||
} else if (sDefaultNightMode != i) {
|
||||
sDefaultNightMode = i;
|
||||
applyDayNightToActiveDelegates();
|
||||
}
|
||||
}
|
||||
|
||||
public static void setApplicationLocales(LocaleListCompat localeListCompat) {
|
||||
Objects.requireNonNull(localeListCompat);
|
||||
if (BuildCompat.isAtLeastT()) {
|
||||
Object localeManagerForApplication = getLocaleManagerForApplication();
|
||||
if (localeManagerForApplication != null) {
|
||||
Api33Impl.localeManagerSetApplicationLocales(localeManagerForApplication, Api24Impl.localeListForLanguageTags(localeListCompat.toLanguageTags()));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (localeListCompat.equals(sRequestedAppLocales)) {
|
||||
return;
|
||||
}
|
||||
synchronized (sActivityDelegatesLock) {
|
||||
sRequestedAppLocales = localeListCompat;
|
||||
applyLocalesToActiveDelegates();
|
||||
}
|
||||
}
|
||||
|
||||
public static LocaleListCompat getApplicationLocales() {
|
||||
if (BuildCompat.isAtLeastT()) {
|
||||
Object localeManagerForApplication = getLocaleManagerForApplication();
|
||||
if (localeManagerForApplication != null) {
|
||||
return LocaleListCompat.wrap(Api33Impl.localeManagerGetApplicationLocales(localeManagerForApplication));
|
||||
}
|
||||
} else {
|
||||
LocaleListCompat localeListCompat = sRequestedAppLocales;
|
||||
if (localeListCompat != null) {
|
||||
return localeListCompat;
|
||||
}
|
||||
}
|
||||
return LocaleListCompat.getEmptyLocaleList();
|
||||
}
|
||||
|
||||
static void setIsAutoStoreLocalesOptedIn(boolean z) {
|
||||
sIsAutoStoreLocalesOptedIn = Boolean.valueOf(z);
|
||||
}
|
||||
|
||||
static Object getLocaleManagerForApplication() {
|
||||
Context contextForDelegate;
|
||||
Iterator<WeakReference<AppCompatDelegate>> it = sActivityDelegates.iterator();
|
||||
while (it.hasNext()) {
|
||||
AppCompatDelegate appCompatDelegate = it.next().get();
|
||||
if (appCompatDelegate != null && (contextForDelegate = appCompatDelegate.getContextForDelegate()) != null) {
|
||||
return contextForDelegate.getSystemService("locale");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static boolean isAutoStorageOptedIn(Context context) {
|
||||
if (sIsAutoStoreLocalesOptedIn == null) {
|
||||
try {
|
||||
ServiceInfo serviceInfo = AppLocalesMetadataHolderService.getServiceInfo(context);
|
||||
if (serviceInfo.metaData != null) {
|
||||
sIsAutoStoreLocalesOptedIn = Boolean.valueOf(serviceInfo.metaData.getBoolean("autoStoreLocales"));
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException unused) {
|
||||
Log.d(TAG, "Checking for metadata for AppLocalesMetadataHolderService : Service not found");
|
||||
sIsAutoStoreLocalesOptedIn = false;
|
||||
}
|
||||
}
|
||||
return sIsAutoStoreLocalesOptedIn.booleanValue();
|
||||
}
|
||||
|
||||
void asyncExecuteSyncRequestedAndStoredLocales(final Context context) {
|
||||
sSerialExecutorForLocalesStorage.execute(new Runnable() { // from class: androidx.appcompat.app.AppCompatDelegate$$ExternalSyntheticLambda0
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
AppCompatDelegate.syncRequestedAndStoredLocales(context);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
public static void syncRequestedAndStoredLocales(final Context context) {
|
||||
if (isAutoStorageOptedIn(context)) {
|
||||
if (BuildCompat.isAtLeastT()) {
|
||||
if (sIsFrameworkSyncChecked) {
|
||||
return;
|
||||
}
|
||||
sSerialExecutorForLocalesStorage.execute(new Runnable() { // from class: androidx.appcompat.app.AppCompatDelegate$$ExternalSyntheticLambda1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
AppCompatDelegate.lambda$syncRequestedAndStoredLocales$1(context);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
synchronized (sAppLocalesStorageSyncLock) {
|
||||
LocaleListCompat localeListCompat = sRequestedAppLocales;
|
||||
if (localeListCompat == null) {
|
||||
if (sStoredAppLocales == null) {
|
||||
sStoredAppLocales = LocaleListCompat.forLanguageTags(AppLocalesStorageHelper.readLocales(context));
|
||||
}
|
||||
if (sStoredAppLocales.isEmpty()) {
|
||||
} else {
|
||||
sRequestedAppLocales = sStoredAppLocales;
|
||||
}
|
||||
} else if (!localeListCompat.equals(sStoredAppLocales)) {
|
||||
LocaleListCompat localeListCompat2 = sRequestedAppLocales;
|
||||
sStoredAppLocales = localeListCompat2;
|
||||
AppLocalesStorageHelper.persistLocales(context, localeListCompat2.toLanguageTags());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ void lambda$syncRequestedAndStoredLocales$1(Context context) {
|
||||
AppLocalesStorageHelper.syncLocalesToFramework(context);
|
||||
sIsFrameworkSyncChecked = true;
|
||||
}
|
||||
|
||||
public static void setCompatVectorFromResourcesEnabled(boolean z) {
|
||||
VectorEnabledTintResources.setCompatVectorFromResourcesEnabled(z);
|
||||
}
|
||||
|
||||
public static boolean isCompatVectorFromResourcesEnabled() {
|
||||
return VectorEnabledTintResources.isCompatVectorFromResourcesEnabled();
|
||||
}
|
||||
|
||||
static void addActiveDelegate(AppCompatDelegate appCompatDelegate) {
|
||||
synchronized (sActivityDelegatesLock) {
|
||||
removeDelegateFromActives(appCompatDelegate);
|
||||
sActivityDelegates.add(new WeakReference<>(appCompatDelegate));
|
||||
}
|
||||
}
|
||||
|
||||
static void removeActivityDelegate(AppCompatDelegate appCompatDelegate) {
|
||||
synchronized (sActivityDelegatesLock) {
|
||||
removeDelegateFromActives(appCompatDelegate);
|
||||
}
|
||||
}
|
||||
|
||||
private static void removeDelegateFromActives(AppCompatDelegate appCompatDelegate) {
|
||||
synchronized (sActivityDelegatesLock) {
|
||||
Iterator<WeakReference<AppCompatDelegate>> it = sActivityDelegates.iterator();
|
||||
while (it.hasNext()) {
|
||||
AppCompatDelegate appCompatDelegate2 = it.next().get();
|
||||
if (appCompatDelegate2 == appCompatDelegate || appCompatDelegate2 == null) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyDayNightToActiveDelegates() {
|
||||
synchronized (sActivityDelegatesLock) {
|
||||
Iterator<WeakReference<AppCompatDelegate>> it = sActivityDelegates.iterator();
|
||||
while (it.hasNext()) {
|
||||
AppCompatDelegate appCompatDelegate = it.next().get();
|
||||
if (appCompatDelegate != null) {
|
||||
appCompatDelegate.applyDayNight();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyLocalesToActiveDelegates() {
|
||||
Iterator<WeakReference<AppCompatDelegate>> it = sActivityDelegates.iterator();
|
||||
while (it.hasNext()) {
|
||||
AppCompatDelegate appCompatDelegate = it.next().get();
|
||||
if (appCompatDelegate != null) {
|
||||
appCompatDelegate.applyAppLocales();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class Api24Impl {
|
||||
private Api24Impl() {
|
||||
}
|
||||
|
||||
static LocaleList localeListForLanguageTags(String str) {
|
||||
return LocaleList.forLanguageTags(str);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api33Impl {
|
||||
private Api33Impl() {
|
||||
}
|
||||
|
||||
static void localeManagerSetApplicationLocales(Object obj, LocaleList localeList) {
|
||||
((LocaleManager) obj).setApplicationLocales(localeList);
|
||||
}
|
||||
|
||||
static LocaleList localeManagerGetApplicationLocales(Object obj) {
|
||||
return ((LocaleManager) obj).getApplicationLocales();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
155
02-Easy5/E5/sources/androidx/appcompat/app/AppCompatDialog.java
Normal file
155
02-Easy5/E5/sources/androidx/appcompat/app/AppCompatDialog.java
Normal file
@@ -0,0 +1,155 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.activity.ComponentDialog;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
import androidx.core.view.KeyEventDispatcher;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatDialog extends ComponentDialog implements AppCompatCallback {
|
||||
private AppCompatDelegate mDelegate;
|
||||
private final KeyEventDispatcher.Component mKeyDispatcher;
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatCallback
|
||||
public void onSupportActionModeFinished(ActionMode actionMode) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatCallback
|
||||
public void onSupportActionModeStarted(ActionMode actionMode) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatCallback
|
||||
public ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public AppCompatDialog(Context context) {
|
||||
this(context, 0);
|
||||
}
|
||||
|
||||
public AppCompatDialog(Context context, int i) {
|
||||
super(context, getThemeResId(context, i));
|
||||
this.mKeyDispatcher = new KeyEventDispatcher.Component() { // from class: androidx.appcompat.app.AppCompatDialog$$ExternalSyntheticLambda0
|
||||
@Override // androidx.core.view.KeyEventDispatcher.Component
|
||||
public final boolean superDispatchKeyEvent(KeyEvent keyEvent) {
|
||||
return AppCompatDialog.this.superDispatchKeyEvent(keyEvent);
|
||||
}
|
||||
};
|
||||
AppCompatDelegate delegate = getDelegate();
|
||||
delegate.setTheme(getThemeResId(context, i));
|
||||
delegate.onCreate(null);
|
||||
}
|
||||
|
||||
protected AppCompatDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
|
||||
super(context);
|
||||
this.mKeyDispatcher = new KeyEventDispatcher.Component() { // from class: androidx.appcompat.app.AppCompatDialog$$ExternalSyntheticLambda0
|
||||
@Override // androidx.core.view.KeyEventDispatcher.Component
|
||||
public final boolean superDispatchKeyEvent(KeyEvent keyEvent) {
|
||||
return AppCompatDialog.this.superDispatchKeyEvent(keyEvent);
|
||||
}
|
||||
};
|
||||
setCancelable(z);
|
||||
setOnCancelListener(onCancelListener);
|
||||
}
|
||||
|
||||
@Override // androidx.activity.ComponentDialog, android.app.Dialog
|
||||
protected void onCreate(Bundle bundle) {
|
||||
getDelegate().installViewFactory();
|
||||
super.onCreate(bundle);
|
||||
getDelegate().onCreate(bundle);
|
||||
}
|
||||
|
||||
public ActionBar getSupportActionBar() {
|
||||
return getDelegate().getSupportActionBar();
|
||||
}
|
||||
|
||||
@Override // androidx.activity.ComponentDialog, android.app.Dialog
|
||||
public void setContentView(int i) {
|
||||
getDelegate().setContentView(i);
|
||||
}
|
||||
|
||||
@Override // androidx.activity.ComponentDialog, android.app.Dialog
|
||||
public void setContentView(View view) {
|
||||
getDelegate().setContentView(view);
|
||||
}
|
||||
|
||||
@Override // androidx.activity.ComponentDialog, android.app.Dialog
|
||||
public void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
|
||||
getDelegate().setContentView(view, layoutParams);
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog
|
||||
public <T extends View> T findViewById(int i) {
|
||||
return (T) getDelegate().findViewById(i);
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
super.setTitle(charSequence);
|
||||
getDelegate().setTitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog
|
||||
public void setTitle(int i) {
|
||||
super.setTitle(i);
|
||||
getDelegate().setTitle(getContext().getString(i));
|
||||
}
|
||||
|
||||
@Override // androidx.activity.ComponentDialog, android.app.Dialog
|
||||
public void addContentView(View view, ViewGroup.LayoutParams layoutParams) {
|
||||
getDelegate().addContentView(view, layoutParams);
|
||||
}
|
||||
|
||||
@Override // androidx.activity.ComponentDialog, android.app.Dialog
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getDelegate().onStop();
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog, android.content.DialogInterface
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
getDelegate().onDestroy();
|
||||
}
|
||||
|
||||
public boolean supportRequestWindowFeature(int i) {
|
||||
return getDelegate().requestWindowFeature(i);
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog
|
||||
public void invalidateOptionsMenu() {
|
||||
getDelegate().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
public AppCompatDelegate getDelegate() {
|
||||
if (this.mDelegate == null) {
|
||||
this.mDelegate = AppCompatDelegate.create(this, this);
|
||||
}
|
||||
return this.mDelegate;
|
||||
}
|
||||
|
||||
private static int getThemeResId(Context context, int i) {
|
||||
if (i != 0) {
|
||||
return i;
|
||||
}
|
||||
TypedValue typedValue = new TypedValue();
|
||||
context.getTheme().resolveAttribute(R.attr.dialogTheme, typedValue, true);
|
||||
return typedValue.resourceId;
|
||||
}
|
||||
|
||||
boolean superDispatchKeyEvent(KeyEvent keyEvent) {
|
||||
return super.dispatchKeyEvent(keyEvent);
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog, android.view.Window.Callback
|
||||
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
||||
return KeyEventDispatcher.dispatchKeyEvent(this.mKeyDispatcher, getWindow().getDecorView(), this, keyEvent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatDialogFragment extends DialogFragment {
|
||||
public AppCompatDialogFragment() {
|
||||
}
|
||||
|
||||
public AppCompatDialogFragment(int i) {
|
||||
super(i);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.DialogFragment
|
||||
public Dialog onCreateDialog(Bundle bundle) {
|
||||
return new AppCompatDialog(getContext(), getTheme());
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.DialogFragment
|
||||
public void setupDialog(Dialog dialog, int i) {
|
||||
if (dialog instanceof AppCompatDialog) {
|
||||
AppCompatDialog appCompatDialog = (AppCompatDialog) dialog;
|
||||
if (i != 1 && i != 2) {
|
||||
if (i != 3) {
|
||||
return;
|
||||
} else {
|
||||
dialog.getWindow().addFlags(24);
|
||||
}
|
||||
}
|
||||
appCompatDialog.supportRequestWindowFeature(1);
|
||||
return;
|
||||
}
|
||||
super.setupDialog(dialog, i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.InflateException;
|
||||
import android.view.View;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.AppCompatAutoCompleteTextView;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
import androidx.appcompat.widget.AppCompatCheckBox;
|
||||
import androidx.appcompat.widget.AppCompatCheckedTextView;
|
||||
import androidx.appcompat.widget.AppCompatEditText;
|
||||
import androidx.appcompat.widget.AppCompatImageButton;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView;
|
||||
import androidx.appcompat.widget.AppCompatRadioButton;
|
||||
import androidx.appcompat.widget.AppCompatRatingBar;
|
||||
import androidx.appcompat.widget.AppCompatSeekBar;
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.appcompat.widget.AppCompatToggleButton;
|
||||
import androidx.appcompat.widget.TintContextWrapper;
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatViewInflater {
|
||||
private static final String LOG_TAG = "AppCompatViewInflater";
|
||||
private final Object[] mConstructorArgs = new Object[2];
|
||||
private static final Class<?>[] sConstructorSignature = {Context.class, AttributeSet.class};
|
||||
private static final int[] sOnClickAttrs = {R.attr.onClick};
|
||||
private static final int[] sAccessibilityHeading = {R.attr.accessibilityHeading};
|
||||
private static final int[] sAccessibilityPaneTitle = {R.attr.accessibilityPaneTitle};
|
||||
private static final int[] sScreenReaderFocusable = {R.attr.screenReaderFocusable};
|
||||
private static final String[] sClassPrefixList = {"android.widget.", "android.view.", "android.webkit."};
|
||||
private static final SimpleArrayMap<String, Constructor<? extends View>> sConstructorMap = new SimpleArrayMap<>();
|
||||
|
||||
protected View createView(Context context, String str, AttributeSet attributeSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final View createView(View view, String str, Context context, AttributeSet attributeSet, boolean z, boolean z2, boolean z3, boolean z4) {
|
||||
Context context2;
|
||||
View createRatingBar;
|
||||
context2 = (!z || view == null) ? context : view.getContext();
|
||||
if (z2 || z3) {
|
||||
context2 = themifyContext(context2, attributeSet, z2, z3);
|
||||
}
|
||||
if (z4) {
|
||||
context2 = TintContextWrapper.wrap(context2);
|
||||
}
|
||||
str.hashCode();
|
||||
switch (str) {
|
||||
case "RatingBar":
|
||||
createRatingBar = createRatingBar(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "CheckedTextView":
|
||||
createRatingBar = createCheckedTextView(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "MultiAutoCompleteTextView":
|
||||
createRatingBar = createMultiAutoCompleteTextView(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "TextView":
|
||||
createRatingBar = createTextView(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "ImageButton":
|
||||
createRatingBar = createImageButton(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "SeekBar":
|
||||
createRatingBar = createSeekBar(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "Spinner":
|
||||
createRatingBar = createSpinner(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "RadioButton":
|
||||
createRatingBar = createRadioButton(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "ToggleButton":
|
||||
createRatingBar = createToggleButton(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "ImageView":
|
||||
createRatingBar = createImageView(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "AutoCompleteTextView":
|
||||
createRatingBar = createAutoCompleteTextView(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "CheckBox":
|
||||
createRatingBar = createCheckBox(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "EditText":
|
||||
createRatingBar = createEditText(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
case "Button":
|
||||
createRatingBar = createButton(context2, attributeSet);
|
||||
verifyNotNull(createRatingBar, str);
|
||||
break;
|
||||
default:
|
||||
createRatingBar = createView(context2, str, attributeSet);
|
||||
break;
|
||||
}
|
||||
if (createRatingBar == null && context != context2) {
|
||||
createRatingBar = createViewFromTag(context2, str, attributeSet);
|
||||
}
|
||||
if (createRatingBar != null) {
|
||||
checkOnClickListener(createRatingBar, attributeSet);
|
||||
backportAccessibilityAttributes(context2, createRatingBar, attributeSet);
|
||||
}
|
||||
return createRatingBar;
|
||||
}
|
||||
|
||||
protected AppCompatTextView createTextView(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatTextView(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatImageView createImageView(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatImageView(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatButton createButton(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatButton(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatEditText createEditText(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatEditText(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatSpinner createSpinner(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatSpinner(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatImageButton createImageButton(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatImageButton(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatCheckBox createCheckBox(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatCheckBox(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatRadioButton createRadioButton(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatRadioButton(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatCheckedTextView createCheckedTextView(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatCheckedTextView(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatAutoCompleteTextView createAutoCompleteTextView(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatAutoCompleteTextView(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatMultiAutoCompleteTextView createMultiAutoCompleteTextView(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatMultiAutoCompleteTextView(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatRatingBar createRatingBar(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatRatingBar(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatSeekBar createSeekBar(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatSeekBar(context, attributeSet);
|
||||
}
|
||||
|
||||
protected AppCompatToggleButton createToggleButton(Context context, AttributeSet attributeSet) {
|
||||
return new AppCompatToggleButton(context, attributeSet);
|
||||
}
|
||||
|
||||
private void verifyNotNull(View view, String str) {
|
||||
if (view != null) {
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException(getClass().getName() + " asked to inflate view for <" + str + ">, but returned null");
|
||||
}
|
||||
|
||||
private View createViewFromTag(Context context, String str, AttributeSet attributeSet) {
|
||||
if (str.equals("view")) {
|
||||
str = attributeSet.getAttributeValue(null, "class");
|
||||
}
|
||||
try {
|
||||
Object[] objArr = this.mConstructorArgs;
|
||||
objArr[0] = context;
|
||||
objArr[1] = attributeSet;
|
||||
if (-1 != str.indexOf(46)) {
|
||||
return createViewByPrefix(context, str, null);
|
||||
}
|
||||
int i = 0;
|
||||
while (true) {
|
||||
String[] strArr = sClassPrefixList;
|
||||
if (i >= strArr.length) {
|
||||
return null;
|
||||
}
|
||||
View createViewByPrefix = createViewByPrefix(context, str, strArr[i]);
|
||||
if (createViewByPrefix != null) {
|
||||
return createViewByPrefix;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
} catch (Exception unused) {
|
||||
return null;
|
||||
} finally {
|
||||
Object[] objArr2 = this.mConstructorArgs;
|
||||
objArr2[0] = null;
|
||||
objArr2[1] = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkOnClickListener(View view, AttributeSet attributeSet) {
|
||||
Context context = view.getContext();
|
||||
if ((context instanceof ContextWrapper) && ViewCompat.hasOnClickListeners(view)) {
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, sOnClickAttrs);
|
||||
String string = obtainStyledAttributes.getString(0);
|
||||
if (string != null) {
|
||||
view.setOnClickListener(new DeclaredOnClickListener(view, string));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
private View createViewByPrefix(Context context, String str, String str2) throws ClassNotFoundException, InflateException {
|
||||
String str3;
|
||||
SimpleArrayMap<String, Constructor<? extends View>> simpleArrayMap = sConstructorMap;
|
||||
Constructor<? extends View> constructor = simpleArrayMap.get(str);
|
||||
if (constructor == null) {
|
||||
if (str2 != null) {
|
||||
try {
|
||||
str3 = str2 + str;
|
||||
} catch (Exception unused) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
str3 = str;
|
||||
}
|
||||
constructor = Class.forName(str3, false, context.getClassLoader()).asSubclass(View.class).getConstructor(sConstructorSignature);
|
||||
simpleArrayMap.put(str, constructor);
|
||||
}
|
||||
constructor.setAccessible(true);
|
||||
return constructor.newInstance(this.mConstructorArgs);
|
||||
}
|
||||
|
||||
private static Context themifyContext(Context context, AttributeSet attributeSet, boolean z, boolean z2) {
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, androidx.appcompat.R.styleable.View, 0, 0);
|
||||
int resourceId = z ? obtainStyledAttributes.getResourceId(androidx.appcompat.R.styleable.View_android_theme, 0) : 0;
|
||||
if (z2 && resourceId == 0 && (resourceId = obtainStyledAttributes.getResourceId(androidx.appcompat.R.styleable.View_theme, 0)) != 0) {
|
||||
Log.i(LOG_TAG, "app:theme is now deprecated. Please move to using android:theme instead.");
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
return resourceId != 0 ? ((context instanceof ContextThemeWrapper) && ((ContextThemeWrapper) context).getThemeResId() == resourceId) ? context : new ContextThemeWrapper(context, resourceId) : context;
|
||||
}
|
||||
|
||||
private void backportAccessibilityAttributes(Context context, View view, AttributeSet attributeSet) {
|
||||
if (Build.VERSION.SDK_INT > 28) {
|
||||
return;
|
||||
}
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, sAccessibilityHeading);
|
||||
if (obtainStyledAttributes.hasValue(0)) {
|
||||
ViewCompat.setAccessibilityHeading(view, obtainStyledAttributes.getBoolean(0, false));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
TypedArray obtainStyledAttributes2 = context.obtainStyledAttributes(attributeSet, sAccessibilityPaneTitle);
|
||||
if (obtainStyledAttributes2.hasValue(0)) {
|
||||
ViewCompat.setAccessibilityPaneTitle(view, obtainStyledAttributes2.getString(0));
|
||||
}
|
||||
obtainStyledAttributes2.recycle();
|
||||
TypedArray obtainStyledAttributes3 = context.obtainStyledAttributes(attributeSet, sScreenReaderFocusable);
|
||||
if (obtainStyledAttributes3.hasValue(0)) {
|
||||
ViewCompat.setScreenReaderFocusable(view, obtainStyledAttributes3.getBoolean(0, false));
|
||||
}
|
||||
obtainStyledAttributes3.recycle();
|
||||
}
|
||||
|
||||
private static class DeclaredOnClickListener implements View.OnClickListener {
|
||||
private final View mHostView;
|
||||
private final String mMethodName;
|
||||
private Context mResolvedContext;
|
||||
private Method mResolvedMethod;
|
||||
|
||||
public DeclaredOnClickListener(View view, String str) {
|
||||
this.mHostView = view;
|
||||
this.mMethodName = str;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (this.mResolvedMethod == null) {
|
||||
resolveMethod(this.mHostView.getContext());
|
||||
}
|
||||
try {
|
||||
this.mResolvedMethod.invoke(this.mResolvedContext, view);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new IllegalStateException("Could not execute non-public method for android:onClick", e);
|
||||
} catch (InvocationTargetException e2) {
|
||||
throw new IllegalStateException("Could not execute method for android:onClick", e2);
|
||||
}
|
||||
}
|
||||
|
||||
private void resolveMethod(Context context) {
|
||||
String str;
|
||||
Method method;
|
||||
while (context != null) {
|
||||
try {
|
||||
if (!context.isRestricted() && (method = context.getClass().getMethod(this.mMethodName, View.class)) != null) {
|
||||
this.mResolvedMethod = method;
|
||||
this.mResolvedContext = context;
|
||||
return;
|
||||
}
|
||||
} catch (NoSuchMethodException unused) {
|
||||
}
|
||||
context = context instanceof ContextWrapper ? ((ContextWrapper) context).getBaseContext() : null;
|
||||
}
|
||||
int id = this.mHostView.getId();
|
||||
if (id == -1) {
|
||||
str = "";
|
||||
} else {
|
||||
str = " with id '" + this.mHostView.getContext().getResources().getResourceEntryName(id) + "'";
|
||||
}
|
||||
throw new IllegalStateException("Could not find method " + this.mMethodName + "(View) in a parent or ancestor Context for android:onClick attribute defined on view " + this.mHostView.getClass() + str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class AppLocalesMetadataHolderService extends Service {
|
||||
@Override // android.app.Service
|
||||
public IBinder onBind(Intent intent) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public static ServiceInfo getServiceInfo(Context context) throws PackageManager.NameNotFoundException {
|
||||
return context.getPackageManager().getServiceInfo(new ComponentName(context, (Class<?>) AppLocalesMetadataHolderService.class), Build.VERSION.SDK_INT >= 24 ? Api24Impl.getDisabledComponentFlag() | 128 : 640);
|
||||
}
|
||||
|
||||
private static class Api24Impl {
|
||||
static int getDisabledComponentFlag() {
|
||||
return 512;
|
||||
}
|
||||
|
||||
private Api24Impl() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.app.AppLocalesStorageHelper;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.Executor;
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppLocalesStorageHelper {
|
||||
static final String APPLICATION_LOCALES_RECORD_FILE = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file";
|
||||
static final String APP_LOCALES_META_DATA_HOLDER_SERVICE_NAME = "androidx.appcompat.app.AppLocalesMetadataHolderService";
|
||||
static final String LOCALE_RECORD_ATTRIBUTE_TAG = "application_locales";
|
||||
static final String LOCALE_RECORD_FILE_TAG = "locales";
|
||||
static final String TAG = "AppLocalesStorageHelper";
|
||||
|
||||
private AppLocalesStorageHelper() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:14:0x0040, code lost:
|
||||
|
||||
if (r3 != null) goto L40;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:22:0x0042, code lost:
|
||||
|
||||
r3.close();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:33:0x0039, code lost:
|
||||
|
||||
r2 = r4.getAttributeValue(null, androidx.appcompat.app.AppLocalesStorageHelper.LOCALE_RECORD_ATTRIBUTE_TAG);
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:43:0x004f, code lost:
|
||||
|
||||
if (r3 == null) goto L27;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
static java.lang.String readLocales(android.content.Context r9) {
|
||||
/*
|
||||
java.lang.String r0 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file"
|
||||
java.lang.String r1 = "AppLocalesStorageHelper"
|
||||
java.lang.String r2 = ""
|
||||
java.io.FileInputStream r3 = r9.openFileInput(r0) // Catch: java.io.FileNotFoundException -> L74
|
||||
org.xmlpull.v1.XmlPullParser r4 = android.util.Xml.newPullParser() // Catch: java.lang.Throwable -> L48 java.lang.Throwable -> L4a
|
||||
java.lang.String r5 = "UTF-8"
|
||||
r4.setInput(r3, r5) // Catch: java.lang.Throwable -> L48 java.lang.Throwable -> L4a
|
||||
int r5 = r4.getDepth() // Catch: java.lang.Throwable -> L48 java.lang.Throwable -> L4a
|
||||
L17:
|
||||
int r6 = r4.next() // Catch: java.lang.Throwable -> L48 java.lang.Throwable -> L4a
|
||||
r7 = 1
|
||||
if (r6 == r7) goto L40
|
||||
r7 = 3
|
||||
if (r6 != r7) goto L27
|
||||
int r8 = r4.getDepth() // Catch: java.lang.Throwable -> L48 java.lang.Throwable -> L4a
|
||||
if (r8 <= r5) goto L40
|
||||
L27:
|
||||
if (r6 == r7) goto L17
|
||||
r7 = 4
|
||||
if (r6 != r7) goto L2d
|
||||
goto L17
|
||||
L2d:
|
||||
java.lang.String r6 = r4.getName() // Catch: java.lang.Throwable -> L48 java.lang.Throwable -> L4a
|
||||
java.lang.String r7 = "locales"
|
||||
boolean r6 = r6.equals(r7) // Catch: java.lang.Throwable -> L48 java.lang.Throwable -> L4a
|
||||
if (r6 == 0) goto L17
|
||||
java.lang.String r5 = "application_locales"
|
||||
r6 = 0
|
||||
java.lang.String r2 = r4.getAttributeValue(r6, r5) // Catch: java.lang.Throwable -> L48 java.lang.Throwable -> L4a
|
||||
L40:
|
||||
if (r3 == 0) goto L52
|
||||
L42:
|
||||
r3.close() // Catch: java.io.IOException -> L46
|
||||
goto L52
|
||||
L46:
|
||||
goto L52
|
||||
L48:
|
||||
r9 = move-exception
|
||||
goto L6e
|
||||
L4a:
|
||||
java.lang.String r4 = "Reading app Locales : Unable to parse through file :androidx.appcompat.app.AppCompatDelegate.application_locales_record_file"
|
||||
android.util.Log.w(r1, r4) // Catch: java.lang.Throwable -> L48
|
||||
if (r3 == 0) goto L52
|
||||
goto L42
|
||||
L52:
|
||||
boolean r3 = r2.isEmpty()
|
||||
if (r3 != 0) goto L6a
|
||||
java.lang.StringBuilder r9 = new java.lang.StringBuilder
|
||||
java.lang.String r0 = "Reading app Locales : Locales read from file: androidx.appcompat.app.AppCompatDelegate.application_locales_record_file , appLocales: "
|
||||
r9.<init>(r0)
|
||||
r9.append(r2)
|
||||
java.lang.String r9 = r9.toString()
|
||||
android.util.Log.d(r1, r9)
|
||||
goto L6d
|
||||
L6a:
|
||||
r9.deleteFile(r0)
|
||||
L6d:
|
||||
return r2
|
||||
L6e:
|
||||
if (r3 == 0) goto L73
|
||||
r3.close() // Catch: java.io.IOException -> L73
|
||||
L73:
|
||||
throw r9
|
||||
L74:
|
||||
java.lang.String r9 = "Reading app Locales : Locales record file not found: androidx.appcompat.app.AppCompatDelegate.application_locales_record_file"
|
||||
android.util.Log.w(r1, r9)
|
||||
return r2
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppLocalesStorageHelper.readLocales(android.content.Context):java.lang.String");
|
||||
}
|
||||
|
||||
static void persistLocales(Context context, String str) {
|
||||
if (str.equals("")) {
|
||||
context.deleteFile(APPLICATION_LOCALES_RECORD_FILE);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
FileOutputStream openFileOutput = context.openFileOutput(APPLICATION_LOCALES_RECORD_FILE, 0);
|
||||
XmlSerializer newSerializer = Xml.newSerializer();
|
||||
try {
|
||||
try {
|
||||
newSerializer.setOutput(openFileOutput, null);
|
||||
newSerializer.startDocument("UTF-8", true);
|
||||
newSerializer.startTag(null, LOCALE_RECORD_FILE_TAG);
|
||||
newSerializer.attribute(null, LOCALE_RECORD_ATTRIBUTE_TAG, str);
|
||||
newSerializer.endTag(null, LOCALE_RECORD_FILE_TAG);
|
||||
newSerializer.endDocument();
|
||||
Log.d(TAG, "Storing App Locales : app-locales: " + str + " persisted successfully.");
|
||||
if (openFileOutput == null) {
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Storing App Locales : Failed to persist app-locales: " + str, e);
|
||||
if (openFileOutput == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
openFileOutput.close();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (openFileOutput != null) {
|
||||
try {
|
||||
openFileOutput.close();
|
||||
} catch (IOException unused2) {
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (FileNotFoundException unused3) {
|
||||
Log.w(TAG, String.format("Storing App Locales : FileNotFoundException: Cannot open file %s for writing ", APPLICATION_LOCALES_RECORD_FILE));
|
||||
}
|
||||
}
|
||||
|
||||
static void syncLocalesToFramework(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= 33) {
|
||||
ComponentName componentName = new ComponentName(context, APP_LOCALES_META_DATA_HOLDER_SERVICE_NAME);
|
||||
if (context.getPackageManager().getComponentEnabledSetting(componentName) != 1) {
|
||||
if (AppCompatDelegate.getApplicationLocales().isEmpty()) {
|
||||
String readLocales = readLocales(context);
|
||||
Object systemService = context.getSystemService("locale");
|
||||
if (systemService != null) {
|
||||
AppCompatDelegate.Api33Impl.localeManagerSetApplicationLocales(systemService, AppCompatDelegate.Api24Impl.localeListForLanguageTags(readLocales));
|
||||
}
|
||||
}
|
||||
context.getPackageManager().setComponentEnabledSetting(componentName, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class ThreadPerTaskExecutor implements Executor {
|
||||
ThreadPerTaskExecutor() {
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.Executor
|
||||
public void execute(Runnable runnable) {
|
||||
new Thread(runnable).start();
|
||||
}
|
||||
}
|
||||
|
||||
static class SerialExecutor implements Executor {
|
||||
Runnable mActive;
|
||||
final Executor mExecutor;
|
||||
private final Object mLock = new Object();
|
||||
final Queue<Runnable> mTasks = new ArrayDeque();
|
||||
|
||||
SerialExecutor(Executor executor) {
|
||||
this.mExecutor = executor;
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.Executor
|
||||
public void execute(final Runnable runnable) {
|
||||
synchronized (this.mLock) {
|
||||
this.mTasks.add(new Runnable() { // from class: androidx.appcompat.app.AppLocalesStorageHelper$SerialExecutor$$ExternalSyntheticLambda0
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
AppLocalesStorageHelper.SerialExecutor.this.m43xd188c474(runnable);
|
||||
}
|
||||
});
|
||||
if (this.mActive == null) {
|
||||
scheduleNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* renamed from: lambda$execute$0$androidx-appcompat-app-AppLocalesStorageHelper$SerialExecutor, reason: not valid java name */
|
||||
/* synthetic */ void m43xd188c474(Runnable runnable) {
|
||||
try {
|
||||
runnable.run();
|
||||
} finally {
|
||||
scheduleNext();
|
||||
}
|
||||
}
|
||||
|
||||
protected void scheduleNext() {
|
||||
synchronized (this.mLock) {
|
||||
Runnable poll = this.mTasks.poll();
|
||||
this.mActive = poll;
|
||||
if (poll != null) {
|
||||
this.mExecutor.execute(poll);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.util.AttributeSet;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class LayoutIncludeDetector {
|
||||
private final Deque<WeakReference<XmlPullParser>> mXmlParserStack = new ArrayDeque();
|
||||
|
||||
LayoutIncludeDetector() {
|
||||
}
|
||||
|
||||
boolean detect(AttributeSet attributeSet) {
|
||||
if (!(attributeSet instanceof XmlPullParser)) {
|
||||
return false;
|
||||
}
|
||||
XmlPullParser xmlPullParser = (XmlPullParser) attributeSet;
|
||||
if (xmlPullParser.getDepth() != 1) {
|
||||
return false;
|
||||
}
|
||||
XmlPullParser popOutdatedAttrHolders = popOutdatedAttrHolders(this.mXmlParserStack);
|
||||
this.mXmlParserStack.push(new WeakReference<>(xmlPullParser));
|
||||
return shouldInheritContext(xmlPullParser, popOutdatedAttrHolders);
|
||||
}
|
||||
|
||||
private static boolean shouldInheritContext(XmlPullParser xmlPullParser, XmlPullParser xmlPullParser2) {
|
||||
if (xmlPullParser2 == null || xmlPullParser == xmlPullParser2) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
if (xmlPullParser2.getEventType() == 2) {
|
||||
return "include".equals(xmlPullParser2.getName());
|
||||
}
|
||||
return false;
|
||||
} catch (XmlPullParserException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static XmlPullParser popOutdatedAttrHolders(Deque<WeakReference<XmlPullParser>> deque) {
|
||||
while (!deque.isEmpty()) {
|
||||
XmlPullParser xmlPullParser = deque.peek().get();
|
||||
if (!isParserOutdated(xmlPullParser)) {
|
||||
return xmlPullParser;
|
||||
}
|
||||
deque.pop();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isParserOutdated(XmlPullParser xmlPullParser) {
|
||||
if (xmlPullParser == null) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
if (xmlPullParser.getEventType() != 3) {
|
||||
return xmlPullParser.getEventType() == 1;
|
||||
}
|
||||
return true;
|
||||
} catch (XmlPullParserException unused) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.os.LocaleList;
|
||||
import androidx.core.os.LocaleListCompat;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class LocaleOverlayHelper {
|
||||
private LocaleOverlayHelper() {
|
||||
}
|
||||
|
||||
static LocaleListCompat combineLocalesIfOverlayExists(LocaleListCompat localeListCompat, LocaleListCompat localeListCompat2) {
|
||||
if (localeListCompat == null || localeListCompat.isEmpty()) {
|
||||
return LocaleListCompat.getEmptyLocaleList();
|
||||
}
|
||||
return combineLocales(localeListCompat, localeListCompat2);
|
||||
}
|
||||
|
||||
static LocaleListCompat combineLocalesIfOverlayExists(LocaleList localeList, LocaleList localeList2) {
|
||||
boolean isEmpty;
|
||||
if (localeList != null) {
|
||||
isEmpty = localeList.isEmpty();
|
||||
if (!isEmpty) {
|
||||
return combineLocales(LocaleListCompat.wrap(localeList), LocaleListCompat.wrap(localeList2));
|
||||
}
|
||||
}
|
||||
return LocaleListCompat.getEmptyLocaleList();
|
||||
}
|
||||
|
||||
private static LocaleListCompat combineLocales(LocaleListCompat localeListCompat, LocaleListCompat localeListCompat2) {
|
||||
Locale locale;
|
||||
LinkedHashSet linkedHashSet = new LinkedHashSet();
|
||||
for (int i = 0; i < localeListCompat.size() + localeListCompat2.size(); i++) {
|
||||
if (i < localeListCompat.size()) {
|
||||
locale = localeListCompat.get(i);
|
||||
} else {
|
||||
locale = localeListCompat2.get(i - localeListCompat.size());
|
||||
}
|
||||
if (locale != null) {
|
||||
linkedHashSet.add(locale);
|
||||
}
|
||||
}
|
||||
return LocaleListCompat.create((Locale[]) linkedHashSet.toArray(new Locale[linkedHashSet.size()]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class NavItemSelectedListener implements AdapterView.OnItemSelectedListener {
|
||||
private final ActionBar.OnNavigationListener mListener;
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemSelectedListener
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
}
|
||||
|
||||
public NavItemSelectedListener(ActionBar.OnNavigationListener onNavigationListener) {
|
||||
this.mListener = onNavigationListener;
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemSelectedListener
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
|
||||
ActionBar.OnNavigationListener onNavigationListener = this.mListener;
|
||||
if (onNavigationListener != null) {
|
||||
onNavigationListener.onNavigationItemSelected(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
205
02-Easy5/E5/sources/androidx/appcompat/app/ResourcesFlusher.java
Normal file
205
02-Easy5/E5/sources/androidx/appcompat/app/ResourcesFlusher.java
Normal file
@@ -0,0 +1,205 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.util.LongSparseArray;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ResourcesFlusher {
|
||||
private static final String TAG = "ResourcesFlusher";
|
||||
private static Field sDrawableCacheField;
|
||||
private static boolean sDrawableCacheFieldFetched;
|
||||
private static Field sResourcesImplField;
|
||||
private static boolean sResourcesImplFieldFetched;
|
||||
private static Class<?> sThemedResourceCacheClazz;
|
||||
private static boolean sThemedResourceCacheClazzFetched;
|
||||
private static Field sThemedResourceCache_mUnthemedEntriesField;
|
||||
private static boolean sThemedResourceCache_mUnthemedEntriesFieldFetched;
|
||||
|
||||
static void flush(Resources resources) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
flushNougats(resources);
|
||||
} else if (Build.VERSION.SDK_INT >= 23) {
|
||||
flushMarshmallows(resources);
|
||||
} else {
|
||||
flushLollipops(resources);
|
||||
}
|
||||
}
|
||||
|
||||
private static void flushLollipops(Resources resources) {
|
||||
Map map;
|
||||
if (!sDrawableCacheFieldFetched) {
|
||||
try {
|
||||
Field declaredField = Resources.class.getDeclaredField("mDrawableCache");
|
||||
sDrawableCacheField = declaredField;
|
||||
declaredField.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
Log.e(TAG, "Could not retrieve Resources#mDrawableCache field", e);
|
||||
}
|
||||
sDrawableCacheFieldFetched = true;
|
||||
}
|
||||
Field field = sDrawableCacheField;
|
||||
if (field != null) {
|
||||
try {
|
||||
map = (Map) field.get(resources);
|
||||
} catch (IllegalAccessException e2) {
|
||||
Log.e(TAG, "Could not retrieve value from Resources#mDrawableCache", e2);
|
||||
map = null;
|
||||
}
|
||||
if (map != null) {
|
||||
map.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x002f A[RETURN] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:16:0x0030 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
private static void flushMarshmallows(android.content.res.Resources r4) {
|
||||
/*
|
||||
boolean r0 = androidx.appcompat.app.ResourcesFlusher.sDrawableCacheFieldFetched
|
||||
java.lang.String r1 = "ResourcesFlusher"
|
||||
if (r0 != 0) goto L1d
|
||||
r0 = 1
|
||||
java.lang.Class<android.content.res.Resources> r2 = android.content.res.Resources.class
|
||||
java.lang.String r3 = "mDrawableCache"
|
||||
java.lang.reflect.Field r2 = r2.getDeclaredField(r3) // Catch: java.lang.NoSuchFieldException -> L15
|
||||
androidx.appcompat.app.ResourcesFlusher.sDrawableCacheField = r2 // Catch: java.lang.NoSuchFieldException -> L15
|
||||
r2.setAccessible(r0) // Catch: java.lang.NoSuchFieldException -> L15
|
||||
goto L1b
|
||||
L15:
|
||||
r2 = move-exception
|
||||
java.lang.String r3 = "Could not retrieve Resources#mDrawableCache field"
|
||||
android.util.Log.e(r1, r3, r2)
|
||||
L1b:
|
||||
androidx.appcompat.app.ResourcesFlusher.sDrawableCacheFieldFetched = r0
|
||||
L1d:
|
||||
java.lang.reflect.Field r0 = androidx.appcompat.app.ResourcesFlusher.sDrawableCacheField
|
||||
if (r0 == 0) goto L2c
|
||||
java.lang.Object r4 = r0.get(r4) // Catch: java.lang.IllegalAccessException -> L26
|
||||
goto L2d
|
||||
L26:
|
||||
r4 = move-exception
|
||||
java.lang.String r0 = "Could not retrieve value from Resources#mDrawableCache"
|
||||
android.util.Log.e(r1, r0, r4)
|
||||
L2c:
|
||||
r4 = 0
|
||||
L2d:
|
||||
if (r4 != 0) goto L30
|
||||
return
|
||||
L30:
|
||||
flushThemedResourcesCache(r4)
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.ResourcesFlusher.flushMarshmallows(android.content.res.Resources):void");
|
||||
}
|
||||
|
||||
private static void flushNougats(Resources resources) {
|
||||
Object obj;
|
||||
if (!sResourcesImplFieldFetched) {
|
||||
try {
|
||||
Field declaredField = Resources.class.getDeclaredField("mResourcesImpl");
|
||||
sResourcesImplField = declaredField;
|
||||
declaredField.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
Log.e(TAG, "Could not retrieve Resources#mResourcesImpl field", e);
|
||||
}
|
||||
sResourcesImplFieldFetched = true;
|
||||
}
|
||||
Field field = sResourcesImplField;
|
||||
if (field == null) {
|
||||
return;
|
||||
}
|
||||
Object obj2 = null;
|
||||
try {
|
||||
obj = field.get(resources);
|
||||
} catch (IllegalAccessException e2) {
|
||||
Log.e(TAG, "Could not retrieve value from Resources#mResourcesImpl", e2);
|
||||
obj = null;
|
||||
}
|
||||
if (obj == null) {
|
||||
return;
|
||||
}
|
||||
if (!sDrawableCacheFieldFetched) {
|
||||
try {
|
||||
Field declaredField2 = obj.getClass().getDeclaredField("mDrawableCache");
|
||||
sDrawableCacheField = declaredField2;
|
||||
declaredField2.setAccessible(true);
|
||||
} catch (NoSuchFieldException e3) {
|
||||
Log.e(TAG, "Could not retrieve ResourcesImpl#mDrawableCache field", e3);
|
||||
}
|
||||
sDrawableCacheFieldFetched = true;
|
||||
}
|
||||
Field field2 = sDrawableCacheField;
|
||||
if (field2 != null) {
|
||||
try {
|
||||
obj2 = field2.get(obj);
|
||||
} catch (IllegalAccessException e4) {
|
||||
Log.e(TAG, "Could not retrieve value from ResourcesImpl#mDrawableCache", e4);
|
||||
}
|
||||
}
|
||||
if (obj2 != null) {
|
||||
flushThemedResourcesCache(obj2);
|
||||
}
|
||||
}
|
||||
|
||||
private static void flushThemedResourcesCache(Object obj) {
|
||||
LongSparseArray longSparseArray;
|
||||
if (!sThemedResourceCacheClazzFetched) {
|
||||
try {
|
||||
sThemedResourceCacheClazz = Class.forName("android.content.res.ThemedResourceCache");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.e(TAG, "Could not find ThemedResourceCache class", e);
|
||||
}
|
||||
sThemedResourceCacheClazzFetched = true;
|
||||
}
|
||||
Class<?> cls = sThemedResourceCacheClazz;
|
||||
if (cls == null) {
|
||||
return;
|
||||
}
|
||||
if (!sThemedResourceCache_mUnthemedEntriesFieldFetched) {
|
||||
try {
|
||||
Field declaredField = cls.getDeclaredField("mUnthemedEntries");
|
||||
sThemedResourceCache_mUnthemedEntriesField = declaredField;
|
||||
declaredField.setAccessible(true);
|
||||
} catch (NoSuchFieldException e2) {
|
||||
Log.e(TAG, "Could not retrieve ThemedResourceCache#mUnthemedEntries field", e2);
|
||||
}
|
||||
sThemedResourceCache_mUnthemedEntriesFieldFetched = true;
|
||||
}
|
||||
Field field = sThemedResourceCache_mUnthemedEntriesField;
|
||||
if (field == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
longSparseArray = (LongSparseArray) field.get(obj);
|
||||
} catch (IllegalAccessException e3) {
|
||||
Log.e(TAG, "Could not retrieve value from ThemedResourceCache#mUnthemedEntries", e3);
|
||||
longSparseArray = null;
|
||||
}
|
||||
if (longSparseArray != null) {
|
||||
Api16Impl.clear(longSparseArray);
|
||||
}
|
||||
}
|
||||
|
||||
private ResourcesFlusher() {
|
||||
}
|
||||
|
||||
static class Api16Impl {
|
||||
private Api16Impl() {
|
||||
}
|
||||
|
||||
static void clear(LongSparseArray longSparseArray) {
|
||||
longSparseArray.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
540
02-Easy5/E5/sources/androidx/appcompat/app/ToolbarActionBar.java
Normal file
540
02-Easy5/E5/sources/androidx/appcompat/app/ToolbarActionBar.java
Normal file
@@ -0,0 +1,540 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
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.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatDelegateImpl;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.appcompat.widget.DecorToolbar;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.appcompat.widget.ToolbarWidgetWrapper;
|
||||
import androidx.core.util.Preconditions;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ToolbarActionBar extends ActionBar {
|
||||
final DecorToolbar mDecorToolbar;
|
||||
private boolean mLastMenuVisibility;
|
||||
final AppCompatDelegateImpl.ActionBarMenuCallback mMenuCallback;
|
||||
private boolean mMenuCallbackSet;
|
||||
private final Toolbar.OnMenuItemClickListener mMenuClicker;
|
||||
boolean mToolbarMenuPrepared;
|
||||
final Window.Callback mWindowCallback;
|
||||
private ArrayList<ActionBar.OnMenuVisibilityListener> mMenuVisibilityListeners = new ArrayList<>();
|
||||
private final Runnable mMenuInvalidator = new Runnable() { // from class: androidx.appcompat.app.ToolbarActionBar.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ToolbarActionBar.this.populateOptionsMenu();
|
||||
}
|
||||
};
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public int getNavigationItemCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public int getNavigationMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public int getSelectedNavigationIndex() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public int getTabCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setDefaultDisplayHomeAsUpEnabled(boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setHomeButtonEnabled(boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setShowHideAnimationEnabled(boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setSplitBackgroundDrawable(Drawable drawable) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setStackedBackgroundDrawable(Drawable drawable) {
|
||||
}
|
||||
|
||||
ToolbarActionBar(Toolbar toolbar, CharSequence charSequence, Window.Callback callback) {
|
||||
Toolbar.OnMenuItemClickListener onMenuItemClickListener = new Toolbar.OnMenuItemClickListener() { // from class: androidx.appcompat.app.ToolbarActionBar.2
|
||||
@Override // androidx.appcompat.widget.Toolbar.OnMenuItemClickListener
|
||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||
return ToolbarActionBar.this.mWindowCallback.onMenuItemSelected(0, menuItem);
|
||||
}
|
||||
};
|
||||
this.mMenuClicker = onMenuItemClickListener;
|
||||
Preconditions.checkNotNull(toolbar);
|
||||
ToolbarWidgetWrapper toolbarWidgetWrapper = new ToolbarWidgetWrapper(toolbar, false);
|
||||
this.mDecorToolbar = toolbarWidgetWrapper;
|
||||
this.mWindowCallback = (Window.Callback) Preconditions.checkNotNull(callback);
|
||||
toolbarWidgetWrapper.setWindowCallback(callback);
|
||||
toolbar.setOnMenuItemClickListener(onMenuItemClickListener);
|
||||
toolbarWidgetWrapper.setWindowTitle(charSequence);
|
||||
this.mMenuCallback = new ToolbarMenuCallback();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setCustomView(View view) {
|
||||
setCustomView(view, new ActionBar.LayoutParams(-2, -2));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setCustomView(View view, ActionBar.LayoutParams layoutParams) {
|
||||
if (view != null) {
|
||||
view.setLayoutParams(layoutParams);
|
||||
}
|
||||
this.mDecorToolbar.setCustomView(view);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setCustomView(int i) {
|
||||
setCustomView(LayoutInflater.from(this.mDecorToolbar.getContext()).inflate(i, this.mDecorToolbar.getViewGroup(), false));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setIcon(int i) {
|
||||
this.mDecorToolbar.setIcon(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setIcon(Drawable drawable) {
|
||||
this.mDecorToolbar.setIcon(drawable);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setLogo(int i) {
|
||||
this.mDecorToolbar.setLogo(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setLogo(Drawable drawable) {
|
||||
this.mDecorToolbar.setLogo(drawable);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setElevation(float f) {
|
||||
ViewCompat.setElevation(this.mDecorToolbar.getViewGroup(), f);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public float getElevation() {
|
||||
return ViewCompat.getElevation(this.mDecorToolbar.getViewGroup());
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public Context getThemedContext() {
|
||||
return this.mDecorToolbar.getContext();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public boolean isTitleTruncated() {
|
||||
return super.isTitleTruncated();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setHomeAsUpIndicator(Drawable drawable) {
|
||||
this.mDecorToolbar.setNavigationIcon(drawable);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setHomeAsUpIndicator(int i) {
|
||||
this.mDecorToolbar.setNavigationIcon(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setHomeActionContentDescription(CharSequence charSequence) {
|
||||
this.mDecorToolbar.setNavigationContentDescription(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setHomeActionContentDescription(int i) {
|
||||
this.mDecorToolbar.setNavigationContentDescription(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setListNavigationCallbacks(SpinnerAdapter spinnerAdapter, ActionBar.OnNavigationListener onNavigationListener) {
|
||||
this.mDecorToolbar.setDropdownParams(spinnerAdapter, new NavItemSelectedListener(onNavigationListener));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setSelectedNavigationItem(int i) {
|
||||
if (this.mDecorToolbar.getNavigationMode() == 1) {
|
||||
this.mDecorToolbar.setDropdownSelectedPosition(i);
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException("setSelectedNavigationIndex not valid for current navigation mode");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
this.mDecorToolbar.setTitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setTitle(int i) {
|
||||
DecorToolbar decorToolbar = this.mDecorToolbar;
|
||||
decorToolbar.setTitle(i != 0 ? decorToolbar.getContext().getText(i) : null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setWindowTitle(CharSequence charSequence) {
|
||||
this.mDecorToolbar.setWindowTitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public boolean requestFocus() {
|
||||
ViewGroup viewGroup = this.mDecorToolbar.getViewGroup();
|
||||
if (viewGroup == null || viewGroup.hasFocus()) {
|
||||
return false;
|
||||
}
|
||||
viewGroup.requestFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setSubtitle(CharSequence charSequence) {
|
||||
this.mDecorToolbar.setSubtitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setSubtitle(int i) {
|
||||
DecorToolbar decorToolbar = this.mDecorToolbar;
|
||||
decorToolbar.setSubtitle(i != 0 ? decorToolbar.getContext().getText(i) : null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setDisplayOptions(int i) {
|
||||
setDisplayOptions(i, -1);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setDisplayOptions(int i, int i2) {
|
||||
this.mDecorToolbar.setDisplayOptions((i & i2) | ((~i2) & this.mDecorToolbar.getDisplayOptions()));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setDisplayUseLogoEnabled(boolean z) {
|
||||
setDisplayOptions(z ? 1 : 0, 1);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setDisplayShowHomeEnabled(boolean z) {
|
||||
setDisplayOptions(z ? 2 : 0, 2);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setDisplayHomeAsUpEnabled(boolean z) {
|
||||
setDisplayOptions(z ? 4 : 0, 4);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setDisplayShowTitleEnabled(boolean z) {
|
||||
setDisplayOptions(z ? 8 : 0, 8);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setDisplayShowCustomEnabled(boolean z) {
|
||||
setDisplayOptions(z ? 16 : 0, 16);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
this.mDecorToolbar.setBackgroundDrawable(drawable);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public View getCustomView() {
|
||||
return this.mDecorToolbar.getCustomView();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public CharSequence getTitle() {
|
||||
return this.mDecorToolbar.getTitle();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public CharSequence getSubtitle() {
|
||||
return this.mDecorToolbar.getSubtitle();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void setNavigationMode(int i) {
|
||||
if (i == 2) {
|
||||
throw new IllegalArgumentException("Tabs not supported in this configuration");
|
||||
}
|
||||
this.mDecorToolbar.setNavigationMode(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public int getDisplayOptions() {
|
||||
return this.mDecorToolbar.getDisplayOptions();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public ActionBar.Tab newTab() {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void addTab(ActionBar.Tab tab) {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void addTab(ActionBar.Tab tab, boolean z) {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void addTab(ActionBar.Tab tab, int i) {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void addTab(ActionBar.Tab tab, int i, boolean z) {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void removeTab(ActionBar.Tab tab) {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void removeTabAt(int i) {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void removeAllTabs() {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void selectTab(ActionBar.Tab tab) {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public ActionBar.Tab getSelectedTab() {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public ActionBar.Tab getTabAt(int i) {
|
||||
throw new UnsupportedOperationException("Tabs are not supported in toolbar action bars");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public int getHeight() {
|
||||
return this.mDecorToolbar.getHeight();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void show() {
|
||||
this.mDecorToolbar.setVisibility(0);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void hide() {
|
||||
this.mDecorToolbar.setVisibility(8);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public boolean isShowing() {
|
||||
return this.mDecorToolbar.getVisibility() == 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public boolean openOptionsMenu() {
|
||||
return this.mDecorToolbar.showOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public boolean closeOptionsMenu() {
|
||||
return this.mDecorToolbar.hideOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public boolean invalidateOptionsMenu() {
|
||||
this.mDecorToolbar.getViewGroup().removeCallbacks(this.mMenuInvalidator);
|
||||
ViewCompat.postOnAnimation(this.mDecorToolbar.getViewGroup(), this.mMenuInvalidator);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public boolean collapseActionView() {
|
||||
if (!this.mDecorToolbar.hasExpandedActionView()) {
|
||||
return false;
|
||||
}
|
||||
this.mDecorToolbar.collapseActionView();
|
||||
return true;
|
||||
}
|
||||
|
||||
void populateOptionsMenu() {
|
||||
Menu menu = getMenu();
|
||||
MenuBuilder menuBuilder = menu instanceof MenuBuilder ? (MenuBuilder) menu : null;
|
||||
if (menuBuilder != null) {
|
||||
menuBuilder.stopDispatchingItemsChanged();
|
||||
}
|
||||
try {
|
||||
menu.clear();
|
||||
if (!this.mWindowCallback.onCreatePanelMenu(0, menu) || !this.mWindowCallback.onPreparePanel(0, null, menu)) {
|
||||
menu.clear();
|
||||
}
|
||||
} finally {
|
||||
if (menuBuilder != null) {
|
||||
menuBuilder.startDispatchingItemsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public boolean onMenuKeyEvent(KeyEvent keyEvent) {
|
||||
if (keyEvent.getAction() == 1) {
|
||||
openOptionsMenu();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public boolean onKeyShortcut(int i, KeyEvent keyEvent) {
|
||||
Menu menu = getMenu();
|
||||
if (menu == null) {
|
||||
return false;
|
||||
}
|
||||
menu.setQwertyMode(KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() != 1);
|
||||
return menu.performShortcut(i, keyEvent, 0);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
void onDestroy() {
|
||||
this.mDecorToolbar.getViewGroup().removeCallbacks(this.mMenuInvalidator);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void addOnMenuVisibilityListener(ActionBar.OnMenuVisibilityListener onMenuVisibilityListener) {
|
||||
this.mMenuVisibilityListeners.add(onMenuVisibilityListener);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void removeOnMenuVisibilityListener(ActionBar.OnMenuVisibilityListener onMenuVisibilityListener) {
|
||||
this.mMenuVisibilityListeners.remove(onMenuVisibilityListener);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.ActionBar
|
||||
public void dispatchMenuVisibilityChanged(boolean z) {
|
||||
if (z == this.mLastMenuVisibility) {
|
||||
return;
|
||||
}
|
||||
this.mLastMenuVisibility = z;
|
||||
int size = this.mMenuVisibilityListeners.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.mMenuVisibilityListeners.get(i).onMenuVisibilityChanged(z);
|
||||
}
|
||||
}
|
||||
|
||||
private class ToolbarMenuCallback implements AppCompatDelegateImpl.ActionBarMenuCallback {
|
||||
ToolbarMenuCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatDelegateImpl.ActionBarMenuCallback
|
||||
public boolean onPreparePanel(int i) {
|
||||
if (i != 0 || ToolbarActionBar.this.mToolbarMenuPrepared) {
|
||||
return false;
|
||||
}
|
||||
ToolbarActionBar.this.mDecorToolbar.setMenuPrepared();
|
||||
ToolbarActionBar.this.mToolbarMenuPrepared = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatDelegateImpl.ActionBarMenuCallback
|
||||
public View onCreatePanelView(int i) {
|
||||
if (i == 0) {
|
||||
return new View(ToolbarActionBar.this.mDecorToolbar.getContext());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Menu getMenu() {
|
||||
if (!this.mMenuCallbackSet) {
|
||||
this.mDecorToolbar.setMenuCallbacks(new ActionMenuPresenterCallback(), new MenuBuilderCallback());
|
||||
this.mMenuCallbackSet = true;
|
||||
}
|
||||
return this.mDecorToolbar.getMenu();
|
||||
}
|
||||
|
||||
private final class ActionMenuPresenterCallback implements MenuPresenter.Callback {
|
||||
private boolean mClosingActionMenu;
|
||||
|
||||
ActionMenuPresenterCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public boolean onOpenSubMenu(MenuBuilder menuBuilder) {
|
||||
ToolbarActionBar.this.mWindowCallback.onMenuOpened(108, menuBuilder);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
if (this.mClosingActionMenu) {
|
||||
return;
|
||||
}
|
||||
this.mClosingActionMenu = true;
|
||||
ToolbarActionBar.this.mDecorToolbar.dismissPopupMenus();
|
||||
ToolbarActionBar.this.mWindowCallback.onPanelClosed(108, menuBuilder);
|
||||
this.mClosingActionMenu = false;
|
||||
}
|
||||
}
|
||||
|
||||
private final class MenuBuilderCallback implements MenuBuilder.Callback {
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public boolean onMenuItemSelected(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MenuBuilderCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public void onMenuModeChange(MenuBuilder menuBuilder) {
|
||||
if (ToolbarActionBar.this.mDecorToolbar.isOverflowMenuShowing()) {
|
||||
ToolbarActionBar.this.mWindowCallback.onPanelClosed(108, menuBuilder);
|
||||
} else if (ToolbarActionBar.this.mWindowCallback.onPreparePanel(0, null, menuBuilder)) {
|
||||
ToolbarActionBar.this.mWindowCallback.onMenuOpened(108, menuBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TwilightCalculator {
|
||||
private static final float ALTIDUTE_CORRECTION_CIVIL_TWILIGHT = -0.10471976f;
|
||||
private static final float C1 = 0.0334196f;
|
||||
private static final float C2 = 3.49066E-4f;
|
||||
private static final float C3 = 5.236E-6f;
|
||||
public static final int DAY = 0;
|
||||
private static final float DEGREES_TO_RADIANS = 0.017453292f;
|
||||
private static final float J0 = 9.0E-4f;
|
||||
public static final int NIGHT = 1;
|
||||
private static final float OBLIQUITY = 0.4092797f;
|
||||
private static final long UTC_2000 = 946728000000L;
|
||||
private static TwilightCalculator sInstance;
|
||||
public int state;
|
||||
public long sunrise;
|
||||
public long sunset;
|
||||
|
||||
TwilightCalculator() {
|
||||
}
|
||||
|
||||
static TwilightCalculator getInstance() {
|
||||
if (sInstance == null) {
|
||||
sInstance = new TwilightCalculator();
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void calculateTwilight(long j, double d, double d2) {
|
||||
double d3 = (0.01720197f * ((j - UTC_2000) / 8.64E7f)) + 6.24006f;
|
||||
double sin = (Math.sin(d3) * 0.03341960161924362d) + d3 + (Math.sin(2.0f * r4) * 3.4906598739326E-4d) + (Math.sin(r4 * 3.0f) * 5.236000106378924E-6d) + 1.796593063d + 3.141592653589793d;
|
||||
double round = Math.round((r3 - J0) - r7) + J0 + ((-d2) / 360.0d) + (Math.sin(d3) * 0.0053d) + (Math.sin(2.0d * sin) * (-0.0069d));
|
||||
double asin = Math.asin(Math.sin(sin) * Math.sin(0.4092797040939331d));
|
||||
double d4 = 0.01745329238474369d * d;
|
||||
double sin2 = (Math.sin(-0.10471975803375244d) - (Math.sin(d4) * Math.sin(asin))) / (Math.cos(d4) * Math.cos(asin));
|
||||
if (sin2 >= 1.0d) {
|
||||
this.state = 1;
|
||||
this.sunset = -1L;
|
||||
this.sunrise = -1L;
|
||||
} else {
|
||||
if (sin2 <= -1.0d) {
|
||||
this.state = 0;
|
||||
this.sunset = -1L;
|
||||
this.sunrise = -1L;
|
||||
return;
|
||||
}
|
||||
double acos = (float) (Math.acos(sin2) / 6.283185307179586d);
|
||||
this.sunset = Math.round((round + acos) * 8.64E7d) + UTC_2000;
|
||||
long round2 = Math.round((round - acos) * 8.64E7d) + UTC_2000;
|
||||
this.sunrise = round2;
|
||||
if (round2 >= j || this.sunset <= j) {
|
||||
this.state = 1;
|
||||
} else {
|
||||
this.state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
105
02-Easy5/E5/sources/androidx/appcompat/app/TwilightManager.java
Normal file
105
02-Easy5/E5/sources/androidx/appcompat/app/TwilightManager.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package androidx.appcompat.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.util.Log;
|
||||
import androidx.core.content.PermissionChecker;
|
||||
import java.util.Calendar;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TwilightManager {
|
||||
private static final int SUNRISE = 6;
|
||||
private static final int SUNSET = 22;
|
||||
private static final String TAG = "TwilightManager";
|
||||
private static TwilightManager sInstance;
|
||||
private final Context mContext;
|
||||
private final LocationManager mLocationManager;
|
||||
private final TwilightState mTwilightState = new TwilightState();
|
||||
|
||||
static void setInstance(TwilightManager twilightManager) {
|
||||
sInstance = twilightManager;
|
||||
}
|
||||
|
||||
static TwilightManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
Context applicationContext = context.getApplicationContext();
|
||||
sInstance = new TwilightManager(applicationContext, (LocationManager) applicationContext.getSystemService("location"));
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
TwilightManager(Context context, LocationManager locationManager) {
|
||||
this.mContext = context;
|
||||
this.mLocationManager = locationManager;
|
||||
}
|
||||
|
||||
boolean isNight() {
|
||||
TwilightState twilightState = this.mTwilightState;
|
||||
if (isStateValid()) {
|
||||
return twilightState.isNight;
|
||||
}
|
||||
Location lastKnownLocation = getLastKnownLocation();
|
||||
if (lastKnownLocation != null) {
|
||||
updateState(lastKnownLocation);
|
||||
return twilightState.isNight;
|
||||
}
|
||||
Log.i(TAG, "Could not get last known location. This is probably because the app does not have any location permissions. Falling back to hardcoded sunrise/sunset values.");
|
||||
int i = Calendar.getInstance().get(11);
|
||||
return i < 6 || i >= 22;
|
||||
}
|
||||
|
||||
private Location getLastKnownLocation() {
|
||||
Location lastKnownLocationForProvider = PermissionChecker.checkSelfPermission(this.mContext, "android.permission.ACCESS_COARSE_LOCATION") == 0 ? getLastKnownLocationForProvider("network") : null;
|
||||
Location lastKnownLocationForProvider2 = PermissionChecker.checkSelfPermission(this.mContext, "android.permission.ACCESS_FINE_LOCATION") == 0 ? getLastKnownLocationForProvider("gps") : null;
|
||||
return (lastKnownLocationForProvider2 == null || lastKnownLocationForProvider == null) ? lastKnownLocationForProvider2 != null ? lastKnownLocationForProvider2 : lastKnownLocationForProvider : lastKnownLocationForProvider2.getTime() > lastKnownLocationForProvider.getTime() ? lastKnownLocationForProvider2 : lastKnownLocationForProvider;
|
||||
}
|
||||
|
||||
private Location getLastKnownLocationForProvider(String str) {
|
||||
try {
|
||||
if (this.mLocationManager.isProviderEnabled(str)) {
|
||||
return this.mLocationManager.getLastKnownLocation(str);
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Failed to get last known location", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isStateValid() {
|
||||
return this.mTwilightState.nextUpdate > System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private void updateState(Location location) {
|
||||
long j;
|
||||
TwilightState twilightState = this.mTwilightState;
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
TwilightCalculator twilightCalculator = TwilightCalculator.getInstance();
|
||||
twilightCalculator.calculateTwilight(currentTimeMillis - 86400000, location.getLatitude(), location.getLongitude());
|
||||
twilightCalculator.calculateTwilight(currentTimeMillis, location.getLatitude(), location.getLongitude());
|
||||
boolean z = twilightCalculator.state == 1;
|
||||
long j2 = twilightCalculator.sunrise;
|
||||
long j3 = twilightCalculator.sunset;
|
||||
twilightCalculator.calculateTwilight(currentTimeMillis + 86400000, location.getLatitude(), location.getLongitude());
|
||||
long j4 = twilightCalculator.sunrise;
|
||||
if (j2 == -1 || j3 == -1) {
|
||||
j = currentTimeMillis + 43200000;
|
||||
} else {
|
||||
if (currentTimeMillis <= j3) {
|
||||
j4 = currentTimeMillis > j2 ? j3 : j2;
|
||||
}
|
||||
j = j4 + 60000;
|
||||
}
|
||||
twilightState.isNight = z;
|
||||
twilightState.nextUpdate = j;
|
||||
}
|
||||
|
||||
private static class TwilightState {
|
||||
boolean isNight;
|
||||
long nextUpdate;
|
||||
|
||||
TwilightState() {
|
||||
}
|
||||
}
|
||||
}
|
||||
1281
02-Easy5/E5/sources/androidx/appcompat/app/WindowDecorActionBar.java
Normal file
1281
02-Easy5/E5/sources/androidx/appcompat/app/WindowDecorActionBar.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
package androidx.appcompat.content.res;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.appcompat.widget.ResourceManagerInternal;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class AppCompatResources {
|
||||
private AppCompatResources() {
|
||||
}
|
||||
|
||||
public static ColorStateList getColorStateList(Context context, int i) {
|
||||
return ContextCompat.getColorStateList(context, i);
|
||||
}
|
||||
|
||||
public static Drawable getDrawable(Context context, int i) {
|
||||
return ResourceManagerInternal.get().getDrawable(context, i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,548 @@
|
||||
package androidx.appcompat.graphics.drawable;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.TimeInterpolator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.graphics.drawable.Animatable;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.StateSet;
|
||||
import android.util.Xml;
|
||||
import androidx.appcompat.graphics.drawable.DrawableContainerCompat;
|
||||
import androidx.appcompat.graphics.drawable.StateListDrawableCompat;
|
||||
import androidx.appcompat.resources.Compatibility;
|
||||
import androidx.appcompat.resources.R;
|
||||
import androidx.appcompat.widget.ResourceManagerInternal;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import androidx.collection.SparseArrayCompat;
|
||||
import androidx.core.content.res.TypedArrayUtils;
|
||||
import androidx.core.graphics.drawable.TintAwareDrawable;
|
||||
import androidx.core.util.ObjectsCompat;
|
||||
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
|
||||
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
|
||||
import java.io.IOException;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AnimatedStateListDrawableCompat extends StateListDrawableCompat implements TintAwareDrawable {
|
||||
private static final String ELEMENT_ITEM = "item";
|
||||
private static final String ELEMENT_TRANSITION = "transition";
|
||||
private static final String ITEM_MISSING_DRAWABLE_ERROR = ": <item> tag requires a 'drawable' attribute or child tag defining a drawable";
|
||||
private static final String LOGTAG = "AnimatedStateListDrawableCompat";
|
||||
private static final String TRANSITION_MISSING_DRAWABLE_ERROR = ": <transition> tag requires a 'drawable' attribute or child tag defining a drawable";
|
||||
private static final String TRANSITION_MISSING_FROM_TO_ID = ": <transition> tag requires 'fromId' & 'toId' attributes";
|
||||
private boolean mMutated;
|
||||
private AnimatedStateListState mState;
|
||||
private Transition mTransition;
|
||||
private int mTransitionFromIndex;
|
||||
private int mTransitionToIndex;
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable
|
||||
public boolean isStateful() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public AnimatedStateListDrawableCompat() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
AnimatedStateListDrawableCompat(AnimatedStateListState animatedStateListState, Resources resources) {
|
||||
super(null);
|
||||
this.mTransitionToIndex = -1;
|
||||
this.mTransitionFromIndex = -1;
|
||||
setConstantState(new AnimatedStateListState(animatedStateListState, this, resources));
|
||||
onStateChange(getState());
|
||||
jumpToCurrentState();
|
||||
}
|
||||
|
||||
public static AnimatedStateListDrawableCompat create(Context context, int i, Resources.Theme theme) {
|
||||
int next;
|
||||
try {
|
||||
Resources resources = context.getResources();
|
||||
XmlResourceParser xml = resources.getXml(i);
|
||||
AttributeSet asAttributeSet = Xml.asAttributeSet(xml);
|
||||
do {
|
||||
next = xml.next();
|
||||
if (next == 2) {
|
||||
break;
|
||||
}
|
||||
} while (next != 1);
|
||||
if (next != 2) {
|
||||
throw new XmlPullParserException("No start tag found");
|
||||
}
|
||||
return createFromXmlInner(context, resources, xml, asAttributeSet, theme);
|
||||
} catch (IOException e) {
|
||||
Log.e(LOGTAG, "parser error", e);
|
||||
return null;
|
||||
} catch (XmlPullParserException e2) {
|
||||
Log.e(LOGTAG, "parser error", e2);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static AnimatedStateListDrawableCompat createFromXmlInner(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws IOException, XmlPullParserException {
|
||||
String name = xmlPullParser.getName();
|
||||
if (!name.equals("animated-selector")) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": invalid animated-selector tag " + name);
|
||||
}
|
||||
AnimatedStateListDrawableCompat animatedStateListDrawableCompat = new AnimatedStateListDrawableCompat();
|
||||
animatedStateListDrawableCompat.inflate(context, resources, xmlPullParser, attributeSet, theme);
|
||||
return animatedStateListDrawableCompat;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat
|
||||
public void inflate(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.AnimatedStateListDrawableCompat);
|
||||
setVisible(obtainAttributes.getBoolean(R.styleable.AnimatedStateListDrawableCompat_android_visible, true), true);
|
||||
updateStateFromTypedArray(obtainAttributes);
|
||||
updateDensity(resources);
|
||||
obtainAttributes.recycle();
|
||||
inflateChildElements(context, resources, xmlPullParser, attributeSet, theme);
|
||||
init();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable
|
||||
public boolean setVisible(boolean z, boolean z2) {
|
||||
boolean visible = super.setVisible(z, z2);
|
||||
Transition transition = this.mTransition;
|
||||
if (transition != null && (visible || z2)) {
|
||||
if (z) {
|
||||
transition.start();
|
||||
} else {
|
||||
jumpToCurrentState();
|
||||
}
|
||||
}
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void addState(int[] iArr, Drawable drawable, int i) {
|
||||
ObjectsCompat.requireNonNull(drawable);
|
||||
this.mState.addStateSet(iArr, drawable, i);
|
||||
onStateChange(getState());
|
||||
}
|
||||
|
||||
public <T extends Drawable & Animatable> void addTransition(int i, int i2, T t, boolean z) {
|
||||
ObjectsCompat.requireNonNull(t);
|
||||
this.mState.addTransition(i, i2, t, z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable
|
||||
public void jumpToCurrentState() {
|
||||
super.jumpToCurrentState();
|
||||
Transition transition = this.mTransition;
|
||||
if (transition != null) {
|
||||
transition.stop();
|
||||
this.mTransition = null;
|
||||
selectDrawable(this.mTransitionToIndex);
|
||||
this.mTransitionToIndex = -1;
|
||||
this.mTransitionFromIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable
|
||||
protected boolean onStateChange(int[] iArr) {
|
||||
int indexOfKeyframe = this.mState.indexOfKeyframe(iArr);
|
||||
boolean z = indexOfKeyframe != getCurrentIndex() && (selectTransition(indexOfKeyframe) || selectDrawable(indexOfKeyframe));
|
||||
Drawable current = getCurrent();
|
||||
return current != null ? z | current.setState(iArr) : z;
|
||||
}
|
||||
|
||||
private boolean selectTransition(int i) {
|
||||
int currentIndex;
|
||||
int indexOfTransition;
|
||||
Transition animatableTransition;
|
||||
Transition transition = this.mTransition;
|
||||
if (transition == null) {
|
||||
currentIndex = getCurrentIndex();
|
||||
} else {
|
||||
if (i == this.mTransitionToIndex) {
|
||||
return true;
|
||||
}
|
||||
if (i == this.mTransitionFromIndex && transition.canReverse()) {
|
||||
transition.reverse();
|
||||
this.mTransitionToIndex = this.mTransitionFromIndex;
|
||||
this.mTransitionFromIndex = i;
|
||||
return true;
|
||||
}
|
||||
currentIndex = this.mTransitionToIndex;
|
||||
transition.stop();
|
||||
}
|
||||
this.mTransition = null;
|
||||
this.mTransitionFromIndex = -1;
|
||||
this.mTransitionToIndex = -1;
|
||||
AnimatedStateListState animatedStateListState = this.mState;
|
||||
int keyframeIdAt = animatedStateListState.getKeyframeIdAt(currentIndex);
|
||||
int keyframeIdAt2 = animatedStateListState.getKeyframeIdAt(i);
|
||||
if (keyframeIdAt2 == 0 || keyframeIdAt == 0 || (indexOfTransition = animatedStateListState.indexOfTransition(keyframeIdAt, keyframeIdAt2)) < 0) {
|
||||
return false;
|
||||
}
|
||||
boolean transitionHasReversibleFlag = animatedStateListState.transitionHasReversibleFlag(keyframeIdAt, keyframeIdAt2);
|
||||
selectDrawable(indexOfTransition);
|
||||
Object current = getCurrent();
|
||||
if (current instanceof AnimationDrawable) {
|
||||
animatableTransition = new AnimationDrawableTransition((AnimationDrawable) current, animatedStateListState.isTransitionReversed(keyframeIdAt, keyframeIdAt2), transitionHasReversibleFlag);
|
||||
} else if (current instanceof AnimatedVectorDrawableCompat) {
|
||||
animatableTransition = new AnimatedVectorDrawableTransition((AnimatedVectorDrawableCompat) current);
|
||||
} else {
|
||||
if (current instanceof Animatable) {
|
||||
animatableTransition = new AnimatableTransition((Animatable) current);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
animatableTransition.start();
|
||||
this.mTransition = animatableTransition;
|
||||
this.mTransitionFromIndex = currentIndex;
|
||||
this.mTransitionToIndex = i;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static abstract class Transition {
|
||||
public boolean canReverse() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void reverse() {
|
||||
}
|
||||
|
||||
public abstract void start();
|
||||
|
||||
public abstract void stop();
|
||||
|
||||
private Transition() {
|
||||
}
|
||||
}
|
||||
|
||||
private static class AnimatableTransition extends Transition {
|
||||
private final Animatable mA;
|
||||
|
||||
AnimatableTransition(Animatable animatable) {
|
||||
super();
|
||||
this.mA = animatable;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void start() {
|
||||
this.mA.start();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void stop() {
|
||||
this.mA.stop();
|
||||
}
|
||||
}
|
||||
|
||||
private static class AnimationDrawableTransition extends Transition {
|
||||
private final ObjectAnimator mAnim;
|
||||
private final boolean mHasReversibleFlag;
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public boolean canReverse() {
|
||||
return this.mHasReversibleFlag;
|
||||
}
|
||||
|
||||
AnimationDrawableTransition(AnimationDrawable animationDrawable, boolean z, boolean z2) {
|
||||
super();
|
||||
int numberOfFrames = animationDrawable.getNumberOfFrames();
|
||||
int i = z ? numberOfFrames - 1 : 0;
|
||||
int i2 = z ? 0 : numberOfFrames - 1;
|
||||
FrameInterpolator frameInterpolator = new FrameInterpolator(animationDrawable, z);
|
||||
ObjectAnimator ofInt = ObjectAnimator.ofInt(animationDrawable, "currentIndex", i, i2);
|
||||
Compatibility.Api18Impl.setAutoCancel(ofInt, true);
|
||||
ofInt.setDuration(frameInterpolator.getTotalDuration());
|
||||
ofInt.setInterpolator(frameInterpolator);
|
||||
this.mHasReversibleFlag = z2;
|
||||
this.mAnim = ofInt;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void start() {
|
||||
this.mAnim.start();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void reverse() {
|
||||
this.mAnim.reverse();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void stop() {
|
||||
this.mAnim.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private static class AnimatedVectorDrawableTransition extends Transition {
|
||||
private final AnimatedVectorDrawableCompat mAvd;
|
||||
|
||||
AnimatedVectorDrawableTransition(AnimatedVectorDrawableCompat animatedVectorDrawableCompat) {
|
||||
super();
|
||||
this.mAvd = animatedVectorDrawableCompat;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void start() {
|
||||
this.mAvd.start();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void stop() {
|
||||
this.mAvd.stop();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStateFromTypedArray(TypedArray typedArray) {
|
||||
AnimatedStateListState animatedStateListState = this.mState;
|
||||
animatedStateListState.mChangingConfigurations |= Compatibility.Api21Impl.getChangingConfigurations(typedArray);
|
||||
animatedStateListState.setVariablePadding(typedArray.getBoolean(R.styleable.AnimatedStateListDrawableCompat_android_variablePadding, animatedStateListState.mVariablePadding));
|
||||
animatedStateListState.setConstantSize(typedArray.getBoolean(R.styleable.AnimatedStateListDrawableCompat_android_constantSize, animatedStateListState.mConstantSize));
|
||||
animatedStateListState.setEnterFadeDuration(typedArray.getInt(R.styleable.AnimatedStateListDrawableCompat_android_enterFadeDuration, animatedStateListState.mEnterFadeDuration));
|
||||
animatedStateListState.setExitFadeDuration(typedArray.getInt(R.styleable.AnimatedStateListDrawableCompat_android_exitFadeDuration, animatedStateListState.mExitFadeDuration));
|
||||
setDither(typedArray.getBoolean(R.styleable.AnimatedStateListDrawableCompat_android_dither, animatedStateListState.mDither));
|
||||
}
|
||||
|
||||
private void init() {
|
||||
onStateChange(getState());
|
||||
}
|
||||
|
||||
private void inflateChildElements(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
int depth = xmlPullParser.getDepth() + 1;
|
||||
while (true) {
|
||||
int next = xmlPullParser.next();
|
||||
if (next == 1) {
|
||||
return;
|
||||
}
|
||||
int depth2 = xmlPullParser.getDepth();
|
||||
if (depth2 < depth && next == 3) {
|
||||
return;
|
||||
}
|
||||
if (next == 2 && depth2 <= depth) {
|
||||
if (xmlPullParser.getName().equals(ELEMENT_ITEM)) {
|
||||
parseItem(context, resources, xmlPullParser, attributeSet, theme);
|
||||
} else if (xmlPullParser.getName().equals(ELEMENT_TRANSITION)) {
|
||||
parseTransition(context, resources, xmlPullParser, attributeSet, theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int parseTransition(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
int next;
|
||||
TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.AnimatedStateListDrawableTransition);
|
||||
int resourceId = obtainAttributes.getResourceId(R.styleable.AnimatedStateListDrawableTransition_android_fromId, -1);
|
||||
int resourceId2 = obtainAttributes.getResourceId(R.styleable.AnimatedStateListDrawableTransition_android_toId, -1);
|
||||
int resourceId3 = obtainAttributes.getResourceId(R.styleable.AnimatedStateListDrawableTransition_android_drawable, -1);
|
||||
Drawable drawable = resourceId3 > 0 ? ResourceManagerInternal.get().getDrawable(context, resourceId3) : null;
|
||||
boolean z = obtainAttributes.getBoolean(R.styleable.AnimatedStateListDrawableTransition_android_reversible, false);
|
||||
obtainAttributes.recycle();
|
||||
if (drawable == null) {
|
||||
do {
|
||||
next = xmlPullParser.next();
|
||||
} while (next == 4);
|
||||
if (next != 2) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + TRANSITION_MISSING_DRAWABLE_ERROR);
|
||||
}
|
||||
if (xmlPullParser.getName().equals("animated-vector")) {
|
||||
drawable = AnimatedVectorDrawableCompat.createFromXmlInner(context, resources, xmlPullParser, attributeSet, theme);
|
||||
} else {
|
||||
drawable = Compatibility.Api21Impl.createFromXmlInner(resources, xmlPullParser, attributeSet, theme);
|
||||
}
|
||||
}
|
||||
if (drawable == null) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + TRANSITION_MISSING_DRAWABLE_ERROR);
|
||||
}
|
||||
if (resourceId == -1 || resourceId2 == -1) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + TRANSITION_MISSING_FROM_TO_ID);
|
||||
}
|
||||
return this.mState.addTransition(resourceId, resourceId2, drawable, z);
|
||||
}
|
||||
|
||||
private int parseItem(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
int next;
|
||||
TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.AnimatedStateListDrawableItem);
|
||||
int resourceId = obtainAttributes.getResourceId(R.styleable.AnimatedStateListDrawableItem_android_id, 0);
|
||||
int resourceId2 = obtainAttributes.getResourceId(R.styleable.AnimatedStateListDrawableItem_android_drawable, -1);
|
||||
Drawable drawable = resourceId2 > 0 ? ResourceManagerInternal.get().getDrawable(context, resourceId2) : null;
|
||||
obtainAttributes.recycle();
|
||||
int[] extractStateSet = extractStateSet(attributeSet);
|
||||
if (drawable == null) {
|
||||
do {
|
||||
next = xmlPullParser.next();
|
||||
} while (next == 4);
|
||||
if (next != 2) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ITEM_MISSING_DRAWABLE_ERROR);
|
||||
}
|
||||
if (xmlPullParser.getName().equals("vector")) {
|
||||
drawable = VectorDrawableCompat.createFromXmlInner(resources, xmlPullParser, attributeSet, theme);
|
||||
} else {
|
||||
drawable = Compatibility.Api21Impl.createFromXmlInner(resources, xmlPullParser, attributeSet, theme);
|
||||
}
|
||||
}
|
||||
if (drawable == null) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ITEM_MISSING_DRAWABLE_ERROR);
|
||||
}
|
||||
return this.mState.addStateSet(extractStateSet, drawable, resourceId);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable
|
||||
public Drawable mutate() {
|
||||
if (!this.mMutated && super.mutate() == this) {
|
||||
this.mState.mutate();
|
||||
this.mMutated = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat
|
||||
public AnimatedStateListState cloneConstantState() {
|
||||
return new AnimatedStateListState(this.mState, this, null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat
|
||||
void clearMutated() {
|
||||
super.clearMutated();
|
||||
this.mMutated = false;
|
||||
}
|
||||
|
||||
static class AnimatedStateListState extends StateListDrawableCompat.StateListState {
|
||||
private static final long REVERSED_BIT = 4294967296L;
|
||||
private static final long REVERSIBLE_FLAG_BIT = 8589934592L;
|
||||
SparseArrayCompat<Integer> mStateIds;
|
||||
LongSparseArray<Long> mTransitions;
|
||||
|
||||
private static long generateTransitionKey(int i, int i2) {
|
||||
return i2 | (i << 32);
|
||||
}
|
||||
|
||||
AnimatedStateListState(AnimatedStateListState animatedStateListState, AnimatedStateListDrawableCompat animatedStateListDrawableCompat, Resources resources) {
|
||||
super(animatedStateListState, animatedStateListDrawableCompat, resources);
|
||||
if (animatedStateListState != null) {
|
||||
this.mTransitions = animatedStateListState.mTransitions;
|
||||
this.mStateIds = animatedStateListState.mStateIds;
|
||||
} else {
|
||||
this.mTransitions = new LongSparseArray<>();
|
||||
this.mStateIds = new SparseArrayCompat<>();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat.StateListState, androidx.appcompat.graphics.drawable.DrawableContainerCompat.DrawableContainerState
|
||||
void mutate() {
|
||||
this.mTransitions = this.mTransitions.m45clone();
|
||||
this.mStateIds = this.mStateIds.m46clone();
|
||||
}
|
||||
|
||||
int addTransition(int i, int i2, Drawable drawable, boolean z) {
|
||||
int addChild = super.addChild(drawable);
|
||||
long generateTransitionKey = generateTransitionKey(i, i2);
|
||||
long j = z ? REVERSIBLE_FLAG_BIT : 0L;
|
||||
long j2 = addChild;
|
||||
this.mTransitions.append(generateTransitionKey, Long.valueOf(j2 | j));
|
||||
if (z) {
|
||||
this.mTransitions.append(generateTransitionKey(i2, i), Long.valueOf(REVERSED_BIT | j2 | j));
|
||||
}
|
||||
return addChild;
|
||||
}
|
||||
|
||||
int addStateSet(int[] iArr, Drawable drawable, int i) {
|
||||
int addStateSet = super.addStateSet(iArr, drawable);
|
||||
this.mStateIds.put(addStateSet, Integer.valueOf(i));
|
||||
return addStateSet;
|
||||
}
|
||||
|
||||
int indexOfKeyframe(int[] iArr) {
|
||||
int indexOfStateSet = super.indexOfStateSet(iArr);
|
||||
return indexOfStateSet >= 0 ? indexOfStateSet : super.indexOfStateSet(StateSet.WILD_CARD);
|
||||
}
|
||||
|
||||
int getKeyframeIdAt(int i) {
|
||||
if (i < 0) {
|
||||
return 0;
|
||||
}
|
||||
return this.mStateIds.get(i, 0).intValue();
|
||||
}
|
||||
|
||||
int indexOfTransition(int i, int i2) {
|
||||
return (int) this.mTransitions.get(generateTransitionKey(i, i2), -1L).longValue();
|
||||
}
|
||||
|
||||
boolean isTransitionReversed(int i, int i2) {
|
||||
return (this.mTransitions.get(generateTransitionKey(i, i2), -1L).longValue() & REVERSED_BIT) != 0;
|
||||
}
|
||||
|
||||
boolean transitionHasReversibleFlag(int i, int i2) {
|
||||
return (this.mTransitions.get(generateTransitionKey(i, i2), -1L).longValue() & REVERSIBLE_FLAG_BIT) != 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat.StateListState, android.graphics.drawable.Drawable.ConstantState
|
||||
public Drawable newDrawable() {
|
||||
return new AnimatedStateListDrawableCompat(this, null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat.StateListState, android.graphics.drawable.Drawable.ConstantState
|
||||
public Drawable newDrawable(Resources resources) {
|
||||
return new AnimatedStateListDrawableCompat(this, resources);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat
|
||||
void setConstantState(DrawableContainerCompat.DrawableContainerState drawableContainerState) {
|
||||
super.setConstantState(drawableContainerState);
|
||||
if (drawableContainerState instanceof AnimatedStateListState) {
|
||||
this.mState = (AnimatedStateListState) drawableContainerState;
|
||||
}
|
||||
}
|
||||
|
||||
private static class FrameInterpolator implements TimeInterpolator {
|
||||
private int[] mFrameTimes;
|
||||
private int mFrames;
|
||||
private int mTotalDuration;
|
||||
|
||||
int getTotalDuration() {
|
||||
return this.mTotalDuration;
|
||||
}
|
||||
|
||||
FrameInterpolator(AnimationDrawable animationDrawable, boolean z) {
|
||||
updateFrames(animationDrawable, z);
|
||||
}
|
||||
|
||||
int updateFrames(AnimationDrawable animationDrawable, boolean z) {
|
||||
int numberOfFrames = animationDrawable.getNumberOfFrames();
|
||||
this.mFrames = numberOfFrames;
|
||||
int[] iArr = this.mFrameTimes;
|
||||
if (iArr == null || iArr.length < numberOfFrames) {
|
||||
this.mFrameTimes = new int[numberOfFrames];
|
||||
}
|
||||
int[] iArr2 = this.mFrameTimes;
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < numberOfFrames; i2++) {
|
||||
int duration = animationDrawable.getDuration(z ? (numberOfFrames - i2) - 1 : i2);
|
||||
iArr2[i2] = duration;
|
||||
i += duration;
|
||||
}
|
||||
this.mTotalDuration = i;
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // android.animation.TimeInterpolator
|
||||
public float getInterpolation(float f) {
|
||||
int i = (int) ((f * this.mTotalDuration) + 0.5f);
|
||||
int i2 = this.mFrames;
|
||||
int[] iArr = this.mFrameTimes;
|
||||
int i3 = 0;
|
||||
while (i3 < i2) {
|
||||
int i4 = iArr[i3];
|
||||
if (i < i4) {
|
||||
break;
|
||||
}
|
||||
i -= i4;
|
||||
i3++;
|
||||
}
|
||||
return (i3 / i2) + (i3 < i2 ? i / this.mTotalDuration : 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,194 @@
|
||||
package androidx.appcompat.graphics.drawable;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DrawableWrapperCompat extends Drawable implements Drawable.Callback {
|
||||
private Drawable mDrawable;
|
||||
|
||||
public Drawable getDrawable() {
|
||||
return this.mDrawable;
|
||||
}
|
||||
|
||||
public DrawableWrapperCompat(Drawable drawable) {
|
||||
setDrawable(drawable);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
this.mDrawable.draw(canvas);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
protected void onBoundsChange(Rect rect) {
|
||||
this.mDrawable.setBounds(rect);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setChangingConfigurations(int i) {
|
||||
this.mDrawable.setChangingConfigurations(i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getChangingConfigurations() {
|
||||
return this.mDrawable.getChangingConfigurations();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setDither(boolean z) {
|
||||
this.mDrawable.setDither(z);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setFilterBitmap(boolean z) {
|
||||
this.mDrawable.setFilterBitmap(z);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAlpha(int i) {
|
||||
this.mDrawable.setAlpha(i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setColorFilter(ColorFilter colorFilter) {
|
||||
this.mDrawable.setColorFilter(colorFilter);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean isStateful() {
|
||||
return this.mDrawable.isStateful();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean setState(int[] iArr) {
|
||||
return this.mDrawable.setState(iArr);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int[] getState() {
|
||||
return this.mDrawable.getState();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void jumpToCurrentState() {
|
||||
this.mDrawable.jumpToCurrentState();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public Drawable getCurrent() {
|
||||
return this.mDrawable.getCurrent();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean setVisible(boolean z, boolean z2) {
|
||||
return super.setVisible(z, z2) || this.mDrawable.setVisible(z, z2);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getOpacity() {
|
||||
return this.mDrawable.getOpacity();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public Region getTransparentRegion() {
|
||||
return this.mDrawable.getTransparentRegion();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getIntrinsicWidth() {
|
||||
return this.mDrawable.getIntrinsicWidth();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getIntrinsicHeight() {
|
||||
return this.mDrawable.getIntrinsicHeight();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getMinimumWidth() {
|
||||
return this.mDrawable.getMinimumWidth();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getMinimumHeight() {
|
||||
return this.mDrawable.getMinimumHeight();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean getPadding(Rect rect) {
|
||||
return this.mDrawable.getPadding(rect);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.Callback
|
||||
public void invalidateDrawable(Drawable drawable) {
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.Callback
|
||||
public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) {
|
||||
scheduleSelf(runnable, j);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.Callback
|
||||
public void unscheduleDrawable(Drawable drawable, Runnable runnable) {
|
||||
unscheduleSelf(runnable);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
protected boolean onLevelChange(int i) {
|
||||
return this.mDrawable.setLevel(i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAutoMirrored(boolean z) {
|
||||
DrawableCompat.setAutoMirrored(this.mDrawable, z);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean isAutoMirrored() {
|
||||
return DrawableCompat.isAutoMirrored(this.mDrawable);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setTint(int i) {
|
||||
DrawableCompat.setTint(this.mDrawable, i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setTintList(ColorStateList colorStateList) {
|
||||
DrawableCompat.setTintList(this.mDrawable, colorStateList);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setTintMode(PorterDuff.Mode mode) {
|
||||
DrawableCompat.setTintMode(this.mDrawable, mode);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setHotspot(float f, float f2) {
|
||||
DrawableCompat.setHotspot(this.mDrawable, f, f2);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setHotspotBounds(int i, int i2, int i3, int i4) {
|
||||
DrawableCompat.setHotspotBounds(this.mDrawable, i, i2, i3, i4);
|
||||
}
|
||||
|
||||
public void setDrawable(Drawable drawable) {
|
||||
Drawable drawable2 = this.mDrawable;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setCallback(null);
|
||||
}
|
||||
this.mDrawable = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
package androidx.appcompat.graphics.drawable;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DrawerArrowDrawable extends Drawable {
|
||||
public static final int ARROW_DIRECTION_END = 3;
|
||||
public static final int ARROW_DIRECTION_LEFT = 0;
|
||||
public static final int ARROW_DIRECTION_RIGHT = 1;
|
||||
public static final int ARROW_DIRECTION_START = 2;
|
||||
private static final float ARROW_HEAD_ANGLE = (float) Math.toRadians(45.0d);
|
||||
private float mArrowHeadLength;
|
||||
private float mArrowShaftLength;
|
||||
private float mBarGap;
|
||||
private float mBarLength;
|
||||
private int mDirection;
|
||||
private float mMaxCutForBarSize;
|
||||
private final Paint mPaint;
|
||||
private final Path mPath;
|
||||
private float mProgress;
|
||||
private final int mSize;
|
||||
private boolean mSpin;
|
||||
private boolean mVerticalMirror;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ArrowDirection {
|
||||
}
|
||||
|
||||
private static float lerp(float f, float f2, float f3) {
|
||||
return f + ((f2 - f) * f3);
|
||||
}
|
||||
|
||||
public float getArrowHeadLength() {
|
||||
return this.mArrowHeadLength;
|
||||
}
|
||||
|
||||
public float getArrowShaftLength() {
|
||||
return this.mArrowShaftLength;
|
||||
}
|
||||
|
||||
public float getBarLength() {
|
||||
return this.mBarLength;
|
||||
}
|
||||
|
||||
public int getDirection() {
|
||||
return this.mDirection;
|
||||
}
|
||||
|
||||
public float getGapSize() {
|
||||
return this.mBarGap;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getIntrinsicHeight() {
|
||||
return this.mSize;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getIntrinsicWidth() {
|
||||
return this.mSize;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getOpacity() {
|
||||
return -3;
|
||||
}
|
||||
|
||||
public final Paint getPaint() {
|
||||
return this.mPaint;
|
||||
}
|
||||
|
||||
public float getProgress() {
|
||||
return this.mProgress;
|
||||
}
|
||||
|
||||
public boolean isSpinEnabled() {
|
||||
return this.mSpin;
|
||||
}
|
||||
|
||||
public DrawerArrowDrawable(Context context) {
|
||||
Paint paint = new Paint();
|
||||
this.mPaint = paint;
|
||||
this.mPath = new Path();
|
||||
this.mVerticalMirror = false;
|
||||
this.mDirection = 2;
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
paint.setStrokeJoin(Paint.Join.MITER);
|
||||
paint.setStrokeCap(Paint.Cap.BUTT);
|
||||
paint.setAntiAlias(true);
|
||||
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(null, R.styleable.DrawerArrowToggle, R.attr.drawerArrowStyle, R.style.Base_Widget_AppCompat_DrawerArrowToggle);
|
||||
setColor(obtainStyledAttributes.getColor(R.styleable.DrawerArrowToggle_color, 0));
|
||||
setBarThickness(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_thickness, 0.0f));
|
||||
setSpinEnabled(obtainStyledAttributes.getBoolean(R.styleable.DrawerArrowToggle_spinBars, true));
|
||||
setGapSize(Math.round(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_gapBetweenBars, 0.0f)));
|
||||
this.mSize = obtainStyledAttributes.getDimensionPixelSize(R.styleable.DrawerArrowToggle_drawableSize, 0);
|
||||
this.mBarLength = Math.round(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_barLength, 0.0f));
|
||||
this.mArrowHeadLength = Math.round(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_arrowHeadLength, 0.0f));
|
||||
this.mArrowShaftLength = obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_arrowShaftLength, 0.0f);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
public void setArrowHeadLength(float f) {
|
||||
if (this.mArrowHeadLength != f) {
|
||||
this.mArrowHeadLength = f;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public void setArrowShaftLength(float f) {
|
||||
if (this.mArrowShaftLength != f) {
|
||||
this.mArrowShaftLength = f;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public void setBarLength(float f) {
|
||||
if (this.mBarLength != f) {
|
||||
this.mBarLength = f;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public void setColor(int i) {
|
||||
if (i != this.mPaint.getColor()) {
|
||||
this.mPaint.setColor(i);
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.mPaint.getColor();
|
||||
}
|
||||
|
||||
public void setBarThickness(float f) {
|
||||
if (this.mPaint.getStrokeWidth() != f) {
|
||||
this.mPaint.setStrokeWidth(f);
|
||||
this.mMaxCutForBarSize = (float) ((f / 2.0f) * Math.cos(ARROW_HEAD_ANGLE));
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public float getBarThickness() {
|
||||
return this.mPaint.getStrokeWidth();
|
||||
}
|
||||
|
||||
public void setGapSize(float f) {
|
||||
if (f != this.mBarGap) {
|
||||
this.mBarGap = f;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public void setDirection(int i) {
|
||||
if (i != this.mDirection) {
|
||||
this.mDirection = i;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSpinEnabled(boolean z) {
|
||||
if (this.mSpin != z) {
|
||||
this.mSpin = z;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public void setVerticalMirror(boolean z) {
|
||||
if (this.mVerticalMirror != z) {
|
||||
this.mVerticalMirror = z;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
Rect bounds = getBounds();
|
||||
int i = this.mDirection;
|
||||
boolean z = false;
|
||||
if (i != 0 && (i == 1 || (i == 3 ? DrawableCompat.getLayoutDirection(this) == 0 : DrawableCompat.getLayoutDirection(this) == 1))) {
|
||||
z = true;
|
||||
}
|
||||
float f = this.mArrowHeadLength;
|
||||
float lerp = lerp(this.mBarLength, (float) Math.sqrt(f * f * 2.0f), this.mProgress);
|
||||
float lerp2 = lerp(this.mBarLength, this.mArrowShaftLength, this.mProgress);
|
||||
float round = Math.round(lerp(0.0f, this.mMaxCutForBarSize, this.mProgress));
|
||||
float lerp3 = lerp(0.0f, ARROW_HEAD_ANGLE, this.mProgress);
|
||||
float lerp4 = lerp(z ? 0.0f : -180.0f, z ? 180.0f : 0.0f, this.mProgress);
|
||||
double d = lerp;
|
||||
double d2 = lerp3;
|
||||
boolean z2 = z;
|
||||
float round2 = Math.round(Math.cos(d2) * d);
|
||||
float round3 = Math.round(d * Math.sin(d2));
|
||||
this.mPath.rewind();
|
||||
float lerp5 = lerp(this.mBarGap + this.mPaint.getStrokeWidth(), -this.mMaxCutForBarSize, this.mProgress);
|
||||
float f2 = (-lerp2) / 2.0f;
|
||||
this.mPath.moveTo(f2 + round, 0.0f);
|
||||
this.mPath.rLineTo(lerp2 - (round * 2.0f), 0.0f);
|
||||
this.mPath.moveTo(f2, lerp5);
|
||||
this.mPath.rLineTo(round2, round3);
|
||||
this.mPath.moveTo(f2, -lerp5);
|
||||
this.mPath.rLineTo(round2, -round3);
|
||||
this.mPath.close();
|
||||
canvas.save();
|
||||
float strokeWidth = this.mPaint.getStrokeWidth();
|
||||
float height = bounds.height() - (3.0f * strokeWidth);
|
||||
canvas.translate(bounds.centerX(), ((((int) (height - (2.0f * r5))) / 4) * 2) + (strokeWidth * 1.5f) + this.mBarGap);
|
||||
if (this.mSpin) {
|
||||
canvas.rotate(lerp4 * (this.mVerticalMirror ^ z2 ? -1 : 1));
|
||||
} else if (z2) {
|
||||
canvas.rotate(180.0f);
|
||||
}
|
||||
canvas.drawPath(this.mPath, this.mPaint);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAlpha(int i) {
|
||||
if (i != this.mPaint.getAlpha()) {
|
||||
this.mPaint.setAlpha(i);
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setColorFilter(ColorFilter colorFilter) {
|
||||
this.mPaint.setColorFilter(colorFilter);
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
public void setProgress(float f) {
|
||||
if (this.mProgress != f) {
|
||||
this.mProgress = f;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
package androidx.appcompat.graphics.drawable;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.StateSet;
|
||||
import androidx.appcompat.graphics.drawable.DrawableContainerCompat;
|
||||
import androidx.appcompat.resources.Compatibility;
|
||||
import androidx.appcompat.resources.R;
|
||||
import androidx.appcompat.widget.ResourceManagerInternal;
|
||||
import androidx.core.content.res.TypedArrayUtils;
|
||||
import java.io.IOException;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class StateListDrawableCompat extends DrawableContainerCompat {
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String TAG = "StateListDrawableCompat";
|
||||
private boolean mMutated;
|
||||
private StateListState mStateListState;
|
||||
|
||||
StateListState getStateListState() {
|
||||
return this.mStateListState;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable
|
||||
public boolean isStateful() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public StateListDrawableCompat() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
public void addState(int[] iArr, Drawable drawable) {
|
||||
if (drawable != null) {
|
||||
this.mStateListState.addStateSet(iArr, drawable);
|
||||
onStateChange(getState());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable
|
||||
protected boolean onStateChange(int[] iArr) {
|
||||
boolean onStateChange = super.onStateChange(iArr);
|
||||
int indexOfStateSet = this.mStateListState.indexOfStateSet(iArr);
|
||||
if (indexOfStateSet < 0) {
|
||||
indexOfStateSet = this.mStateListState.indexOfStateSet(StateSet.WILD_CARD);
|
||||
}
|
||||
return selectDrawable(indexOfStateSet) || onStateChange;
|
||||
}
|
||||
|
||||
public void inflate(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.StateListDrawable);
|
||||
setVisible(obtainAttributes.getBoolean(R.styleable.StateListDrawable_android_visible, true), true);
|
||||
updateStateFromTypedArray(obtainAttributes);
|
||||
updateDensity(resources);
|
||||
obtainAttributes.recycle();
|
||||
inflateChildElements(context, resources, xmlPullParser, attributeSet, theme);
|
||||
onStateChange(getState());
|
||||
}
|
||||
|
||||
private void updateStateFromTypedArray(TypedArray typedArray) {
|
||||
StateListState stateListState = this.mStateListState;
|
||||
stateListState.mChangingConfigurations |= Compatibility.Api21Impl.getChangingConfigurations(typedArray);
|
||||
stateListState.mVariablePadding = typedArray.getBoolean(R.styleable.StateListDrawable_android_variablePadding, stateListState.mVariablePadding);
|
||||
stateListState.mConstantSize = typedArray.getBoolean(R.styleable.StateListDrawable_android_constantSize, stateListState.mConstantSize);
|
||||
stateListState.mEnterFadeDuration = typedArray.getInt(R.styleable.StateListDrawable_android_enterFadeDuration, stateListState.mEnterFadeDuration);
|
||||
stateListState.mExitFadeDuration = typedArray.getInt(R.styleable.StateListDrawable_android_exitFadeDuration, stateListState.mExitFadeDuration);
|
||||
stateListState.mDither = typedArray.getBoolean(R.styleable.StateListDrawable_android_dither, stateListState.mDither);
|
||||
}
|
||||
|
||||
private void inflateChildElements(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
int next;
|
||||
StateListState stateListState = this.mStateListState;
|
||||
int depth = xmlPullParser.getDepth() + 1;
|
||||
while (true) {
|
||||
int next2 = xmlPullParser.next();
|
||||
if (next2 == 1) {
|
||||
return;
|
||||
}
|
||||
int depth2 = xmlPullParser.getDepth();
|
||||
if (depth2 < depth && next2 == 3) {
|
||||
return;
|
||||
}
|
||||
if (next2 == 2 && depth2 <= depth && xmlPullParser.getName().equals("item")) {
|
||||
TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.StateListDrawableItem);
|
||||
int resourceId = obtainAttributes.getResourceId(R.styleable.StateListDrawableItem_android_drawable, -1);
|
||||
Drawable drawable = resourceId > 0 ? ResourceManagerInternal.get().getDrawable(context, resourceId) : null;
|
||||
obtainAttributes.recycle();
|
||||
int[] extractStateSet = extractStateSet(attributeSet);
|
||||
if (drawable == null) {
|
||||
do {
|
||||
next = xmlPullParser.next();
|
||||
} while (next == 4);
|
||||
if (next != 2) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": <item> tag requires a 'drawable' attribute or child tag defining a drawable");
|
||||
}
|
||||
drawable = Compatibility.Api21Impl.createFromXmlInner(resources, xmlPullParser, attributeSet, theme);
|
||||
}
|
||||
stateListState.addStateSet(extractStateSet, drawable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int[] extractStateSet(AttributeSet attributeSet) {
|
||||
int attributeCount = attributeSet.getAttributeCount();
|
||||
int[] iArr = new int[attributeCount];
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < attributeCount; i2++) {
|
||||
int attributeNameResource = attributeSet.getAttributeNameResource(i2);
|
||||
if (attributeNameResource != 0 && attributeNameResource != 16842960 && attributeNameResource != 16843161) {
|
||||
int i3 = i + 1;
|
||||
if (!attributeSet.getAttributeBooleanValue(i2, false)) {
|
||||
attributeNameResource = -attributeNameResource;
|
||||
}
|
||||
iArr[i] = attributeNameResource;
|
||||
i = i3;
|
||||
}
|
||||
}
|
||||
return StateSet.trimStateSet(iArr, i);
|
||||
}
|
||||
|
||||
int getStateCount() {
|
||||
return this.mStateListState.getChildCount();
|
||||
}
|
||||
|
||||
int[] getStateSet(int i) {
|
||||
return this.mStateListState.mStateSets[i];
|
||||
}
|
||||
|
||||
Drawable getStateDrawable(int i) {
|
||||
return this.mStateListState.getChild(i);
|
||||
}
|
||||
|
||||
int getStateDrawableIndex(int[] iArr) {
|
||||
return this.mStateListState.indexOfStateSet(iArr);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable
|
||||
public Drawable mutate() {
|
||||
if (!this.mMutated && super.mutate() == this) {
|
||||
this.mStateListState.mutate();
|
||||
this.mMutated = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat
|
||||
public StateListState cloneConstantState() {
|
||||
return new StateListState(this.mStateListState, this, null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat
|
||||
void clearMutated() {
|
||||
super.clearMutated();
|
||||
this.mMutated = false;
|
||||
}
|
||||
|
||||
static class StateListState extends DrawableContainerCompat.DrawableContainerState {
|
||||
int[][] mStateSets;
|
||||
|
||||
StateListState(StateListState stateListState, StateListDrawableCompat stateListDrawableCompat, Resources resources) {
|
||||
super(stateListState, stateListDrawableCompat, resources);
|
||||
if (stateListState != null) {
|
||||
this.mStateSets = stateListState.mStateSets;
|
||||
} else {
|
||||
this.mStateSets = new int[getCapacity()][];
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat.DrawableContainerState
|
||||
void mutate() {
|
||||
int[][] iArr = this.mStateSets;
|
||||
int[][] iArr2 = new int[iArr.length][];
|
||||
for (int length = iArr.length - 1; length >= 0; length--) {
|
||||
int[] iArr3 = this.mStateSets[length];
|
||||
iArr2[length] = iArr3 != null ? (int[]) iArr3.clone() : null;
|
||||
}
|
||||
this.mStateSets = iArr2;
|
||||
}
|
||||
|
||||
int addStateSet(int[] iArr, Drawable drawable) {
|
||||
int addChild = addChild(drawable);
|
||||
this.mStateSets[addChild] = iArr;
|
||||
return addChild;
|
||||
}
|
||||
|
||||
int indexOfStateSet(int[] iArr) {
|
||||
int[][] iArr2 = this.mStateSets;
|
||||
int childCount = getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
if (StateSet.stateSetMatches(iArr2[i], iArr)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.ConstantState
|
||||
public Drawable newDrawable() {
|
||||
return new StateListDrawableCompat(this, null);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.ConstantState
|
||||
public Drawable newDrawable(Resources resources) {
|
||||
return new StateListDrawableCompat(this, resources);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat.DrawableContainerState
|
||||
public void growArray(int i, int i2) {
|
||||
super.growArray(i, i2);
|
||||
int[][] iArr = new int[i2][];
|
||||
System.arraycopy(this.mStateSets, 0, iArr, 0, i);
|
||||
this.mStateSets = iArr;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable
|
||||
public void applyTheme(Resources.Theme theme) {
|
||||
super.applyTheme(theme);
|
||||
onStateChange(getState());
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat
|
||||
void setConstantState(DrawableContainerCompat.DrawableContainerState drawableContainerState) {
|
||||
super.setConstantState(drawableContainerState);
|
||||
if (drawableContainerState instanceof StateListState) {
|
||||
this.mStateListState = (StateListState) drawableContainerState;
|
||||
}
|
||||
}
|
||||
|
||||
StateListDrawableCompat(StateListState stateListState, Resources resources) {
|
||||
setConstantState(new StateListState(stateListState, this, resources));
|
||||
onStateChange(getState());
|
||||
}
|
||||
|
||||
StateListDrawableCompat(StateListState stateListState) {
|
||||
if (stateListState != null) {
|
||||
setConstantState(stateListState);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package androidx.appcompat.resources;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import java.io.IOException;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Compatibility {
|
||||
private Compatibility() {
|
||||
}
|
||||
|
||||
public static class Api21Impl {
|
||||
private Api21Impl() {
|
||||
}
|
||||
|
||||
public static void inflate(Drawable drawable, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws IOException, XmlPullParserException {
|
||||
drawable.inflate(resources, xmlPullParser, attributeSet, theme);
|
||||
}
|
||||
|
||||
public static int getChangingConfigurations(TypedArray typedArray) {
|
||||
return typedArray.getChangingConfigurations();
|
||||
}
|
||||
|
||||
public static Drawable createFromXmlInner(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws IOException, XmlPullParserException {
|
||||
return Drawable.createFromXmlInner(resources, xmlPullParser, attributeSet, theme);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Api18Impl {
|
||||
private Api18Impl() {
|
||||
}
|
||||
|
||||
public static void setAutoCancel(ObjectAnimator objectAnimator, boolean z) {
|
||||
objectAnimator.setAutoCancel(z);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Api15Impl {
|
||||
private Api15Impl() {
|
||||
}
|
||||
|
||||
public static void getValueForDensity(Resources resources, int i, int i2, TypedValue typedValue, boolean z) {
|
||||
resources.getValueForDensity(i, i2, typedValue, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
45
02-Easy5/E5/sources/androidx/appcompat/resources/R.java
Normal file
45
02-Easy5/E5/sources/androidx/appcompat/resources/R.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package androidx.appcompat.resources;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R {
|
||||
|
||||
public static final class drawable {
|
||||
public static final int abc_vector_test = 0x7f070077;
|
||||
|
||||
private drawable() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class styleable {
|
||||
public static final int AnimatedStateListDrawableCompat_android_constantSize = 0x00000003;
|
||||
public static final int AnimatedStateListDrawableCompat_android_dither = 0x00000000;
|
||||
public static final int AnimatedStateListDrawableCompat_android_enterFadeDuration = 0x00000004;
|
||||
public static final int AnimatedStateListDrawableCompat_android_exitFadeDuration = 0x00000005;
|
||||
public static final int AnimatedStateListDrawableCompat_android_variablePadding = 0x00000002;
|
||||
public static final int AnimatedStateListDrawableCompat_android_visible = 0x00000001;
|
||||
public static final int AnimatedStateListDrawableItem_android_drawable = 0x00000001;
|
||||
public static final int AnimatedStateListDrawableItem_android_id = 0x00000000;
|
||||
public static final int AnimatedStateListDrawableTransition_android_drawable = 0x00000000;
|
||||
public static final int AnimatedStateListDrawableTransition_android_fromId = 0x00000002;
|
||||
public static final int AnimatedStateListDrawableTransition_android_reversible = 0x00000003;
|
||||
public static final int AnimatedStateListDrawableTransition_android_toId = 0x00000001;
|
||||
public static final int StateListDrawableItem_android_drawable = 0x00000000;
|
||||
public static final int StateListDrawable_android_constantSize = 0x00000003;
|
||||
public static final int StateListDrawable_android_dither = 0x00000000;
|
||||
public static final int StateListDrawable_android_enterFadeDuration = 0x00000004;
|
||||
public static final int StateListDrawable_android_exitFadeDuration = 0x00000005;
|
||||
public static final int StateListDrawable_android_variablePadding = 0x00000002;
|
||||
public static final int StateListDrawable_android_visible = 0x00000001;
|
||||
public static final int[] AnimatedStateListDrawableCompat = {android.R.attr.dither, android.R.attr.visible, android.R.attr.variablePadding, android.R.attr.constantSize, android.R.attr.enterFadeDuration, android.R.attr.exitFadeDuration};
|
||||
public static final int[] AnimatedStateListDrawableItem = {android.R.attr.id, android.R.attr.drawable};
|
||||
public static final int[] AnimatedStateListDrawableTransition = {android.R.attr.drawable, android.R.attr.toId, android.R.attr.fromId, android.R.attr.reversible};
|
||||
public static final int[] StateListDrawable = {android.R.attr.dither, android.R.attr.visible, android.R.attr.variablePadding, android.R.attr.constantSize, android.R.attr.enterFadeDuration, android.R.attr.exitFadeDuration};
|
||||
public static final int[] StateListDrawableItem = {android.R.attr.drawable};
|
||||
|
||||
private styleable() {
|
||||
}
|
||||
}
|
||||
|
||||
private R() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package androidx.appcompat.text;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.text.method.TransformationMethod;
|
||||
import android.view.View;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AllCapsTransformationMethod implements TransformationMethod {
|
||||
private Locale mLocale;
|
||||
|
||||
@Override // android.text.method.TransformationMethod
|
||||
public void onFocusChanged(View view, CharSequence charSequence, boolean z, int i, Rect rect) {
|
||||
}
|
||||
|
||||
public AllCapsTransformationMethod(Context context) {
|
||||
this.mLocale = context.getResources().getConfiguration().locale;
|
||||
}
|
||||
|
||||
@Override // android.text.method.TransformationMethod
|
||||
public CharSequence getTransformation(CharSequence charSequence, View view) {
|
||||
if (charSequence != null) {
|
||||
return charSequence.toString().toUpperCase(this.mLocale);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package androidx.appcompat.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import androidx.appcompat.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarPolicy {
|
||||
private Context mContext;
|
||||
|
||||
public boolean showsOverflowMenuButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static ActionBarPolicy get(Context context) {
|
||||
return new ActionBarPolicy(context);
|
||||
}
|
||||
|
||||
private ActionBarPolicy(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
public int getMaxActionButtons() {
|
||||
Configuration configuration = this.mContext.getResources().getConfiguration();
|
||||
int i = configuration.screenWidthDp;
|
||||
int i2 = configuration.screenHeightDp;
|
||||
if (configuration.smallestScreenWidthDp > 600 || i > 600) {
|
||||
return 5;
|
||||
}
|
||||
if (i > 960 && i2 > 720) {
|
||||
return 5;
|
||||
}
|
||||
if (i > 720 && i2 > 960) {
|
||||
return 5;
|
||||
}
|
||||
if (i >= 500) {
|
||||
return 4;
|
||||
}
|
||||
if (i > 640 && i2 > 480) {
|
||||
return 4;
|
||||
}
|
||||
if (i <= 480 || i2 <= 640) {
|
||||
return i >= 360 ? 3 : 2;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int getEmbeddedMenuWidthLimit() {
|
||||
return this.mContext.getResources().getDisplayMetrics().widthPixels / 2;
|
||||
}
|
||||
|
||||
public boolean hasEmbeddedTabs() {
|
||||
return this.mContext.getResources().getBoolean(R.bool.abc_action_bar_embed_tabs);
|
||||
}
|
||||
|
||||
public int getTabContainerHeight() {
|
||||
TypedArray obtainStyledAttributes = this.mContext.obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);
|
||||
int layoutDimension = obtainStyledAttributes.getLayoutDimension(R.styleable.ActionBar_height, 0);
|
||||
Resources resources = this.mContext.getResources();
|
||||
if (!hasEmbeddedTabs()) {
|
||||
layoutDimension = Math.min(layoutDimension, resources.getDimensionPixelSize(R.dimen.abc_action_bar_stacked_max_height));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
return layoutDimension;
|
||||
}
|
||||
|
||||
public boolean enableHomeButtonByDefault() {
|
||||
return this.mContext.getApplicationInfo().targetSdkVersion < 14;
|
||||
}
|
||||
|
||||
public int getStackedTabMaxWidth() {
|
||||
return this.mContext.getResources().getDimensionPixelSize(R.dimen.abc_action_bar_stacked_tab_max_width);
|
||||
}
|
||||
}
|
||||
70
02-Easy5/E5/sources/androidx/appcompat/view/ActionMode.java
Normal file
70
02-Easy5/E5/sources/androidx/appcompat/view/ActionMode.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package androidx.appcompat.view;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class ActionMode {
|
||||
private Object mTag;
|
||||
private boolean mTitleOptionalHint;
|
||||
|
||||
public interface Callback {
|
||||
boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem);
|
||||
|
||||
boolean onCreateActionMode(ActionMode actionMode, Menu menu);
|
||||
|
||||
void onDestroyActionMode(ActionMode actionMode);
|
||||
|
||||
boolean onPrepareActionMode(ActionMode actionMode, Menu menu);
|
||||
}
|
||||
|
||||
public abstract void finish();
|
||||
|
||||
public abstract View getCustomView();
|
||||
|
||||
public abstract Menu getMenu();
|
||||
|
||||
public abstract MenuInflater getMenuInflater();
|
||||
|
||||
public abstract CharSequence getSubtitle();
|
||||
|
||||
public Object getTag() {
|
||||
return this.mTag;
|
||||
}
|
||||
|
||||
public abstract CharSequence getTitle();
|
||||
|
||||
public boolean getTitleOptionalHint() {
|
||||
return this.mTitleOptionalHint;
|
||||
}
|
||||
|
||||
public abstract void invalidate();
|
||||
|
||||
public boolean isTitleOptional() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isUiFocusable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void setCustomView(View view);
|
||||
|
||||
public abstract void setSubtitle(int i);
|
||||
|
||||
public abstract void setSubtitle(CharSequence charSequence);
|
||||
|
||||
public void setTag(Object obj) {
|
||||
this.mTag = obj;
|
||||
}
|
||||
|
||||
public abstract void setTitle(int i);
|
||||
|
||||
public abstract void setTitle(CharSequence charSequence);
|
||||
|
||||
public void setTitleOptionalHint(boolean z) {
|
||||
this.mTitleOptionalHint = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package androidx.appcompat.view;
|
||||
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public interface CollapsibleActionView {
|
||||
void onActionViewCollapsed();
|
||||
|
||||
void onActionViewExpanded();
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package androidx.appcompat.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.view.LayoutInflater;
|
||||
import androidx.appcompat.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ContextThemeWrapper extends ContextWrapper {
|
||||
private static Configuration sEmptyConfig;
|
||||
private LayoutInflater mInflater;
|
||||
private Configuration mOverrideConfiguration;
|
||||
private Resources mResources;
|
||||
private Resources.Theme mTheme;
|
||||
private int mThemeResource;
|
||||
|
||||
public int getThemeResId() {
|
||||
return this.mThemeResource;
|
||||
}
|
||||
|
||||
public ContextThemeWrapper() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
public ContextThemeWrapper(Context context, int i) {
|
||||
super(context);
|
||||
this.mThemeResource = i;
|
||||
}
|
||||
|
||||
public ContextThemeWrapper(Context context, Resources.Theme theme) {
|
||||
super(context);
|
||||
this.mTheme = theme;
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper
|
||||
protected void attachBaseContext(Context context) {
|
||||
super.attachBaseContext(context);
|
||||
}
|
||||
|
||||
public void applyOverrideConfiguration(Configuration configuration) {
|
||||
if (this.mResources != null) {
|
||||
throw new IllegalStateException("getResources() or getAssets() has already been called");
|
||||
}
|
||||
if (this.mOverrideConfiguration != null) {
|
||||
throw new IllegalStateException("Override configuration has already been set");
|
||||
}
|
||||
this.mOverrideConfiguration = new Configuration(configuration);
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public Resources getResources() {
|
||||
return getResourcesInternal();
|
||||
}
|
||||
|
||||
private Resources getResourcesInternal() {
|
||||
if (this.mResources == null) {
|
||||
if (this.mOverrideConfiguration == null || (Build.VERSION.SDK_INT >= 26 && isEmptyConfiguration(this.mOverrideConfiguration))) {
|
||||
this.mResources = super.getResources();
|
||||
} else {
|
||||
this.mResources = Api17Impl.createConfigurationContext(this, this.mOverrideConfiguration).getResources();
|
||||
}
|
||||
}
|
||||
return this.mResources;
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public void setTheme(int i) {
|
||||
if (this.mThemeResource != i) {
|
||||
this.mThemeResource = i;
|
||||
initializeTheme();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public Resources.Theme getTheme() {
|
||||
Resources.Theme theme = this.mTheme;
|
||||
if (theme != null) {
|
||||
return theme;
|
||||
}
|
||||
if (this.mThemeResource == 0) {
|
||||
this.mThemeResource = R.style.Theme_AppCompat_Light;
|
||||
}
|
||||
initializeTheme();
|
||||
return this.mTheme;
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public Object getSystemService(String str) {
|
||||
if (!"layout_inflater".equals(str)) {
|
||||
return getBaseContext().getSystemService(str);
|
||||
}
|
||||
if (this.mInflater == null) {
|
||||
this.mInflater = LayoutInflater.from(getBaseContext()).cloneInContext(this);
|
||||
}
|
||||
return this.mInflater;
|
||||
}
|
||||
|
||||
protected void onApplyThemeResource(Resources.Theme theme, int i, boolean z) {
|
||||
theme.applyStyle(i, true);
|
||||
}
|
||||
|
||||
private void initializeTheme() {
|
||||
boolean z = this.mTheme == null;
|
||||
if (z) {
|
||||
this.mTheme = getResources().newTheme();
|
||||
Resources.Theme theme = getBaseContext().getTheme();
|
||||
if (theme != null) {
|
||||
this.mTheme.setTo(theme);
|
||||
}
|
||||
}
|
||||
onApplyThemeResource(this.mTheme, this.mThemeResource, z);
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public AssetManager getAssets() {
|
||||
return getResources().getAssets();
|
||||
}
|
||||
|
||||
private static boolean isEmptyConfiguration(Configuration configuration) {
|
||||
if (configuration == null) {
|
||||
return true;
|
||||
}
|
||||
if (sEmptyConfig == null) {
|
||||
Configuration configuration2 = new Configuration();
|
||||
configuration2.fontScale = 0.0f;
|
||||
sEmptyConfig = configuration2;
|
||||
}
|
||||
return configuration.equals(sEmptyConfig);
|
||||
}
|
||||
|
||||
static class Api17Impl {
|
||||
private Api17Impl() {
|
||||
}
|
||||
|
||||
static Context createConfigurationContext(ContextThemeWrapper contextThemeWrapper, Configuration configuration) {
|
||||
return contextThemeWrapper.createConfigurationContext(configuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
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.view.menu.MenuPopupHelper;
|
||||
import androidx.appcompat.view.menu.SubMenuBuilder;
|
||||
import androidx.appcompat.widget.ActionBarContextView;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class StandaloneActionMode extends ActionMode implements MenuBuilder.Callback {
|
||||
private ActionMode.Callback mCallback;
|
||||
private Context mContext;
|
||||
private ActionBarContextView mContextView;
|
||||
private WeakReference<View> mCustomView;
|
||||
private boolean mFinished;
|
||||
private boolean mFocusable;
|
||||
private MenuBuilder mMenu;
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public Menu getMenu() {
|
||||
return this.mMenu;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public boolean isUiFocusable() {
|
||||
return this.mFocusable;
|
||||
}
|
||||
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
}
|
||||
|
||||
public void onCloseSubMenu(SubMenuBuilder subMenuBuilder) {
|
||||
}
|
||||
|
||||
public StandaloneActionMode(Context context, ActionBarContextView actionBarContextView, ActionMode.Callback callback, boolean z) {
|
||||
this.mContext = context;
|
||||
this.mContextView = actionBarContextView;
|
||||
this.mCallback = callback;
|
||||
MenuBuilder defaultShowAsAction = new MenuBuilder(actionBarContextView.getContext()).setDefaultShowAsAction(1);
|
||||
this.mMenu = defaultShowAsAction;
|
||||
defaultShowAsAction.setCallback(this);
|
||||
this.mFocusable = z;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
this.mContextView.setTitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public void setSubtitle(CharSequence charSequence) {
|
||||
this.mContextView.setSubtitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public void setTitle(int i) {
|
||||
setTitle(this.mContext.getString(i));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public void setSubtitle(int i) {
|
||||
setSubtitle(this.mContext.getString(i));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public void setTitleOptionalHint(boolean z) {
|
||||
super.setTitleOptionalHint(z);
|
||||
this.mContextView.setTitleOptional(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public boolean isTitleOptional() {
|
||||
return this.mContextView.isTitleOptional();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public void setCustomView(View view) {
|
||||
this.mContextView.setCustomView(view);
|
||||
this.mCustomView = view != null ? new WeakReference<>(view) : null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public void invalidate() {
|
||||
this.mCallback.onPrepareActionMode(this, this.mMenu);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public void finish() {
|
||||
if (this.mFinished) {
|
||||
return;
|
||||
}
|
||||
this.mFinished = true;
|
||||
this.mCallback.onDestroyActionMode(this);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public CharSequence getTitle() {
|
||||
return this.mContextView.getTitle();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public CharSequence getSubtitle() {
|
||||
return this.mContextView.getSubtitle();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public View getCustomView() {
|
||||
WeakReference<View> weakReference = this.mCustomView;
|
||||
if (weakReference != null) {
|
||||
return weakReference.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode
|
||||
public MenuInflater getMenuInflater() {
|
||||
return new SupportMenuInflater(this.mContextView.getContext());
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public boolean onMenuItemSelected(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
return this.mCallback.onActionItemClicked(this, menuItem);
|
||||
}
|
||||
|
||||
public boolean onSubMenuSelected(SubMenuBuilder subMenuBuilder) {
|
||||
if (!subMenuBuilder.hasVisibleItems()) {
|
||||
return true;
|
||||
}
|
||||
new MenuPopupHelper(this.mContextView.getContext(), subMenuBuilder).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public void onMenuModeChange(MenuBuilder menuBuilder) {
|
||||
invalidate();
|
||||
this.mContextView.showOverflowMenu();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package androidx.appcompat.view;
|
||||
|
||||
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 androidx.appcompat.view.ActionMode;
|
||||
import androidx.appcompat.view.menu.MenuItemWrapperICS;
|
||||
import androidx.appcompat.view.menu.MenuWrapperICS;
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import androidx.core.internal.view.SupportMenu;
|
||||
import androidx.core.internal.view.SupportMenuItem;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SupportActionModeWrapper extends android.view.ActionMode {
|
||||
final Context mContext;
|
||||
final ActionMode mWrappedObject;
|
||||
|
||||
public SupportActionModeWrapper(Context context, ActionMode actionMode) {
|
||||
this.mContext = context;
|
||||
this.mWrappedObject = actionMode;
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public Object getTag() {
|
||||
return this.mWrappedObject.getTag();
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public void setTag(Object obj) {
|
||||
this.mWrappedObject.setTag(obj);
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
this.mWrappedObject.setTitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public void setSubtitle(CharSequence charSequence) {
|
||||
this.mWrappedObject.setSubtitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public void invalidate() {
|
||||
this.mWrappedObject.invalidate();
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public void finish() {
|
||||
this.mWrappedObject.finish();
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public Menu getMenu() {
|
||||
return new MenuWrapperICS(this.mContext, (SupportMenu) this.mWrappedObject.getMenu());
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public CharSequence getTitle() {
|
||||
return this.mWrappedObject.getTitle();
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public void setTitle(int i) {
|
||||
this.mWrappedObject.setTitle(i);
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public CharSequence getSubtitle() {
|
||||
return this.mWrappedObject.getSubtitle();
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public void setSubtitle(int i) {
|
||||
this.mWrappedObject.setSubtitle(i);
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public View getCustomView() {
|
||||
return this.mWrappedObject.getCustomView();
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public void setCustomView(View view) {
|
||||
this.mWrappedObject.setCustomView(view);
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public MenuInflater getMenuInflater() {
|
||||
return this.mWrappedObject.getMenuInflater();
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public boolean getTitleOptionalHint() {
|
||||
return this.mWrappedObject.getTitleOptionalHint();
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public void setTitleOptionalHint(boolean z) {
|
||||
this.mWrappedObject.setTitleOptionalHint(z);
|
||||
}
|
||||
|
||||
@Override // android.view.ActionMode
|
||||
public boolean isTitleOptional() {
|
||||
return this.mWrappedObject.isTitleOptional();
|
||||
}
|
||||
|
||||
public static class CallbackWrapper implements ActionMode.Callback {
|
||||
final Context mContext;
|
||||
final ActionMode.Callback mWrappedCallback;
|
||||
final ArrayList<SupportActionModeWrapper> mActionModes = new ArrayList<>();
|
||||
final SimpleArrayMap<Menu, Menu> mMenus = new SimpleArrayMap<>();
|
||||
|
||||
public CallbackWrapper(Context context, ActionMode.Callback callback) {
|
||||
this.mContext = context;
|
||||
this.mWrappedCallback = callback;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode.Callback
|
||||
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
|
||||
return this.mWrappedCallback.onCreateActionMode(getActionModeWrapper(actionMode), getMenuWrapper(menu));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode.Callback
|
||||
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
|
||||
return this.mWrappedCallback.onPrepareActionMode(getActionModeWrapper(actionMode), getMenuWrapper(menu));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode.Callback
|
||||
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
|
||||
return this.mWrappedCallback.onActionItemClicked(getActionModeWrapper(actionMode), new MenuItemWrapperICS(this.mContext, (SupportMenuItem) menuItem));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.ActionMode.Callback
|
||||
public void onDestroyActionMode(ActionMode actionMode) {
|
||||
this.mWrappedCallback.onDestroyActionMode(getActionModeWrapper(actionMode));
|
||||
}
|
||||
|
||||
private Menu getMenuWrapper(Menu menu) {
|
||||
Menu menu2 = this.mMenus.get(menu);
|
||||
if (menu2 != null) {
|
||||
return menu2;
|
||||
}
|
||||
MenuWrapperICS menuWrapperICS = new MenuWrapperICS(this.mContext, (SupportMenu) menu);
|
||||
this.mMenus.put(menu, menuWrapperICS);
|
||||
return menuWrapperICS;
|
||||
}
|
||||
|
||||
public android.view.ActionMode getActionModeWrapper(ActionMode actionMode) {
|
||||
int size = this.mActionModes.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
SupportActionModeWrapper supportActionModeWrapper = this.mActionModes.get(i);
|
||||
if (supportActionModeWrapper != null && supportActionModeWrapper.mWrappedObject == actionMode) {
|
||||
return supportActionModeWrapper;
|
||||
}
|
||||
}
|
||||
SupportActionModeWrapper supportActionModeWrapper2 = new SupportActionModeWrapper(this.mContext, actionMode);
|
||||
this.mActionModes.add(supportActionModeWrapper2);
|
||||
return supportActionModeWrapper2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,573 @@
|
||||
package androidx.appcompat.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
import android.view.InflateException;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.menu.MenuItemImpl;
|
||||
import androidx.appcompat.view.menu.MenuItemWrapperICS;
|
||||
import androidx.appcompat.widget.DrawableUtils;
|
||||
import androidx.appcompat.widget.TintTypedArray;
|
||||
import androidx.core.internal.view.SupportMenu;
|
||||
import androidx.core.view.ActionProvider;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SupportMenuInflater extends MenuInflater {
|
||||
static final Class<?>[] ACTION_PROVIDER_CONSTRUCTOR_SIGNATURE;
|
||||
static final Class<?>[] ACTION_VIEW_CONSTRUCTOR_SIGNATURE;
|
||||
static final String LOG_TAG = "SupportMenuInflater";
|
||||
static final int NO_ID = 0;
|
||||
private static final String XML_GROUP = "group";
|
||||
private static final String XML_ITEM = "item";
|
||||
private static final String XML_MENU = "menu";
|
||||
final Object[] mActionProviderConstructorArguments;
|
||||
final Object[] mActionViewConstructorArguments;
|
||||
Context mContext;
|
||||
private Object mRealOwner;
|
||||
|
||||
static {
|
||||
Class<?>[] clsArr = {Context.class};
|
||||
ACTION_VIEW_CONSTRUCTOR_SIGNATURE = clsArr;
|
||||
ACTION_PROVIDER_CONSTRUCTOR_SIGNATURE = clsArr;
|
||||
}
|
||||
|
||||
public SupportMenuInflater(Context context) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
Object[] objArr = {context};
|
||||
this.mActionViewConstructorArguments = objArr;
|
||||
this.mActionProviderConstructorArguments = objArr;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuInflater
|
||||
public void inflate(int i, Menu menu) {
|
||||
if (!(menu instanceof SupportMenu)) {
|
||||
super.inflate(i, menu);
|
||||
return;
|
||||
}
|
||||
XmlResourceParser xmlResourceParser = null;
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
xmlResourceParser = this.mContext.getResources().getLayout(i);
|
||||
parseMenu(xmlResourceParser, Xml.asAttributeSet(xmlResourceParser), menu);
|
||||
} catch (XmlPullParserException e) {
|
||||
throw new InflateException("Error inflating menu XML", e);
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
throw new InflateException("Error inflating menu XML", e2);
|
||||
}
|
||||
} finally {
|
||||
if (xmlResourceParser != null) {
|
||||
xmlResourceParser.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:11:0x0045, code lost:
|
||||
|
||||
if (r15 == 2) goto L41;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:13:0x0048, code lost:
|
||||
|
||||
if (r15 == 3) goto L20;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:14:0x004c, code lost:
|
||||
|
||||
r15 = r13.getName();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:15:0x0050, code lost:
|
||||
|
||||
if (r7 == false) goto L25;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:17:0x0056, code lost:
|
||||
|
||||
if (r15.equals(r8) == false) goto L25;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:18:0x0058, code lost:
|
||||
|
||||
r8 = null;
|
||||
r7 = false;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:20:0x00b8, code lost:
|
||||
|
||||
r15 = r13.next();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:22:0x005f, code lost:
|
||||
|
||||
if (r15.equals(androidx.appcompat.view.SupportMenuInflater.XML_GROUP) == false) goto L28;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:23:0x0061, code lost:
|
||||
|
||||
r0.resetGroup();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:26:0x0069, code lost:
|
||||
|
||||
if (r15.equals(androidx.appcompat.view.SupportMenuInflater.XML_ITEM) == false) goto L38;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:28:0x006f, code lost:
|
||||
|
||||
if (r0.hasAddedItem() != false) goto L65;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:30:0x0073, code lost:
|
||||
|
||||
if (r0.itemActionProvider == null) goto L37;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:32:0x007b, code lost:
|
||||
|
||||
if (r0.itemActionProvider.hasSubMenu() == false) goto L37;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:33:0x007d, code lost:
|
||||
|
||||
r0.addSubMenuItem();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:35:0x0081, code lost:
|
||||
|
||||
r0.addItem();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:39:0x0089, code lost:
|
||||
|
||||
if (r15.equals(androidx.appcompat.view.SupportMenuInflater.XML_MENU) == false) goto L68;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:40:0x008b, code lost:
|
||||
|
||||
r6 = true;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:44:0x008d, code lost:
|
||||
|
||||
if (r7 == false) goto L43;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:45:0x0090, code lost:
|
||||
|
||||
r15 = r13.getName();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:46:0x0098, code lost:
|
||||
|
||||
if (r15.equals(androidx.appcompat.view.SupportMenuInflater.XML_GROUP) == false) goto L46;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:47:0x009a, code lost:
|
||||
|
||||
r0.readGroup(r14);
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:50:0x00a2, code lost:
|
||||
|
||||
if (r15.equals(androidx.appcompat.view.SupportMenuInflater.XML_ITEM) == false) goto L49;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:51:0x00a4, code lost:
|
||||
|
||||
r0.readItem(r14);
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:54:0x00ac, code lost:
|
||||
|
||||
if (r15.equals(androidx.appcompat.view.SupportMenuInflater.XML_MENU) == false) goto L52;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:55:0x00ae, code lost:
|
||||
|
||||
parseMenu(r13, r14, r0.addSubMenuItem());
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:57:0x00b6, code lost:
|
||||
|
||||
r8 = r15;
|
||||
r7 = true;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:62:0x00c4, code lost:
|
||||
|
||||
throw new java.lang.RuntimeException("Unexpected end of document");
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:65:0x00c5, code lost:
|
||||
|
||||
return;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:7:0x0038, code lost:
|
||||
|
||||
r8 = null;
|
||||
r6 = false;
|
||||
r7 = false;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:8:0x003d, code lost:
|
||||
|
||||
if (r6 != false) goto L60;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:9:0x003f, code lost:
|
||||
|
||||
if (r15 == 1) goto L61;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
private void parseMenu(org.xmlpull.v1.XmlPullParser r13, android.util.AttributeSet r14, android.view.Menu r15) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException {
|
||||
/*
|
||||
r12 = this;
|
||||
androidx.appcompat.view.SupportMenuInflater$MenuState r0 = new androidx.appcompat.view.SupportMenuInflater$MenuState
|
||||
r0.<init>(r15)
|
||||
int r15 = r13.getEventType()
|
||||
L9:
|
||||
r1 = 2
|
||||
java.lang.String r2 = "menu"
|
||||
r3 = 1
|
||||
if (r15 != r1) goto L32
|
||||
java.lang.String r15 = r13.getName()
|
||||
boolean r4 = r15.equals(r2)
|
||||
if (r4 == 0) goto L1e
|
||||
int r15 = r13.next()
|
||||
goto L38
|
||||
L1e:
|
||||
java.lang.RuntimeException r13 = new java.lang.RuntimeException
|
||||
java.lang.StringBuilder r14 = new java.lang.StringBuilder
|
||||
java.lang.String r0 = "Expecting menu, got "
|
||||
r14.<init>(r0)
|
||||
r14.append(r15)
|
||||
java.lang.String r14 = r14.toString()
|
||||
r13.<init>(r14)
|
||||
throw r13
|
||||
L32:
|
||||
int r15 = r13.next()
|
||||
if (r15 != r3) goto L9
|
||||
L38:
|
||||
r4 = 0
|
||||
r5 = 0
|
||||
r8 = r5
|
||||
r6 = 0
|
||||
r7 = 0
|
||||
L3d:
|
||||
if (r6 != 0) goto Lc5
|
||||
if (r15 == r3) goto Lbd
|
||||
java.lang.String r9 = "item"
|
||||
java.lang.String r10 = "group"
|
||||
if (r15 == r1) goto L8d
|
||||
r11 = 3
|
||||
if (r15 == r11) goto L4c
|
||||
goto Lb8
|
||||
L4c:
|
||||
java.lang.String r15 = r13.getName()
|
||||
if (r7 == 0) goto L5b
|
||||
boolean r11 = r15.equals(r8)
|
||||
if (r11 == 0) goto L5b
|
||||
r8 = r5
|
||||
r7 = 0
|
||||
goto Lb8
|
||||
L5b:
|
||||
boolean r10 = r15.equals(r10)
|
||||
if (r10 == 0) goto L65
|
||||
r0.resetGroup()
|
||||
goto Lb8
|
||||
L65:
|
||||
boolean r9 = r15.equals(r9)
|
||||
if (r9 == 0) goto L85
|
||||
boolean r15 = r0.hasAddedItem()
|
||||
if (r15 != 0) goto Lb8
|
||||
androidx.core.view.ActionProvider r15 = r0.itemActionProvider
|
||||
if (r15 == 0) goto L81
|
||||
androidx.core.view.ActionProvider r15 = r0.itemActionProvider
|
||||
boolean r15 = r15.hasSubMenu()
|
||||
if (r15 == 0) goto L81
|
||||
r0.addSubMenuItem()
|
||||
goto Lb8
|
||||
L81:
|
||||
r0.addItem()
|
||||
goto Lb8
|
||||
L85:
|
||||
boolean r15 = r15.equals(r2)
|
||||
if (r15 == 0) goto Lb8
|
||||
r6 = 1
|
||||
goto Lb8
|
||||
L8d:
|
||||
if (r7 == 0) goto L90
|
||||
goto Lb8
|
||||
L90:
|
||||
java.lang.String r15 = r13.getName()
|
||||
boolean r10 = r15.equals(r10)
|
||||
if (r10 == 0) goto L9e
|
||||
r0.readGroup(r14)
|
||||
goto Lb8
|
||||
L9e:
|
||||
boolean r9 = r15.equals(r9)
|
||||
if (r9 == 0) goto La8
|
||||
r0.readItem(r14)
|
||||
goto Lb8
|
||||
La8:
|
||||
boolean r9 = r15.equals(r2)
|
||||
if (r9 == 0) goto Lb6
|
||||
android.view.SubMenu r15 = r0.addSubMenuItem()
|
||||
r12.parseMenu(r13, r14, r15)
|
||||
goto Lb8
|
||||
Lb6:
|
||||
r8 = r15
|
||||
r7 = 1
|
||||
Lb8:
|
||||
int r15 = r13.next()
|
||||
goto L3d
|
||||
Lbd:
|
||||
java.lang.RuntimeException r13 = new java.lang.RuntimeException
|
||||
java.lang.String r14 = "Unexpected end of document"
|
||||
r13.<init>(r14)
|
||||
throw r13
|
||||
Lc5:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.view.SupportMenuInflater.parseMenu(org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.view.Menu):void");
|
||||
}
|
||||
|
||||
Object getRealOwner() {
|
||||
if (this.mRealOwner == null) {
|
||||
this.mRealOwner = findRealOwner(this.mContext);
|
||||
}
|
||||
return this.mRealOwner;
|
||||
}
|
||||
|
||||
private Object findRealOwner(Object obj) {
|
||||
return (!(obj instanceof Activity) && (obj instanceof ContextWrapper)) ? findRealOwner(((ContextWrapper) obj).getBaseContext()) : obj;
|
||||
}
|
||||
|
||||
private static class InflatedOnMenuItemClickListener implements MenuItem.OnMenuItemClickListener {
|
||||
private static final Class<?>[] PARAM_TYPES = {MenuItem.class};
|
||||
private Method mMethod;
|
||||
private Object mRealOwner;
|
||||
|
||||
public InflatedOnMenuItemClickListener(Object obj, String str) {
|
||||
this.mRealOwner = obj;
|
||||
Class<?> cls = obj.getClass();
|
||||
try {
|
||||
this.mMethod = cls.getMethod(str, PARAM_TYPES);
|
||||
} catch (Exception e) {
|
||||
InflateException inflateException = new InflateException("Couldn't resolve menu item onClick handler " + str + " in class " + cls.getName());
|
||||
inflateException.initCause(e);
|
||||
throw inflateException;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem.OnMenuItemClickListener
|
||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||
try {
|
||||
if (this.mMethod.getReturnType() == Boolean.TYPE) {
|
||||
return ((Boolean) this.mMethod.invoke(this.mRealOwner, menuItem)).booleanValue();
|
||||
}
|
||||
this.mMethod.invoke(this.mRealOwner, menuItem);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MenuState {
|
||||
private static final int defaultGroupId = 0;
|
||||
private static final int defaultItemCategory = 0;
|
||||
private static final int defaultItemCheckable = 0;
|
||||
private static final boolean defaultItemChecked = false;
|
||||
private static final boolean defaultItemEnabled = true;
|
||||
private static final int defaultItemId = 0;
|
||||
private static final int defaultItemOrder = 0;
|
||||
private static final boolean defaultItemVisible = true;
|
||||
private int groupCategory;
|
||||
private int groupCheckable;
|
||||
private boolean groupEnabled;
|
||||
private int groupId;
|
||||
private int groupOrder;
|
||||
private boolean groupVisible;
|
||||
ActionProvider itemActionProvider;
|
||||
private String itemActionProviderClassName;
|
||||
private String itemActionViewClassName;
|
||||
private int itemActionViewLayout;
|
||||
private boolean itemAdded;
|
||||
private int itemAlphabeticModifiers;
|
||||
private char itemAlphabeticShortcut;
|
||||
private int itemCategoryOrder;
|
||||
private int itemCheckable;
|
||||
private boolean itemChecked;
|
||||
private CharSequence itemContentDescription;
|
||||
private boolean itemEnabled;
|
||||
private int itemIconResId;
|
||||
private ColorStateList itemIconTintList = null;
|
||||
private PorterDuff.Mode itemIconTintMode = null;
|
||||
private int itemId;
|
||||
private String itemListenerMethodName;
|
||||
private int itemNumericModifiers;
|
||||
private char itemNumericShortcut;
|
||||
private int itemShowAsAction;
|
||||
private CharSequence itemTitle;
|
||||
private CharSequence itemTitleCondensed;
|
||||
private CharSequence itemTooltipText;
|
||||
private boolean itemVisible;
|
||||
private Menu menu;
|
||||
|
||||
public boolean hasAddedItem() {
|
||||
return this.itemAdded;
|
||||
}
|
||||
|
||||
public void resetGroup() {
|
||||
this.groupId = 0;
|
||||
this.groupCategory = 0;
|
||||
this.groupOrder = 0;
|
||||
this.groupCheckable = 0;
|
||||
this.groupVisible = true;
|
||||
this.groupEnabled = true;
|
||||
}
|
||||
|
||||
public MenuState(Menu menu) {
|
||||
this.menu = menu;
|
||||
resetGroup();
|
||||
}
|
||||
|
||||
public void readGroup(AttributeSet attributeSet) {
|
||||
TypedArray obtainStyledAttributes = SupportMenuInflater.this.mContext.obtainStyledAttributes(attributeSet, R.styleable.MenuGroup);
|
||||
this.groupId = obtainStyledAttributes.getResourceId(R.styleable.MenuGroup_android_id, 0);
|
||||
this.groupCategory = obtainStyledAttributes.getInt(R.styleable.MenuGroup_android_menuCategory, 0);
|
||||
this.groupOrder = obtainStyledAttributes.getInt(R.styleable.MenuGroup_android_orderInCategory, 0);
|
||||
this.groupCheckable = obtainStyledAttributes.getInt(R.styleable.MenuGroup_android_checkableBehavior, 0);
|
||||
this.groupVisible = obtainStyledAttributes.getBoolean(R.styleable.MenuGroup_android_visible, true);
|
||||
this.groupEnabled = obtainStyledAttributes.getBoolean(R.styleable.MenuGroup_android_enabled, true);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
public void readItem(AttributeSet attributeSet) {
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(SupportMenuInflater.this.mContext, attributeSet, R.styleable.MenuItem);
|
||||
this.itemId = obtainStyledAttributes.getResourceId(R.styleable.MenuItem_android_id, 0);
|
||||
this.itemCategoryOrder = (obtainStyledAttributes.getInt(R.styleable.MenuItem_android_menuCategory, this.groupCategory) & SupportMenu.CATEGORY_MASK) | (obtainStyledAttributes.getInt(R.styleable.MenuItem_android_orderInCategory, this.groupOrder) & SupportMenu.USER_MASK);
|
||||
this.itemTitle = obtainStyledAttributes.getText(R.styleable.MenuItem_android_title);
|
||||
this.itemTitleCondensed = obtainStyledAttributes.getText(R.styleable.MenuItem_android_titleCondensed);
|
||||
this.itemIconResId = obtainStyledAttributes.getResourceId(R.styleable.MenuItem_android_icon, 0);
|
||||
this.itemAlphabeticShortcut = getShortcut(obtainStyledAttributes.getString(R.styleable.MenuItem_android_alphabeticShortcut));
|
||||
this.itemAlphabeticModifiers = obtainStyledAttributes.getInt(R.styleable.MenuItem_alphabeticModifiers, 4096);
|
||||
this.itemNumericShortcut = getShortcut(obtainStyledAttributes.getString(R.styleable.MenuItem_android_numericShortcut));
|
||||
this.itemNumericModifiers = obtainStyledAttributes.getInt(R.styleable.MenuItem_numericModifiers, 4096);
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.MenuItem_android_checkable)) {
|
||||
this.itemCheckable = obtainStyledAttributes.getBoolean(R.styleable.MenuItem_android_checkable, false) ? 1 : 0;
|
||||
} else {
|
||||
this.itemCheckable = this.groupCheckable;
|
||||
}
|
||||
this.itemChecked = obtainStyledAttributes.getBoolean(R.styleable.MenuItem_android_checked, false);
|
||||
this.itemVisible = obtainStyledAttributes.getBoolean(R.styleable.MenuItem_android_visible, this.groupVisible);
|
||||
this.itemEnabled = obtainStyledAttributes.getBoolean(R.styleable.MenuItem_android_enabled, this.groupEnabled);
|
||||
this.itemShowAsAction = obtainStyledAttributes.getInt(R.styleable.MenuItem_showAsAction, -1);
|
||||
this.itemListenerMethodName = obtainStyledAttributes.getString(R.styleable.MenuItem_android_onClick);
|
||||
this.itemActionViewLayout = obtainStyledAttributes.getResourceId(R.styleable.MenuItem_actionLayout, 0);
|
||||
this.itemActionViewClassName = obtainStyledAttributes.getString(R.styleable.MenuItem_actionViewClass);
|
||||
String string = obtainStyledAttributes.getString(R.styleable.MenuItem_actionProviderClass);
|
||||
this.itemActionProviderClassName = string;
|
||||
boolean z = string != null;
|
||||
if (z && this.itemActionViewLayout == 0 && this.itemActionViewClassName == null) {
|
||||
this.itemActionProvider = (ActionProvider) newInstance(string, SupportMenuInflater.ACTION_PROVIDER_CONSTRUCTOR_SIGNATURE, SupportMenuInflater.this.mActionProviderConstructorArguments);
|
||||
} else {
|
||||
if (z) {
|
||||
Log.w(SupportMenuInflater.LOG_TAG, "Ignoring attribute 'actionProviderClass'. Action view already specified.");
|
||||
}
|
||||
this.itemActionProvider = null;
|
||||
}
|
||||
this.itemContentDescription = obtainStyledAttributes.getText(R.styleable.MenuItem_contentDescription);
|
||||
this.itemTooltipText = obtainStyledAttributes.getText(R.styleable.MenuItem_tooltipText);
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.MenuItem_iconTintMode)) {
|
||||
this.itemIconTintMode = DrawableUtils.parseTintMode(obtainStyledAttributes.getInt(R.styleable.MenuItem_iconTintMode, -1), this.itemIconTintMode);
|
||||
} else {
|
||||
this.itemIconTintMode = null;
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.MenuItem_iconTint)) {
|
||||
this.itemIconTintList = obtainStyledAttributes.getColorStateList(R.styleable.MenuItem_iconTint);
|
||||
} else {
|
||||
this.itemIconTintList = null;
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
this.itemAdded = false;
|
||||
}
|
||||
|
||||
private char getShortcut(String str) {
|
||||
if (str == null) {
|
||||
return (char) 0;
|
||||
}
|
||||
return str.charAt(0);
|
||||
}
|
||||
|
||||
private void setItem(MenuItem menuItem) {
|
||||
boolean z = false;
|
||||
menuItem.setChecked(this.itemChecked).setVisible(this.itemVisible).setEnabled(this.itemEnabled).setCheckable(this.itemCheckable >= 1).setTitleCondensed(this.itemTitleCondensed).setIcon(this.itemIconResId);
|
||||
int i = this.itemShowAsAction;
|
||||
if (i >= 0) {
|
||||
menuItem.setShowAsAction(i);
|
||||
}
|
||||
if (this.itemListenerMethodName != null) {
|
||||
if (SupportMenuInflater.this.mContext.isRestricted()) {
|
||||
throw new IllegalStateException("The android:onClick attribute cannot be used within a restricted context");
|
||||
}
|
||||
menuItem.setOnMenuItemClickListener(new InflatedOnMenuItemClickListener(SupportMenuInflater.this.getRealOwner(), this.itemListenerMethodName));
|
||||
}
|
||||
if (this.itemCheckable >= 2) {
|
||||
if (menuItem instanceof MenuItemImpl) {
|
||||
((MenuItemImpl) menuItem).setExclusiveCheckable(true);
|
||||
} else if (menuItem instanceof MenuItemWrapperICS) {
|
||||
((MenuItemWrapperICS) menuItem).setExclusiveCheckable(true);
|
||||
}
|
||||
}
|
||||
String str = this.itemActionViewClassName;
|
||||
if (str != null) {
|
||||
menuItem.setActionView((View) newInstance(str, SupportMenuInflater.ACTION_VIEW_CONSTRUCTOR_SIGNATURE, SupportMenuInflater.this.mActionViewConstructorArguments));
|
||||
z = true;
|
||||
}
|
||||
int i2 = this.itemActionViewLayout;
|
||||
if (i2 > 0) {
|
||||
if (!z) {
|
||||
menuItem.setActionView(i2);
|
||||
} else {
|
||||
Log.w(SupportMenuInflater.LOG_TAG, "Ignoring attribute 'itemActionViewLayout'. Action view already specified.");
|
||||
}
|
||||
}
|
||||
ActionProvider actionProvider = this.itemActionProvider;
|
||||
if (actionProvider != null) {
|
||||
MenuItemCompat.setActionProvider(menuItem, actionProvider);
|
||||
}
|
||||
MenuItemCompat.setContentDescription(menuItem, this.itemContentDescription);
|
||||
MenuItemCompat.setTooltipText(menuItem, this.itemTooltipText);
|
||||
MenuItemCompat.setAlphabeticShortcut(menuItem, this.itemAlphabeticShortcut, this.itemAlphabeticModifiers);
|
||||
MenuItemCompat.setNumericShortcut(menuItem, this.itemNumericShortcut, this.itemNumericModifiers);
|
||||
PorterDuff.Mode mode = this.itemIconTintMode;
|
||||
if (mode != null) {
|
||||
MenuItemCompat.setIconTintMode(menuItem, mode);
|
||||
}
|
||||
ColorStateList colorStateList = this.itemIconTintList;
|
||||
if (colorStateList != null) {
|
||||
MenuItemCompat.setIconTintList(menuItem, colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem() {
|
||||
this.itemAdded = true;
|
||||
setItem(this.menu.add(this.groupId, this.itemId, this.itemCategoryOrder, this.itemTitle));
|
||||
}
|
||||
|
||||
public SubMenu addSubMenuItem() {
|
||||
this.itemAdded = true;
|
||||
SubMenu addSubMenu = this.menu.addSubMenu(this.groupId, this.itemId, this.itemCategoryOrder, this.itemTitle);
|
||||
setItem(addSubMenu.getItem());
|
||||
return addSubMenu;
|
||||
}
|
||||
|
||||
private <T> T newInstance(String str, Class<?>[] clsArr, Object[] objArr) {
|
||||
try {
|
||||
Constructor<?> constructor = Class.forName(str, false, SupportMenuInflater.this.mContext.getClassLoader()).getConstructor(clsArr);
|
||||
constructor.setAccessible(true);
|
||||
return (T) constructor.newInstance(objArr);
|
||||
} catch (Exception e) {
|
||||
Log.w(SupportMenuInflater.LOG_TAG, "Cannot instantiate class: " + str, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package androidx.appcompat.view;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorListener;
|
||||
import androidx.core.view.ViewPropertyAnimatorListenerAdapter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ViewPropertyAnimatorCompatSet {
|
||||
private Interpolator mInterpolator;
|
||||
private boolean mIsStarted;
|
||||
ViewPropertyAnimatorListener mListener;
|
||||
private long mDuration = -1;
|
||||
private final ViewPropertyAnimatorListenerAdapter mProxyListener = new ViewPropertyAnimatorListenerAdapter() { // from class: androidx.appcompat.view.ViewPropertyAnimatorCompatSet.1
|
||||
private boolean mProxyStarted = false;
|
||||
private int mProxyEndCount = 0;
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationStart(View view) {
|
||||
if (this.mProxyStarted) {
|
||||
return;
|
||||
}
|
||||
this.mProxyStarted = true;
|
||||
if (ViewPropertyAnimatorCompatSet.this.mListener != null) {
|
||||
ViewPropertyAnimatorCompatSet.this.mListener.onAnimationStart(null);
|
||||
}
|
||||
}
|
||||
|
||||
void onEnd() {
|
||||
this.mProxyEndCount = 0;
|
||||
this.mProxyStarted = false;
|
||||
ViewPropertyAnimatorCompatSet.this.onAnimationsEnded();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationEnd(View view) {
|
||||
int i = this.mProxyEndCount + 1;
|
||||
this.mProxyEndCount = i;
|
||||
if (i == ViewPropertyAnimatorCompatSet.this.mAnimators.size()) {
|
||||
if (ViewPropertyAnimatorCompatSet.this.mListener != null) {
|
||||
ViewPropertyAnimatorCompatSet.this.mListener.onAnimationEnd(null);
|
||||
}
|
||||
onEnd();
|
||||
}
|
||||
}
|
||||
};
|
||||
final ArrayList<ViewPropertyAnimatorCompat> mAnimators = new ArrayList<>();
|
||||
|
||||
void onAnimationsEnded() {
|
||||
this.mIsStarted = false;
|
||||
}
|
||||
|
||||
public ViewPropertyAnimatorCompatSet setDuration(long j) {
|
||||
if (!this.mIsStarted) {
|
||||
this.mDuration = j;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewPropertyAnimatorCompatSet setInterpolator(Interpolator interpolator) {
|
||||
if (!this.mIsStarted) {
|
||||
this.mInterpolator = interpolator;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewPropertyAnimatorCompatSet setListener(ViewPropertyAnimatorListener viewPropertyAnimatorListener) {
|
||||
if (!this.mIsStarted) {
|
||||
this.mListener = viewPropertyAnimatorListener;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewPropertyAnimatorCompatSet play(ViewPropertyAnimatorCompat viewPropertyAnimatorCompat) {
|
||||
if (!this.mIsStarted) {
|
||||
this.mAnimators.add(viewPropertyAnimatorCompat);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewPropertyAnimatorCompatSet playSequentially(ViewPropertyAnimatorCompat viewPropertyAnimatorCompat, ViewPropertyAnimatorCompat viewPropertyAnimatorCompat2) {
|
||||
this.mAnimators.add(viewPropertyAnimatorCompat);
|
||||
viewPropertyAnimatorCompat2.setStartDelay(viewPropertyAnimatorCompat.getDuration());
|
||||
this.mAnimators.add(viewPropertyAnimatorCompat2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (this.mIsStarted) {
|
||||
return;
|
||||
}
|
||||
Iterator<ViewPropertyAnimatorCompat> it = this.mAnimators.iterator();
|
||||
while (it.hasNext()) {
|
||||
ViewPropertyAnimatorCompat next = it.next();
|
||||
long j = this.mDuration;
|
||||
if (j >= 0) {
|
||||
next.setDuration(j);
|
||||
}
|
||||
Interpolator interpolator = this.mInterpolator;
|
||||
if (interpolator != null) {
|
||||
next.setInterpolator(interpolator);
|
||||
}
|
||||
if (this.mListener != null) {
|
||||
next.setListener(this.mProxyListener);
|
||||
}
|
||||
next.start();
|
||||
}
|
||||
this.mIsStarted = true;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
if (this.mIsStarted) {
|
||||
Iterator<ViewPropertyAnimatorCompat> it = this.mAnimators.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().cancel();
|
||||
}
|
||||
this.mIsStarted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package androidx.appcompat.view;
|
||||
|
||||
import android.view.ActionMode;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.KeyboardShortcutGroup;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SearchEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class WindowCallbackWrapper implements Window.Callback {
|
||||
final Window.Callback mWrapped;
|
||||
|
||||
public final Window.Callback getWrapped() {
|
||||
return this.mWrapped;
|
||||
}
|
||||
|
||||
public WindowCallbackWrapper(Window.Callback callback) {
|
||||
if (callback == null) {
|
||||
throw new IllegalArgumentException("Window callback may not be null");
|
||||
}
|
||||
this.mWrapped = callback;
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
||||
return this.mWrapped.dispatchKeyEvent(keyEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean dispatchKeyShortcutEvent(KeyEvent keyEvent) {
|
||||
return this.mWrapped.dispatchKeyShortcutEvent(keyEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
|
||||
return this.mWrapped.dispatchTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean dispatchTrackballEvent(MotionEvent motionEvent) {
|
||||
return this.mWrapped.dispatchTrackballEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean dispatchGenericMotionEvent(MotionEvent motionEvent) {
|
||||
return this.mWrapped.dispatchGenericMotionEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
return this.mWrapped.dispatchPopulateAccessibilityEvent(accessibilityEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public View onCreatePanelView(int i) {
|
||||
return this.mWrapped.onCreatePanelView(i);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean onCreatePanelMenu(int i, Menu menu) {
|
||||
return this.mWrapped.onCreatePanelMenu(i, menu);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean onPreparePanel(int i, View view, Menu menu) {
|
||||
return this.mWrapped.onPreparePanel(i, view, menu);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean onMenuOpened(int i, Menu menu) {
|
||||
return this.mWrapped.onMenuOpened(i, menu);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean onMenuItemSelected(int i, MenuItem menuItem) {
|
||||
return this.mWrapped.onMenuItemSelected(i, menuItem);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public void onWindowAttributesChanged(WindowManager.LayoutParams layoutParams) {
|
||||
this.mWrapped.onWindowAttributesChanged(layoutParams);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public void onContentChanged() {
|
||||
this.mWrapped.onContentChanged();
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public void onWindowFocusChanged(boolean z) {
|
||||
this.mWrapped.onWindowFocusChanged(z);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public void onAttachedToWindow() {
|
||||
this.mWrapped.onAttachedToWindow();
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public void onDetachedFromWindow() {
|
||||
this.mWrapped.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public void onPanelClosed(int i, Menu menu) {
|
||||
this.mWrapped.onPanelClosed(i, menu);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean onSearchRequested(SearchEvent searchEvent) {
|
||||
return Api23Impl.onSearchRequested(this.mWrapped, searchEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public boolean onSearchRequested() {
|
||||
return this.mWrapped.onSearchRequested();
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public android.view.ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
|
||||
return this.mWrapped.onWindowStartingActionMode(callback);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public android.view.ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int i) {
|
||||
return Api23Impl.onWindowStartingActionMode(this.mWrapped, callback, i);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public void onActionModeStarted(android.view.ActionMode actionMode) {
|
||||
this.mWrapped.onActionModeStarted(actionMode);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public void onActionModeFinished(android.view.ActionMode actionMode) {
|
||||
this.mWrapped.onActionModeFinished(actionMode);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> list, Menu menu, int i) {
|
||||
Api24Impl.onProvideKeyboardShortcuts(this.mWrapped, list, menu, i);
|
||||
}
|
||||
|
||||
@Override // android.view.Window.Callback
|
||||
public void onPointerCaptureChanged(boolean z) {
|
||||
Api26Impl.onPointerCaptureChanged(this.mWrapped, z);
|
||||
}
|
||||
|
||||
static class Api23Impl {
|
||||
private Api23Impl() {
|
||||
}
|
||||
|
||||
static boolean onSearchRequested(Window.Callback callback, SearchEvent searchEvent) {
|
||||
return callback.onSearchRequested(searchEvent);
|
||||
}
|
||||
|
||||
static android.view.ActionMode onWindowStartingActionMode(Window.Callback callback, ActionMode.Callback callback2, int i) {
|
||||
return callback.onWindowStartingActionMode(callback2, i);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api24Impl {
|
||||
private Api24Impl() {
|
||||
}
|
||||
|
||||
static void onProvideKeyboardShortcuts(Window.Callback callback, List<KeyboardShortcutGroup> list, Menu menu, int i) {
|
||||
callback.onProvideKeyboardShortcuts(list, menu, i);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static void onPointerCaptureChanged(Window.Callback callback, boolean z) {
|
||||
callback.onPointerCaptureChanged(z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,413 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.internal.view.SupportMenuItem;
|
||||
import androidx.core.view.ActionProvider;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionMenuItem implements SupportMenuItem {
|
||||
private static final int CHECKABLE = 1;
|
||||
private static final int CHECKED = 2;
|
||||
private static final int ENABLED = 16;
|
||||
private static final int EXCLUSIVE = 4;
|
||||
private static final int HIDDEN = 8;
|
||||
private MenuItem.OnMenuItemClickListener mClickListener;
|
||||
private CharSequence mContentDescription;
|
||||
private Context mContext;
|
||||
private final int mGroup;
|
||||
private Drawable mIconDrawable;
|
||||
private final int mId;
|
||||
private Intent mIntent;
|
||||
private final int mOrdering;
|
||||
private char mShortcutAlphabeticChar;
|
||||
private char mShortcutNumericChar;
|
||||
private CharSequence mTitle;
|
||||
private CharSequence mTitleCondensed;
|
||||
private CharSequence mTooltipText;
|
||||
private int mShortcutNumericModifiers = 4096;
|
||||
private int mShortcutAlphabeticModifiers = 4096;
|
||||
private ColorStateList mIconTintList = null;
|
||||
private PorterDuff.Mode mIconTintMode = null;
|
||||
private boolean mHasIconTint = false;
|
||||
private boolean mHasIconTintMode = false;
|
||||
private int mFlags = 16;
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public boolean collapseActionView() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public boolean expandActionView() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public View getActionView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public int getAlphabeticModifiers() {
|
||||
return this.mShortcutAlphabeticModifiers;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public char getAlphabeticShortcut() {
|
||||
return this.mShortcutAlphabeticChar;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public CharSequence getContentDescription() {
|
||||
return this.mContentDescription;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public int getGroupId() {
|
||||
return this.mGroup;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public Drawable getIcon() {
|
||||
return this.mIconDrawable;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public ColorStateList getIconTintList() {
|
||||
return this.mIconTintList;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public PorterDuff.Mode getIconTintMode() {
|
||||
return this.mIconTintMode;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public Intent getIntent() {
|
||||
return this.mIntent;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public int getItemId() {
|
||||
return this.mId;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public ContextMenu.ContextMenuInfo getMenuInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public int getNumericModifiers() {
|
||||
return this.mShortcutNumericModifiers;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public char getNumericShortcut() {
|
||||
return this.mShortcutNumericChar;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public int getOrder() {
|
||||
return this.mOrdering;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public SubMenu getSubMenu() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem
|
||||
public ActionProvider getSupportActionProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public CharSequence getTitle() {
|
||||
return this.mTitle;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public CharSequence getTitleCondensed() {
|
||||
CharSequence charSequence = this.mTitleCondensed;
|
||||
return charSequence != null ? charSequence : this.mTitle;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public CharSequence getTooltipText() {
|
||||
return this.mTooltipText;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean hasSubMenu() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public boolean isActionViewExpanded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isCheckable() {
|
||||
return (this.mFlags & 1) != 0;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isChecked() {
|
||||
return (this.mFlags & 2) != 0;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isEnabled() {
|
||||
return (this.mFlags & 16) != 0;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isVisible() {
|
||||
return (this.mFlags & 8) == 0;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem
|
||||
public boolean requiresActionButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem
|
||||
public boolean requiresOverflow() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setCheckable(boolean z) {
|
||||
this.mFlags = (z ? 1 : 0) | (this.mFlags & (-2));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setChecked(boolean z) {
|
||||
this.mFlags = (z ? 2 : 0) | (this.mFlags & (-3));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public SupportMenuItem setContentDescription(CharSequence charSequence) {
|
||||
this.mContentDescription = charSequence;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setEnabled(boolean z) {
|
||||
this.mFlags = (z ? 16 : 0) | (this.mFlags & (-17));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ActionMenuItem setExclusiveCheckable(boolean z) {
|
||||
this.mFlags = (z ? 4 : 0) | (this.mFlags & (-5));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIntent(Intent intent) {
|
||||
this.mIntent = intent;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setNumericShortcut(char c) {
|
||||
this.mShortcutNumericChar = c;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener onMenuItemClickListener) {
|
||||
this.mClickListener = onMenuItemClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public void setShowAsAction(int i) {
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setTitle(CharSequence charSequence) {
|
||||
this.mTitle = charSequence;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setTitleCondensed(CharSequence charSequence) {
|
||||
this.mTitleCondensed = charSequence;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public SupportMenuItem setTooltipText(CharSequence charSequence) {
|
||||
this.mTooltipText = charSequence;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setVisible(boolean z) {
|
||||
this.mFlags = (this.mFlags & 8) | (z ? 0 : 8);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ActionMenuItem(Context context, int i, int i2, int i3, int i4, CharSequence charSequence) {
|
||||
this.mContext = context;
|
||||
this.mId = i2;
|
||||
this.mGroup = i;
|
||||
this.mOrdering = i4;
|
||||
this.mTitle = charSequence;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setAlphabeticShortcut(char c) {
|
||||
this.mShortcutAlphabeticChar = Character.toLowerCase(c);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public MenuItem setAlphabeticShortcut(char c, int i) {
|
||||
this.mShortcutAlphabeticChar = Character.toLowerCase(c);
|
||||
this.mShortcutAlphabeticModifiers = KeyEvent.normalizeMetaState(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIcon(Drawable drawable) {
|
||||
this.mIconDrawable = drawable;
|
||||
applyIconTint();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIcon(int i) {
|
||||
this.mIconDrawable = ContextCompat.getDrawable(this.mContext, i);
|
||||
applyIconTint();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public MenuItem setNumericShortcut(char c, int i) {
|
||||
this.mShortcutNumericChar = c;
|
||||
this.mShortcutNumericModifiers = KeyEvent.normalizeMetaState(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setShortcut(char c, char c2) {
|
||||
this.mShortcutNumericChar = c;
|
||||
this.mShortcutAlphabeticChar = Character.toLowerCase(c2);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public MenuItem setShortcut(char c, char c2, int i, int i2) {
|
||||
this.mShortcutNumericChar = c;
|
||||
this.mShortcutNumericModifiers = KeyEvent.normalizeMetaState(i);
|
||||
this.mShortcutAlphabeticChar = Character.toLowerCase(c2);
|
||||
this.mShortcutAlphabeticModifiers = KeyEvent.normalizeMetaState(i2);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setTitle(int i) {
|
||||
this.mTitle = this.mContext.getResources().getString(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean invoke() {
|
||||
MenuItem.OnMenuItemClickListener onMenuItemClickListener = this.mClickListener;
|
||||
if (onMenuItemClickListener != null && onMenuItemClickListener.onMenuItemClick(this)) {
|
||||
return true;
|
||||
}
|
||||
Intent intent = this.mIntent;
|
||||
if (intent == null) {
|
||||
return false;
|
||||
}
|
||||
this.mContext.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public SupportMenuItem setActionView(View view) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setActionProvider(android.view.ActionProvider actionProvider) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public android.view.ActionProvider getActionProvider() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public SupportMenuItem setActionView(int i) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem
|
||||
public SupportMenuItem setSupportActionProvider(ActionProvider actionProvider) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public SupportMenuItem setShowAsActionFlags(int i) {
|
||||
setShowAsAction(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener onActionExpandListener) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public MenuItem setIconTintList(ColorStateList colorStateList) {
|
||||
this.mIconTintList = colorStateList;
|
||||
this.mHasIconTint = true;
|
||||
applyIconTint();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public MenuItem setIconTintMode(PorterDuff.Mode mode) {
|
||||
this.mIconTintMode = mode;
|
||||
this.mHasIconTintMode = true;
|
||||
applyIconTint();
|
||||
return this;
|
||||
}
|
||||
|
||||
private void applyIconTint() {
|
||||
Drawable drawable = this.mIconDrawable;
|
||||
if (drawable != null) {
|
||||
if (this.mHasIconTint || this.mHasIconTintMode) {
|
||||
Drawable wrap = DrawableCompat.wrap(drawable);
|
||||
this.mIconDrawable = wrap;
|
||||
Drawable mutate = wrap.mutate();
|
||||
this.mIconDrawable = mutate;
|
||||
if (this.mHasIconTint) {
|
||||
DrawableCompat.setTintList(mutate, this.mIconTintList);
|
||||
}
|
||||
if (this.mHasIconTintMode) {
|
||||
DrawableCompat.setTintMode(this.mIconDrawable, this.mIconTintMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import androidx.appcompat.widget.ActionMenuView;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.appcompat.widget.ForwardingListener;
|
||||
import androidx.appcompat.widget.TooltipCompat;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionMenuItemView extends AppCompatTextView implements MenuView.ItemView, View.OnClickListener, ActionMenuView.ActionMenuChildView {
|
||||
private static final int MAX_ICON_SIZE = 32;
|
||||
private static final String TAG = "ActionMenuItemView";
|
||||
private boolean mAllowTextWithIcon;
|
||||
private boolean mExpandedFormat;
|
||||
private ForwardingListener mForwardingListener;
|
||||
private Drawable mIcon;
|
||||
MenuItemImpl mItemData;
|
||||
MenuBuilder.ItemInvoker mItemInvoker;
|
||||
private int mMaxIconSize;
|
||||
private int mMinWidth;
|
||||
PopupCallback mPopupCallback;
|
||||
private int mSavedPaddingLeft;
|
||||
private CharSequence mTitle;
|
||||
|
||||
public static abstract class PopupCallback {
|
||||
public abstract ShowableListMenu getPopup();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public MenuItemImpl getItemData() {
|
||||
return this.mItemData;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public boolean prefersCondensedTitle() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void setCheckable(boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void setChecked(boolean z) {
|
||||
}
|
||||
|
||||
public void setItemInvoker(MenuBuilder.ItemInvoker itemInvoker) {
|
||||
this.mItemInvoker = itemInvoker;
|
||||
}
|
||||
|
||||
public void setPopupCallback(PopupCallback popupCallback) {
|
||||
this.mPopupCallback = popupCallback;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void setShortcut(boolean z, char c) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public boolean showsIcon() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ActionMenuItemView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActionMenuItemView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public ActionMenuItemView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
Resources resources = context.getResources();
|
||||
this.mAllowTextWithIcon = shouldAllowTextWithIcon();
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ActionMenuItemView, i, 0);
|
||||
this.mMinWidth = obtainStyledAttributes.getDimensionPixelSize(R.styleable.ActionMenuItemView_android_minWidth, 0);
|
||||
obtainStyledAttributes.recycle();
|
||||
this.mMaxIconSize = (int) ((resources.getDisplayMetrics().density * 32.0f) + 0.5f);
|
||||
setOnClickListener(this);
|
||||
this.mSavedPaddingLeft = -1;
|
||||
setSaveEnabled(false);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
this.mAllowTextWithIcon = shouldAllowTextWithIcon();
|
||||
updateTextButtonVisibility();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public CharSequence getAccessibilityClassName() {
|
||||
return Button.class.getName();
|
||||
}
|
||||
|
||||
private boolean shouldAllowTextWithIcon() {
|
||||
Configuration configuration = getContext().getResources().getConfiguration();
|
||||
int i = configuration.screenWidthDp;
|
||||
return i >= 480 || (i >= 640 && configuration.screenHeightDp >= 480) || configuration.orientation == 2;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public void setPadding(int i, int i2, int i3, int i4) {
|
||||
this.mSavedPaddingLeft = i;
|
||||
super.setPadding(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void initialize(MenuItemImpl menuItemImpl, int i) {
|
||||
this.mItemData = menuItemImpl;
|
||||
setIcon(menuItemImpl.getIcon());
|
||||
setTitle(menuItemImpl.getTitleForItemView(this));
|
||||
setId(menuItemImpl.getItemId());
|
||||
setVisibility(menuItemImpl.isVisible() ? 0 : 8);
|
||||
setEnabled(menuItemImpl.isEnabled());
|
||||
if (menuItemImpl.hasSubMenu() && this.mForwardingListener == null) {
|
||||
this.mForwardingListener = new ActionMenuItemForwardingListener();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
ForwardingListener forwardingListener;
|
||||
if (this.mItemData.hasSubMenu() && (forwardingListener = this.mForwardingListener) != null && forwardingListener.onTouch(this, motionEvent)) {
|
||||
return true;
|
||||
}
|
||||
return super.onTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
MenuBuilder.ItemInvoker itemInvoker = this.mItemInvoker;
|
||||
if (itemInvoker != null) {
|
||||
itemInvoker.invokeItem(this.mItemData);
|
||||
}
|
||||
}
|
||||
|
||||
public void setExpandedFormat(boolean z) {
|
||||
if (this.mExpandedFormat != z) {
|
||||
this.mExpandedFormat = z;
|
||||
MenuItemImpl menuItemImpl = this.mItemData;
|
||||
if (menuItemImpl != null) {
|
||||
menuItemImpl.actionFormatChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTextButtonVisibility() {
|
||||
boolean z = true;
|
||||
boolean z2 = !TextUtils.isEmpty(this.mTitle);
|
||||
if (this.mIcon != null && (!this.mItemData.showsTextAsAction() || (!this.mAllowTextWithIcon && !this.mExpandedFormat))) {
|
||||
z = false;
|
||||
}
|
||||
boolean z3 = z2 & z;
|
||||
setText(z3 ? this.mTitle : null);
|
||||
CharSequence contentDescription = this.mItemData.getContentDescription();
|
||||
if (TextUtils.isEmpty(contentDescription)) {
|
||||
setContentDescription(z3 ? null : this.mItemData.getTitle());
|
||||
} else {
|
||||
setContentDescription(contentDescription);
|
||||
}
|
||||
CharSequence tooltipText = this.mItemData.getTooltipText();
|
||||
if (TextUtils.isEmpty(tooltipText)) {
|
||||
TooltipCompat.setTooltipText(this, z3 ? null : this.mItemData.getTitle());
|
||||
} else {
|
||||
TooltipCompat.setTooltipText(this, tooltipText);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void setIcon(Drawable drawable) {
|
||||
this.mIcon = drawable;
|
||||
if (drawable != null) {
|
||||
int intrinsicWidth = drawable.getIntrinsicWidth();
|
||||
int intrinsicHeight = drawable.getIntrinsicHeight();
|
||||
int i = this.mMaxIconSize;
|
||||
if (intrinsicWidth > i) {
|
||||
intrinsicHeight = (int) (intrinsicHeight * (i / intrinsicWidth));
|
||||
intrinsicWidth = i;
|
||||
}
|
||||
if (intrinsicHeight > i) {
|
||||
intrinsicWidth = (int) (intrinsicWidth * (i / intrinsicHeight));
|
||||
} else {
|
||||
i = intrinsicHeight;
|
||||
}
|
||||
drawable.setBounds(0, 0, intrinsicWidth, i);
|
||||
}
|
||||
setCompoundDrawables(drawable, null, null, null);
|
||||
updateTextButtonVisibility();
|
||||
}
|
||||
|
||||
public boolean hasText() {
|
||||
return !TextUtils.isEmpty(getText());
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
this.mTitle = charSequence;
|
||||
updateTextButtonVisibility();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActionMenuView.ActionMenuChildView
|
||||
public boolean needsDividerBefore() {
|
||||
return hasText() && this.mItemData.getIcon() == null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActionMenuView.ActionMenuChildView
|
||||
public boolean needsDividerAfter() {
|
||||
return hasText();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView, android.widget.TextView, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int i3;
|
||||
boolean hasText = hasText();
|
||||
if (hasText && (i3 = this.mSavedPaddingLeft) >= 0) {
|
||||
super.setPadding(i3, getPaddingTop(), getPaddingRight(), getPaddingBottom());
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
int mode = View.MeasureSpec.getMode(i);
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
int measuredWidth = getMeasuredWidth();
|
||||
int min = mode == Integer.MIN_VALUE ? Math.min(size, this.mMinWidth) : this.mMinWidth;
|
||||
if (mode != 1073741824 && this.mMinWidth > 0 && measuredWidth < min) {
|
||||
super.onMeasure(View.MeasureSpec.makeMeasureSpec(min, BasicMeasure.EXACTLY), i2);
|
||||
}
|
||||
if (hasText || this.mIcon == null) {
|
||||
return;
|
||||
}
|
||||
super.setPadding((getMeasuredWidth() - this.mIcon.getBounds().width()) / 2, getPaddingTop(), getPaddingRight(), getPaddingBottom());
|
||||
}
|
||||
|
||||
private class ActionMenuItemForwardingListener extends ForwardingListener {
|
||||
public ActionMenuItemForwardingListener() {
|
||||
super(ActionMenuItemView.this);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public ShowableListMenu getPopup() {
|
||||
if (ActionMenuItemView.this.mPopupCallback != null) {
|
||||
return ActionMenuItemView.this.mPopupCallback.getPopup();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
protected boolean onForwardingStarted() {
|
||||
ShowableListMenu popup;
|
||||
return ActionMenuItemView.this.mItemInvoker != null && ActionMenuItemView.this.mItemInvoker.invokeItem(ActionMenuItemView.this.mItemData) && (popup = getPopup()) != null && popup.isShowing();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public void onRestoreInstanceState(Parcelable parcelable) {
|
||||
super.onRestoreInstanceState(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class BaseMenuPresenter implements MenuPresenter {
|
||||
private MenuPresenter.Callback mCallback;
|
||||
protected Context mContext;
|
||||
private int mId;
|
||||
protected LayoutInflater mInflater;
|
||||
private int mItemLayoutRes;
|
||||
protected MenuBuilder mMenu;
|
||||
private int mMenuLayoutRes;
|
||||
protected MenuView mMenuView;
|
||||
protected Context mSystemContext;
|
||||
protected LayoutInflater mSystemInflater;
|
||||
|
||||
public abstract void bindItemView(MenuItemImpl menuItemImpl, MenuView.ItemView itemView);
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean collapseItemActionView(MenuBuilder menuBuilder, MenuItemImpl menuItemImpl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean expandItemActionView(MenuBuilder menuBuilder, MenuItemImpl menuItemImpl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean flagActionItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public MenuPresenter.Callback getCallback() {
|
||||
return this.mCallback;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public int getId() {
|
||||
return this.mId;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void setCallback(MenuPresenter.Callback callback) {
|
||||
this.mCallback = callback;
|
||||
}
|
||||
|
||||
public void setId(int i) {
|
||||
this.mId = i;
|
||||
}
|
||||
|
||||
public boolean shouldIncludeItem(int i, MenuItemImpl menuItemImpl) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BaseMenuPresenter(Context context, int i, int i2) {
|
||||
this.mSystemContext = context;
|
||||
this.mSystemInflater = LayoutInflater.from(context);
|
||||
this.mMenuLayoutRes = i;
|
||||
this.mItemLayoutRes = i2;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void initForMenu(Context context, MenuBuilder menuBuilder) {
|
||||
this.mContext = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.mMenu = menuBuilder;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public MenuView getMenuView(ViewGroup viewGroup) {
|
||||
if (this.mMenuView == null) {
|
||||
MenuView menuView = (MenuView) this.mSystemInflater.inflate(this.mMenuLayoutRes, viewGroup, false);
|
||||
this.mMenuView = menuView;
|
||||
menuView.initialize(this.mMenu);
|
||||
updateMenuView(true);
|
||||
}
|
||||
return this.mMenuView;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void updateMenuView(boolean z) {
|
||||
ViewGroup viewGroup = (ViewGroup) this.mMenuView;
|
||||
if (viewGroup == null) {
|
||||
return;
|
||||
}
|
||||
MenuBuilder menuBuilder = this.mMenu;
|
||||
int i = 0;
|
||||
if (menuBuilder != null) {
|
||||
menuBuilder.flagActionItems();
|
||||
ArrayList<MenuItemImpl> visibleItems = this.mMenu.getVisibleItems();
|
||||
int size = visibleItems.size();
|
||||
int i2 = 0;
|
||||
for (int i3 = 0; i3 < size; i3++) {
|
||||
MenuItemImpl menuItemImpl = visibleItems.get(i3);
|
||||
if (shouldIncludeItem(i2, menuItemImpl)) {
|
||||
View childAt = viewGroup.getChildAt(i2);
|
||||
MenuItemImpl itemData = childAt instanceof MenuView.ItemView ? ((MenuView.ItemView) childAt).getItemData() : null;
|
||||
View itemView = getItemView(menuItemImpl, childAt, viewGroup);
|
||||
if (menuItemImpl != itemData) {
|
||||
itemView.setPressed(false);
|
||||
itemView.jumpDrawablesToCurrentState();
|
||||
}
|
||||
if (itemView != childAt) {
|
||||
addItemView(itemView, i2);
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
i = i2;
|
||||
}
|
||||
while (i < viewGroup.getChildCount()) {
|
||||
if (!filterLeftoverView(viewGroup, i)) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void addItemView(View view, int i) {
|
||||
ViewGroup viewGroup = (ViewGroup) view.getParent();
|
||||
if (viewGroup != null) {
|
||||
viewGroup.removeView(view);
|
||||
}
|
||||
((ViewGroup) this.mMenuView).addView(view, i);
|
||||
}
|
||||
|
||||
protected boolean filterLeftoverView(ViewGroup viewGroup, int i) {
|
||||
viewGroup.removeViewAt(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
public MenuView.ItemView createItemView(ViewGroup viewGroup) {
|
||||
return (MenuView.ItemView) this.mSystemInflater.inflate(this.mItemLayoutRes, viewGroup, false);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public View getItemView(MenuItemImpl menuItemImpl, View view, ViewGroup viewGroup) {
|
||||
MenuView.ItemView itemView;
|
||||
if (view instanceof MenuView.ItemView) {
|
||||
itemView = (MenuView.ItemView) view;
|
||||
} else {
|
||||
itemView = createItemView(viewGroup);
|
||||
}
|
||||
bindItemView(menuItemImpl, itemView);
|
||||
return (View) itemView;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
MenuPresenter.Callback callback = this.mCallback;
|
||||
if (callback != null) {
|
||||
callback.onCloseMenu(menuBuilder, z);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Type inference failed for: r2v4, types: [androidx.appcompat.view.menu.MenuBuilder] */
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean onSubMenuSelected(SubMenuBuilder subMenuBuilder) {
|
||||
MenuPresenter.Callback callback = this.mCallback;
|
||||
SubMenuBuilder subMenuBuilder2 = subMenuBuilder;
|
||||
if (callback == null) {
|
||||
return false;
|
||||
}
|
||||
if (subMenuBuilder == null) {
|
||||
subMenuBuilder2 = this.mMenu;
|
||||
}
|
||||
return callback.onOpenSubMenu(subMenuBuilder2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import androidx.core.internal.view.SupportMenuItem;
|
||||
import androidx.core.internal.view.SupportSubMenu;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class BaseMenuWrapper {
|
||||
final Context mContext;
|
||||
private SimpleArrayMap<SupportMenuItem, MenuItem> mMenuItems;
|
||||
private SimpleArrayMap<SupportSubMenu, SubMenu> mSubMenus;
|
||||
|
||||
BaseMenuWrapper(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
final MenuItem getMenuItemWrapper(MenuItem menuItem) {
|
||||
if (!(menuItem instanceof SupportMenuItem)) {
|
||||
return menuItem;
|
||||
}
|
||||
SupportMenuItem supportMenuItem = (SupportMenuItem) menuItem;
|
||||
if (this.mMenuItems == null) {
|
||||
this.mMenuItems = new SimpleArrayMap<>();
|
||||
}
|
||||
MenuItem menuItem2 = this.mMenuItems.get(supportMenuItem);
|
||||
if (menuItem2 != null) {
|
||||
return menuItem2;
|
||||
}
|
||||
MenuItemWrapperICS menuItemWrapperICS = new MenuItemWrapperICS(this.mContext, supportMenuItem);
|
||||
this.mMenuItems.put(supportMenuItem, menuItemWrapperICS);
|
||||
return menuItemWrapperICS;
|
||||
}
|
||||
|
||||
final SubMenu getSubMenuWrapper(SubMenu subMenu) {
|
||||
if (!(subMenu instanceof SupportSubMenu)) {
|
||||
return subMenu;
|
||||
}
|
||||
SupportSubMenu supportSubMenu = (SupportSubMenu) subMenu;
|
||||
if (this.mSubMenus == null) {
|
||||
this.mSubMenus = new SimpleArrayMap<>();
|
||||
}
|
||||
SubMenu subMenu2 = this.mSubMenus.get(supportSubMenu);
|
||||
if (subMenu2 != null) {
|
||||
return subMenu2;
|
||||
}
|
||||
SubMenuWrapperICS subMenuWrapperICS = new SubMenuWrapperICS(this.mContext, supportSubMenu);
|
||||
this.mSubMenus.put(supportSubMenu, subMenuWrapperICS);
|
||||
return subMenuWrapperICS;
|
||||
}
|
||||
|
||||
final void internalClear() {
|
||||
SimpleArrayMap<SupportMenuItem, MenuItem> simpleArrayMap = this.mMenuItems;
|
||||
if (simpleArrayMap != null) {
|
||||
simpleArrayMap.clear();
|
||||
}
|
||||
SimpleArrayMap<SupportSubMenu, SubMenu> simpleArrayMap2 = this.mSubMenus;
|
||||
if (simpleArrayMap2 != null) {
|
||||
simpleArrayMap2.clear();
|
||||
}
|
||||
}
|
||||
|
||||
final void internalRemoveGroup(int i) {
|
||||
if (this.mMenuItems == null) {
|
||||
return;
|
||||
}
|
||||
int i2 = 0;
|
||||
while (i2 < this.mMenuItems.size()) {
|
||||
if (this.mMenuItems.keyAt(i2).getGroupId() == i) {
|
||||
this.mMenuItems.removeAt(i2);
|
||||
i2--;
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
|
||||
final void internalRemoveItem(int i) {
|
||||
if (this.mMenuItems == null) {
|
||||
return;
|
||||
}
|
||||
for (int i2 = 0; i2 < this.mMenuItems.size(); i2++) {
|
||||
if (this.mMenuItems.keyAt(i2).getItemId() == i) {
|
||||
this.mMenuItems.removeAt(i2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,569 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Parcelable;
|
||||
import android.os.SystemClock;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.HeaderViewListAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.appcompat.widget.MenuItemHoverListener;
|
||||
import androidx.appcompat.widget.MenuPopupWindow;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, View.OnKeyListener, PopupWindow.OnDismissListener {
|
||||
static final int HORIZ_POSITION_LEFT = 0;
|
||||
static final int HORIZ_POSITION_RIGHT = 1;
|
||||
private static final int ITEM_LAYOUT = R.layout.abc_cascading_menu_item_layout;
|
||||
static final int SUBMENU_TIMEOUT_MS = 200;
|
||||
private View mAnchorView;
|
||||
private final Context mContext;
|
||||
private boolean mHasXOffset;
|
||||
private boolean mHasYOffset;
|
||||
private final int mMenuMaxWidth;
|
||||
private PopupWindow.OnDismissListener mOnDismissListener;
|
||||
private final boolean mOverflowOnly;
|
||||
private final int mPopupStyleAttr;
|
||||
private final int mPopupStyleRes;
|
||||
private MenuPresenter.Callback mPresenterCallback;
|
||||
boolean mShouldCloseImmediately;
|
||||
private boolean mShowTitle;
|
||||
View mShownAnchorView;
|
||||
final Handler mSubMenuHoverHandler;
|
||||
ViewTreeObserver mTreeObserver;
|
||||
private int mXOffset;
|
||||
private int mYOffset;
|
||||
private final List<MenuBuilder> mPendingMenus = new ArrayList();
|
||||
final List<CascadingMenuInfo> mShowingMenus = new ArrayList();
|
||||
final ViewTreeObserver.OnGlobalLayoutListener mGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { // from class: androidx.appcompat.view.menu.CascadingMenuPopup.1
|
||||
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
||||
public void onGlobalLayout() {
|
||||
if (!CascadingMenuPopup.this.isShowing() || CascadingMenuPopup.this.mShowingMenus.size() <= 0 || CascadingMenuPopup.this.mShowingMenus.get(0).window.isModal()) {
|
||||
return;
|
||||
}
|
||||
View view = CascadingMenuPopup.this.mShownAnchorView;
|
||||
if (view == null || !view.isShown()) {
|
||||
CascadingMenuPopup.this.dismiss();
|
||||
return;
|
||||
}
|
||||
Iterator<CascadingMenuInfo> it = CascadingMenuPopup.this.mShowingMenus.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().window.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
private final View.OnAttachStateChangeListener mAttachStateChangeListener = new View.OnAttachStateChangeListener() { // from class: androidx.appcompat.view.menu.CascadingMenuPopup.2
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewAttachedToWindow(View view) {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewDetachedFromWindow(View view) {
|
||||
if (CascadingMenuPopup.this.mTreeObserver != null) {
|
||||
if (!CascadingMenuPopup.this.mTreeObserver.isAlive()) {
|
||||
CascadingMenuPopup.this.mTreeObserver = view.getViewTreeObserver();
|
||||
}
|
||||
CascadingMenuPopup.this.mTreeObserver.removeGlobalOnLayoutListener(CascadingMenuPopup.this.mGlobalLayoutListener);
|
||||
}
|
||||
view.removeOnAttachStateChangeListener(this);
|
||||
}
|
||||
};
|
||||
private final MenuItemHoverListener mMenuItemHoverListener = new MenuItemHoverListener() { // from class: androidx.appcompat.view.menu.CascadingMenuPopup.3
|
||||
@Override // androidx.appcompat.widget.MenuItemHoverListener
|
||||
public void onItemHoverExit(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
CascadingMenuPopup.this.mSubMenuHoverHandler.removeCallbacksAndMessages(menuBuilder);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.MenuItemHoverListener
|
||||
public void onItemHoverEnter(final MenuBuilder menuBuilder, final MenuItem menuItem) {
|
||||
CascadingMenuPopup.this.mSubMenuHoverHandler.removeCallbacksAndMessages(null);
|
||||
int size = CascadingMenuPopup.this.mShowingMenus.size();
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= size) {
|
||||
i = -1;
|
||||
break;
|
||||
} else if (menuBuilder == CascadingMenuPopup.this.mShowingMenus.get(i).menu) {
|
||||
break;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i == -1) {
|
||||
return;
|
||||
}
|
||||
int i2 = i + 1;
|
||||
final CascadingMenuInfo cascadingMenuInfo = i2 < CascadingMenuPopup.this.mShowingMenus.size() ? CascadingMenuPopup.this.mShowingMenus.get(i2) : null;
|
||||
CascadingMenuPopup.this.mSubMenuHoverHandler.postAtTime(new Runnable() { // from class: androidx.appcompat.view.menu.CascadingMenuPopup.3.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (cascadingMenuInfo != null) {
|
||||
CascadingMenuPopup.this.mShouldCloseImmediately = true;
|
||||
cascadingMenuInfo.menu.close(false);
|
||||
CascadingMenuPopup.this.mShouldCloseImmediately = false;
|
||||
}
|
||||
if (menuItem.isEnabled() && menuItem.hasSubMenu()) {
|
||||
menuBuilder.performItemAction(menuItem, 4);
|
||||
}
|
||||
}
|
||||
}, menuBuilder, SystemClock.uptimeMillis() + 200);
|
||||
}
|
||||
};
|
||||
private int mRawDropDownGravity = 0;
|
||||
private int mDropDownGravity = 0;
|
||||
private boolean mForceShowIcon = false;
|
||||
private int mLastPosition = getInitialMenuPosition();
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface HorizPosition {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
protected boolean closeMenuOnSubMenuOpened() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean flagActionItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onRestoreInstanceState(Parcelable parcelable) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public Parcelable onSaveInstanceState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void setCallback(MenuPresenter.Callback callback) {
|
||||
this.mPresenterCallback = callback;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setForceShowIcon(boolean z) {
|
||||
this.mForceShowIcon = z;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setHorizontalOffset(int i) {
|
||||
this.mHasXOffset = true;
|
||||
this.mXOffset = i;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setOnDismissListener(PopupWindow.OnDismissListener onDismissListener) {
|
||||
this.mOnDismissListener = onDismissListener;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setShowTitle(boolean z) {
|
||||
this.mShowTitle = z;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setVerticalOffset(int i) {
|
||||
this.mHasYOffset = true;
|
||||
this.mYOffset = i;
|
||||
}
|
||||
|
||||
public CascadingMenuPopup(Context context, View view, int i, int i2, boolean z) {
|
||||
this.mContext = context;
|
||||
this.mAnchorView = view;
|
||||
this.mPopupStyleAttr = i;
|
||||
this.mPopupStyleRes = i2;
|
||||
this.mOverflowOnly = z;
|
||||
Resources resources = context.getResources();
|
||||
this.mMenuMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2, resources.getDimensionPixelSize(R.dimen.abc_config_prefDialogWidth));
|
||||
this.mSubMenuHoverHandler = new Handler();
|
||||
}
|
||||
|
||||
private MenuPopupWindow createPopupWindow() {
|
||||
MenuPopupWindow menuPopupWindow = new MenuPopupWindow(this.mContext, null, this.mPopupStyleAttr, this.mPopupStyleRes);
|
||||
menuPopupWindow.setHoverListener(this.mMenuItemHoverListener);
|
||||
menuPopupWindow.setOnItemClickListener(this);
|
||||
menuPopupWindow.setOnDismissListener(this);
|
||||
menuPopupWindow.setAnchorView(this.mAnchorView);
|
||||
menuPopupWindow.setDropDownGravity(this.mDropDownGravity);
|
||||
menuPopupWindow.setModal(true);
|
||||
menuPopupWindow.setInputMethodMode(2);
|
||||
return menuPopupWindow;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public void show() {
|
||||
if (isShowing()) {
|
||||
return;
|
||||
}
|
||||
Iterator<MenuBuilder> it = this.mPendingMenus.iterator();
|
||||
while (it.hasNext()) {
|
||||
showMenu(it.next());
|
||||
}
|
||||
this.mPendingMenus.clear();
|
||||
View view = this.mAnchorView;
|
||||
this.mShownAnchorView = view;
|
||||
if (view != null) {
|
||||
boolean z = this.mTreeObserver == null;
|
||||
ViewTreeObserver viewTreeObserver = view.getViewTreeObserver();
|
||||
this.mTreeObserver = viewTreeObserver;
|
||||
if (z) {
|
||||
viewTreeObserver.addOnGlobalLayoutListener(this.mGlobalLayoutListener);
|
||||
}
|
||||
this.mShownAnchorView.addOnAttachStateChangeListener(this.mAttachStateChangeListener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public void dismiss() {
|
||||
int size = this.mShowingMenus.size();
|
||||
if (size > 0) {
|
||||
CascadingMenuInfo[] cascadingMenuInfoArr = (CascadingMenuInfo[]) this.mShowingMenus.toArray(new CascadingMenuInfo[size]);
|
||||
for (int i = size - 1; i >= 0; i--) {
|
||||
CascadingMenuInfo cascadingMenuInfo = cascadingMenuInfoArr[i];
|
||||
if (cascadingMenuInfo.window.isShowing()) {
|
||||
cascadingMenuInfo.window.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnKeyListener
|
||||
public boolean onKey(View view, int i, KeyEvent keyEvent) {
|
||||
if (keyEvent.getAction() != 1 || i != 82) {
|
||||
return false;
|
||||
}
|
||||
dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
private int getInitialMenuPosition() {
|
||||
return ViewCompat.getLayoutDirection(this.mAnchorView) == 1 ? 0 : 1;
|
||||
}
|
||||
|
||||
private int getNextMenuPosition(int i) {
|
||||
List<CascadingMenuInfo> list = this.mShowingMenus;
|
||||
ListView listView = list.get(list.size() - 1).getListView();
|
||||
int[] iArr = new int[2];
|
||||
listView.getLocationOnScreen(iArr);
|
||||
Rect rect = new Rect();
|
||||
this.mShownAnchorView.getWindowVisibleDisplayFrame(rect);
|
||||
return this.mLastPosition == 1 ? (iArr[0] + listView.getWidth()) + i > rect.right ? 0 : 1 : iArr[0] - i < 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void addMenu(MenuBuilder menuBuilder) {
|
||||
menuBuilder.addMenuPresenter(this, this.mContext);
|
||||
if (isShowing()) {
|
||||
showMenu(menuBuilder);
|
||||
} else {
|
||||
this.mPendingMenus.add(menuBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
private void showMenu(MenuBuilder menuBuilder) {
|
||||
CascadingMenuInfo cascadingMenuInfo;
|
||||
View view;
|
||||
int i;
|
||||
int i2;
|
||||
int i3;
|
||||
LayoutInflater from = LayoutInflater.from(this.mContext);
|
||||
MenuAdapter menuAdapter = new MenuAdapter(menuBuilder, from, this.mOverflowOnly, ITEM_LAYOUT);
|
||||
if (!isShowing() && this.mForceShowIcon) {
|
||||
menuAdapter.setForceShowIcon(true);
|
||||
} else if (isShowing()) {
|
||||
menuAdapter.setForceShowIcon(MenuPopup.shouldPreserveIconSpacing(menuBuilder));
|
||||
}
|
||||
int measureIndividualMenuWidth = measureIndividualMenuWidth(menuAdapter, null, this.mContext, this.mMenuMaxWidth);
|
||||
MenuPopupWindow createPopupWindow = createPopupWindow();
|
||||
createPopupWindow.setAdapter(menuAdapter);
|
||||
createPopupWindow.setContentWidth(measureIndividualMenuWidth);
|
||||
createPopupWindow.setDropDownGravity(this.mDropDownGravity);
|
||||
if (this.mShowingMenus.size() > 0) {
|
||||
List<CascadingMenuInfo> list = this.mShowingMenus;
|
||||
cascadingMenuInfo = list.get(list.size() - 1);
|
||||
view = findParentViewForSubmenu(cascadingMenuInfo, menuBuilder);
|
||||
} else {
|
||||
cascadingMenuInfo = null;
|
||||
view = null;
|
||||
}
|
||||
if (view != null) {
|
||||
createPopupWindow.setTouchModal(false);
|
||||
createPopupWindow.setEnterTransition(null);
|
||||
int nextMenuPosition = getNextMenuPosition(measureIndividualMenuWidth);
|
||||
boolean z = nextMenuPosition == 1;
|
||||
this.mLastPosition = nextMenuPosition;
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
createPopupWindow.setAnchorView(view);
|
||||
i2 = 0;
|
||||
i = 0;
|
||||
} else {
|
||||
int[] iArr = new int[2];
|
||||
this.mAnchorView.getLocationOnScreen(iArr);
|
||||
int[] iArr2 = new int[2];
|
||||
view.getLocationOnScreen(iArr2);
|
||||
if ((this.mDropDownGravity & 7) == 5) {
|
||||
iArr[0] = iArr[0] + this.mAnchorView.getWidth();
|
||||
iArr2[0] = iArr2[0] + view.getWidth();
|
||||
}
|
||||
i = iArr2[0] - iArr[0];
|
||||
i2 = iArr2[1] - iArr[1];
|
||||
}
|
||||
if ((this.mDropDownGravity & 5) == 5) {
|
||||
if (!z) {
|
||||
measureIndividualMenuWidth = view.getWidth();
|
||||
i3 = i - measureIndividualMenuWidth;
|
||||
}
|
||||
i3 = i + measureIndividualMenuWidth;
|
||||
} else {
|
||||
if (z) {
|
||||
measureIndividualMenuWidth = view.getWidth();
|
||||
i3 = i + measureIndividualMenuWidth;
|
||||
}
|
||||
i3 = i - measureIndividualMenuWidth;
|
||||
}
|
||||
createPopupWindow.setHorizontalOffset(i3);
|
||||
createPopupWindow.setOverlapAnchor(true);
|
||||
createPopupWindow.setVerticalOffset(i2);
|
||||
} else {
|
||||
if (this.mHasXOffset) {
|
||||
createPopupWindow.setHorizontalOffset(this.mXOffset);
|
||||
}
|
||||
if (this.mHasYOffset) {
|
||||
createPopupWindow.setVerticalOffset(this.mYOffset);
|
||||
}
|
||||
createPopupWindow.setEpicenterBounds(getEpicenterBounds());
|
||||
}
|
||||
this.mShowingMenus.add(new CascadingMenuInfo(createPopupWindow, menuBuilder, this.mLastPosition));
|
||||
createPopupWindow.show();
|
||||
ListView listView = createPopupWindow.getListView();
|
||||
listView.setOnKeyListener(this);
|
||||
if (cascadingMenuInfo == null && this.mShowTitle && menuBuilder.getHeaderTitle() != null) {
|
||||
FrameLayout frameLayout = (FrameLayout) from.inflate(R.layout.abc_popup_menu_header_item_layout, (ViewGroup) listView, false);
|
||||
TextView textView = (TextView) frameLayout.findViewById(android.R.id.title);
|
||||
frameLayout.setEnabled(false);
|
||||
textView.setText(menuBuilder.getHeaderTitle());
|
||||
listView.addHeaderView(frameLayout, null, false);
|
||||
createPopupWindow.show();
|
||||
}
|
||||
}
|
||||
|
||||
private MenuItem findMenuItemForSubmenu(MenuBuilder menuBuilder, MenuBuilder menuBuilder2) {
|
||||
int size = menuBuilder.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
MenuItem item = menuBuilder.getItem(i);
|
||||
if (item.hasSubMenu() && menuBuilder2 == item.getSubMenu()) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private View findParentViewForSubmenu(CascadingMenuInfo cascadingMenuInfo, MenuBuilder menuBuilder) {
|
||||
MenuAdapter menuAdapter;
|
||||
int i;
|
||||
int firstVisiblePosition;
|
||||
MenuItem findMenuItemForSubmenu = findMenuItemForSubmenu(cascadingMenuInfo.menu, menuBuilder);
|
||||
if (findMenuItemForSubmenu == null) {
|
||||
return null;
|
||||
}
|
||||
ListView listView = cascadingMenuInfo.getListView();
|
||||
ListAdapter adapter = listView.getAdapter();
|
||||
int i2 = 0;
|
||||
if (adapter instanceof HeaderViewListAdapter) {
|
||||
HeaderViewListAdapter headerViewListAdapter = (HeaderViewListAdapter) adapter;
|
||||
i = headerViewListAdapter.getHeadersCount();
|
||||
menuAdapter = (MenuAdapter) headerViewListAdapter.getWrappedAdapter();
|
||||
} else {
|
||||
menuAdapter = (MenuAdapter) adapter;
|
||||
i = 0;
|
||||
}
|
||||
int count = menuAdapter.getCount();
|
||||
while (true) {
|
||||
if (i2 >= count) {
|
||||
i2 = -1;
|
||||
break;
|
||||
}
|
||||
if (findMenuItemForSubmenu == menuAdapter.getItem(i2)) {
|
||||
break;
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
if (i2 != -1 && (firstVisiblePosition = (i2 + i) - listView.getFirstVisiblePosition()) >= 0 && firstVisiblePosition < listView.getChildCount()) {
|
||||
return listView.getChildAt(firstVisiblePosition);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public boolean isShowing() {
|
||||
return this.mShowingMenus.size() > 0 && this.mShowingMenus.get(0).window.isShowing();
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow.OnDismissListener
|
||||
public void onDismiss() {
|
||||
CascadingMenuInfo cascadingMenuInfo;
|
||||
int size = this.mShowingMenus.size();
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= size) {
|
||||
cascadingMenuInfo = null;
|
||||
break;
|
||||
}
|
||||
cascadingMenuInfo = this.mShowingMenus.get(i);
|
||||
if (!cascadingMenuInfo.window.isShowing()) {
|
||||
break;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (cascadingMenuInfo != null) {
|
||||
cascadingMenuInfo.menu.close(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void updateMenuView(boolean z) {
|
||||
Iterator<CascadingMenuInfo> it = this.mShowingMenus.iterator();
|
||||
while (it.hasNext()) {
|
||||
toMenuAdapter(it.next().getListView().getAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean onSubMenuSelected(SubMenuBuilder subMenuBuilder) {
|
||||
for (CascadingMenuInfo cascadingMenuInfo : this.mShowingMenus) {
|
||||
if (subMenuBuilder == cascadingMenuInfo.menu) {
|
||||
cascadingMenuInfo.getListView().requestFocus();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!subMenuBuilder.hasVisibleItems()) {
|
||||
return false;
|
||||
}
|
||||
addMenu(subMenuBuilder);
|
||||
MenuPresenter.Callback callback = this.mPresenterCallback;
|
||||
if (callback != null) {
|
||||
callback.onOpenSubMenu(subMenuBuilder);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int findIndexOfAddedMenu(MenuBuilder menuBuilder) {
|
||||
int size = this.mShowingMenus.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (menuBuilder == this.mShowingMenus.get(i).menu) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
int findIndexOfAddedMenu = findIndexOfAddedMenu(menuBuilder);
|
||||
if (findIndexOfAddedMenu < 0) {
|
||||
return;
|
||||
}
|
||||
int i = findIndexOfAddedMenu + 1;
|
||||
if (i < this.mShowingMenus.size()) {
|
||||
this.mShowingMenus.get(i).menu.close(false);
|
||||
}
|
||||
CascadingMenuInfo remove = this.mShowingMenus.remove(findIndexOfAddedMenu);
|
||||
remove.menu.removeMenuPresenter(this);
|
||||
if (this.mShouldCloseImmediately) {
|
||||
remove.window.setExitTransition(null);
|
||||
remove.window.setAnimationStyle(0);
|
||||
}
|
||||
remove.window.dismiss();
|
||||
int size = this.mShowingMenus.size();
|
||||
if (size > 0) {
|
||||
this.mLastPosition = this.mShowingMenus.get(size - 1).position;
|
||||
} else {
|
||||
this.mLastPosition = getInitialMenuPosition();
|
||||
}
|
||||
if (size != 0) {
|
||||
if (z) {
|
||||
this.mShowingMenus.get(0).menu.close(false);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
dismiss();
|
||||
MenuPresenter.Callback callback = this.mPresenterCallback;
|
||||
if (callback != null) {
|
||||
callback.onCloseMenu(menuBuilder, true);
|
||||
}
|
||||
ViewTreeObserver viewTreeObserver = this.mTreeObserver;
|
||||
if (viewTreeObserver != null) {
|
||||
if (viewTreeObserver.isAlive()) {
|
||||
this.mTreeObserver.removeGlobalOnLayoutListener(this.mGlobalLayoutListener);
|
||||
}
|
||||
this.mTreeObserver = null;
|
||||
}
|
||||
this.mShownAnchorView.removeOnAttachStateChangeListener(this.mAttachStateChangeListener);
|
||||
this.mOnDismissListener.onDismiss();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setGravity(int i) {
|
||||
if (this.mRawDropDownGravity != i) {
|
||||
this.mRawDropDownGravity = i;
|
||||
this.mDropDownGravity = GravityCompat.getAbsoluteGravity(i, ViewCompat.getLayoutDirection(this.mAnchorView));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setAnchorView(View view) {
|
||||
if (this.mAnchorView != view) {
|
||||
this.mAnchorView = view;
|
||||
this.mDropDownGravity = GravityCompat.getAbsoluteGravity(this.mRawDropDownGravity, ViewCompat.getLayoutDirection(view));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public ListView getListView() {
|
||||
if (this.mShowingMenus.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return this.mShowingMenus.get(r0.size() - 1).getListView();
|
||||
}
|
||||
|
||||
private static class CascadingMenuInfo {
|
||||
public final MenuBuilder menu;
|
||||
public final int position;
|
||||
public final MenuPopupWindow window;
|
||||
|
||||
public CascadingMenuInfo(MenuPopupWindow menuPopupWindow, MenuBuilder menuBuilder, int i) {
|
||||
this.window = menuPopupWindow;
|
||||
this.menu = menuBuilder;
|
||||
this.position = i;
|
||||
}
|
||||
|
||||
public ListView getListView() {
|
||||
return this.window.getListView();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.widget.TintTypedArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ExpandedMenuView extends ListView implements MenuBuilder.ItemInvoker, MenuView, AdapterView.OnItemClickListener {
|
||||
private static final int[] TINT_ATTRS = {R.attr.background, R.attr.divider};
|
||||
private int mAnimations;
|
||||
private MenuBuilder mMenu;
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView
|
||||
public int getWindowAnimations() {
|
||||
return this.mAnimations;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView
|
||||
public void initialize(MenuBuilder menuBuilder) {
|
||||
this.mMenu = menuBuilder;
|
||||
}
|
||||
|
||||
public ExpandedMenuView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.listViewStyle);
|
||||
}
|
||||
|
||||
public ExpandedMenuView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet);
|
||||
setOnItemClickListener(this);
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, TINT_ATTRS, i, 0);
|
||||
if (obtainStyledAttributes.hasValue(0)) {
|
||||
setBackgroundDrawable(obtainStyledAttributes.getDrawable(0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(1)) {
|
||||
setDivider(obtainStyledAttributes.getDrawable(1));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
@Override // android.widget.ListView, android.widget.AbsListView, android.widget.AdapterView, android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
setChildrenDrawingCacheEnabled(false);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.ItemInvoker
|
||||
public boolean invokeItem(MenuItemImpl menuItemImpl) {
|
||||
return this.mMenu.performItemAction(menuItemImpl, 0);
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemClickListener
|
||||
public void onItemClick(AdapterView adapterView, View view, int i, long j) {
|
||||
invokeItem((MenuItemImpl) getAdapter().getItem(i));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import androidx.appcompat.widget.TintTypedArray;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ListMenuItemView extends LinearLayout implements MenuView.ItemView, AbsListView.SelectionBoundsAdjuster {
|
||||
private static final String TAG = "ListMenuItemView";
|
||||
private Drawable mBackground;
|
||||
private CheckBox mCheckBox;
|
||||
private LinearLayout mContent;
|
||||
private boolean mForceShowIcon;
|
||||
private ImageView mGroupDivider;
|
||||
private boolean mHasListDivider;
|
||||
private ImageView mIconView;
|
||||
private LayoutInflater mInflater;
|
||||
private MenuItemImpl mItemData;
|
||||
private boolean mPreserveIconSpacing;
|
||||
private RadioButton mRadioButton;
|
||||
private TextView mShortcutView;
|
||||
private Drawable mSubMenuArrow;
|
||||
private ImageView mSubMenuArrowView;
|
||||
private int mTextAppearance;
|
||||
private Context mTextAppearanceContext;
|
||||
private TextView mTitleView;
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public MenuItemImpl getItemData() {
|
||||
return this.mItemData;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public boolean prefersCondensedTitle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setForceShowIcon(boolean z) {
|
||||
this.mForceShowIcon = z;
|
||||
this.mPreserveIconSpacing = z;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public boolean showsIcon() {
|
||||
return this.mForceShowIcon;
|
||||
}
|
||||
|
||||
public ListMenuItemView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.listMenuViewStyle);
|
||||
}
|
||||
|
||||
public ListMenuItemView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet);
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(getContext(), attributeSet, R.styleable.MenuView, i, 0);
|
||||
this.mBackground = obtainStyledAttributes.getDrawable(R.styleable.MenuView_android_itemBackground);
|
||||
this.mTextAppearance = obtainStyledAttributes.getResourceId(R.styleable.MenuView_android_itemTextAppearance, -1);
|
||||
this.mPreserveIconSpacing = obtainStyledAttributes.getBoolean(R.styleable.MenuView_preserveIconSpacing, false);
|
||||
this.mTextAppearanceContext = context;
|
||||
this.mSubMenuArrow = obtainStyledAttributes.getDrawable(R.styleable.MenuView_subMenuArrow);
|
||||
TypedArray obtainStyledAttributes2 = context.getTheme().obtainStyledAttributes(null, new int[]{android.R.attr.divider}, R.attr.dropDownListViewStyle, 0);
|
||||
this.mHasListDivider = obtainStyledAttributes2.hasValue(0);
|
||||
obtainStyledAttributes.recycle();
|
||||
obtainStyledAttributes2.recycle();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
ViewCompat.setBackground(this, this.mBackground);
|
||||
TextView textView = (TextView) findViewById(R.id.title);
|
||||
this.mTitleView = textView;
|
||||
int i = this.mTextAppearance;
|
||||
if (i != -1) {
|
||||
textView.setTextAppearance(this.mTextAppearanceContext, i);
|
||||
}
|
||||
this.mShortcutView = (TextView) findViewById(R.id.shortcut);
|
||||
ImageView imageView = (ImageView) findViewById(R.id.submenuarrow);
|
||||
this.mSubMenuArrowView = imageView;
|
||||
if (imageView != null) {
|
||||
imageView.setImageDrawable(this.mSubMenuArrow);
|
||||
}
|
||||
this.mGroupDivider = (ImageView) findViewById(R.id.group_divider);
|
||||
this.mContent = (LinearLayout) findViewById(R.id.content);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void initialize(MenuItemImpl menuItemImpl, int i) {
|
||||
this.mItemData = menuItemImpl;
|
||||
setVisibility(menuItemImpl.isVisible() ? 0 : 8);
|
||||
setTitle(menuItemImpl.getTitleForItemView(this));
|
||||
setCheckable(menuItemImpl.isCheckable());
|
||||
setShortcut(menuItemImpl.shouldShowShortcut(), menuItemImpl.getShortcut());
|
||||
setIcon(menuItemImpl.getIcon());
|
||||
setEnabled(menuItemImpl.isEnabled());
|
||||
setSubMenuArrowVisible(menuItemImpl.hasSubMenu());
|
||||
setContentDescription(menuItemImpl.getContentDescription());
|
||||
}
|
||||
|
||||
private void addContentView(View view) {
|
||||
addContentView(view, -1);
|
||||
}
|
||||
|
||||
private void addContentView(View view, int i) {
|
||||
LinearLayout linearLayout = this.mContent;
|
||||
if (linearLayout != null) {
|
||||
linearLayout.addView(view, i);
|
||||
} else {
|
||||
addView(view, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
if (charSequence != null) {
|
||||
this.mTitleView.setText(charSequence);
|
||||
if (this.mTitleView.getVisibility() != 0) {
|
||||
this.mTitleView.setVisibility(0);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.mTitleView.getVisibility() != 8) {
|
||||
this.mTitleView.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void setCheckable(boolean z) {
|
||||
CompoundButton compoundButton;
|
||||
CompoundButton compoundButton2;
|
||||
if (!z && this.mRadioButton == null && this.mCheckBox == null) {
|
||||
return;
|
||||
}
|
||||
if (this.mItemData.isExclusiveCheckable()) {
|
||||
if (this.mRadioButton == null) {
|
||||
insertRadioButton();
|
||||
}
|
||||
compoundButton = this.mRadioButton;
|
||||
compoundButton2 = this.mCheckBox;
|
||||
} else {
|
||||
if (this.mCheckBox == null) {
|
||||
insertCheckBox();
|
||||
}
|
||||
compoundButton = this.mCheckBox;
|
||||
compoundButton2 = this.mRadioButton;
|
||||
}
|
||||
if (z) {
|
||||
compoundButton.setChecked(this.mItemData.isChecked());
|
||||
if (compoundButton.getVisibility() != 0) {
|
||||
compoundButton.setVisibility(0);
|
||||
}
|
||||
if (compoundButton2 == null || compoundButton2.getVisibility() == 8) {
|
||||
return;
|
||||
}
|
||||
compoundButton2.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
CheckBox checkBox = this.mCheckBox;
|
||||
if (checkBox != null) {
|
||||
checkBox.setVisibility(8);
|
||||
}
|
||||
RadioButton radioButton = this.mRadioButton;
|
||||
if (radioButton != null) {
|
||||
radioButton.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void setChecked(boolean z) {
|
||||
CompoundButton compoundButton;
|
||||
if (this.mItemData.isExclusiveCheckable()) {
|
||||
if (this.mRadioButton == null) {
|
||||
insertRadioButton();
|
||||
}
|
||||
compoundButton = this.mRadioButton;
|
||||
} else {
|
||||
if (this.mCheckBox == null) {
|
||||
insertCheckBox();
|
||||
}
|
||||
compoundButton = this.mCheckBox;
|
||||
}
|
||||
compoundButton.setChecked(z);
|
||||
}
|
||||
|
||||
private void setSubMenuArrowVisible(boolean z) {
|
||||
ImageView imageView = this.mSubMenuArrowView;
|
||||
if (imageView != null) {
|
||||
imageView.setVisibility(z ? 0 : 8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void setShortcut(boolean z, char c) {
|
||||
int i = (z && this.mItemData.shouldShowShortcut()) ? 0 : 8;
|
||||
if (i == 0) {
|
||||
this.mShortcutView.setText(this.mItemData.getShortcutLabel());
|
||||
}
|
||||
if (this.mShortcutView.getVisibility() != i) {
|
||||
this.mShortcutView.setVisibility(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView.ItemView
|
||||
public void setIcon(Drawable drawable) {
|
||||
boolean z = this.mItemData.shouldShowIcon() || this.mForceShowIcon;
|
||||
if (z || this.mPreserveIconSpacing) {
|
||||
ImageView imageView = this.mIconView;
|
||||
if (imageView == null && drawable == null && !this.mPreserveIconSpacing) {
|
||||
return;
|
||||
}
|
||||
if (imageView == null) {
|
||||
insertIconView();
|
||||
}
|
||||
if (drawable != null || this.mPreserveIconSpacing) {
|
||||
ImageView imageView2 = this.mIconView;
|
||||
if (!z) {
|
||||
drawable = null;
|
||||
}
|
||||
imageView2.setImageDrawable(drawable);
|
||||
if (this.mIconView.getVisibility() != 0) {
|
||||
this.mIconView.setVisibility(0);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.mIconView.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.LinearLayout, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
if (this.mIconView != null && this.mPreserveIconSpacing) {
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) this.mIconView.getLayoutParams();
|
||||
if (layoutParams.height > 0 && layoutParams2.width <= 0) {
|
||||
layoutParams2.width = layoutParams.height;
|
||||
}
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
private void insertIconView() {
|
||||
ImageView imageView = (ImageView) getInflater().inflate(R.layout.abc_list_menu_item_icon, (ViewGroup) this, false);
|
||||
this.mIconView = imageView;
|
||||
addContentView(imageView, 0);
|
||||
}
|
||||
|
||||
private void insertRadioButton() {
|
||||
RadioButton radioButton = (RadioButton) getInflater().inflate(R.layout.abc_list_menu_item_radio, (ViewGroup) this, false);
|
||||
this.mRadioButton = radioButton;
|
||||
addContentView(radioButton);
|
||||
}
|
||||
|
||||
private void insertCheckBox() {
|
||||
CheckBox checkBox = (CheckBox) getInflater().inflate(R.layout.abc_list_menu_item_checkbox, (ViewGroup) this, false);
|
||||
this.mCheckBox = checkBox;
|
||||
addContentView(checkBox);
|
||||
}
|
||||
|
||||
private LayoutInflater getInflater() {
|
||||
if (this.mInflater == null) {
|
||||
this.mInflater = LayoutInflater.from(getContext());
|
||||
}
|
||||
return this.mInflater;
|
||||
}
|
||||
|
||||
public void setGroupDividerEnabled(boolean z) {
|
||||
ImageView imageView = this.mGroupDivider;
|
||||
if (imageView != null) {
|
||||
imageView.setVisibility((this.mHasListDivider || !z) ? 8 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView.SelectionBoundsAdjuster
|
||||
public void adjustListItemSelectionBounds(Rect rect) {
|
||||
ImageView imageView = this.mGroupDivider;
|
||||
if (imageView == null || imageView.getVisibility() != 0) {
|
||||
return;
|
||||
}
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.mGroupDivider.getLayoutParams();
|
||||
rect.top += this.mGroupDivider.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClickListener {
|
||||
private static final String TAG = "ListMenuPresenter";
|
||||
public static final String VIEWS_TAG = "android:menu:list";
|
||||
MenuAdapter mAdapter;
|
||||
private MenuPresenter.Callback mCallback;
|
||||
Context mContext;
|
||||
private int mId;
|
||||
LayoutInflater mInflater;
|
||||
int mItemIndexOffset;
|
||||
int mItemLayoutRes;
|
||||
MenuBuilder mMenu;
|
||||
ExpandedMenuView mMenuView;
|
||||
int mThemeRes;
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean collapseItemActionView(MenuBuilder menuBuilder, MenuItemImpl menuItemImpl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean expandItemActionView(MenuBuilder menuBuilder, MenuItemImpl menuItemImpl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean flagActionItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public int getId() {
|
||||
return this.mId;
|
||||
}
|
||||
|
||||
int getItemIndexOffset() {
|
||||
return this.mItemIndexOffset;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void setCallback(MenuPresenter.Callback callback) {
|
||||
this.mCallback = callback;
|
||||
}
|
||||
|
||||
public void setId(int i) {
|
||||
this.mId = i;
|
||||
}
|
||||
|
||||
public ListMenuPresenter(Context context, int i) {
|
||||
this(i, 0);
|
||||
this.mContext = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
public ListMenuPresenter(int i, int i2) {
|
||||
this.mItemLayoutRes = i;
|
||||
this.mThemeRes = i2;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void initForMenu(Context context, MenuBuilder menuBuilder) {
|
||||
if (this.mThemeRes != 0) {
|
||||
ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(context, this.mThemeRes);
|
||||
this.mContext = contextThemeWrapper;
|
||||
this.mInflater = LayoutInflater.from(contextThemeWrapper);
|
||||
} else if (this.mContext != null) {
|
||||
this.mContext = context;
|
||||
if (this.mInflater == null) {
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
}
|
||||
this.mMenu = menuBuilder;
|
||||
MenuAdapter menuAdapter = this.mAdapter;
|
||||
if (menuAdapter != null) {
|
||||
menuAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public MenuView getMenuView(ViewGroup viewGroup) {
|
||||
if (this.mMenuView == null) {
|
||||
this.mMenuView = (ExpandedMenuView) this.mInflater.inflate(R.layout.abc_expanded_menu_layout, viewGroup, false);
|
||||
if (this.mAdapter == null) {
|
||||
this.mAdapter = new MenuAdapter();
|
||||
}
|
||||
this.mMenuView.setAdapter((ListAdapter) this.mAdapter);
|
||||
this.mMenuView.setOnItemClickListener(this);
|
||||
}
|
||||
return this.mMenuView;
|
||||
}
|
||||
|
||||
public ListAdapter getAdapter() {
|
||||
if (this.mAdapter == null) {
|
||||
this.mAdapter = new MenuAdapter();
|
||||
}
|
||||
return this.mAdapter;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void updateMenuView(boolean z) {
|
||||
MenuAdapter menuAdapter = this.mAdapter;
|
||||
if (menuAdapter != null) {
|
||||
menuAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean onSubMenuSelected(SubMenuBuilder subMenuBuilder) {
|
||||
if (!subMenuBuilder.hasVisibleItems()) {
|
||||
return false;
|
||||
}
|
||||
new MenuDialogHelper(subMenuBuilder).show(null);
|
||||
MenuPresenter.Callback callback = this.mCallback;
|
||||
if (callback == null) {
|
||||
return true;
|
||||
}
|
||||
callback.onOpenSubMenu(subMenuBuilder);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
MenuPresenter.Callback callback = this.mCallback;
|
||||
if (callback != null) {
|
||||
callback.onCloseMenu(menuBuilder, z);
|
||||
}
|
||||
}
|
||||
|
||||
public void setItemIndexOffset(int i) {
|
||||
this.mItemIndexOffset = i;
|
||||
if (this.mMenuView != null) {
|
||||
updateMenuView(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemClickListener
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
|
||||
this.mMenu.performItemAction(this.mAdapter.getItem(i), this, 0);
|
||||
}
|
||||
|
||||
public void saveHierarchyState(Bundle bundle) {
|
||||
SparseArray<Parcelable> sparseArray = new SparseArray<>();
|
||||
ExpandedMenuView expandedMenuView = this.mMenuView;
|
||||
if (expandedMenuView != null) {
|
||||
expandedMenuView.saveHierarchyState(sparseArray);
|
||||
}
|
||||
bundle.putSparseParcelableArray(VIEWS_TAG, sparseArray);
|
||||
}
|
||||
|
||||
public void restoreHierarchyState(Bundle bundle) {
|
||||
SparseArray<Parcelable> sparseParcelableArray = bundle.getSparseParcelableArray(VIEWS_TAG);
|
||||
if (sparseParcelableArray != null) {
|
||||
this.mMenuView.restoreHierarchyState(sparseParcelableArray);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public Parcelable onSaveInstanceState() {
|
||||
if (this.mMenuView == null) {
|
||||
return null;
|
||||
}
|
||||
Bundle bundle = new Bundle();
|
||||
saveHierarchyState(bundle);
|
||||
return bundle;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onRestoreInstanceState(Parcelable parcelable) {
|
||||
restoreHierarchyState((Bundle) parcelable);
|
||||
}
|
||||
|
||||
private class MenuAdapter extends BaseAdapter {
|
||||
private int mExpandedIndex = -1;
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
public MenuAdapter() {
|
||||
findExpandedIndex();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
int size = ListMenuPresenter.this.mMenu.getNonActionItems().size() - ListMenuPresenter.this.mItemIndexOffset;
|
||||
return this.mExpandedIndex < 0 ? size : size - 1;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public MenuItemImpl getItem(int i) {
|
||||
ArrayList<MenuItemImpl> nonActionItems = ListMenuPresenter.this.mMenu.getNonActionItems();
|
||||
int i2 = i + ListMenuPresenter.this.mItemIndexOffset;
|
||||
int i3 = this.mExpandedIndex;
|
||||
if (i3 >= 0 && i2 >= i3) {
|
||||
i2++;
|
||||
}
|
||||
return nonActionItems.get(i2);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
if (view == null) {
|
||||
view = ListMenuPresenter.this.mInflater.inflate(ListMenuPresenter.this.mItemLayoutRes, viewGroup, false);
|
||||
}
|
||||
((MenuView.ItemView) view).initialize(getItem(i), 0);
|
||||
return view;
|
||||
}
|
||||
|
||||
void findExpandedIndex() {
|
||||
MenuItemImpl expandedItem = ListMenuPresenter.this.mMenu.getExpandedItem();
|
||||
if (expandedItem != null) {
|
||||
ArrayList<MenuItemImpl> nonActionItems = ListMenuPresenter.this.mMenu.getNonActionItems();
|
||||
int size = nonActionItems.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (nonActionItems.get(i) == expandedItem) {
|
||||
this.mExpandedIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mExpandedIndex = -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter
|
||||
public void notifyDataSetChanged() {
|
||||
findExpandedIndex();
|
||||
super.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MenuAdapter extends BaseAdapter {
|
||||
MenuBuilder mAdapterMenu;
|
||||
private int mExpandedIndex = -1;
|
||||
private boolean mForceShowIcon;
|
||||
private final LayoutInflater mInflater;
|
||||
private final int mItemLayoutRes;
|
||||
private final boolean mOverflowOnly;
|
||||
|
||||
public MenuBuilder getAdapterMenu() {
|
||||
return this.mAdapterMenu;
|
||||
}
|
||||
|
||||
public boolean getForceShowIcon() {
|
||||
return this.mForceShowIcon;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
public void setForceShowIcon(boolean z) {
|
||||
this.mForceShowIcon = z;
|
||||
}
|
||||
|
||||
public MenuAdapter(MenuBuilder menuBuilder, LayoutInflater layoutInflater, boolean z, int i) {
|
||||
this.mOverflowOnly = z;
|
||||
this.mInflater = layoutInflater;
|
||||
this.mAdapterMenu = menuBuilder;
|
||||
this.mItemLayoutRes = i;
|
||||
findExpandedIndex();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
ArrayList<MenuItemImpl> nonActionItems = this.mOverflowOnly ? this.mAdapterMenu.getNonActionItems() : this.mAdapterMenu.getVisibleItems();
|
||||
if (this.mExpandedIndex < 0) {
|
||||
return nonActionItems.size();
|
||||
}
|
||||
return nonActionItems.size() - 1;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public MenuItemImpl getItem(int i) {
|
||||
ArrayList<MenuItemImpl> nonActionItems = this.mOverflowOnly ? this.mAdapterMenu.getNonActionItems() : this.mAdapterMenu.getVisibleItems();
|
||||
int i2 = this.mExpandedIndex;
|
||||
if (i2 >= 0 && i >= i2) {
|
||||
i++;
|
||||
}
|
||||
return nonActionItems.get(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
if (view == null) {
|
||||
view = this.mInflater.inflate(this.mItemLayoutRes, viewGroup, false);
|
||||
}
|
||||
int groupId = getItem(i).getGroupId();
|
||||
int i2 = i - 1;
|
||||
ListMenuItemView listMenuItemView = (ListMenuItemView) view;
|
||||
listMenuItemView.setGroupDividerEnabled(this.mAdapterMenu.isGroupDividerEnabled() && groupId != (i2 >= 0 ? getItem(i2).getGroupId() : groupId));
|
||||
MenuView.ItemView itemView = (MenuView.ItemView) view;
|
||||
if (this.mForceShowIcon) {
|
||||
listMenuItemView.setForceShowIcon(true);
|
||||
}
|
||||
itemView.initialize(getItem(i), 0);
|
||||
return view;
|
||||
}
|
||||
|
||||
void findExpandedIndex() {
|
||||
MenuItemImpl expandedItem = this.mAdapterMenu.getExpandedItem();
|
||||
if (expandedItem != null) {
|
||||
ArrayList<MenuItemImpl> nonActionItems = this.mAdapterMenu.getNonActionItems();
|
||||
int size = nonActionItems.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (nonActionItems.get(i) == expandedItem) {
|
||||
this.mExpandedIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mExpandedIndex = -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter
|
||||
public void notifyDataSetChanged() {
|
||||
findExpandedIndex();
|
||||
super.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,982 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.KeyCharacterMap;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.internal.view.SupportMenu;
|
||||
import androidx.core.view.ActionProvider;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MenuBuilder implements SupportMenu {
|
||||
private static final String ACTION_VIEW_STATES_KEY = "android:menu:actionviewstates";
|
||||
private static final String EXPANDED_ACTION_VIEW_ID = "android:menu:expandedactionview";
|
||||
private static final String PRESENTER_KEY = "android:menu:presenters";
|
||||
private static final String TAG = "MenuBuilder";
|
||||
private static final int[] sCategoryToOrder = {1, 4, 5, 3, 2, 0};
|
||||
private Callback mCallback;
|
||||
private final Context mContext;
|
||||
private ContextMenu.ContextMenuInfo mCurrentMenuInfo;
|
||||
private MenuItemImpl mExpandedItem;
|
||||
Drawable mHeaderIcon;
|
||||
CharSequence mHeaderTitle;
|
||||
View mHeaderView;
|
||||
private boolean mOverrideVisibleItems;
|
||||
private boolean mQwertyMode;
|
||||
private final Resources mResources;
|
||||
private boolean mShortcutsVisible;
|
||||
private int mDefaultShowAsAction = 0;
|
||||
private boolean mPreventDispatchingItemsChanged = false;
|
||||
private boolean mItemsChangedWhileDispatchPrevented = false;
|
||||
private boolean mStructureChangedWhileDispatchPrevented = false;
|
||||
private boolean mOptionalIconsVisible = false;
|
||||
private boolean mIsClosing = false;
|
||||
private ArrayList<MenuItemImpl> mTempShortcutItemList = new ArrayList<>();
|
||||
private CopyOnWriteArrayList<WeakReference<MenuPresenter>> mPresenters = new CopyOnWriteArrayList<>();
|
||||
private boolean mGroupDividerEnabled = false;
|
||||
private ArrayList<MenuItemImpl> mItems = new ArrayList<>();
|
||||
private ArrayList<MenuItemImpl> mVisibleItems = new ArrayList<>();
|
||||
private boolean mIsVisibleItemsStale = true;
|
||||
private ArrayList<MenuItemImpl> mActionItems = new ArrayList<>();
|
||||
private ArrayList<MenuItemImpl> mNonActionItems = new ArrayList<>();
|
||||
private boolean mIsActionItemsStale = true;
|
||||
|
||||
public interface Callback {
|
||||
boolean onMenuItemSelected(MenuBuilder menuBuilder, MenuItem menuItem);
|
||||
|
||||
void onMenuModeChange(MenuBuilder menuBuilder);
|
||||
}
|
||||
|
||||
public interface ItemInvoker {
|
||||
boolean invokeItem(MenuItemImpl menuItemImpl);
|
||||
}
|
||||
|
||||
protected String getActionViewStatesKey() {
|
||||
return ACTION_VIEW_STATES_KEY;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return this.mContext;
|
||||
}
|
||||
|
||||
public MenuItemImpl getExpandedItem() {
|
||||
return this.mExpandedItem;
|
||||
}
|
||||
|
||||
public Drawable getHeaderIcon() {
|
||||
return this.mHeaderIcon;
|
||||
}
|
||||
|
||||
public CharSequence getHeaderTitle() {
|
||||
return this.mHeaderTitle;
|
||||
}
|
||||
|
||||
public View getHeaderView() {
|
||||
return this.mHeaderView;
|
||||
}
|
||||
|
||||
boolean getOptionalIconsVisible() {
|
||||
return this.mOptionalIconsVisible;
|
||||
}
|
||||
|
||||
Resources getResources() {
|
||||
return this.mResources;
|
||||
}
|
||||
|
||||
public MenuBuilder getRootMenu() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isGroupDividerEnabled() {
|
||||
return this.mGroupDividerEnabled;
|
||||
}
|
||||
|
||||
boolean isQwertyMode() {
|
||||
return this.mQwertyMode;
|
||||
}
|
||||
|
||||
public boolean isShortcutsVisible() {
|
||||
return this.mShortcutsVisible;
|
||||
}
|
||||
|
||||
public void setCallback(Callback callback) {
|
||||
this.mCallback = callback;
|
||||
}
|
||||
|
||||
public void setCurrentMenuInfo(ContextMenu.ContextMenuInfo contextMenuInfo) {
|
||||
this.mCurrentMenuInfo = contextMenuInfo;
|
||||
}
|
||||
|
||||
public MenuBuilder setDefaultShowAsAction(int i) {
|
||||
this.mDefaultShowAsAction = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenu, android.view.Menu
|
||||
public void setGroupDividerEnabled(boolean z) {
|
||||
this.mGroupDividerEnabled = z;
|
||||
}
|
||||
|
||||
public void setOptionalIconsVisible(boolean z) {
|
||||
this.mOptionalIconsVisible = z;
|
||||
}
|
||||
|
||||
public void setOverrideVisibleItems(boolean z) {
|
||||
this.mOverrideVisibleItems = z;
|
||||
}
|
||||
|
||||
public void stopDispatchingItemsChanged() {
|
||||
if (this.mPreventDispatchingItemsChanged) {
|
||||
return;
|
||||
}
|
||||
this.mPreventDispatchingItemsChanged = true;
|
||||
this.mItemsChangedWhileDispatchPrevented = false;
|
||||
this.mStructureChangedWhileDispatchPrevented = false;
|
||||
}
|
||||
|
||||
public MenuBuilder(Context context) {
|
||||
this.mContext = context;
|
||||
this.mResources = context.getResources();
|
||||
setShortcutsVisibleInner(true);
|
||||
}
|
||||
|
||||
public void addMenuPresenter(MenuPresenter menuPresenter) {
|
||||
addMenuPresenter(menuPresenter, this.mContext);
|
||||
}
|
||||
|
||||
public void addMenuPresenter(MenuPresenter menuPresenter, Context context) {
|
||||
this.mPresenters.add(new WeakReference<>(menuPresenter));
|
||||
menuPresenter.initForMenu(context, this);
|
||||
this.mIsActionItemsStale = true;
|
||||
}
|
||||
|
||||
public void removeMenuPresenter(MenuPresenter menuPresenter) {
|
||||
Iterator<WeakReference<MenuPresenter>> it = this.mPresenters.iterator();
|
||||
while (it.hasNext()) {
|
||||
WeakReference<MenuPresenter> next = it.next();
|
||||
MenuPresenter menuPresenter2 = next.get();
|
||||
if (menuPresenter2 == null || menuPresenter2 == menuPresenter) {
|
||||
this.mPresenters.remove(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchPresenterUpdate(boolean z) {
|
||||
if (this.mPresenters.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
stopDispatchingItemsChanged();
|
||||
Iterator<WeakReference<MenuPresenter>> it = this.mPresenters.iterator();
|
||||
while (it.hasNext()) {
|
||||
WeakReference<MenuPresenter> next = it.next();
|
||||
MenuPresenter menuPresenter = next.get();
|
||||
if (menuPresenter == null) {
|
||||
this.mPresenters.remove(next);
|
||||
} else {
|
||||
menuPresenter.updateMenuView(z);
|
||||
}
|
||||
}
|
||||
startDispatchingItemsChanged();
|
||||
}
|
||||
|
||||
private boolean dispatchSubMenuSelected(SubMenuBuilder subMenuBuilder, MenuPresenter menuPresenter) {
|
||||
if (this.mPresenters.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
boolean onSubMenuSelected = menuPresenter != null ? menuPresenter.onSubMenuSelected(subMenuBuilder) : false;
|
||||
Iterator<WeakReference<MenuPresenter>> it = this.mPresenters.iterator();
|
||||
while (it.hasNext()) {
|
||||
WeakReference<MenuPresenter> next = it.next();
|
||||
MenuPresenter menuPresenter2 = next.get();
|
||||
if (menuPresenter2 == null) {
|
||||
this.mPresenters.remove(next);
|
||||
} else if (!onSubMenuSelected) {
|
||||
onSubMenuSelected = menuPresenter2.onSubMenuSelected(subMenuBuilder);
|
||||
}
|
||||
}
|
||||
return onSubMenuSelected;
|
||||
}
|
||||
|
||||
private void dispatchSaveInstanceState(Bundle bundle) {
|
||||
Parcelable onSaveInstanceState;
|
||||
if (this.mPresenters.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
SparseArray<? extends Parcelable> sparseArray = new SparseArray<>();
|
||||
Iterator<WeakReference<MenuPresenter>> it = this.mPresenters.iterator();
|
||||
while (it.hasNext()) {
|
||||
WeakReference<MenuPresenter> next = it.next();
|
||||
MenuPresenter menuPresenter = next.get();
|
||||
if (menuPresenter == null) {
|
||||
this.mPresenters.remove(next);
|
||||
} else {
|
||||
int id = menuPresenter.getId();
|
||||
if (id > 0 && (onSaveInstanceState = menuPresenter.onSaveInstanceState()) != null) {
|
||||
sparseArray.put(id, onSaveInstanceState);
|
||||
}
|
||||
}
|
||||
}
|
||||
bundle.putSparseParcelableArray(PRESENTER_KEY, sparseArray);
|
||||
}
|
||||
|
||||
private void dispatchRestoreInstanceState(Bundle bundle) {
|
||||
Parcelable parcelable;
|
||||
SparseArray sparseParcelableArray = bundle.getSparseParcelableArray(PRESENTER_KEY);
|
||||
if (sparseParcelableArray == null || this.mPresenters.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Iterator<WeakReference<MenuPresenter>> it = this.mPresenters.iterator();
|
||||
while (it.hasNext()) {
|
||||
WeakReference<MenuPresenter> next = it.next();
|
||||
MenuPresenter menuPresenter = next.get();
|
||||
if (menuPresenter == null) {
|
||||
this.mPresenters.remove(next);
|
||||
} else {
|
||||
int id = menuPresenter.getId();
|
||||
if (id > 0 && (parcelable = (Parcelable) sparseParcelableArray.get(id)) != null) {
|
||||
menuPresenter.onRestoreInstanceState(parcelable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void savePresenterStates(Bundle bundle) {
|
||||
dispatchSaveInstanceState(bundle);
|
||||
}
|
||||
|
||||
public void restorePresenterStates(Bundle bundle) {
|
||||
dispatchRestoreInstanceState(bundle);
|
||||
}
|
||||
|
||||
public void saveActionViewStates(Bundle bundle) {
|
||||
int size = size();
|
||||
SparseArray<? extends Parcelable> sparseArray = null;
|
||||
for (int i = 0; i < size; i++) {
|
||||
MenuItem item = getItem(i);
|
||||
View actionView = item.getActionView();
|
||||
if (actionView != null && actionView.getId() != -1) {
|
||||
if (sparseArray == null) {
|
||||
sparseArray = new SparseArray<>();
|
||||
}
|
||||
actionView.saveHierarchyState(sparseArray);
|
||||
if (item.isActionViewExpanded()) {
|
||||
bundle.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId());
|
||||
}
|
||||
}
|
||||
if (item.hasSubMenu()) {
|
||||
((SubMenuBuilder) item.getSubMenu()).saveActionViewStates(bundle);
|
||||
}
|
||||
}
|
||||
if (sparseArray != null) {
|
||||
bundle.putSparseParcelableArray(getActionViewStatesKey(), sparseArray);
|
||||
}
|
||||
}
|
||||
|
||||
public void restoreActionViewStates(Bundle bundle) {
|
||||
MenuItem findItem;
|
||||
if (bundle == null) {
|
||||
return;
|
||||
}
|
||||
SparseArray<Parcelable> sparseParcelableArray = bundle.getSparseParcelableArray(getActionViewStatesKey());
|
||||
int size = size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
MenuItem item = getItem(i);
|
||||
View actionView = item.getActionView();
|
||||
if (actionView != null && actionView.getId() != -1) {
|
||||
actionView.restoreHierarchyState(sparseParcelableArray);
|
||||
}
|
||||
if (item.hasSubMenu()) {
|
||||
((SubMenuBuilder) item.getSubMenu()).restoreActionViewStates(bundle);
|
||||
}
|
||||
}
|
||||
int i2 = bundle.getInt(EXPANDED_ACTION_VIEW_ID);
|
||||
if (i2 <= 0 || (findItem = findItem(i2)) == null) {
|
||||
return;
|
||||
}
|
||||
findItem.expandActionView();
|
||||
}
|
||||
|
||||
protected MenuItem addInternal(int i, int i2, int i3, CharSequence charSequence) {
|
||||
int ordering = getOrdering(i3);
|
||||
MenuItemImpl createNewMenuItem = createNewMenuItem(i, i2, i3, ordering, charSequence, this.mDefaultShowAsAction);
|
||||
ContextMenu.ContextMenuInfo contextMenuInfo = this.mCurrentMenuInfo;
|
||||
if (contextMenuInfo != null) {
|
||||
createNewMenuItem.setMenuInfo(contextMenuInfo);
|
||||
}
|
||||
ArrayList<MenuItemImpl> arrayList = this.mItems;
|
||||
arrayList.add(findInsertIndex(arrayList, ordering), createNewMenuItem);
|
||||
onItemsChanged(true);
|
||||
return createNewMenuItem;
|
||||
}
|
||||
|
||||
private MenuItemImpl createNewMenuItem(int i, int i2, int i3, int i4, CharSequence charSequence, int i5) {
|
||||
return new MenuItemImpl(this, i, i2, i3, i4, charSequence, i5);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem add(CharSequence charSequence) {
|
||||
return addInternal(0, 0, 0, charSequence);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem add(int i) {
|
||||
return addInternal(0, 0, 0, this.mResources.getString(i));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem add(int i, int i2, int i3, CharSequence charSequence) {
|
||||
return addInternal(i, i2, i3, charSequence);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem add(int i, int i2, int i3, int i4) {
|
||||
return addInternal(i, i2, i3, this.mResources.getString(i4));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public SubMenu addSubMenu(CharSequence charSequence) {
|
||||
return addSubMenu(0, 0, 0, charSequence);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public SubMenu addSubMenu(int i) {
|
||||
return addSubMenu(0, 0, 0, this.mResources.getString(i));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public SubMenu addSubMenu(int i, int i2, int i3, CharSequence charSequence) {
|
||||
MenuItemImpl menuItemImpl = (MenuItemImpl) addInternal(i, i2, i3, charSequence);
|
||||
SubMenuBuilder subMenuBuilder = new SubMenuBuilder(this.mContext, this, menuItemImpl);
|
||||
menuItemImpl.setSubMenu(subMenuBuilder);
|
||||
return subMenuBuilder;
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public SubMenu addSubMenu(int i, int i2, int i3, int i4) {
|
||||
return addSubMenu(i, i2, i3, this.mResources.getString(i4));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public int addIntentOptions(int i, int i2, int i3, ComponentName componentName, Intent[] intentArr, Intent intent, int i4, MenuItem[] menuItemArr) {
|
||||
PackageManager packageManager = this.mContext.getPackageManager();
|
||||
List<ResolveInfo> queryIntentActivityOptions = packageManager.queryIntentActivityOptions(componentName, intentArr, intent, 0);
|
||||
int size = queryIntentActivityOptions != null ? queryIntentActivityOptions.size() : 0;
|
||||
if ((i4 & 1) == 0) {
|
||||
removeGroup(i);
|
||||
}
|
||||
for (int i5 = 0; i5 < size; i5++) {
|
||||
ResolveInfo resolveInfo = queryIntentActivityOptions.get(i5);
|
||||
Intent intent2 = new Intent(resolveInfo.specificIndex < 0 ? intent : intentArr[resolveInfo.specificIndex]);
|
||||
intent2.setComponent(new ComponentName(resolveInfo.activityInfo.applicationInfo.packageName, resolveInfo.activityInfo.name));
|
||||
MenuItem intent3 = add(i, i2, i3, resolveInfo.loadLabel(packageManager)).setIcon(resolveInfo.loadIcon(packageManager)).setIntent(intent2);
|
||||
if (menuItemArr != null && resolveInfo.specificIndex >= 0) {
|
||||
menuItemArr[resolveInfo.specificIndex] = intent3;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void removeItem(int i) {
|
||||
removeItemAtInt(findItemIndex(i), true);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void removeGroup(int i) {
|
||||
int findGroupIndex = findGroupIndex(i);
|
||||
if (findGroupIndex >= 0) {
|
||||
int size = this.mItems.size() - findGroupIndex;
|
||||
int i2 = 0;
|
||||
while (true) {
|
||||
int i3 = i2 + 1;
|
||||
if (i2 >= size || this.mItems.get(findGroupIndex).getGroupId() != i) {
|
||||
break;
|
||||
}
|
||||
removeItemAtInt(findGroupIndex, false);
|
||||
i2 = i3;
|
||||
}
|
||||
onItemsChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeItemAtInt(int i, boolean z) {
|
||||
if (i < 0 || i >= this.mItems.size()) {
|
||||
return;
|
||||
}
|
||||
this.mItems.remove(i);
|
||||
if (z) {
|
||||
onItemsChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItemAt(int i) {
|
||||
removeItemAtInt(i, true);
|
||||
}
|
||||
|
||||
public void clearAll() {
|
||||
this.mPreventDispatchingItemsChanged = true;
|
||||
clear();
|
||||
clearHeader();
|
||||
this.mPresenters.clear();
|
||||
this.mPreventDispatchingItemsChanged = false;
|
||||
this.mItemsChangedWhileDispatchPrevented = false;
|
||||
this.mStructureChangedWhileDispatchPrevented = false;
|
||||
onItemsChanged(true);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void clear() {
|
||||
MenuItemImpl menuItemImpl = this.mExpandedItem;
|
||||
if (menuItemImpl != null) {
|
||||
collapseItemActionView(menuItemImpl);
|
||||
}
|
||||
this.mItems.clear();
|
||||
onItemsChanged(true);
|
||||
}
|
||||
|
||||
void setExclusiveItemChecked(MenuItem menuItem) {
|
||||
int groupId = menuItem.getGroupId();
|
||||
int size = this.mItems.size();
|
||||
stopDispatchingItemsChanged();
|
||||
for (int i = 0; i < size; i++) {
|
||||
MenuItemImpl menuItemImpl = this.mItems.get(i);
|
||||
if (menuItemImpl.getGroupId() == groupId && menuItemImpl.isExclusiveCheckable() && menuItemImpl.isCheckable()) {
|
||||
menuItemImpl.setCheckedInt(menuItemImpl == menuItem);
|
||||
}
|
||||
}
|
||||
startDispatchingItemsChanged();
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void setGroupCheckable(int i, boolean z, boolean z2) {
|
||||
int size = this.mItems.size();
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
MenuItemImpl menuItemImpl = this.mItems.get(i2);
|
||||
if (menuItemImpl.getGroupId() == i) {
|
||||
menuItemImpl.setExclusiveCheckable(z2);
|
||||
menuItemImpl.setCheckable(z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void setGroupVisible(int i, boolean z) {
|
||||
int size = this.mItems.size();
|
||||
boolean z2 = false;
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
MenuItemImpl menuItemImpl = this.mItems.get(i2);
|
||||
if (menuItemImpl.getGroupId() == i && menuItemImpl.setVisibleInt(z)) {
|
||||
z2 = true;
|
||||
}
|
||||
}
|
||||
if (z2) {
|
||||
onItemsChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void setGroupEnabled(int i, boolean z) {
|
||||
int size = this.mItems.size();
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
MenuItemImpl menuItemImpl = this.mItems.get(i2);
|
||||
if (menuItemImpl.getGroupId() == i) {
|
||||
menuItemImpl.setEnabled(z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public boolean hasVisibleItems() {
|
||||
if (this.mOverrideVisibleItems) {
|
||||
return true;
|
||||
}
|
||||
int size = size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (this.mItems.get(i).isVisible()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem findItem(int i) {
|
||||
MenuItem findItem;
|
||||
int size = size();
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
MenuItemImpl menuItemImpl = this.mItems.get(i2);
|
||||
if (menuItemImpl.getItemId() == i) {
|
||||
return menuItemImpl;
|
||||
}
|
||||
if (menuItemImpl.hasSubMenu() && (findItem = menuItemImpl.getSubMenu().findItem(i)) != null) {
|
||||
return findItem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int findItemIndex(int i) {
|
||||
int size = size();
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
if (this.mItems.get(i2).getItemId() == i) {
|
||||
return i2;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int findGroupIndex(int i) {
|
||||
return findGroupIndex(i, 0);
|
||||
}
|
||||
|
||||
public int findGroupIndex(int i, int i2) {
|
||||
int size = size();
|
||||
if (i2 < 0) {
|
||||
i2 = 0;
|
||||
}
|
||||
while (i2 < size) {
|
||||
if (this.mItems.get(i2).getGroupId() == i) {
|
||||
return i2;
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public int size() {
|
||||
return this.mItems.size();
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem getItem(int i) {
|
||||
return this.mItems.get(i);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public boolean isShortcutKey(int i, KeyEvent keyEvent) {
|
||||
return findItemWithShortcutForKey(i, keyEvent) != null;
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void setQwertyMode(boolean z) {
|
||||
this.mQwertyMode = z;
|
||||
onItemsChanged(false);
|
||||
}
|
||||
|
||||
private static int getOrdering(int i) {
|
||||
int i2 = ((-65536) & i) >> 16;
|
||||
if (i2 >= 0) {
|
||||
int[] iArr = sCategoryToOrder;
|
||||
if (i2 < iArr.length) {
|
||||
return (i & SupportMenu.USER_MASK) | (iArr[i2] << 16);
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("order does not contain a valid category.");
|
||||
}
|
||||
|
||||
public void setShortcutsVisible(boolean z) {
|
||||
if (this.mShortcutsVisible == z) {
|
||||
return;
|
||||
}
|
||||
setShortcutsVisibleInner(z);
|
||||
onItemsChanged(false);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:5:0x0019, code lost:
|
||||
|
||||
if (androidx.core.view.ViewConfigurationCompat.shouldShowMenuShortcutsWhenKeyboardPresent(android.view.ViewConfiguration.get(r2.mContext), r2.mContext) != false) goto L9;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
private void setShortcutsVisibleInner(boolean r3) {
|
||||
/*
|
||||
r2 = this;
|
||||
if (r3 == 0) goto L1c
|
||||
android.content.res.Resources r3 = r2.mResources
|
||||
android.content.res.Configuration r3 = r3.getConfiguration()
|
||||
int r3 = r3.keyboard
|
||||
r0 = 1
|
||||
if (r3 == r0) goto L1c
|
||||
android.content.Context r3 = r2.mContext
|
||||
android.view.ViewConfiguration r3 = android.view.ViewConfiguration.get(r3)
|
||||
android.content.Context r1 = r2.mContext
|
||||
boolean r3 = androidx.core.view.ViewConfigurationCompat.shouldShowMenuShortcutsWhenKeyboardPresent(r3, r1)
|
||||
if (r3 == 0) goto L1c
|
||||
goto L1d
|
||||
L1c:
|
||||
r0 = 0
|
||||
L1d:
|
||||
r2.mShortcutsVisible = r0
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.view.menu.MenuBuilder.setShortcutsVisibleInner(boolean):void");
|
||||
}
|
||||
|
||||
boolean dispatchMenuItemSelected(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
Callback callback = this.mCallback;
|
||||
return callback != null && callback.onMenuItemSelected(menuBuilder, menuItem);
|
||||
}
|
||||
|
||||
public void changeMenuMode() {
|
||||
Callback callback = this.mCallback;
|
||||
if (callback != null) {
|
||||
callback.onMenuModeChange(this);
|
||||
}
|
||||
}
|
||||
|
||||
private static int findInsertIndex(ArrayList<MenuItemImpl> arrayList, int i) {
|
||||
for (int size = arrayList.size() - 1; size >= 0; size--) {
|
||||
if (arrayList.get(size).getOrdering() <= i) {
|
||||
return size + 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public boolean performShortcut(int i, KeyEvent keyEvent, int i2) {
|
||||
MenuItemImpl findItemWithShortcutForKey = findItemWithShortcutForKey(i, keyEvent);
|
||||
boolean performItemAction = findItemWithShortcutForKey != null ? performItemAction(findItemWithShortcutForKey, i2) : false;
|
||||
if ((i2 & 2) != 0) {
|
||||
close(true);
|
||||
}
|
||||
return performItemAction;
|
||||
}
|
||||
|
||||
void findItemsWithShortcutForKey(List<MenuItemImpl> list, int i, KeyEvent keyEvent) {
|
||||
boolean isQwertyMode = isQwertyMode();
|
||||
int modifiers = keyEvent.getModifiers();
|
||||
KeyCharacterMap.KeyData keyData = new KeyCharacterMap.KeyData();
|
||||
if (keyEvent.getKeyData(keyData) || i == 67) {
|
||||
int size = this.mItems.size();
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
MenuItemImpl menuItemImpl = this.mItems.get(i2);
|
||||
if (menuItemImpl.hasSubMenu()) {
|
||||
((MenuBuilder) menuItemImpl.getSubMenu()).findItemsWithShortcutForKey(list, i, keyEvent);
|
||||
}
|
||||
char alphabeticShortcut = isQwertyMode ? menuItemImpl.getAlphabeticShortcut() : menuItemImpl.getNumericShortcut();
|
||||
if ((modifiers & SupportMenu.SUPPORTED_MODIFIERS_MASK) == ((isQwertyMode ? menuItemImpl.getAlphabeticModifiers() : menuItemImpl.getNumericModifiers()) & SupportMenu.SUPPORTED_MODIFIERS_MASK) && alphabeticShortcut != 0 && ((alphabeticShortcut == keyData.meta[0] || alphabeticShortcut == keyData.meta[2] || (isQwertyMode && alphabeticShortcut == '\b' && i == 67)) && menuItemImpl.isEnabled())) {
|
||||
list.add(menuItemImpl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MenuItemImpl findItemWithShortcutForKey(int i, KeyEvent keyEvent) {
|
||||
char numericShortcut;
|
||||
ArrayList<MenuItemImpl> arrayList = this.mTempShortcutItemList;
|
||||
arrayList.clear();
|
||||
findItemsWithShortcutForKey(arrayList, i, keyEvent);
|
||||
if (arrayList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
int metaState = keyEvent.getMetaState();
|
||||
KeyCharacterMap.KeyData keyData = new KeyCharacterMap.KeyData();
|
||||
keyEvent.getKeyData(keyData);
|
||||
int size = arrayList.size();
|
||||
if (size == 1) {
|
||||
return arrayList.get(0);
|
||||
}
|
||||
boolean isQwertyMode = isQwertyMode();
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
MenuItemImpl menuItemImpl = arrayList.get(i2);
|
||||
if (isQwertyMode) {
|
||||
numericShortcut = menuItemImpl.getAlphabeticShortcut();
|
||||
} else {
|
||||
numericShortcut = menuItemImpl.getNumericShortcut();
|
||||
}
|
||||
if ((numericShortcut == keyData.meta[0] && (metaState & 2) == 0) || ((numericShortcut == keyData.meta[2] && (metaState & 2) != 0) || (isQwertyMode && numericShortcut == '\b' && i == 67))) {
|
||||
return menuItemImpl;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public boolean performIdentifierAction(int i, int i2) {
|
||||
return performItemAction(findItem(i), i2);
|
||||
}
|
||||
|
||||
public boolean performItemAction(MenuItem menuItem, int i) {
|
||||
return performItemAction(menuItem, null, i);
|
||||
}
|
||||
|
||||
public boolean performItemAction(MenuItem menuItem, MenuPresenter menuPresenter, int i) {
|
||||
MenuItemImpl menuItemImpl = (MenuItemImpl) menuItem;
|
||||
if (menuItemImpl == null || !menuItemImpl.isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
boolean invoke = menuItemImpl.invoke();
|
||||
ActionProvider supportActionProvider = menuItemImpl.getSupportActionProvider();
|
||||
boolean z = supportActionProvider != null && supportActionProvider.hasSubMenu();
|
||||
if (menuItemImpl.hasCollapsibleActionView()) {
|
||||
invoke |= menuItemImpl.expandActionView();
|
||||
if (invoke) {
|
||||
close(true);
|
||||
}
|
||||
} else if (menuItemImpl.hasSubMenu() || z) {
|
||||
if ((i & 4) == 0) {
|
||||
close(false);
|
||||
}
|
||||
if (!menuItemImpl.hasSubMenu()) {
|
||||
menuItemImpl.setSubMenu(new SubMenuBuilder(getContext(), this, menuItemImpl));
|
||||
}
|
||||
SubMenuBuilder subMenuBuilder = (SubMenuBuilder) menuItemImpl.getSubMenu();
|
||||
if (z) {
|
||||
supportActionProvider.onPrepareSubMenu(subMenuBuilder);
|
||||
}
|
||||
invoke |= dispatchSubMenuSelected(subMenuBuilder, menuPresenter);
|
||||
if (!invoke) {
|
||||
close(true);
|
||||
}
|
||||
} else if ((i & 1) == 0) {
|
||||
close(true);
|
||||
}
|
||||
return invoke;
|
||||
}
|
||||
|
||||
public final void close(boolean z) {
|
||||
if (this.mIsClosing) {
|
||||
return;
|
||||
}
|
||||
this.mIsClosing = true;
|
||||
Iterator<WeakReference<MenuPresenter>> it = this.mPresenters.iterator();
|
||||
while (it.hasNext()) {
|
||||
WeakReference<MenuPresenter> next = it.next();
|
||||
MenuPresenter menuPresenter = next.get();
|
||||
if (menuPresenter == null) {
|
||||
this.mPresenters.remove(next);
|
||||
} else {
|
||||
menuPresenter.onCloseMenu(this, z);
|
||||
}
|
||||
}
|
||||
this.mIsClosing = false;
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void close() {
|
||||
close(true);
|
||||
}
|
||||
|
||||
public void onItemsChanged(boolean z) {
|
||||
if (this.mPreventDispatchingItemsChanged) {
|
||||
this.mItemsChangedWhileDispatchPrevented = true;
|
||||
if (z) {
|
||||
this.mStructureChangedWhileDispatchPrevented = true;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (z) {
|
||||
this.mIsVisibleItemsStale = true;
|
||||
this.mIsActionItemsStale = true;
|
||||
}
|
||||
dispatchPresenterUpdate(z);
|
||||
}
|
||||
|
||||
public void startDispatchingItemsChanged() {
|
||||
this.mPreventDispatchingItemsChanged = false;
|
||||
if (this.mItemsChangedWhileDispatchPrevented) {
|
||||
this.mItemsChangedWhileDispatchPrevented = false;
|
||||
onItemsChanged(this.mStructureChangedWhileDispatchPrevented);
|
||||
}
|
||||
}
|
||||
|
||||
void onItemVisibleChanged(MenuItemImpl menuItemImpl) {
|
||||
this.mIsVisibleItemsStale = true;
|
||||
onItemsChanged(true);
|
||||
}
|
||||
|
||||
void onItemActionRequestChanged(MenuItemImpl menuItemImpl) {
|
||||
this.mIsActionItemsStale = true;
|
||||
onItemsChanged(true);
|
||||
}
|
||||
|
||||
public ArrayList<MenuItemImpl> getVisibleItems() {
|
||||
if (!this.mIsVisibleItemsStale) {
|
||||
return this.mVisibleItems;
|
||||
}
|
||||
this.mVisibleItems.clear();
|
||||
int size = this.mItems.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
MenuItemImpl menuItemImpl = this.mItems.get(i);
|
||||
if (menuItemImpl.isVisible()) {
|
||||
this.mVisibleItems.add(menuItemImpl);
|
||||
}
|
||||
}
|
||||
this.mIsVisibleItemsStale = false;
|
||||
this.mIsActionItemsStale = true;
|
||||
return this.mVisibleItems;
|
||||
}
|
||||
|
||||
public void flagActionItems() {
|
||||
ArrayList<MenuItemImpl> visibleItems = getVisibleItems();
|
||||
if (this.mIsActionItemsStale) {
|
||||
Iterator<WeakReference<MenuPresenter>> it = this.mPresenters.iterator();
|
||||
boolean z = false;
|
||||
while (it.hasNext()) {
|
||||
WeakReference<MenuPresenter> next = it.next();
|
||||
MenuPresenter menuPresenter = next.get();
|
||||
if (menuPresenter == null) {
|
||||
this.mPresenters.remove(next);
|
||||
} else {
|
||||
z |= menuPresenter.flagActionItems();
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
this.mActionItems.clear();
|
||||
this.mNonActionItems.clear();
|
||||
int size = visibleItems.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
MenuItemImpl menuItemImpl = visibleItems.get(i);
|
||||
if (menuItemImpl.isActionButton()) {
|
||||
this.mActionItems.add(menuItemImpl);
|
||||
} else {
|
||||
this.mNonActionItems.add(menuItemImpl);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.mActionItems.clear();
|
||||
this.mNonActionItems.clear();
|
||||
this.mNonActionItems.addAll(getVisibleItems());
|
||||
}
|
||||
this.mIsActionItemsStale = false;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<MenuItemImpl> getActionItems() {
|
||||
flagActionItems();
|
||||
return this.mActionItems;
|
||||
}
|
||||
|
||||
public ArrayList<MenuItemImpl> getNonActionItems() {
|
||||
flagActionItems();
|
||||
return this.mNonActionItems;
|
||||
}
|
||||
|
||||
public void clearHeader() {
|
||||
this.mHeaderIcon = null;
|
||||
this.mHeaderTitle = null;
|
||||
this.mHeaderView = null;
|
||||
onItemsChanged(false);
|
||||
}
|
||||
|
||||
private void setHeaderInternal(int i, CharSequence charSequence, int i2, Drawable drawable, View view) {
|
||||
Resources resources = getResources();
|
||||
if (view != null) {
|
||||
this.mHeaderView = view;
|
||||
this.mHeaderTitle = null;
|
||||
this.mHeaderIcon = null;
|
||||
} else {
|
||||
if (i > 0) {
|
||||
this.mHeaderTitle = resources.getText(i);
|
||||
} else if (charSequence != null) {
|
||||
this.mHeaderTitle = charSequence;
|
||||
}
|
||||
if (i2 > 0) {
|
||||
this.mHeaderIcon = ContextCompat.getDrawable(getContext(), i2);
|
||||
} else if (drawable != null) {
|
||||
this.mHeaderIcon = drawable;
|
||||
}
|
||||
this.mHeaderView = null;
|
||||
}
|
||||
onItemsChanged(false);
|
||||
}
|
||||
|
||||
protected MenuBuilder setHeaderTitleInt(CharSequence charSequence) {
|
||||
setHeaderInternal(0, charSequence, 0, null, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected MenuBuilder setHeaderTitleInt(int i) {
|
||||
setHeaderInternal(i, null, 0, null, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected MenuBuilder setHeaderIconInt(Drawable drawable) {
|
||||
setHeaderInternal(0, null, 0, drawable, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected MenuBuilder setHeaderIconInt(int i) {
|
||||
setHeaderInternal(0, null, i, null, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected MenuBuilder setHeaderViewInt(View view) {
|
||||
setHeaderInternal(0, null, 0, null, view);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean expandItemActionView(MenuItemImpl menuItemImpl) {
|
||||
boolean z = false;
|
||||
if (this.mPresenters.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
stopDispatchingItemsChanged();
|
||||
Iterator<WeakReference<MenuPresenter>> it = this.mPresenters.iterator();
|
||||
while (it.hasNext()) {
|
||||
WeakReference<MenuPresenter> next = it.next();
|
||||
MenuPresenter menuPresenter = next.get();
|
||||
if (menuPresenter == null) {
|
||||
this.mPresenters.remove(next);
|
||||
} else {
|
||||
z = menuPresenter.expandItemActionView(this, menuItemImpl);
|
||||
if (z) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
startDispatchingItemsChanged();
|
||||
if (z) {
|
||||
this.mExpandedItem = menuItemImpl;
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
public boolean collapseItemActionView(MenuItemImpl menuItemImpl) {
|
||||
boolean z = false;
|
||||
if (!this.mPresenters.isEmpty() && this.mExpandedItem == menuItemImpl) {
|
||||
stopDispatchingItemsChanged();
|
||||
Iterator<WeakReference<MenuPresenter>> it = this.mPresenters.iterator();
|
||||
while (it.hasNext()) {
|
||||
WeakReference<MenuPresenter> next = it.next();
|
||||
MenuPresenter menuPresenter = next.get();
|
||||
if (menuPresenter == null) {
|
||||
this.mPresenters.remove(next);
|
||||
} else {
|
||||
z = menuPresenter.collapseItemActionView(this, menuItemImpl);
|
||||
if (z) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
startDispatchingItemsChanged();
|
||||
if (z) {
|
||||
this.mExpandedItem = null;
|
||||
}
|
||||
}
|
||||
return z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.IBinder;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.core.view.PointerIconCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class MenuDialogHelper implements DialogInterface.OnKeyListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, MenuPresenter.Callback {
|
||||
private AlertDialog mDialog;
|
||||
private MenuBuilder mMenu;
|
||||
ListMenuPresenter mPresenter;
|
||||
private MenuPresenter.Callback mPresenterCallback;
|
||||
|
||||
public void setPresenterCallback(MenuPresenter.Callback callback) {
|
||||
this.mPresenterCallback = callback;
|
||||
}
|
||||
|
||||
public MenuDialogHelper(MenuBuilder menuBuilder) {
|
||||
this.mMenu = menuBuilder;
|
||||
}
|
||||
|
||||
public void show(IBinder iBinder) {
|
||||
MenuBuilder menuBuilder = this.mMenu;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(menuBuilder.getContext());
|
||||
ListMenuPresenter listMenuPresenter = new ListMenuPresenter(builder.getContext(), R.layout.abc_list_menu_item_layout);
|
||||
this.mPresenter = listMenuPresenter;
|
||||
listMenuPresenter.setCallback(this);
|
||||
this.mMenu.addMenuPresenter(this.mPresenter);
|
||||
builder.setAdapter(this.mPresenter.getAdapter(), this);
|
||||
View headerView = menuBuilder.getHeaderView();
|
||||
if (headerView != null) {
|
||||
builder.setCustomTitle(headerView);
|
||||
} else {
|
||||
builder.setIcon(menuBuilder.getHeaderIcon()).setTitle(menuBuilder.getHeaderTitle());
|
||||
}
|
||||
builder.setOnKeyListener(this);
|
||||
AlertDialog create = builder.create();
|
||||
this.mDialog = create;
|
||||
create.setOnDismissListener(this);
|
||||
WindowManager.LayoutParams attributes = this.mDialog.getWindow().getAttributes();
|
||||
attributes.type = PointerIconCompat.TYPE_HELP;
|
||||
if (iBinder != null) {
|
||||
attributes.token = iBinder;
|
||||
}
|
||||
attributes.flags |= 131072;
|
||||
this.mDialog.show();
|
||||
}
|
||||
|
||||
@Override // android.content.DialogInterface.OnKeyListener
|
||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
||||
Window window;
|
||||
View decorView;
|
||||
KeyEvent.DispatcherState keyDispatcherState;
|
||||
View decorView2;
|
||||
KeyEvent.DispatcherState keyDispatcherState2;
|
||||
if (i == 82 || i == 4) {
|
||||
if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) {
|
||||
Window window2 = this.mDialog.getWindow();
|
||||
if (window2 != null && (decorView2 = window2.getDecorView()) != null && (keyDispatcherState2 = decorView2.getKeyDispatcherState()) != null) {
|
||||
keyDispatcherState2.startTracking(keyEvent, this);
|
||||
return true;
|
||||
}
|
||||
} else if (keyEvent.getAction() == 1 && !keyEvent.isCanceled() && (window = this.mDialog.getWindow()) != null && (decorView = window.getDecorView()) != null && (keyDispatcherState = decorView.getKeyDispatcherState()) != null && keyDispatcherState.isTracking(keyEvent)) {
|
||||
this.mMenu.close(true);
|
||||
dialogInterface.dismiss();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return this.mMenu.performShortcut(i, keyEvent, 0);
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
AlertDialog alertDialog = this.mDialog;
|
||||
if (alertDialog != null) {
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.content.DialogInterface.OnDismissListener
|
||||
public void onDismiss(DialogInterface dialogInterface) {
|
||||
this.mPresenter.onCloseMenu(this.mMenu, true);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
if (z || menuBuilder == this.mMenu) {
|
||||
dismiss();
|
||||
}
|
||||
MenuPresenter.Callback callback = this.mPresenterCallback;
|
||||
if (callback != null) {
|
||||
callback.onCloseMenu(menuBuilder, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public boolean onOpenSubMenu(MenuBuilder menuBuilder) {
|
||||
MenuPresenter.Callback callback = this.mPresenterCallback;
|
||||
if (callback != null) {
|
||||
return callback.onOpenSubMenu(menuBuilder);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
this.mMenu.performItemAction((MenuItemImpl) this.mPresenter.getAdapter().getItem(i), 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface MenuHelper {
|
||||
void dismiss();
|
||||
|
||||
void setPresenterCallback(MenuPresenter.Callback callback);
|
||||
}
|
||||
@@ -0,0 +1,711 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.internal.view.SupportMenuItem;
|
||||
import androidx.core.view.ActionProvider;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class MenuItemImpl implements SupportMenuItem {
|
||||
private static final int CHECKABLE = 1;
|
||||
private static final int CHECKED = 2;
|
||||
private static final int ENABLED = 16;
|
||||
private static final int EXCLUSIVE = 4;
|
||||
private static final int HIDDEN = 8;
|
||||
private static final int IS_ACTION = 32;
|
||||
static final int NO_ICON = 0;
|
||||
private static final int SHOW_AS_ACTION_MASK = 3;
|
||||
private static final String TAG = "MenuItemImpl";
|
||||
private ActionProvider mActionProvider;
|
||||
private View mActionView;
|
||||
private final int mCategoryOrder;
|
||||
private MenuItem.OnMenuItemClickListener mClickListener;
|
||||
private CharSequence mContentDescription;
|
||||
private final int mGroup;
|
||||
private Drawable mIconDrawable;
|
||||
private final int mId;
|
||||
private Intent mIntent;
|
||||
private Runnable mItemCallback;
|
||||
MenuBuilder mMenu;
|
||||
private ContextMenu.ContextMenuInfo mMenuInfo;
|
||||
private MenuItem.OnActionExpandListener mOnActionExpandListener;
|
||||
private final int mOrdering;
|
||||
private char mShortcutAlphabeticChar;
|
||||
private char mShortcutNumericChar;
|
||||
private int mShowAsAction;
|
||||
private SubMenuBuilder mSubMenu;
|
||||
private CharSequence mTitle;
|
||||
private CharSequence mTitleCondensed;
|
||||
private CharSequence mTooltipText;
|
||||
private int mShortcutNumericModifiers = 4096;
|
||||
private int mShortcutAlphabeticModifiers = 4096;
|
||||
private int mIconResId = 0;
|
||||
private ColorStateList mIconTintList = null;
|
||||
private PorterDuff.Mode mIconTintMode = null;
|
||||
private boolean mHasIconTint = false;
|
||||
private boolean mHasIconTintMode = false;
|
||||
private boolean mNeedToApplyIconTint = false;
|
||||
private int mFlags = 16;
|
||||
private boolean mIsActionViewExpanded = false;
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public int getAlphabeticModifiers() {
|
||||
return this.mShortcutAlphabeticModifiers;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public char getAlphabeticShortcut() {
|
||||
return this.mShortcutAlphabeticChar;
|
||||
}
|
||||
|
||||
Runnable getCallback() {
|
||||
return this.mItemCallback;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public CharSequence getContentDescription() {
|
||||
return this.mContentDescription;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public int getGroupId() {
|
||||
return this.mGroup;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public ColorStateList getIconTintList() {
|
||||
return this.mIconTintList;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public PorterDuff.Mode getIconTintMode() {
|
||||
return this.mIconTintMode;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public Intent getIntent() {
|
||||
return this.mIntent;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
@ViewDebug.CapturedViewProperty
|
||||
public int getItemId() {
|
||||
return this.mId;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public ContextMenu.ContextMenuInfo getMenuInfo() {
|
||||
return this.mMenuInfo;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public int getNumericModifiers() {
|
||||
return this.mShortcutNumericModifiers;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public char getNumericShortcut() {
|
||||
return this.mShortcutNumericChar;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public int getOrder() {
|
||||
return this.mCategoryOrder;
|
||||
}
|
||||
|
||||
public int getOrdering() {
|
||||
return this.mOrdering;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public SubMenu getSubMenu() {
|
||||
return this.mSubMenu;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem
|
||||
public ActionProvider getSupportActionProvider() {
|
||||
return this.mActionProvider;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
@ViewDebug.CapturedViewProperty
|
||||
public CharSequence getTitle() {
|
||||
return this.mTitle;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public CharSequence getTitleCondensed() {
|
||||
CharSequence charSequence = this.mTitleCondensed;
|
||||
return charSequence != null ? charSequence : this.mTitle;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public CharSequence getTooltipText() {
|
||||
return this.mTooltipText;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean hasSubMenu() {
|
||||
return this.mSubMenu != null;
|
||||
}
|
||||
|
||||
public boolean isActionButton() {
|
||||
return (this.mFlags & 32) == 32;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public boolean isActionViewExpanded() {
|
||||
return this.mIsActionViewExpanded;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isCheckable() {
|
||||
return (this.mFlags & 1) == 1;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isChecked() {
|
||||
return (this.mFlags & 2) == 2;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isEnabled() {
|
||||
return (this.mFlags & 16) != 0;
|
||||
}
|
||||
|
||||
public boolean isExclusiveCheckable() {
|
||||
return (this.mFlags & 4) != 0;
|
||||
}
|
||||
|
||||
public boolean requestsActionButton() {
|
||||
return (this.mShowAsAction & 1) == 1;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem
|
||||
public boolean requiresActionButton() {
|
||||
return (this.mShowAsAction & 2) == 2;
|
||||
}
|
||||
|
||||
public MenuItem setCallback(Runnable runnable) {
|
||||
this.mItemCallback = runnable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setExclusiveCheckable(boolean z) {
|
||||
this.mFlags = (z ? 4 : 0) | (this.mFlags & (-5));
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIntent(Intent intent) {
|
||||
this.mIntent = intent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setIsActionButton(boolean z) {
|
||||
if (z) {
|
||||
this.mFlags |= 32;
|
||||
} else {
|
||||
this.mFlags &= -33;
|
||||
}
|
||||
}
|
||||
|
||||
void setMenuInfo(ContextMenu.ContextMenuInfo contextMenuInfo) {
|
||||
this.mMenuInfo = contextMenuInfo;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener onActionExpandListener) {
|
||||
this.mOnActionExpandListener = onActionExpandListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener onMenuItemClickListener) {
|
||||
this.mClickListener = onMenuItemClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
boolean setVisibleInt(boolean z) {
|
||||
int i = this.mFlags;
|
||||
int i2 = (z ? 0 : 8) | (i & (-9));
|
||||
this.mFlags = i2;
|
||||
return i != i2;
|
||||
}
|
||||
|
||||
public boolean showsTextAsAction() {
|
||||
return (this.mShowAsAction & 4) == 4;
|
||||
}
|
||||
|
||||
MenuItemImpl(MenuBuilder menuBuilder, int i, int i2, int i3, int i4, CharSequence charSequence, int i5) {
|
||||
this.mMenu = menuBuilder;
|
||||
this.mId = i2;
|
||||
this.mGroup = i;
|
||||
this.mCategoryOrder = i3;
|
||||
this.mOrdering = i4;
|
||||
this.mTitle = charSequence;
|
||||
this.mShowAsAction = i5;
|
||||
}
|
||||
|
||||
public boolean invoke() {
|
||||
MenuItem.OnMenuItemClickListener onMenuItemClickListener = this.mClickListener;
|
||||
if (onMenuItemClickListener != null && onMenuItemClickListener.onMenuItemClick(this)) {
|
||||
return true;
|
||||
}
|
||||
MenuBuilder menuBuilder = this.mMenu;
|
||||
if (menuBuilder.dispatchMenuItemSelected(menuBuilder, this)) {
|
||||
return true;
|
||||
}
|
||||
Runnable runnable = this.mItemCallback;
|
||||
if (runnable != null) {
|
||||
runnable.run();
|
||||
return true;
|
||||
}
|
||||
if (this.mIntent != null) {
|
||||
try {
|
||||
this.mMenu.getContext().startActivity(this.mIntent);
|
||||
return true;
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e(TAG, "Can't find activity to handle intent; ignoring", e);
|
||||
}
|
||||
}
|
||||
ActionProvider actionProvider = this.mActionProvider;
|
||||
return actionProvider != null && actionProvider.onPerformDefaultAction();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setEnabled(boolean z) {
|
||||
if (z) {
|
||||
this.mFlags |= 16;
|
||||
} else {
|
||||
this.mFlags &= -17;
|
||||
}
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setAlphabeticShortcut(char c) {
|
||||
if (this.mShortcutAlphabeticChar == c) {
|
||||
return this;
|
||||
}
|
||||
this.mShortcutAlphabeticChar = Character.toLowerCase(c);
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public MenuItem setAlphabeticShortcut(char c, int i) {
|
||||
if (this.mShortcutAlphabeticChar == c && this.mShortcutAlphabeticModifiers == i) {
|
||||
return this;
|
||||
}
|
||||
this.mShortcutAlphabeticChar = Character.toLowerCase(c);
|
||||
this.mShortcutAlphabeticModifiers = KeyEvent.normalizeMetaState(i);
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setNumericShortcut(char c) {
|
||||
if (this.mShortcutNumericChar == c) {
|
||||
return this;
|
||||
}
|
||||
this.mShortcutNumericChar = c;
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public MenuItem setNumericShortcut(char c, int i) {
|
||||
if (this.mShortcutNumericChar == c && this.mShortcutNumericModifiers == i) {
|
||||
return this;
|
||||
}
|
||||
this.mShortcutNumericChar = c;
|
||||
this.mShortcutNumericModifiers = KeyEvent.normalizeMetaState(i);
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setShortcut(char c, char c2) {
|
||||
this.mShortcutNumericChar = c;
|
||||
this.mShortcutAlphabeticChar = Character.toLowerCase(c2);
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public MenuItem setShortcut(char c, char c2, int i, int i2) {
|
||||
this.mShortcutNumericChar = c;
|
||||
this.mShortcutNumericModifiers = KeyEvent.normalizeMetaState(i);
|
||||
this.mShortcutAlphabeticChar = Character.toLowerCase(c2);
|
||||
this.mShortcutAlphabeticModifiers = KeyEvent.normalizeMetaState(i2);
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
char getShortcut() {
|
||||
return this.mMenu.isQwertyMode() ? this.mShortcutAlphabeticChar : this.mShortcutNumericChar;
|
||||
}
|
||||
|
||||
String getShortcutLabel() {
|
||||
char shortcut = getShortcut();
|
||||
if (shortcut == 0) {
|
||||
return "";
|
||||
}
|
||||
Resources resources = this.mMenu.getContext().getResources();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (ViewConfiguration.get(this.mMenu.getContext()).hasPermanentMenuKey()) {
|
||||
sb.append(resources.getString(R.string.abc_prepend_shortcut_label));
|
||||
}
|
||||
int i = this.mMenu.isQwertyMode() ? this.mShortcutAlphabeticModifiers : this.mShortcutNumericModifiers;
|
||||
appendModifier(sb, i, 65536, resources.getString(R.string.abc_menu_meta_shortcut_label));
|
||||
appendModifier(sb, i, 4096, resources.getString(R.string.abc_menu_ctrl_shortcut_label));
|
||||
appendModifier(sb, i, 2, resources.getString(R.string.abc_menu_alt_shortcut_label));
|
||||
appendModifier(sb, i, 1, resources.getString(R.string.abc_menu_shift_shortcut_label));
|
||||
appendModifier(sb, i, 4, resources.getString(R.string.abc_menu_sym_shortcut_label));
|
||||
appendModifier(sb, i, 8, resources.getString(R.string.abc_menu_function_shortcut_label));
|
||||
if (shortcut == '\b') {
|
||||
sb.append(resources.getString(R.string.abc_menu_delete_shortcut_label));
|
||||
} else if (shortcut == '\n') {
|
||||
sb.append(resources.getString(R.string.abc_menu_enter_shortcut_label));
|
||||
} else if (shortcut == ' ') {
|
||||
sb.append(resources.getString(R.string.abc_menu_space_shortcut_label));
|
||||
} else {
|
||||
sb.append(shortcut);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static void appendModifier(StringBuilder sb, int i, int i2, String str) {
|
||||
if ((i & i2) == i2) {
|
||||
sb.append(str);
|
||||
}
|
||||
}
|
||||
|
||||
boolean shouldShowShortcut() {
|
||||
return this.mMenu.isShortcutsVisible() && getShortcut() != 0;
|
||||
}
|
||||
|
||||
public void setSubMenu(SubMenuBuilder subMenuBuilder) {
|
||||
this.mSubMenu = subMenuBuilder;
|
||||
subMenuBuilder.setHeaderTitle(getTitle());
|
||||
}
|
||||
|
||||
CharSequence getTitleForItemView(MenuView.ItemView itemView) {
|
||||
if (itemView != null && itemView.prefersCondensedTitle()) {
|
||||
return getTitleCondensed();
|
||||
}
|
||||
return getTitle();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setTitle(CharSequence charSequence) {
|
||||
this.mTitle = charSequence;
|
||||
this.mMenu.onItemsChanged(false);
|
||||
SubMenuBuilder subMenuBuilder = this.mSubMenu;
|
||||
if (subMenuBuilder != null) {
|
||||
subMenuBuilder.setHeaderTitle(charSequence);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setTitle(int i) {
|
||||
return setTitle(this.mMenu.getContext().getString(i));
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setTitleCondensed(CharSequence charSequence) {
|
||||
this.mTitleCondensed = charSequence;
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public Drawable getIcon() {
|
||||
Drawable drawable = this.mIconDrawable;
|
||||
if (drawable != null) {
|
||||
return applyIconTintIfNecessary(drawable);
|
||||
}
|
||||
if (this.mIconResId == 0) {
|
||||
return null;
|
||||
}
|
||||
Drawable drawable2 = AppCompatResources.getDrawable(this.mMenu.getContext(), this.mIconResId);
|
||||
this.mIconResId = 0;
|
||||
this.mIconDrawable = drawable2;
|
||||
return applyIconTintIfNecessary(drawable2);
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIcon(Drawable drawable) {
|
||||
this.mIconResId = 0;
|
||||
this.mIconDrawable = drawable;
|
||||
this.mNeedToApplyIconTint = true;
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIcon(int i) {
|
||||
this.mIconDrawable = null;
|
||||
this.mIconResId = i;
|
||||
this.mNeedToApplyIconTint = true;
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public MenuItem setIconTintList(ColorStateList colorStateList) {
|
||||
this.mIconTintList = colorStateList;
|
||||
this.mHasIconTint = true;
|
||||
this.mNeedToApplyIconTint = true;
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public MenuItem setIconTintMode(PorterDuff.Mode mode) {
|
||||
this.mIconTintMode = mode;
|
||||
this.mHasIconTintMode = true;
|
||||
this.mNeedToApplyIconTint = true;
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
private Drawable applyIconTintIfNecessary(Drawable drawable) {
|
||||
if (drawable != null && this.mNeedToApplyIconTint && (this.mHasIconTint || this.mHasIconTintMode)) {
|
||||
drawable = DrawableCompat.wrap(drawable).mutate();
|
||||
if (this.mHasIconTint) {
|
||||
DrawableCompat.setTintList(drawable, this.mIconTintList);
|
||||
}
|
||||
if (this.mHasIconTintMode) {
|
||||
DrawableCompat.setTintMode(drawable, this.mIconTintMode);
|
||||
}
|
||||
this.mNeedToApplyIconTint = false;
|
||||
}
|
||||
return drawable;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setCheckable(boolean z) {
|
||||
int i = this.mFlags;
|
||||
int i2 = (z ? 1 : 0) | (i & (-2));
|
||||
this.mFlags = i2;
|
||||
if (i != i2) {
|
||||
this.mMenu.onItemsChanged(false);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setChecked(boolean z) {
|
||||
if ((this.mFlags & 4) != 0) {
|
||||
this.mMenu.setExclusiveItemChecked(this);
|
||||
} else {
|
||||
setCheckedInt(z);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
void setCheckedInt(boolean z) {
|
||||
int i = this.mFlags;
|
||||
int i2 = (z ? 2 : 0) | (i & (-3));
|
||||
this.mFlags = i2;
|
||||
if (i != i2) {
|
||||
this.mMenu.onItemsChanged(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isVisible() {
|
||||
ActionProvider actionProvider = this.mActionProvider;
|
||||
return (actionProvider == null || !actionProvider.overridesItemVisibility()) ? (this.mFlags & 8) == 0 : (this.mFlags & 8) == 0 && this.mActionProvider.isVisible();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setVisible(boolean z) {
|
||||
if (setVisibleInt(z)) {
|
||||
this.mMenu.onItemVisibleChanged(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
CharSequence charSequence = this.mTitle;
|
||||
if (charSequence != null) {
|
||||
return charSequence.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void actionFormatChanged() {
|
||||
this.mMenu.onItemActionRequestChanged(this);
|
||||
}
|
||||
|
||||
public boolean shouldShowIcon() {
|
||||
return this.mMenu.getOptionalIconsVisible();
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem
|
||||
public boolean requiresOverflow() {
|
||||
return (requiresActionButton() || requestsActionButton()) ? false : true;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public void setShowAsAction(int i) {
|
||||
int i2 = i & 3;
|
||||
if (i2 != 0 && i2 != 1 && i2 != 2) {
|
||||
throw new IllegalArgumentException("SHOW_AS_ACTION_ALWAYS, SHOW_AS_ACTION_IF_ROOM, and SHOW_AS_ACTION_NEVER are mutually exclusive.");
|
||||
}
|
||||
this.mShowAsAction = i;
|
||||
this.mMenu.onItemActionRequestChanged(this);
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public SupportMenuItem setActionView(View view) {
|
||||
int i;
|
||||
this.mActionView = view;
|
||||
this.mActionProvider = null;
|
||||
if (view != null && view.getId() == -1 && (i = this.mId) > 0) {
|
||||
view.setId(i);
|
||||
}
|
||||
this.mMenu.onItemActionRequestChanged(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public SupportMenuItem setActionView(int i) {
|
||||
Context context = this.mMenu.getContext();
|
||||
setActionView(LayoutInflater.from(context).inflate(i, (ViewGroup) new LinearLayout(context), false));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public View getActionView() {
|
||||
View view = this.mActionView;
|
||||
if (view != null) {
|
||||
return view;
|
||||
}
|
||||
ActionProvider actionProvider = this.mActionProvider;
|
||||
if (actionProvider == null) {
|
||||
return null;
|
||||
}
|
||||
View onCreateActionView = actionProvider.onCreateActionView(this);
|
||||
this.mActionView = onCreateActionView;
|
||||
return onCreateActionView;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setActionProvider(android.view.ActionProvider actionProvider) {
|
||||
throw new UnsupportedOperationException("This is not supported, use MenuItemCompat.setActionProvider()");
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public android.view.ActionProvider getActionProvider() {
|
||||
throw new UnsupportedOperationException("This is not supported, use MenuItemCompat.getActionProvider()");
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem
|
||||
public SupportMenuItem setSupportActionProvider(ActionProvider actionProvider) {
|
||||
ActionProvider actionProvider2 = this.mActionProvider;
|
||||
if (actionProvider2 != null) {
|
||||
actionProvider2.reset();
|
||||
}
|
||||
this.mActionView = null;
|
||||
this.mActionProvider = actionProvider;
|
||||
this.mMenu.onItemsChanged(true);
|
||||
ActionProvider actionProvider3 = this.mActionProvider;
|
||||
if (actionProvider3 != null) {
|
||||
actionProvider3.setVisibilityListener(new ActionProvider.VisibilityListener() { // from class: androidx.appcompat.view.menu.MenuItemImpl.1
|
||||
@Override // androidx.core.view.ActionProvider.VisibilityListener
|
||||
public void onActionProviderVisibilityChanged(boolean z) {
|
||||
MenuItemImpl.this.mMenu.onItemVisibleChanged(MenuItemImpl.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public SupportMenuItem setShowAsActionFlags(int i) {
|
||||
setShowAsAction(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public boolean expandActionView() {
|
||||
if (!hasCollapsibleActionView()) {
|
||||
return false;
|
||||
}
|
||||
MenuItem.OnActionExpandListener onActionExpandListener = this.mOnActionExpandListener;
|
||||
if (onActionExpandListener == null || onActionExpandListener.onMenuItemActionExpand(this)) {
|
||||
return this.mMenu.expandItemActionView(this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
|
||||
public boolean collapseActionView() {
|
||||
if ((this.mShowAsAction & 8) == 0) {
|
||||
return false;
|
||||
}
|
||||
if (this.mActionView == null) {
|
||||
return true;
|
||||
}
|
||||
MenuItem.OnActionExpandListener onActionExpandListener = this.mOnActionExpandListener;
|
||||
if (onActionExpandListener == null || onActionExpandListener.onMenuItemActionCollapse(this)) {
|
||||
return this.mMenu.collapseItemActionView(this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasCollapsibleActionView() {
|
||||
ActionProvider actionProvider;
|
||||
if ((this.mShowAsAction & 8) == 0) {
|
||||
return false;
|
||||
}
|
||||
if (this.mActionView == null && (actionProvider = this.mActionProvider) != null) {
|
||||
this.mActionView = actionProvider.onCreateActionView(this);
|
||||
}
|
||||
return this.mActionView != null;
|
||||
}
|
||||
|
||||
public void setActionViewExpanded(boolean z) {
|
||||
this.mIsActionViewExpanded = z;
|
||||
this.mMenu.onItemsChanged(false);
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public SupportMenuItem setContentDescription(CharSequence charSequence) {
|
||||
this.mContentDescription = charSequence;
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public SupportMenuItem setTooltipText(CharSequence charSequence) {
|
||||
this.mTooltipText = charSequence;
|
||||
this.mMenu.onItemsChanged(false);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,483 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.ActionProvider;
|
||||
import android.view.CollapsibleActionView;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import androidx.core.internal.view.SupportMenuItem;
|
||||
import androidx.core.view.ActionProvider;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MenuItemWrapperICS extends BaseMenuWrapper implements MenuItem {
|
||||
static final String LOG_TAG = "MenuItemWrapper";
|
||||
private Method mSetExclusiveCheckableMethod;
|
||||
private final SupportMenuItem mWrappedObject;
|
||||
|
||||
public MenuItemWrapperICS(Context context, SupportMenuItem supportMenuItem) {
|
||||
super(context);
|
||||
if (supportMenuItem == null) {
|
||||
throw new IllegalArgumentException("Wrapped Object can not be null.");
|
||||
}
|
||||
this.mWrappedObject = supportMenuItem;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public int getItemId() {
|
||||
return this.mWrappedObject.getItemId();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public int getGroupId() {
|
||||
return this.mWrappedObject.getGroupId();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public int getOrder() {
|
||||
return this.mWrappedObject.getOrder();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setTitle(CharSequence charSequence) {
|
||||
this.mWrappedObject.setTitle(charSequence);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setTitle(int i) {
|
||||
this.mWrappedObject.setTitle(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public CharSequence getTitle() {
|
||||
return this.mWrappedObject.getTitle();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setTitleCondensed(CharSequence charSequence) {
|
||||
this.mWrappedObject.setTitleCondensed(charSequence);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public CharSequence getTitleCondensed() {
|
||||
return this.mWrappedObject.getTitleCondensed();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIcon(Drawable drawable) {
|
||||
this.mWrappedObject.setIcon(drawable);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIcon(int i) {
|
||||
this.mWrappedObject.setIcon(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public Drawable getIcon() {
|
||||
return this.mWrappedObject.getIcon();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIntent(Intent intent) {
|
||||
this.mWrappedObject.setIntent(intent);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public Intent getIntent() {
|
||||
return this.mWrappedObject.getIntent();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setShortcut(char c, char c2) {
|
||||
this.mWrappedObject.setShortcut(c, c2);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setShortcut(char c, char c2, int i, int i2) {
|
||||
this.mWrappedObject.setShortcut(c, c2, i, i2);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setNumericShortcut(char c) {
|
||||
this.mWrappedObject.setNumericShortcut(c);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setNumericShortcut(char c, int i) {
|
||||
this.mWrappedObject.setNumericShortcut(c, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public char getNumericShortcut() {
|
||||
return this.mWrappedObject.getNumericShortcut();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public int getNumericModifiers() {
|
||||
return this.mWrappedObject.getNumericModifiers();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setAlphabeticShortcut(char c) {
|
||||
this.mWrappedObject.setAlphabeticShortcut(c);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setAlphabeticShortcut(char c, int i) {
|
||||
this.mWrappedObject.setAlphabeticShortcut(c, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public char getAlphabeticShortcut() {
|
||||
return this.mWrappedObject.getAlphabeticShortcut();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public int getAlphabeticModifiers() {
|
||||
return this.mWrappedObject.getAlphabeticModifiers();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setCheckable(boolean z) {
|
||||
this.mWrappedObject.setCheckable(z);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isCheckable() {
|
||||
return this.mWrappedObject.isCheckable();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setChecked(boolean z) {
|
||||
this.mWrappedObject.setChecked(z);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isChecked() {
|
||||
return this.mWrappedObject.isChecked();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setVisible(boolean z) {
|
||||
return this.mWrappedObject.setVisible(z);
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isVisible() {
|
||||
return this.mWrappedObject.isVisible();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setEnabled(boolean z) {
|
||||
this.mWrappedObject.setEnabled(z);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isEnabled() {
|
||||
return this.mWrappedObject.isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean hasSubMenu() {
|
||||
return this.mWrappedObject.hasSubMenu();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public SubMenu getSubMenu() {
|
||||
return getSubMenuWrapper(this.mWrappedObject.getSubMenu());
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener onMenuItemClickListener) {
|
||||
this.mWrappedObject.setOnMenuItemClickListener(onMenuItemClickListener != null ? new OnMenuItemClickListenerWrapper(onMenuItemClickListener) : null);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public ContextMenu.ContextMenuInfo getMenuInfo() {
|
||||
return this.mWrappedObject.getMenuInfo();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public void setShowAsAction(int i) {
|
||||
this.mWrappedObject.setShowAsAction(i);
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setShowAsActionFlags(int i) {
|
||||
this.mWrappedObject.setShowAsActionFlags(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setActionView(View view) {
|
||||
if (view instanceof CollapsibleActionView) {
|
||||
view = new CollapsibleActionViewWrapper(view);
|
||||
}
|
||||
this.mWrappedObject.setActionView(view);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setActionView(int i) {
|
||||
this.mWrappedObject.setActionView(i);
|
||||
View actionView = this.mWrappedObject.getActionView();
|
||||
if (actionView instanceof CollapsibleActionView) {
|
||||
this.mWrappedObject.setActionView(new CollapsibleActionViewWrapper(actionView));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public View getActionView() {
|
||||
View actionView = this.mWrappedObject.getActionView();
|
||||
return actionView instanceof CollapsibleActionViewWrapper ? ((CollapsibleActionViewWrapper) actionView).getWrappedView() : actionView;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setActionProvider(ActionProvider actionProvider) {
|
||||
ActionProviderWrapperJB actionProviderWrapperJB = new ActionProviderWrapperJB(this.mContext, actionProvider);
|
||||
SupportMenuItem supportMenuItem = this.mWrappedObject;
|
||||
if (actionProvider == null) {
|
||||
actionProviderWrapperJB = null;
|
||||
}
|
||||
supportMenuItem.setSupportActionProvider(actionProviderWrapperJB);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public ActionProvider getActionProvider() {
|
||||
androidx.core.view.ActionProvider supportActionProvider = this.mWrappedObject.getSupportActionProvider();
|
||||
if (supportActionProvider instanceof ActionProviderWrapper) {
|
||||
return ((ActionProviderWrapper) supportActionProvider).mInner;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean expandActionView() {
|
||||
return this.mWrappedObject.expandActionView();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean collapseActionView() {
|
||||
return this.mWrappedObject.collapseActionView();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public boolean isActionViewExpanded() {
|
||||
return this.mWrappedObject.isActionViewExpanded();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener onActionExpandListener) {
|
||||
this.mWrappedObject.setOnActionExpandListener(onActionExpandListener != null ? new OnActionExpandListenerWrapper(onActionExpandListener) : null);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setContentDescription(CharSequence charSequence) {
|
||||
this.mWrappedObject.setContentDescription(charSequence);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public CharSequence getContentDescription() {
|
||||
return this.mWrappedObject.getContentDescription();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setTooltipText(CharSequence charSequence) {
|
||||
this.mWrappedObject.setTooltipText(charSequence);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public CharSequence getTooltipText() {
|
||||
return this.mWrappedObject.getTooltipText();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIconTintList(ColorStateList colorStateList) {
|
||||
this.mWrappedObject.setIconTintList(colorStateList);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public ColorStateList getIconTintList() {
|
||||
return this.mWrappedObject.getIconTintList();
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public MenuItem setIconTintMode(PorterDuff.Mode mode) {
|
||||
this.mWrappedObject.setIconTintMode(mode);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem
|
||||
public PorterDuff.Mode getIconTintMode() {
|
||||
return this.mWrappedObject.getIconTintMode();
|
||||
}
|
||||
|
||||
public void setExclusiveCheckable(boolean z) {
|
||||
try {
|
||||
if (this.mSetExclusiveCheckableMethod == null) {
|
||||
this.mSetExclusiveCheckableMethod = this.mWrappedObject.getClass().getDeclaredMethod("setExclusiveCheckable", Boolean.TYPE);
|
||||
}
|
||||
this.mSetExclusiveCheckableMethod.invoke(this.mWrappedObject, Boolean.valueOf(z));
|
||||
} catch (Exception e) {
|
||||
Log.w(LOG_TAG, "Error while calling setExclusiveCheckable", e);
|
||||
}
|
||||
}
|
||||
|
||||
private class OnMenuItemClickListenerWrapper implements MenuItem.OnMenuItemClickListener {
|
||||
private final MenuItem.OnMenuItemClickListener mObject;
|
||||
|
||||
OnMenuItemClickListenerWrapper(MenuItem.OnMenuItemClickListener onMenuItemClickListener) {
|
||||
this.mObject = onMenuItemClickListener;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem.OnMenuItemClickListener
|
||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||
return this.mObject.onMenuItemClick(MenuItemWrapperICS.this.getMenuItemWrapper(menuItem));
|
||||
}
|
||||
}
|
||||
|
||||
private class OnActionExpandListenerWrapper implements MenuItem.OnActionExpandListener {
|
||||
private final MenuItem.OnActionExpandListener mObject;
|
||||
|
||||
OnActionExpandListenerWrapper(MenuItem.OnActionExpandListener onActionExpandListener) {
|
||||
this.mObject = onActionExpandListener;
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem.OnActionExpandListener
|
||||
public boolean onMenuItemActionExpand(MenuItem menuItem) {
|
||||
return this.mObject.onMenuItemActionExpand(MenuItemWrapperICS.this.getMenuItemWrapper(menuItem));
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem.OnActionExpandListener
|
||||
public boolean onMenuItemActionCollapse(MenuItem menuItem) {
|
||||
return this.mObject.onMenuItemActionCollapse(MenuItemWrapperICS.this.getMenuItemWrapper(menuItem));
|
||||
}
|
||||
}
|
||||
|
||||
private class ActionProviderWrapper extends androidx.core.view.ActionProvider {
|
||||
final ActionProvider mInner;
|
||||
|
||||
ActionProviderWrapper(Context context, ActionProvider actionProvider) {
|
||||
super(context);
|
||||
this.mInner = actionProvider;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public View onCreateActionView() {
|
||||
return this.mInner.onCreateActionView();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public boolean onPerformDefaultAction() {
|
||||
return this.mInner.onPerformDefaultAction();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public boolean hasSubMenu() {
|
||||
return this.mInner.hasSubMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public void onPrepareSubMenu(SubMenu subMenu) {
|
||||
this.mInner.onPrepareSubMenu(MenuItemWrapperICS.this.getSubMenuWrapper(subMenu));
|
||||
}
|
||||
}
|
||||
|
||||
private class ActionProviderWrapperJB extends ActionProviderWrapper implements ActionProvider.VisibilityListener {
|
||||
private ActionProvider.VisibilityListener mListener;
|
||||
|
||||
ActionProviderWrapperJB(Context context, android.view.ActionProvider actionProvider) {
|
||||
super(context, actionProvider);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public View onCreateActionView(MenuItem menuItem) {
|
||||
return this.mInner.onCreateActionView(menuItem);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public boolean overridesItemVisibility() {
|
||||
return this.mInner.overridesItemVisibility();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public boolean isVisible() {
|
||||
return this.mInner.isVisible();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public void refreshVisibility() {
|
||||
this.mInner.refreshVisibility();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public void setVisibilityListener(ActionProvider.VisibilityListener visibilityListener) {
|
||||
this.mListener = visibilityListener;
|
||||
this.mInner.setVisibilityListener(visibilityListener != null ? this : null);
|
||||
}
|
||||
|
||||
@Override // android.view.ActionProvider.VisibilityListener
|
||||
public void onActionProviderVisibilityChanged(boolean z) {
|
||||
ActionProvider.VisibilityListener visibilityListener = this.mListener;
|
||||
if (visibilityListener != null) {
|
||||
visibilityListener.onActionProviderVisibilityChanged(z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class CollapsibleActionViewWrapper extends FrameLayout implements androidx.appcompat.view.CollapsibleActionView {
|
||||
final CollapsibleActionView mWrappedView;
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
CollapsibleActionViewWrapper(View view) {
|
||||
super(view.getContext());
|
||||
this.mWrappedView = (CollapsibleActionView) view;
|
||||
addView(view);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.CollapsibleActionView
|
||||
public void onActionViewExpanded() {
|
||||
this.mWrappedView.onActionViewExpanded();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.CollapsibleActionView
|
||||
public void onActionViewCollapsed() {
|
||||
this.mWrappedView.onActionViewCollapsed();
|
||||
}
|
||||
|
||||
View getWrappedView() {
|
||||
return (View) this.mWrappedView;
|
||||
}
|
||||
}
|
||||
}
|
||||
126
02-Easy5/E5/sources/androidx/appcompat/view/menu/MenuPopup.java
Normal file
126
02-Easy5/E5/sources/androidx/appcompat/view/menu/MenuPopup.java
Normal file
@@ -0,0 +1,126 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.HeaderViewListAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class MenuPopup implements ShowableListMenu, MenuPresenter, AdapterView.OnItemClickListener {
|
||||
private Rect mEpicenterBounds;
|
||||
|
||||
public abstract void addMenu(MenuBuilder menuBuilder);
|
||||
|
||||
protected boolean closeMenuOnSubMenuOpened() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean collapseItemActionView(MenuBuilder menuBuilder, MenuItemImpl menuItemImpl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean expandItemActionView(MenuBuilder menuBuilder, MenuItemImpl menuItemImpl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Rect getEpicenterBounds() {
|
||||
return this.mEpicenterBounds;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public int getId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void initForMenu(Context context, MenuBuilder menuBuilder) {
|
||||
}
|
||||
|
||||
public abstract void setAnchorView(View view);
|
||||
|
||||
public void setEpicenterBounds(Rect rect) {
|
||||
this.mEpicenterBounds = rect;
|
||||
}
|
||||
|
||||
public abstract void setForceShowIcon(boolean z);
|
||||
|
||||
public abstract void setGravity(int i);
|
||||
|
||||
public abstract void setHorizontalOffset(int i);
|
||||
|
||||
public abstract void setOnDismissListener(PopupWindow.OnDismissListener onDismissListener);
|
||||
|
||||
public abstract void setShowTitle(boolean z);
|
||||
|
||||
public abstract void setVerticalOffset(int i);
|
||||
|
||||
MenuPopup() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public MenuView getMenuView(ViewGroup viewGroup) {
|
||||
throw new UnsupportedOperationException("MenuPopups manage their own views");
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemClickListener
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
|
||||
ListAdapter listAdapter = (ListAdapter) adapterView.getAdapter();
|
||||
toMenuAdapter(listAdapter).mAdapterMenu.performItemAction((MenuItem) listAdapter.getItem(i), this, closeMenuOnSubMenuOpened() ? 0 : 4);
|
||||
}
|
||||
|
||||
protected static int measureIndividualMenuWidth(ListAdapter listAdapter, ViewGroup viewGroup, Context context, int i) {
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
int count = listAdapter.getCount();
|
||||
View view = null;
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
for (int i4 = 0; i4 < count; i4++) {
|
||||
int itemViewType = listAdapter.getItemViewType(i4);
|
||||
if (itemViewType != i3) {
|
||||
view = null;
|
||||
i3 = itemViewType;
|
||||
}
|
||||
if (viewGroup == null) {
|
||||
viewGroup = new FrameLayout(context);
|
||||
}
|
||||
view = listAdapter.getView(i4, view, viewGroup);
|
||||
view.measure(makeMeasureSpec, makeMeasureSpec2);
|
||||
int measuredWidth = view.getMeasuredWidth();
|
||||
if (measuredWidth >= i) {
|
||||
return i;
|
||||
}
|
||||
if (measuredWidth > i2) {
|
||||
i2 = measuredWidth;
|
||||
}
|
||||
}
|
||||
return i2;
|
||||
}
|
||||
|
||||
protected static MenuAdapter toMenuAdapter(ListAdapter listAdapter) {
|
||||
if (listAdapter instanceof HeaderViewListAdapter) {
|
||||
return (MenuAdapter) ((HeaderViewListAdapter) listAdapter).getWrappedAdapter();
|
||||
}
|
||||
return (MenuAdapter) listAdapter;
|
||||
}
|
||||
|
||||
protected static boolean shouldPreserveIconSpacing(MenuBuilder menuBuilder) {
|
||||
int size = menuBuilder.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
MenuItem item = menuBuilder.getItem(i);
|
||||
if (item.isVisible() && item.getIcon() != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.view.Display;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ListView;
|
||||
import android.widget.PopupWindow;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MenuPopupHelper implements MenuHelper {
|
||||
private static final int TOUCH_EPICENTER_SIZE_DP = 48;
|
||||
private View mAnchorView;
|
||||
private final Context mContext;
|
||||
private int mDropDownGravity;
|
||||
private boolean mForceShowIcon;
|
||||
private final PopupWindow.OnDismissListener mInternalOnDismissListener;
|
||||
private final MenuBuilder mMenu;
|
||||
private PopupWindow.OnDismissListener mOnDismissListener;
|
||||
private final boolean mOverflowOnly;
|
||||
private MenuPopup mPopup;
|
||||
private final int mPopupStyleAttr;
|
||||
private final int mPopupStyleRes;
|
||||
private MenuPresenter.Callback mPresenterCallback;
|
||||
|
||||
public int getGravity() {
|
||||
return this.mDropDownGravity;
|
||||
}
|
||||
|
||||
public void setAnchorView(View view) {
|
||||
this.mAnchorView = view;
|
||||
}
|
||||
|
||||
public void setGravity(int i) {
|
||||
this.mDropDownGravity = i;
|
||||
}
|
||||
|
||||
public void setOnDismissListener(PopupWindow.OnDismissListener onDismissListener) {
|
||||
this.mOnDismissListener = onDismissListener;
|
||||
}
|
||||
|
||||
public MenuPopupHelper(Context context, MenuBuilder menuBuilder) {
|
||||
this(context, menuBuilder, null, false, R.attr.popupMenuStyle, 0);
|
||||
}
|
||||
|
||||
public MenuPopupHelper(Context context, MenuBuilder menuBuilder, View view) {
|
||||
this(context, menuBuilder, view, false, R.attr.popupMenuStyle, 0);
|
||||
}
|
||||
|
||||
public MenuPopupHelper(Context context, MenuBuilder menuBuilder, View view, boolean z, int i) {
|
||||
this(context, menuBuilder, view, z, i, 0);
|
||||
}
|
||||
|
||||
public MenuPopupHelper(Context context, MenuBuilder menuBuilder, View view, boolean z, int i, int i2) {
|
||||
this.mDropDownGravity = GravityCompat.START;
|
||||
this.mInternalOnDismissListener = new PopupWindow.OnDismissListener() { // from class: androidx.appcompat.view.menu.MenuPopupHelper.1
|
||||
@Override // android.widget.PopupWindow.OnDismissListener
|
||||
public void onDismiss() {
|
||||
MenuPopupHelper.this.onDismiss();
|
||||
}
|
||||
};
|
||||
this.mContext = context;
|
||||
this.mMenu = menuBuilder;
|
||||
this.mAnchorView = view;
|
||||
this.mOverflowOnly = z;
|
||||
this.mPopupStyleAttr = i;
|
||||
this.mPopupStyleRes = i2;
|
||||
}
|
||||
|
||||
public void setForceShowIcon(boolean z) {
|
||||
this.mForceShowIcon = z;
|
||||
MenuPopup menuPopup = this.mPopup;
|
||||
if (menuPopup != null) {
|
||||
menuPopup.setForceShowIcon(z);
|
||||
}
|
||||
}
|
||||
|
||||
public void show() {
|
||||
if (!tryShow()) {
|
||||
throw new IllegalStateException("MenuPopupHelper cannot be used without an anchor");
|
||||
}
|
||||
}
|
||||
|
||||
public void show(int i, int i2) {
|
||||
if (!tryShow(i, i2)) {
|
||||
throw new IllegalStateException("MenuPopupHelper cannot be used without an anchor");
|
||||
}
|
||||
}
|
||||
|
||||
public MenuPopup getPopup() {
|
||||
if (this.mPopup == null) {
|
||||
this.mPopup = createPopup();
|
||||
}
|
||||
return this.mPopup;
|
||||
}
|
||||
|
||||
public boolean tryShow() {
|
||||
if (isShowing()) {
|
||||
return true;
|
||||
}
|
||||
if (this.mAnchorView == null) {
|
||||
return false;
|
||||
}
|
||||
showPopup(0, 0, false, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean tryShow(int i, int i2) {
|
||||
if (isShowing()) {
|
||||
return true;
|
||||
}
|
||||
if (this.mAnchorView == null) {
|
||||
return false;
|
||||
}
|
||||
showPopup(i, i2, true, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
private MenuPopup createPopup() {
|
||||
MenuPopup standardMenuPopup;
|
||||
Display defaultDisplay = ((WindowManager) this.mContext.getSystemService("window")).getDefaultDisplay();
|
||||
Point point = new Point();
|
||||
Api17Impl.getRealSize(defaultDisplay, point);
|
||||
if (Math.min(point.x, point.y) >= this.mContext.getResources().getDimensionPixelSize(R.dimen.abc_cascading_menus_min_smallest_width)) {
|
||||
standardMenuPopup = new CascadingMenuPopup(this.mContext, this.mAnchorView, this.mPopupStyleAttr, this.mPopupStyleRes, this.mOverflowOnly);
|
||||
} else {
|
||||
standardMenuPopup = new StandardMenuPopup(this.mContext, this.mMenu, this.mAnchorView, this.mPopupStyleAttr, this.mPopupStyleRes, this.mOverflowOnly);
|
||||
}
|
||||
standardMenuPopup.addMenu(this.mMenu);
|
||||
standardMenuPopup.setOnDismissListener(this.mInternalOnDismissListener);
|
||||
standardMenuPopup.setAnchorView(this.mAnchorView);
|
||||
standardMenuPopup.setCallback(this.mPresenterCallback);
|
||||
standardMenuPopup.setForceShowIcon(this.mForceShowIcon);
|
||||
standardMenuPopup.setGravity(this.mDropDownGravity);
|
||||
return standardMenuPopup;
|
||||
}
|
||||
|
||||
private void showPopup(int i, int i2, boolean z, boolean z2) {
|
||||
MenuPopup popup = getPopup();
|
||||
popup.setShowTitle(z2);
|
||||
if (z) {
|
||||
if ((GravityCompat.getAbsoluteGravity(this.mDropDownGravity, ViewCompat.getLayoutDirection(this.mAnchorView)) & 7) == 5) {
|
||||
i -= this.mAnchorView.getWidth();
|
||||
}
|
||||
popup.setHorizontalOffset(i);
|
||||
popup.setVerticalOffset(i2);
|
||||
int i3 = (int) ((this.mContext.getResources().getDisplayMetrics().density * 48.0f) / 2.0f);
|
||||
popup.setEpicenterBounds(new Rect(i - i3, i2 - i3, i + i3, i2 + i3));
|
||||
}
|
||||
popup.show();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuHelper
|
||||
public void dismiss() {
|
||||
if (isShowing()) {
|
||||
this.mPopup.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
protected void onDismiss() {
|
||||
this.mPopup = null;
|
||||
PopupWindow.OnDismissListener onDismissListener = this.mOnDismissListener;
|
||||
if (onDismissListener != null) {
|
||||
onDismissListener.onDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
MenuPopup menuPopup = this.mPopup;
|
||||
return menuPopup != null && menuPopup.isShowing();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuHelper
|
||||
public void setPresenterCallback(MenuPresenter.Callback callback) {
|
||||
this.mPresenterCallback = callback;
|
||||
MenuPopup menuPopup = this.mPopup;
|
||||
if (menuPopup != null) {
|
||||
menuPopup.setCallback(callback);
|
||||
}
|
||||
}
|
||||
|
||||
public ListView getListView() {
|
||||
return getPopup().getListView();
|
||||
}
|
||||
|
||||
static class Api17Impl {
|
||||
private Api17Impl() {
|
||||
}
|
||||
|
||||
static void getRealSize(Display display, Point point) {
|
||||
display.getRealSize(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcelable;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface MenuPresenter {
|
||||
|
||||
public interface Callback {
|
||||
void onCloseMenu(MenuBuilder menuBuilder, boolean z);
|
||||
|
||||
boolean onOpenSubMenu(MenuBuilder menuBuilder);
|
||||
}
|
||||
|
||||
boolean collapseItemActionView(MenuBuilder menuBuilder, MenuItemImpl menuItemImpl);
|
||||
|
||||
boolean expandItemActionView(MenuBuilder menuBuilder, MenuItemImpl menuItemImpl);
|
||||
|
||||
boolean flagActionItems();
|
||||
|
||||
int getId();
|
||||
|
||||
MenuView getMenuView(ViewGroup viewGroup);
|
||||
|
||||
void initForMenu(Context context, MenuBuilder menuBuilder);
|
||||
|
||||
void onCloseMenu(MenuBuilder menuBuilder, boolean z);
|
||||
|
||||
void onRestoreInstanceState(Parcelable parcelable);
|
||||
|
||||
Parcelable onSaveInstanceState();
|
||||
|
||||
boolean onSubMenuSelected(SubMenuBuilder subMenuBuilder);
|
||||
|
||||
void setCallback(Callback callback);
|
||||
|
||||
void updateMenuView(boolean z);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface MenuView {
|
||||
|
||||
public interface ItemView {
|
||||
MenuItemImpl getItemData();
|
||||
|
||||
void initialize(MenuItemImpl menuItemImpl, int i);
|
||||
|
||||
boolean prefersCondensedTitle();
|
||||
|
||||
void setCheckable(boolean z);
|
||||
|
||||
void setChecked(boolean z);
|
||||
|
||||
void setEnabled(boolean z);
|
||||
|
||||
void setIcon(Drawable drawable);
|
||||
|
||||
void setShortcut(boolean z, char c);
|
||||
|
||||
void setTitle(CharSequence charSequence);
|
||||
|
||||
boolean showsIcon();
|
||||
}
|
||||
|
||||
int getWindowAnimations();
|
||||
|
||||
void initialize(MenuBuilder menuBuilder);
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import androidx.core.internal.view.SupportMenu;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MenuWrapperICS extends BaseMenuWrapper implements Menu {
|
||||
private final SupportMenu mWrappedObject;
|
||||
|
||||
public MenuWrapperICS(Context context, SupportMenu supportMenu) {
|
||||
super(context);
|
||||
if (supportMenu == null) {
|
||||
throw new IllegalArgumentException("Wrapped Object can not be null.");
|
||||
}
|
||||
this.mWrappedObject = supportMenu;
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem add(CharSequence charSequence) {
|
||||
return getMenuItemWrapper(this.mWrappedObject.add(charSequence));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem add(int i) {
|
||||
return getMenuItemWrapper(this.mWrappedObject.add(i));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem add(int i, int i2, int i3, CharSequence charSequence) {
|
||||
return getMenuItemWrapper(this.mWrappedObject.add(i, i2, i3, charSequence));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem add(int i, int i2, int i3, int i4) {
|
||||
return getMenuItemWrapper(this.mWrappedObject.add(i, i2, i3, i4));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public SubMenu addSubMenu(CharSequence charSequence) {
|
||||
return getSubMenuWrapper(this.mWrappedObject.addSubMenu(charSequence));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public SubMenu addSubMenu(int i) {
|
||||
return getSubMenuWrapper(this.mWrappedObject.addSubMenu(i));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public SubMenu addSubMenu(int i, int i2, int i3, CharSequence charSequence) {
|
||||
return getSubMenuWrapper(this.mWrappedObject.addSubMenu(i, i2, i3, charSequence));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public SubMenu addSubMenu(int i, int i2, int i3, int i4) {
|
||||
return getSubMenuWrapper(this.mWrappedObject.addSubMenu(i, i2, i3, i4));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public int addIntentOptions(int i, int i2, int i3, ComponentName componentName, Intent[] intentArr, Intent intent, int i4, MenuItem[] menuItemArr) {
|
||||
MenuItem[] menuItemArr2 = menuItemArr != null ? new MenuItem[menuItemArr.length] : null;
|
||||
int addIntentOptions = this.mWrappedObject.addIntentOptions(i, i2, i3, componentName, intentArr, intent, i4, menuItemArr2);
|
||||
if (menuItemArr2 != null) {
|
||||
int length = menuItemArr2.length;
|
||||
for (int i5 = 0; i5 < length; i5++) {
|
||||
menuItemArr[i5] = getMenuItemWrapper(menuItemArr2[i5]);
|
||||
}
|
||||
}
|
||||
return addIntentOptions;
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void removeItem(int i) {
|
||||
internalRemoveItem(i);
|
||||
this.mWrappedObject.removeItem(i);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void removeGroup(int i) {
|
||||
internalRemoveGroup(i);
|
||||
this.mWrappedObject.removeGroup(i);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void clear() {
|
||||
internalClear();
|
||||
this.mWrappedObject.clear();
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void setGroupCheckable(int i, boolean z, boolean z2) {
|
||||
this.mWrappedObject.setGroupCheckable(i, z, z2);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void setGroupVisible(int i, boolean z) {
|
||||
this.mWrappedObject.setGroupVisible(i, z);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void setGroupEnabled(int i, boolean z) {
|
||||
this.mWrappedObject.setGroupEnabled(i, z);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public boolean hasVisibleItems() {
|
||||
return this.mWrappedObject.hasVisibleItems();
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem findItem(int i) {
|
||||
return getMenuItemWrapper(this.mWrappedObject.findItem(i));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public int size() {
|
||||
return this.mWrappedObject.size();
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public MenuItem getItem(int i) {
|
||||
return getMenuItemWrapper(this.mWrappedObject.getItem(i));
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void close() {
|
||||
this.mWrappedObject.close();
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public boolean performShortcut(int i, KeyEvent keyEvent, int i2) {
|
||||
return this.mWrappedObject.performShortcut(i, keyEvent, i2);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public boolean isShortcutKey(int i, KeyEvent keyEvent) {
|
||||
return this.mWrappedObject.isShortcutKey(i, keyEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public boolean performIdentifierAction(int i, int i2) {
|
||||
return this.mWrappedObject.performIdentifierAction(i, i2);
|
||||
}
|
||||
|
||||
@Override // android.view.Menu
|
||||
public void setQwertyMode(boolean z) {
|
||||
this.mWrappedObject.setQwertyMode(z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.widget.ListView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ShowableListMenu {
|
||||
void dismiss();
|
||||
|
||||
ListView getListView();
|
||||
|
||||
boolean isShowing();
|
||||
|
||||
void show();
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Parcelable;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.appcompat.widget.MenuPopupWindow;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class StandardMenuPopup extends MenuPopup implements PopupWindow.OnDismissListener, AdapterView.OnItemClickListener, MenuPresenter, View.OnKeyListener {
|
||||
private static final int ITEM_LAYOUT = R.layout.abc_popup_menu_item_layout;
|
||||
private final MenuAdapter mAdapter;
|
||||
private View mAnchorView;
|
||||
private int mContentWidth;
|
||||
private final Context mContext;
|
||||
private boolean mHasContentWidth;
|
||||
private final MenuBuilder mMenu;
|
||||
private PopupWindow.OnDismissListener mOnDismissListener;
|
||||
private final boolean mOverflowOnly;
|
||||
final MenuPopupWindow mPopup;
|
||||
private final int mPopupMaxWidth;
|
||||
private final int mPopupStyleAttr;
|
||||
private final int mPopupStyleRes;
|
||||
private MenuPresenter.Callback mPresenterCallback;
|
||||
private boolean mShowTitle;
|
||||
View mShownAnchorView;
|
||||
ViewTreeObserver mTreeObserver;
|
||||
private boolean mWasDismissed;
|
||||
final ViewTreeObserver.OnGlobalLayoutListener mGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { // from class: androidx.appcompat.view.menu.StandardMenuPopup.1
|
||||
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
||||
public void onGlobalLayout() {
|
||||
if (!StandardMenuPopup.this.isShowing() || StandardMenuPopup.this.mPopup.isModal()) {
|
||||
return;
|
||||
}
|
||||
View view = StandardMenuPopup.this.mShownAnchorView;
|
||||
if (view == null || !view.isShown()) {
|
||||
StandardMenuPopup.this.dismiss();
|
||||
} else {
|
||||
StandardMenuPopup.this.mPopup.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
private final View.OnAttachStateChangeListener mAttachStateChangeListener = new View.OnAttachStateChangeListener() { // from class: androidx.appcompat.view.menu.StandardMenuPopup.2
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewAttachedToWindow(View view) {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewDetachedFromWindow(View view) {
|
||||
if (StandardMenuPopup.this.mTreeObserver != null) {
|
||||
if (!StandardMenuPopup.this.mTreeObserver.isAlive()) {
|
||||
StandardMenuPopup.this.mTreeObserver = view.getViewTreeObserver();
|
||||
}
|
||||
StandardMenuPopup.this.mTreeObserver.removeGlobalOnLayoutListener(StandardMenuPopup.this.mGlobalLayoutListener);
|
||||
}
|
||||
view.removeOnAttachStateChangeListener(this);
|
||||
}
|
||||
};
|
||||
private int mDropDownGravity = 0;
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void addMenu(MenuBuilder menuBuilder) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean flagActionItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onRestoreInstanceState(Parcelable parcelable) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public Parcelable onSaveInstanceState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setAnchorView(View view) {
|
||||
this.mAnchorView = view;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void setCallback(MenuPresenter.Callback callback) {
|
||||
this.mPresenterCallback = callback;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setGravity(int i) {
|
||||
this.mDropDownGravity = i;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setOnDismissListener(PopupWindow.OnDismissListener onDismissListener) {
|
||||
this.mOnDismissListener = onDismissListener;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setShowTitle(boolean z) {
|
||||
this.mShowTitle = z;
|
||||
}
|
||||
|
||||
public StandardMenuPopup(Context context, MenuBuilder menuBuilder, View view, int i, int i2, boolean z) {
|
||||
this.mContext = context;
|
||||
this.mMenu = menuBuilder;
|
||||
this.mOverflowOnly = z;
|
||||
this.mAdapter = new MenuAdapter(menuBuilder, LayoutInflater.from(context), z, ITEM_LAYOUT);
|
||||
this.mPopupStyleAttr = i;
|
||||
this.mPopupStyleRes = i2;
|
||||
Resources resources = context.getResources();
|
||||
this.mPopupMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2, resources.getDimensionPixelSize(R.dimen.abc_config_prefDialogWidth));
|
||||
this.mAnchorView = view;
|
||||
this.mPopup = new MenuPopupWindow(context, null, i, i2);
|
||||
menuBuilder.addMenuPresenter(this, context);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setForceShowIcon(boolean z) {
|
||||
this.mAdapter.setForceShowIcon(z);
|
||||
}
|
||||
|
||||
private boolean tryShow() {
|
||||
View view;
|
||||
if (isShowing()) {
|
||||
return true;
|
||||
}
|
||||
if (this.mWasDismissed || (view = this.mAnchorView) == null) {
|
||||
return false;
|
||||
}
|
||||
this.mShownAnchorView = view;
|
||||
this.mPopup.setOnDismissListener(this);
|
||||
this.mPopup.setOnItemClickListener(this);
|
||||
this.mPopup.setModal(true);
|
||||
View view2 = this.mShownAnchorView;
|
||||
boolean z = this.mTreeObserver == null;
|
||||
ViewTreeObserver viewTreeObserver = view2.getViewTreeObserver();
|
||||
this.mTreeObserver = viewTreeObserver;
|
||||
if (z) {
|
||||
viewTreeObserver.addOnGlobalLayoutListener(this.mGlobalLayoutListener);
|
||||
}
|
||||
view2.addOnAttachStateChangeListener(this.mAttachStateChangeListener);
|
||||
this.mPopup.setAnchorView(view2);
|
||||
this.mPopup.setDropDownGravity(this.mDropDownGravity);
|
||||
if (!this.mHasContentWidth) {
|
||||
this.mContentWidth = measureIndividualMenuWidth(this.mAdapter, null, this.mContext, this.mPopupMaxWidth);
|
||||
this.mHasContentWidth = true;
|
||||
}
|
||||
this.mPopup.setContentWidth(this.mContentWidth);
|
||||
this.mPopup.setInputMethodMode(2);
|
||||
this.mPopup.setEpicenterBounds(getEpicenterBounds());
|
||||
this.mPopup.show();
|
||||
ListView listView = this.mPopup.getListView();
|
||||
listView.setOnKeyListener(this);
|
||||
if (this.mShowTitle && this.mMenu.getHeaderTitle() != null) {
|
||||
FrameLayout frameLayout = (FrameLayout) LayoutInflater.from(this.mContext).inflate(R.layout.abc_popup_menu_header_item_layout, (ViewGroup) listView, false);
|
||||
TextView textView = (TextView) frameLayout.findViewById(android.R.id.title);
|
||||
if (textView != null) {
|
||||
textView.setText(this.mMenu.getHeaderTitle());
|
||||
}
|
||||
frameLayout.setEnabled(false);
|
||||
listView.addHeaderView(frameLayout, null, false);
|
||||
}
|
||||
this.mPopup.setAdapter(this.mAdapter);
|
||||
this.mPopup.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public void show() {
|
||||
if (!tryShow()) {
|
||||
throw new IllegalStateException("StandardMenuPopup cannot be used without an anchor");
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public void dismiss() {
|
||||
if (isShowing()) {
|
||||
this.mPopup.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public boolean isShowing() {
|
||||
return !this.mWasDismissed && this.mPopup.isShowing();
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow.OnDismissListener
|
||||
public void onDismiss() {
|
||||
this.mWasDismissed = true;
|
||||
this.mMenu.close();
|
||||
ViewTreeObserver viewTreeObserver = this.mTreeObserver;
|
||||
if (viewTreeObserver != null) {
|
||||
if (!viewTreeObserver.isAlive()) {
|
||||
this.mTreeObserver = this.mShownAnchorView.getViewTreeObserver();
|
||||
}
|
||||
this.mTreeObserver.removeGlobalOnLayoutListener(this.mGlobalLayoutListener);
|
||||
this.mTreeObserver = null;
|
||||
}
|
||||
this.mShownAnchorView.removeOnAttachStateChangeListener(this.mAttachStateChangeListener);
|
||||
PopupWindow.OnDismissListener onDismissListener = this.mOnDismissListener;
|
||||
if (onDismissListener != null) {
|
||||
onDismissListener.onDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void updateMenuView(boolean z) {
|
||||
this.mHasContentWidth = false;
|
||||
MenuAdapter menuAdapter = this.mAdapter;
|
||||
if (menuAdapter != null) {
|
||||
menuAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean onSubMenuSelected(SubMenuBuilder subMenuBuilder) {
|
||||
if (subMenuBuilder.hasVisibleItems()) {
|
||||
MenuPopupHelper menuPopupHelper = new MenuPopupHelper(this.mContext, subMenuBuilder, this.mShownAnchorView, this.mOverflowOnly, this.mPopupStyleAttr, this.mPopupStyleRes);
|
||||
menuPopupHelper.setPresenterCallback(this.mPresenterCallback);
|
||||
menuPopupHelper.setForceShowIcon(MenuPopup.shouldPreserveIconSpacing(subMenuBuilder));
|
||||
menuPopupHelper.setOnDismissListener(this.mOnDismissListener);
|
||||
this.mOnDismissListener = null;
|
||||
this.mMenu.close(false);
|
||||
int horizontalOffset = this.mPopup.getHorizontalOffset();
|
||||
int verticalOffset = this.mPopup.getVerticalOffset();
|
||||
if ((Gravity.getAbsoluteGravity(this.mDropDownGravity, ViewCompat.getLayoutDirection(this.mAnchorView)) & 7) == 5) {
|
||||
horizontalOffset += this.mAnchorView.getWidth();
|
||||
}
|
||||
if (menuPopupHelper.tryShow(horizontalOffset, verticalOffset)) {
|
||||
MenuPresenter.Callback callback = this.mPresenterCallback;
|
||||
if (callback == null) {
|
||||
return true;
|
||||
}
|
||||
callback.onOpenSubMenu(subMenuBuilder);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
if (menuBuilder != this.mMenu) {
|
||||
return;
|
||||
}
|
||||
dismiss();
|
||||
MenuPresenter.Callback callback = this.mPresenterCallback;
|
||||
if (callback != null) {
|
||||
callback.onCloseMenu(menuBuilder, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnKeyListener
|
||||
public boolean onKey(View view, int i, KeyEvent keyEvent) {
|
||||
if (keyEvent.getAction() != 1 || i != 82) {
|
||||
return false;
|
||||
}
|
||||
dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public ListView getListView() {
|
||||
return this.mPopup.getListView();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setHorizontalOffset(int i) {
|
||||
this.mPopup.setHorizontalOffset(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopup
|
||||
public void setVerticalOffset(int i) {
|
||||
this.mPopup.setVerticalOffset(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SubMenuBuilder extends MenuBuilder implements SubMenu {
|
||||
private MenuItemImpl mItem;
|
||||
private MenuBuilder mParentMenu;
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public MenuItem getItem() {
|
||||
return this.mItem;
|
||||
}
|
||||
|
||||
public Menu getParentMenu() {
|
||||
return this.mParentMenu;
|
||||
}
|
||||
|
||||
public SubMenuBuilder(Context context, MenuBuilder menuBuilder, MenuItemImpl menuItemImpl) {
|
||||
super(context);
|
||||
this.mParentMenu = menuBuilder;
|
||||
this.mItem = menuItemImpl;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder, android.view.Menu
|
||||
public void setQwertyMode(boolean z) {
|
||||
this.mParentMenu.setQwertyMode(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder
|
||||
public boolean isQwertyMode() {
|
||||
return this.mParentMenu.isQwertyMode();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder
|
||||
public void setShortcutsVisible(boolean z) {
|
||||
this.mParentMenu.setShortcutsVisible(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder
|
||||
public boolean isShortcutsVisible() {
|
||||
return this.mParentMenu.isShortcutsVisible();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder
|
||||
public void setCallback(MenuBuilder.Callback callback) {
|
||||
this.mParentMenu.setCallback(callback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder
|
||||
public MenuBuilder getRootMenu() {
|
||||
return this.mParentMenu.getRootMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder
|
||||
boolean dispatchMenuItemSelected(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
return super.dispatchMenuItemSelected(menuBuilder, menuItem) || this.mParentMenu.dispatchMenuItemSelected(menuBuilder, menuItem);
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setIcon(Drawable drawable) {
|
||||
this.mItem.setIcon(drawable);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setIcon(int i) {
|
||||
this.mItem.setIcon(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setHeaderIcon(Drawable drawable) {
|
||||
return (SubMenu) super.setHeaderIconInt(drawable);
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setHeaderIcon(int i) {
|
||||
return (SubMenu) super.setHeaderIconInt(i);
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setHeaderTitle(CharSequence charSequence) {
|
||||
return (SubMenu) super.setHeaderTitleInt(charSequence);
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setHeaderTitle(int i) {
|
||||
return (SubMenu) super.setHeaderTitleInt(i);
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setHeaderView(View view) {
|
||||
return (SubMenu) super.setHeaderViewInt(view);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder
|
||||
public boolean expandItemActionView(MenuItemImpl menuItemImpl) {
|
||||
return this.mParentMenu.expandItemActionView(menuItemImpl);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder
|
||||
public boolean collapseItemActionView(MenuItemImpl menuItemImpl) {
|
||||
return this.mParentMenu.collapseItemActionView(menuItemImpl);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder
|
||||
public String getActionViewStatesKey() {
|
||||
MenuItemImpl menuItemImpl = this.mItem;
|
||||
int itemId = menuItemImpl != null ? menuItemImpl.getItemId() : 0;
|
||||
if (itemId == 0) {
|
||||
return null;
|
||||
}
|
||||
return super.getActionViewStatesKey() + ":" + itemId;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder, androidx.core.internal.view.SupportMenu, android.view.Menu
|
||||
public void setGroupDividerEnabled(boolean z) {
|
||||
this.mParentMenu.setGroupDividerEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder
|
||||
public boolean isGroupDividerEnabled() {
|
||||
return this.mParentMenu.isGroupDividerEnabled();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package androidx.appcompat.view.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
import androidx.core.internal.view.SupportSubMenu;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class SubMenuWrapperICS extends MenuWrapperICS implements SubMenu {
|
||||
private final SupportSubMenu mSubMenu;
|
||||
|
||||
SubMenuWrapperICS(Context context, SupportSubMenu supportSubMenu) {
|
||||
super(context, supportSubMenu);
|
||||
this.mSubMenu = supportSubMenu;
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setHeaderTitle(int i) {
|
||||
this.mSubMenu.setHeaderTitle(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setHeaderTitle(CharSequence charSequence) {
|
||||
this.mSubMenu.setHeaderTitle(charSequence);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setHeaderIcon(int i) {
|
||||
this.mSubMenu.setHeaderIcon(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setHeaderIcon(Drawable drawable) {
|
||||
this.mSubMenu.setHeaderIcon(drawable);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setHeaderView(View view) {
|
||||
this.mSubMenu.setHeaderView(view);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public void clearHeader() {
|
||||
this.mSubMenu.clearHeader();
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setIcon(int i) {
|
||||
this.mSubMenu.setIcon(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public SubMenu setIcon(Drawable drawable) {
|
||||
this.mSubMenu.setIcon(drawable);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.view.SubMenu
|
||||
public MenuItem getItem() {
|
||||
return getMenuItemWrapper(this.mSubMenu.getItem());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorListener;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class AbsActionBarView extends ViewGroup {
|
||||
private static final int FADE_DURATION = 200;
|
||||
protected ActionMenuPresenter mActionMenuPresenter;
|
||||
protected int mContentHeight;
|
||||
private boolean mEatingHover;
|
||||
private boolean mEatingTouch;
|
||||
protected ActionMenuView mMenuView;
|
||||
protected final Context mPopupContext;
|
||||
protected final VisibilityAnimListener mVisAnimListener;
|
||||
protected ViewPropertyAnimatorCompat mVisibilityAnim;
|
||||
|
||||
protected static int next(int i, int i2, boolean z) {
|
||||
return z ? i - i2 : i + i2;
|
||||
}
|
||||
|
||||
public int getContentHeight() {
|
||||
return this.mContentHeight;
|
||||
}
|
||||
|
||||
AbsActionBarView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
AbsActionBarView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
AbsActionBarView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.mVisAnimListener = new VisibilityAnimListener();
|
||||
TypedValue typedValue = new TypedValue();
|
||||
if (!context.getTheme().resolveAttribute(R.attr.actionBarPopupTheme, typedValue, true) || typedValue.resourceId == 0) {
|
||||
this.mPopupContext = context;
|
||||
} else {
|
||||
this.mPopupContext = new ContextThemeWrapper(context, typedValue.resourceId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);
|
||||
setContentHeight(obtainStyledAttributes.getLayoutDimension(R.styleable.ActionBar_height, 0));
|
||||
obtainStyledAttributes.recycle();
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.onConfigurationChanged(configuration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
int actionMasked = motionEvent.getActionMasked();
|
||||
if (actionMasked == 0) {
|
||||
this.mEatingTouch = false;
|
||||
}
|
||||
if (!this.mEatingTouch) {
|
||||
boolean onTouchEvent = super.onTouchEvent(motionEvent);
|
||||
if (actionMasked == 0 && !onTouchEvent) {
|
||||
this.mEatingTouch = true;
|
||||
}
|
||||
}
|
||||
if (actionMasked == 1 || actionMasked == 3) {
|
||||
this.mEatingTouch = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
int actionMasked = motionEvent.getActionMasked();
|
||||
if (actionMasked == 9) {
|
||||
this.mEatingHover = false;
|
||||
}
|
||||
if (!this.mEatingHover) {
|
||||
boolean onHoverEvent = super.onHoverEvent(motionEvent);
|
||||
if (actionMasked == 9 && !onHoverEvent) {
|
||||
this.mEatingHover = true;
|
||||
}
|
||||
}
|
||||
if (actionMasked == 10 || actionMasked == 3) {
|
||||
this.mEatingHover = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setContentHeight(int i) {
|
||||
this.mContentHeight = i;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public int getAnimatedVisibility() {
|
||||
if (this.mVisibilityAnim != null) {
|
||||
return this.mVisAnimListener.mFinalVisibility;
|
||||
}
|
||||
return getVisibility();
|
||||
}
|
||||
|
||||
public ViewPropertyAnimatorCompat setupAnimatorToVisibility(int i, long j) {
|
||||
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.mVisibilityAnim;
|
||||
if (viewPropertyAnimatorCompat != null) {
|
||||
viewPropertyAnimatorCompat.cancel();
|
||||
}
|
||||
if (i == 0) {
|
||||
if (getVisibility() != 0) {
|
||||
setAlpha(0.0f);
|
||||
}
|
||||
ViewPropertyAnimatorCompat alpha = ViewCompat.animate(this).alpha(1.0f);
|
||||
alpha.setDuration(j);
|
||||
alpha.setListener(this.mVisAnimListener.withFinalVisibility(alpha, i));
|
||||
return alpha;
|
||||
}
|
||||
ViewPropertyAnimatorCompat alpha2 = ViewCompat.animate(this).alpha(0.0f);
|
||||
alpha2.setDuration(j);
|
||||
alpha2.setListener(this.mVisAnimListener.withFinalVisibility(alpha2, i));
|
||||
return alpha2;
|
||||
}
|
||||
|
||||
public void animateToVisibility(int i) {
|
||||
setupAnimatorToVisibility(i, 200L).start();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setVisibility(int i) {
|
||||
if (i != getVisibility()) {
|
||||
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.mVisibilityAnim;
|
||||
if (viewPropertyAnimatorCompat != null) {
|
||||
viewPropertyAnimatorCompat.cancel();
|
||||
}
|
||||
super.setVisibility(i);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean showOverflowMenu() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
return actionMenuPresenter.showOverflowMenu();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void postShowOverflowMenu() {
|
||||
post(new Runnable() { // from class: androidx.appcompat.widget.AbsActionBarView.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AbsActionBarView.this.showOverflowMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean hideOverflowMenu() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
return actionMenuPresenter.hideOverflowMenu();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowing() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
return actionMenuPresenter.isOverflowMenuShowing();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowPending() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
return actionMenuPresenter.isOverflowMenuShowPending();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOverflowReserved() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.isOverflowReserved();
|
||||
}
|
||||
|
||||
public boolean canShowOverflowMenu() {
|
||||
return isOverflowReserved() && getVisibility() == 0;
|
||||
}
|
||||
|
||||
public void dismissPopupMenus() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.dismissPopupMenus();
|
||||
}
|
||||
}
|
||||
|
||||
protected int measureChildView(View view, int i, int i2, int i3) {
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i, Integer.MIN_VALUE), i2);
|
||||
return Math.max(0, (i - view.getMeasuredWidth()) - i3);
|
||||
}
|
||||
|
||||
protected int positionChild(View view, int i, int i2, int i3, boolean z) {
|
||||
int measuredWidth = view.getMeasuredWidth();
|
||||
int measuredHeight = view.getMeasuredHeight();
|
||||
int i4 = i2 + ((i3 - measuredHeight) / 2);
|
||||
if (z) {
|
||||
view.layout(i - measuredWidth, i4, i, measuredHeight + i4);
|
||||
} else {
|
||||
view.layout(i, i4, i + measuredWidth, measuredHeight + i4);
|
||||
}
|
||||
return z ? -measuredWidth : measuredWidth;
|
||||
}
|
||||
|
||||
protected class VisibilityAnimListener implements ViewPropertyAnimatorListener {
|
||||
private boolean mCanceled = false;
|
||||
int mFinalVisibility;
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationCancel(View view) {
|
||||
this.mCanceled = true;
|
||||
}
|
||||
|
||||
protected VisibilityAnimListener() {
|
||||
}
|
||||
|
||||
public VisibilityAnimListener withFinalVisibility(ViewPropertyAnimatorCompat viewPropertyAnimatorCompat, int i) {
|
||||
AbsActionBarView.this.mVisibilityAnim = viewPropertyAnimatorCompat;
|
||||
this.mFinalVisibility = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationStart(View view) {
|
||||
AbsActionBarView.super.setVisibility(0);
|
||||
this.mCanceled = false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationEnd(View view) {
|
||||
if (this.mCanceled) {
|
||||
return;
|
||||
}
|
||||
AbsActionBarView.this.mVisibilityAnim = null;
|
||||
AbsActionBarView.super.setVisibility(this.mFinalVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ActionBarBackgroundDrawable extends Drawable {
|
||||
final ActionBarContainer mContainer;
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getOpacity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAlpha(int i) {
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setColorFilter(ColorFilter colorFilter) {
|
||||
}
|
||||
|
||||
public ActionBarBackgroundDrawable(ActionBarContainer actionBarContainer) {
|
||||
this.mContainer = actionBarContainer;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
if (this.mContainer.mIsSplit) {
|
||||
if (this.mContainer.mSplitBackground != null) {
|
||||
this.mContainer.mSplitBackground.draw(canvas);
|
||||
}
|
||||
} else {
|
||||
if (this.mContainer.mBackground != null) {
|
||||
this.mContainer.mBackground.draw(canvas);
|
||||
}
|
||||
if (this.mContainer.mStackedBackground == null || !this.mContainer.mIsStacked) {
|
||||
return;
|
||||
}
|
||||
this.mContainer.mStackedBackground.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void getOutline(Outline outline) {
|
||||
if (this.mContainer.mIsSplit) {
|
||||
if (this.mContainer.mSplitBackground != null) {
|
||||
Api21Impl.getOutline(this.mContainer.mBackground, outline);
|
||||
}
|
||||
} else if (this.mContainer.mBackground != null) {
|
||||
Api21Impl.getOutline(this.mContainer.mBackground, outline);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Api21Impl {
|
||||
private Api21Impl() {
|
||||
}
|
||||
|
||||
public static void getOutline(Drawable drawable, Outline outline) {
|
||||
drawable.getOutline(outline);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
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.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarContainer extends FrameLayout {
|
||||
private View mActionBarView;
|
||||
Drawable mBackground;
|
||||
private View mContextView;
|
||||
private int mHeight;
|
||||
boolean mIsSplit;
|
||||
boolean mIsStacked;
|
||||
private boolean mIsTransitioning;
|
||||
Drawable mSplitBackground;
|
||||
Drawable mStackedBackground;
|
||||
private View mTabContainer;
|
||||
|
||||
public View getTabContainer() {
|
||||
return this.mTabContainer;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent
|
||||
public ActionMode startActionModeForChild(View view, ActionMode.Callback callback) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ActionBarContainer(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActionBarContainer(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
ViewCompat.setBackground(this, new ActionBarBackgroundDrawable(this));
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ActionBar);
|
||||
this.mBackground = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_background);
|
||||
this.mStackedBackground = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_backgroundStacked);
|
||||
this.mHeight = obtainStyledAttributes.getDimensionPixelSize(R.styleable.ActionBar_height, -1);
|
||||
boolean z = true;
|
||||
if (getId() == R.id.split_action_bar) {
|
||||
this.mIsSplit = true;
|
||||
this.mSplitBackground = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_backgroundSplit);
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
if (!this.mIsSplit ? this.mBackground != null || this.mStackedBackground != null : this.mSplitBackground != null) {
|
||||
z = false;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
this.mActionBarView = findViewById(R.id.action_bar);
|
||||
this.mContextView = findViewById(R.id.action_context_bar);
|
||||
}
|
||||
|
||||
public void setPrimaryBackground(Drawable drawable) {
|
||||
Drawable drawable2 = this.mBackground;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setCallback(null);
|
||||
unscheduleDrawable(this.mBackground);
|
||||
}
|
||||
this.mBackground = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
View view = this.mActionBarView;
|
||||
if (view != null) {
|
||||
this.mBackground.setBounds(view.getLeft(), this.mActionBarView.getTop(), this.mActionBarView.getRight(), this.mActionBarView.getBottom());
|
||||
}
|
||||
}
|
||||
boolean z = true;
|
||||
if (!this.mIsSplit ? this.mBackground != null || this.mStackedBackground != null : this.mSplitBackground != null) {
|
||||
z = false;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
invalidate();
|
||||
Api21Impl.invalidateOutline(this);
|
||||
}
|
||||
|
||||
public void setStackedBackground(Drawable drawable) {
|
||||
Drawable drawable2;
|
||||
Drawable drawable3 = this.mStackedBackground;
|
||||
if (drawable3 != null) {
|
||||
drawable3.setCallback(null);
|
||||
unscheduleDrawable(this.mStackedBackground);
|
||||
}
|
||||
this.mStackedBackground = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
if (this.mIsStacked && (drawable2 = this.mStackedBackground) != null) {
|
||||
drawable2.setBounds(this.mTabContainer.getLeft(), this.mTabContainer.getTop(), this.mTabContainer.getRight(), this.mTabContainer.getBottom());
|
||||
}
|
||||
}
|
||||
boolean z = true;
|
||||
if (!this.mIsSplit ? this.mBackground != null || this.mStackedBackground != null : this.mSplitBackground != null) {
|
||||
z = false;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
invalidate();
|
||||
Api21Impl.invalidateOutline(this);
|
||||
}
|
||||
|
||||
public void setSplitBackground(Drawable drawable) {
|
||||
Drawable drawable2;
|
||||
Drawable drawable3 = this.mSplitBackground;
|
||||
if (drawable3 != null) {
|
||||
drawable3.setCallback(null);
|
||||
unscheduleDrawable(this.mSplitBackground);
|
||||
}
|
||||
this.mSplitBackground = drawable;
|
||||
boolean z = false;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
if (this.mIsSplit && (drawable2 = this.mSplitBackground) != null) {
|
||||
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||
}
|
||||
}
|
||||
if (!this.mIsSplit ? !(this.mBackground != null || this.mStackedBackground != null) : this.mSplitBackground == null) {
|
||||
z = true;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
invalidate();
|
||||
Api21Impl.invalidateOutline(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setVisibility(int i) {
|
||||
super.setVisibility(i);
|
||||
boolean z = i == 0;
|
||||
Drawable drawable = this.mBackground;
|
||||
if (drawable != null) {
|
||||
drawable.setVisible(z, false);
|
||||
}
|
||||
Drawable drawable2 = this.mStackedBackground;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setVisible(z, false);
|
||||
}
|
||||
Drawable drawable3 = this.mSplitBackground;
|
||||
if (drawable3 != null) {
|
||||
drawable3.setVisible(z, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected boolean verifyDrawable(Drawable drawable) {
|
||||
return (drawable == this.mBackground && !this.mIsSplit) || (drawable == this.mStackedBackground && this.mIsStacked) || ((drawable == this.mSplitBackground && this.mIsSplit) || super.verifyDrawable(drawable));
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
Drawable drawable = this.mBackground;
|
||||
if (drawable != null && drawable.isStateful()) {
|
||||
this.mBackground.setState(getDrawableState());
|
||||
}
|
||||
Drawable drawable2 = this.mStackedBackground;
|
||||
if (drawable2 != null && drawable2.isStateful()) {
|
||||
this.mStackedBackground.setState(getDrawableState());
|
||||
}
|
||||
Drawable drawable3 = this.mSplitBackground;
|
||||
if (drawable3 == null || !drawable3.isStateful()) {
|
||||
return;
|
||||
}
|
||||
this.mSplitBackground.setState(getDrawableState());
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void jumpDrawablesToCurrentState() {
|
||||
super.jumpDrawablesToCurrentState();
|
||||
Drawable drawable = this.mBackground;
|
||||
if (drawable != null) {
|
||||
drawable.jumpToCurrentState();
|
||||
}
|
||||
Drawable drawable2 = this.mStackedBackground;
|
||||
if (drawable2 != null) {
|
||||
drawable2.jumpToCurrentState();
|
||||
}
|
||||
Drawable drawable3 = this.mSplitBackground;
|
||||
if (drawable3 != null) {
|
||||
drawable3.jumpToCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
public void setTransitioning(boolean z) {
|
||||
this.mIsTransitioning = z;
|
||||
setDescendantFocusability(z ? 393216 : 262144);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
||||
return this.mIsTransitioning || super.onInterceptTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
super.onTouchEvent(motionEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
super.onHoverEvent(motionEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTabContainer(ScrollingTabContainerView scrollingTabContainerView) {
|
||||
View view = this.mTabContainer;
|
||||
if (view != null) {
|
||||
removeView(view);
|
||||
}
|
||||
this.mTabContainer = scrollingTabContainerView;
|
||||
if (scrollingTabContainerView != null) {
|
||||
addView(scrollingTabContainerView);
|
||||
ViewGroup.LayoutParams layoutParams = scrollingTabContainerView.getLayoutParams();
|
||||
layoutParams.width = -1;
|
||||
layoutParams.height = -2;
|
||||
scrollingTabContainerView.setAllowCollapse(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent
|
||||
public ActionMode startActionModeForChild(View view, ActionMode.Callback callback, int i) {
|
||||
if (i != 0) {
|
||||
return super.startActionModeForChild(view, callback, i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isCollapsed(View view) {
|
||||
return view == null || view.getVisibility() == 8 || view.getMeasuredHeight() == 0;
|
||||
}
|
||||
|
||||
private int getMeasuredHeightWithMargins(View view) {
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
|
||||
return view.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, android.view.View
|
||||
public void onMeasure(int i, int i2) {
|
||||
int measuredHeightWithMargins;
|
||||
int i3;
|
||||
if (this.mActionBarView == null && View.MeasureSpec.getMode(i2) == Integer.MIN_VALUE && (i3 = this.mHeight) >= 0) {
|
||||
i2 = View.MeasureSpec.makeMeasureSpec(Math.min(i3, View.MeasureSpec.getSize(i2)), Integer.MIN_VALUE);
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
if (this.mActionBarView == null) {
|
||||
return;
|
||||
}
|
||||
int mode = View.MeasureSpec.getMode(i2);
|
||||
View view = this.mTabContainer;
|
||||
if (view == null || view.getVisibility() == 8 || mode == 1073741824) {
|
||||
return;
|
||||
}
|
||||
if (!isCollapsed(this.mActionBarView)) {
|
||||
measuredHeightWithMargins = getMeasuredHeightWithMargins(this.mActionBarView);
|
||||
} else {
|
||||
measuredHeightWithMargins = !isCollapsed(this.mContextView) ? getMeasuredHeightWithMargins(this.mContextView) : 0;
|
||||
}
|
||||
setMeasuredDimension(getMeasuredWidth(), Math.min(measuredHeightWithMargins + getMeasuredHeightWithMargins(this.mTabContainer), mode == Integer.MIN_VALUE ? View.MeasureSpec.getSize(i2) : Integer.MAX_VALUE));
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
|
||||
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
Drawable drawable;
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
View view = this.mTabContainer;
|
||||
boolean z2 = true;
|
||||
boolean z3 = (view == null || view.getVisibility() == 8) ? false : true;
|
||||
if (view != null && view.getVisibility() != 8) {
|
||||
int measuredHeight = getMeasuredHeight();
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
|
||||
view.layout(i, (measuredHeight - view.getMeasuredHeight()) - layoutParams.bottomMargin, i3, measuredHeight - layoutParams.bottomMargin);
|
||||
}
|
||||
if (this.mIsSplit) {
|
||||
Drawable drawable2 = this.mSplitBackground;
|
||||
if (drawable2 == null) {
|
||||
return;
|
||||
} else {
|
||||
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||
}
|
||||
} else {
|
||||
if (this.mBackground == null) {
|
||||
z2 = false;
|
||||
} else if (this.mActionBarView.getVisibility() == 0) {
|
||||
this.mBackground.setBounds(this.mActionBarView.getLeft(), this.mActionBarView.getTop(), this.mActionBarView.getRight(), this.mActionBarView.getBottom());
|
||||
} else {
|
||||
View view2 = this.mContextView;
|
||||
if (view2 != null && view2.getVisibility() == 0) {
|
||||
this.mBackground.setBounds(this.mContextView.getLeft(), this.mContextView.getTop(), this.mContextView.getRight(), this.mContextView.getBottom());
|
||||
} else {
|
||||
this.mBackground.setBounds(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
this.mIsStacked = z3;
|
||||
if (z3 && (drawable = this.mStackedBackground) != null) {
|
||||
drawable.setBounds(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
|
||||
} else if (!z2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private static class Api21Impl {
|
||||
private Api21Impl() {
|
||||
}
|
||||
|
||||
public static void invalidateOutline(ActionBarContainer actionBarContainer) {
|
||||
actionBarContainer.invalidateOutline();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,388 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarContextView extends AbsActionBarView {
|
||||
private View mClose;
|
||||
private View mCloseButton;
|
||||
private int mCloseItemLayout;
|
||||
private View mCustomView;
|
||||
private CharSequence mSubtitle;
|
||||
private int mSubtitleStyleRes;
|
||||
private TextView mSubtitleView;
|
||||
private CharSequence mTitle;
|
||||
private LinearLayout mTitleLayout;
|
||||
private boolean mTitleOptional;
|
||||
private int mTitleStyleRes;
|
||||
private TextView mTitleView;
|
||||
|
||||
public CharSequence getSubtitle() {
|
||||
return this.mSubtitle;
|
||||
}
|
||||
|
||||
public CharSequence getTitle() {
|
||||
return this.mTitle;
|
||||
}
|
||||
|
||||
public boolean isTitleOptional() {
|
||||
return this.mTitleOptional;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean shouldDelayChildPressedState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ void animateToVisibility(int i) {
|
||||
super.animateToVisibility(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ boolean canShowOverflowMenu() {
|
||||
return super.canShowOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ void dismissPopupMenus() {
|
||||
super.dismissPopupMenus();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ int getAnimatedVisibility() {
|
||||
return super.getAnimatedVisibility();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ int getContentHeight() {
|
||||
return super.getContentHeight();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ boolean isOverflowMenuShowPending() {
|
||||
return super.isOverflowMenuShowPending();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ boolean isOverflowReserved() {
|
||||
return super.isOverflowReserved();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView, android.view.View
|
||||
public /* bridge */ /* synthetic */ boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
return super.onHoverEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView, android.view.View
|
||||
public /* bridge */ /* synthetic */ boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
return super.onTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ void postShowOverflowMenu() {
|
||||
super.postShowOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView, android.view.View
|
||||
public /* bridge */ /* synthetic */ void setVisibility(int i) {
|
||||
super.setVisibility(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ ViewPropertyAnimatorCompat setupAnimatorToVisibility(int i, long j) {
|
||||
return super.setupAnimatorToVisibility(i, j);
|
||||
}
|
||||
|
||||
public ActionBarContextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActionBarContextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.actionModeStyle);
|
||||
}
|
||||
|
||||
public ActionBarContextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.ActionMode, i, 0);
|
||||
ViewCompat.setBackground(this, obtainStyledAttributes.getDrawable(R.styleable.ActionMode_background));
|
||||
this.mTitleStyleRes = obtainStyledAttributes.getResourceId(R.styleable.ActionMode_titleTextStyle, 0);
|
||||
this.mSubtitleStyleRes = obtainStyledAttributes.getResourceId(R.styleable.ActionMode_subtitleTextStyle, 0);
|
||||
this.mContentHeight = obtainStyledAttributes.getLayoutDimension(R.styleable.ActionMode_height, 0);
|
||||
this.mCloseItemLayout = obtainStyledAttributes.getResourceId(R.styleable.ActionMode_closeItemLayout, R.layout.abc_action_mode_close_item_material);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (this.mActionMenuPresenter != null) {
|
||||
this.mActionMenuPresenter.hideOverflowMenu();
|
||||
this.mActionMenuPresenter.hideSubMenus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public void setContentHeight(int i) {
|
||||
this.mContentHeight = i;
|
||||
}
|
||||
|
||||
public void setCustomView(View view) {
|
||||
LinearLayout linearLayout;
|
||||
View view2 = this.mCustomView;
|
||||
if (view2 != null) {
|
||||
removeView(view2);
|
||||
}
|
||||
this.mCustomView = view;
|
||||
if (view != null && (linearLayout = this.mTitleLayout) != null) {
|
||||
removeView(linearLayout);
|
||||
this.mTitleLayout = null;
|
||||
}
|
||||
if (view != null) {
|
||||
addView(view);
|
||||
}
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
this.mTitle = charSequence;
|
||||
initTitle();
|
||||
ViewCompat.setAccessibilityPaneTitle(this, charSequence);
|
||||
}
|
||||
|
||||
public void setSubtitle(CharSequence charSequence) {
|
||||
this.mSubtitle = charSequence;
|
||||
initTitle();
|
||||
}
|
||||
|
||||
private void initTitle() {
|
||||
if (this.mTitleLayout == null) {
|
||||
LayoutInflater.from(getContext()).inflate(R.layout.abc_action_bar_title_item, this);
|
||||
LinearLayout linearLayout = (LinearLayout) getChildAt(getChildCount() - 1);
|
||||
this.mTitleLayout = linearLayout;
|
||||
this.mTitleView = (TextView) linearLayout.findViewById(R.id.action_bar_title);
|
||||
this.mSubtitleView = (TextView) this.mTitleLayout.findViewById(R.id.action_bar_subtitle);
|
||||
if (this.mTitleStyleRes != 0) {
|
||||
this.mTitleView.setTextAppearance(getContext(), this.mTitleStyleRes);
|
||||
}
|
||||
if (this.mSubtitleStyleRes != 0) {
|
||||
this.mSubtitleView.setTextAppearance(getContext(), this.mSubtitleStyleRes);
|
||||
}
|
||||
}
|
||||
this.mTitleView.setText(this.mTitle);
|
||||
this.mSubtitleView.setText(this.mSubtitle);
|
||||
boolean z = !TextUtils.isEmpty(this.mTitle);
|
||||
boolean z2 = !TextUtils.isEmpty(this.mSubtitle);
|
||||
int i = 0;
|
||||
this.mSubtitleView.setVisibility(z2 ? 0 : 8);
|
||||
LinearLayout linearLayout2 = this.mTitleLayout;
|
||||
if (!z && !z2) {
|
||||
i = 8;
|
||||
}
|
||||
linearLayout2.setVisibility(i);
|
||||
if (this.mTitleLayout.getParent() == null) {
|
||||
addView(this.mTitleLayout);
|
||||
}
|
||||
}
|
||||
|
||||
public void initForMode(final ActionMode actionMode) {
|
||||
View view = this.mClose;
|
||||
if (view == null) {
|
||||
View inflate = LayoutInflater.from(getContext()).inflate(this.mCloseItemLayout, (ViewGroup) this, false);
|
||||
this.mClose = inflate;
|
||||
addView(inflate);
|
||||
} else if (view.getParent() == null) {
|
||||
addView(this.mClose);
|
||||
}
|
||||
View findViewById = this.mClose.findViewById(R.id.action_mode_close_button);
|
||||
this.mCloseButton = findViewById;
|
||||
findViewById.setOnClickListener(new View.OnClickListener() { // from class: androidx.appcompat.widget.ActionBarContextView.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view2) {
|
||||
actionMode.finish();
|
||||
}
|
||||
});
|
||||
MenuBuilder menuBuilder = (MenuBuilder) actionMode.getMenu();
|
||||
if (this.mActionMenuPresenter != null) {
|
||||
this.mActionMenuPresenter.dismissPopupMenus();
|
||||
}
|
||||
this.mActionMenuPresenter = new ActionMenuPresenter(getContext());
|
||||
this.mActionMenuPresenter.setReserveOverflow(true);
|
||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-2, -1);
|
||||
menuBuilder.addMenuPresenter(this.mActionMenuPresenter, this.mPopupContext);
|
||||
this.mMenuView = (ActionMenuView) this.mActionMenuPresenter.getMenuView(this);
|
||||
ViewCompat.setBackground(this.mMenuView, null);
|
||||
addView(this.mMenuView, layoutParams);
|
||||
}
|
||||
|
||||
public void closeMode() {
|
||||
if (this.mClose == null) {
|
||||
killMode();
|
||||
}
|
||||
}
|
||||
|
||||
public void killMode() {
|
||||
removeAllViews();
|
||||
this.mCustomView = null;
|
||||
this.mMenuView = null;
|
||||
this.mActionMenuPresenter = null;
|
||||
View view = this.mCloseButton;
|
||||
if (view != null) {
|
||||
view.setOnClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public boolean showOverflowMenu() {
|
||||
if (this.mActionMenuPresenter != null) {
|
||||
return this.mActionMenuPresenter.showOverflowMenu();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public boolean hideOverflowMenu() {
|
||||
if (this.mActionMenuPresenter != null) {
|
||||
return this.mActionMenuPresenter.hideOverflowMenu();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public boolean isOverflowMenuShowing() {
|
||||
if (this.mActionMenuPresenter != null) {
|
||||
return this.mActionMenuPresenter.isOverflowMenuShowing();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
|
||||
return new ViewGroup.MarginLayoutParams(-1, -2);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
||||
return new ViewGroup.MarginLayoutParams(getContext(), attributeSet);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int mode = View.MeasureSpec.getMode(i);
|
||||
int i3 = BasicMeasure.EXACTLY;
|
||||
if (mode != 1073741824) {
|
||||
throw new IllegalStateException(getClass().getSimpleName() + " can only be used with android:layout_width=\"match_parent\" (or fill_parent)");
|
||||
}
|
||||
if (View.MeasureSpec.getMode(i2) == 0) {
|
||||
throw new IllegalStateException(getClass().getSimpleName() + " can only be used with android:layout_height=\"wrap_content\"");
|
||||
}
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
int size2 = this.mContentHeight > 0 ? this.mContentHeight : View.MeasureSpec.getSize(i2);
|
||||
int paddingTop = getPaddingTop() + getPaddingBottom();
|
||||
int paddingLeft = (size - getPaddingLeft()) - getPaddingRight();
|
||||
int i4 = size2 - paddingTop;
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i4, Integer.MIN_VALUE);
|
||||
View view = this.mClose;
|
||||
if (view != null) {
|
||||
int measureChildView = measureChildView(view, paddingLeft, makeMeasureSpec, 0);
|
||||
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.mClose.getLayoutParams();
|
||||
paddingLeft = measureChildView - (marginLayoutParams.leftMargin + marginLayoutParams.rightMargin);
|
||||
}
|
||||
if (this.mMenuView != null && this.mMenuView.getParent() == this) {
|
||||
paddingLeft = measureChildView(this.mMenuView, paddingLeft, makeMeasureSpec, 0);
|
||||
}
|
||||
LinearLayout linearLayout = this.mTitleLayout;
|
||||
if (linearLayout != null && this.mCustomView == null) {
|
||||
if (this.mTitleOptional) {
|
||||
this.mTitleLayout.measure(View.MeasureSpec.makeMeasureSpec(0, 0), makeMeasureSpec);
|
||||
int measuredWidth = this.mTitleLayout.getMeasuredWidth();
|
||||
boolean z = measuredWidth <= paddingLeft;
|
||||
if (z) {
|
||||
paddingLeft -= measuredWidth;
|
||||
}
|
||||
this.mTitleLayout.setVisibility(z ? 0 : 8);
|
||||
} else {
|
||||
paddingLeft = measureChildView(linearLayout, paddingLeft, makeMeasureSpec, 0);
|
||||
}
|
||||
}
|
||||
View view2 = this.mCustomView;
|
||||
if (view2 != null) {
|
||||
ViewGroup.LayoutParams layoutParams = view2.getLayoutParams();
|
||||
int i5 = layoutParams.width != -2 ? BasicMeasure.EXACTLY : Integer.MIN_VALUE;
|
||||
if (layoutParams.width >= 0) {
|
||||
paddingLeft = Math.min(layoutParams.width, paddingLeft);
|
||||
}
|
||||
if (layoutParams.height == -2) {
|
||||
i3 = Integer.MIN_VALUE;
|
||||
}
|
||||
if (layoutParams.height >= 0) {
|
||||
i4 = Math.min(layoutParams.height, i4);
|
||||
}
|
||||
this.mCustomView.measure(View.MeasureSpec.makeMeasureSpec(paddingLeft, i5), View.MeasureSpec.makeMeasureSpec(i4, i3));
|
||||
}
|
||||
if (this.mContentHeight <= 0) {
|
||||
int childCount = getChildCount();
|
||||
int i6 = 0;
|
||||
for (int i7 = 0; i7 < childCount; i7++) {
|
||||
int measuredHeight = getChildAt(i7).getMeasuredHeight() + paddingTop;
|
||||
if (measuredHeight > i6) {
|
||||
i6 = measuredHeight;
|
||||
}
|
||||
}
|
||||
setMeasuredDimension(size, i6);
|
||||
return;
|
||||
}
|
||||
setMeasuredDimension(size, size2);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
boolean isLayoutRtl = ViewUtils.isLayoutRtl(this);
|
||||
int paddingRight = isLayoutRtl ? (i3 - i) - getPaddingRight() : getPaddingLeft();
|
||||
int paddingTop = getPaddingTop();
|
||||
int paddingTop2 = ((i4 - i2) - getPaddingTop()) - getPaddingBottom();
|
||||
View view = this.mClose;
|
||||
if (view != null && view.getVisibility() != 8) {
|
||||
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.mClose.getLayoutParams();
|
||||
int i5 = isLayoutRtl ? marginLayoutParams.rightMargin : marginLayoutParams.leftMargin;
|
||||
int i6 = isLayoutRtl ? marginLayoutParams.leftMargin : marginLayoutParams.rightMargin;
|
||||
int next = next(paddingRight, i5, isLayoutRtl);
|
||||
paddingRight = next(next + positionChild(this.mClose, next, paddingTop, paddingTop2, isLayoutRtl), i6, isLayoutRtl);
|
||||
}
|
||||
int i7 = paddingRight;
|
||||
LinearLayout linearLayout = this.mTitleLayout;
|
||||
if (linearLayout != null && this.mCustomView == null && linearLayout.getVisibility() != 8) {
|
||||
i7 += positionChild(this.mTitleLayout, i7, paddingTop, paddingTop2, isLayoutRtl);
|
||||
}
|
||||
int i8 = i7;
|
||||
View view2 = this.mCustomView;
|
||||
if (view2 != null) {
|
||||
positionChild(view2, i8, paddingTop, paddingTop2, isLayoutRtl);
|
||||
}
|
||||
int paddingLeft = isLayoutRtl ? getPaddingLeft() : (i3 - i) - getPaddingRight();
|
||||
if (this.mMenuView != null) {
|
||||
positionChild(this.mMenuView, paddingLeft, paddingTop, paddingTop2, !isLayoutRtl);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTitleOptional(boolean z) {
|
||||
if (z != this.mTitleOptional) {
|
||||
requestLayout();
|
||||
}
|
||||
this.mTitleOptional = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,744 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewPropertyAnimator;
|
||||
import android.view.Window;
|
||||
import android.widget.OverScroller;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.NestedScrollingParent;
|
||||
import androidx.core.view.NestedScrollingParent2;
|
||||
import androidx.core.view.NestedScrollingParent3;
|
||||
import androidx.core.view.NestedScrollingParentHelper;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarOverlayLayout extends ViewGroup implements DecorContentParent, NestedScrollingParent, NestedScrollingParent2, NestedScrollingParent3 {
|
||||
private static final int ACTION_BAR_ANIMATE_DELAY = 600;
|
||||
static final int[] ATTRS = {R.attr.actionBarSize, android.R.attr.windowContentOverlay};
|
||||
private static final String TAG = "ActionBarOverlayLayout";
|
||||
private int mActionBarHeight;
|
||||
ActionBarContainer mActionBarTop;
|
||||
private ActionBarVisibilityCallback mActionBarVisibilityCallback;
|
||||
private final Runnable mAddActionBarHideOffset;
|
||||
boolean mAnimatingForFling;
|
||||
private final Rect mBaseContentInsets;
|
||||
private WindowInsetsCompat mBaseInnerInsets;
|
||||
private final Rect mBaseInnerInsetsRect;
|
||||
private ContentFrameLayout mContent;
|
||||
private final Rect mContentInsets;
|
||||
ViewPropertyAnimator mCurrentActionBarTopAnimator;
|
||||
private DecorToolbar mDecorToolbar;
|
||||
private OverScroller mFlingEstimator;
|
||||
private boolean mHasNonEmbeddedTabs;
|
||||
private boolean mHideOnContentScroll;
|
||||
private int mHideOnContentScrollReference;
|
||||
private boolean mIgnoreWindowContentOverlay;
|
||||
private WindowInsetsCompat mInnerInsets;
|
||||
private final Rect mInnerInsetsRect;
|
||||
private final Rect mLastBaseContentInsets;
|
||||
private WindowInsetsCompat mLastBaseInnerInsets;
|
||||
private final Rect mLastBaseInnerInsetsRect;
|
||||
private WindowInsetsCompat mLastInnerInsets;
|
||||
private final Rect mLastInnerInsetsRect;
|
||||
private int mLastSystemUiVisibility;
|
||||
private boolean mOverlayMode;
|
||||
private final NestedScrollingParentHelper mParentHelper;
|
||||
private final Runnable mRemoveActionBarHideOffset;
|
||||
final AnimatorListenerAdapter mTopAnimatorListener;
|
||||
private Drawable mWindowContentOverlay;
|
||||
private int mWindowVisibility;
|
||||
|
||||
public interface ActionBarVisibilityCallback {
|
||||
void enableContentAnimations(boolean z);
|
||||
|
||||
void hideForSystem();
|
||||
|
||||
void onContentScrollStarted();
|
||||
|
||||
void onContentScrollStopped();
|
||||
|
||||
void onWindowVisibilityChanged(int i);
|
||||
|
||||
void showForSystem();
|
||||
}
|
||||
|
||||
public boolean isHideOnContentScrollEnabled() {
|
||||
return this.mHideOnContentScroll;
|
||||
}
|
||||
|
||||
public boolean isInOverlayMode() {
|
||||
return this.mOverlayMode;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public boolean onNestedPreFling(View view, float f, float f2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
|
||||
}
|
||||
|
||||
public void setHasNonEmbeddedTabs(boolean z) {
|
||||
this.mHasNonEmbeddedTabs = z;
|
||||
}
|
||||
|
||||
public void setShowingForActionMode(boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setUiOptions(int i) {
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean shouldDelayChildPressedState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ActionBarOverlayLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActionBarOverlayLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.mWindowVisibility = 0;
|
||||
this.mBaseContentInsets = new Rect();
|
||||
this.mLastBaseContentInsets = new Rect();
|
||||
this.mContentInsets = new Rect();
|
||||
this.mBaseInnerInsetsRect = new Rect();
|
||||
this.mLastBaseInnerInsetsRect = new Rect();
|
||||
this.mInnerInsetsRect = new Rect();
|
||||
this.mLastInnerInsetsRect = new Rect();
|
||||
this.mBaseInnerInsets = WindowInsetsCompat.CONSUMED;
|
||||
this.mLastBaseInnerInsets = WindowInsetsCompat.CONSUMED;
|
||||
this.mInnerInsets = WindowInsetsCompat.CONSUMED;
|
||||
this.mLastInnerInsets = WindowInsetsCompat.CONSUMED;
|
||||
this.mTopAnimatorListener = new AnimatorListenerAdapter() { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.1
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
ActionBarOverlayLayout.this.mCurrentActionBarTopAnimator = null;
|
||||
ActionBarOverlayLayout.this.mAnimatingForFling = false;
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
ActionBarOverlayLayout.this.mCurrentActionBarTopAnimator = null;
|
||||
ActionBarOverlayLayout.this.mAnimatingForFling = false;
|
||||
}
|
||||
};
|
||||
this.mRemoveActionBarHideOffset = new Runnable() { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ActionBarOverlayLayout.this.haltActionBarHideOffsetAnimations();
|
||||
ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this;
|
||||
actionBarOverlayLayout.mCurrentActionBarTopAnimator = actionBarOverlayLayout.mActionBarTop.animate().translationY(0.0f).setListener(ActionBarOverlayLayout.this.mTopAnimatorListener);
|
||||
}
|
||||
};
|
||||
this.mAddActionBarHideOffset = new Runnable() { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ActionBarOverlayLayout.this.haltActionBarHideOffsetAnimations();
|
||||
ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this;
|
||||
actionBarOverlayLayout.mCurrentActionBarTopAnimator = actionBarOverlayLayout.mActionBarTop.animate().translationY(-ActionBarOverlayLayout.this.mActionBarTop.getHeight()).setListener(ActionBarOverlayLayout.this.mTopAnimatorListener);
|
||||
}
|
||||
};
|
||||
init(context);
|
||||
this.mParentHelper = new NestedScrollingParentHelper(this);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
TypedArray obtainStyledAttributes = getContext().getTheme().obtainStyledAttributes(ATTRS);
|
||||
this.mActionBarHeight = obtainStyledAttributes.getDimensionPixelSize(0, 0);
|
||||
Drawable drawable = obtainStyledAttributes.getDrawable(1);
|
||||
this.mWindowContentOverlay = drawable;
|
||||
setWillNotDraw(drawable == null);
|
||||
obtainStyledAttributes.recycle();
|
||||
this.mIgnoreWindowContentOverlay = context.getApplicationInfo().targetSdkVersion < 19;
|
||||
this.mFlingEstimator = new OverScroller(context);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
haltActionBarHideOffsetAnimations();
|
||||
}
|
||||
|
||||
public void setActionBarVisibilityCallback(ActionBarVisibilityCallback actionBarVisibilityCallback) {
|
||||
this.mActionBarVisibilityCallback = actionBarVisibilityCallback;
|
||||
if (getWindowToken() != null) {
|
||||
this.mActionBarVisibilityCallback.onWindowVisibilityChanged(this.mWindowVisibility);
|
||||
int i = this.mLastSystemUiVisibility;
|
||||
if (i != 0) {
|
||||
onWindowSystemUiVisibilityChanged(i);
|
||||
ViewCompat.requestApplyInsets(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOverlayMode(boolean z) {
|
||||
this.mOverlayMode = z;
|
||||
this.mIgnoreWindowContentOverlay = z && getContext().getApplicationInfo().targetSdkVersion < 19;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
init(getContext());
|
||||
ViewCompat.requestApplyInsets(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
@Deprecated
|
||||
public void onWindowSystemUiVisibilityChanged(int i) {
|
||||
super.onWindowSystemUiVisibilityChanged(i);
|
||||
pullChildren();
|
||||
int i2 = this.mLastSystemUiVisibility ^ i;
|
||||
this.mLastSystemUiVisibility = i;
|
||||
boolean z = (i & 4) == 0;
|
||||
boolean z2 = (i & 256) != 0;
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.mActionBarVisibilityCallback;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.enableContentAnimations(!z2);
|
||||
if (z || !z2) {
|
||||
this.mActionBarVisibilityCallback.showForSystem();
|
||||
} else {
|
||||
this.mActionBarVisibilityCallback.hideForSystem();
|
||||
}
|
||||
}
|
||||
if ((i2 & 256) == 0 || this.mActionBarVisibilityCallback == null) {
|
||||
return;
|
||||
}
|
||||
ViewCompat.requestApplyInsets(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onWindowVisibilityChanged(int i) {
|
||||
super.onWindowVisibilityChanged(i);
|
||||
this.mWindowVisibility = i;
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.mActionBarVisibilityCallback;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.onWindowVisibilityChanged(i);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean applyInsets(View view, Rect rect, boolean z, boolean z2, boolean z3, boolean z4) {
|
||||
boolean z5;
|
||||
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
||||
if (!z || layoutParams.leftMargin == rect.left) {
|
||||
z5 = false;
|
||||
} else {
|
||||
layoutParams.leftMargin = rect.left;
|
||||
z5 = true;
|
||||
}
|
||||
if (z2 && layoutParams.topMargin != rect.top) {
|
||||
layoutParams.topMargin = rect.top;
|
||||
z5 = true;
|
||||
}
|
||||
if (z4 && layoutParams.rightMargin != rect.right) {
|
||||
layoutParams.rightMargin = rect.right;
|
||||
z5 = true;
|
||||
}
|
||||
if (!z3 || layoutParams.bottomMargin == rect.bottom) {
|
||||
return z5;
|
||||
}
|
||||
layoutParams.bottomMargin = rect.bottom;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected boolean fitSystemWindows(Rect rect) {
|
||||
return super.fitSystemWindows(rect);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:11:0x0061, code lost:
|
||||
|
||||
if (r0 != false) goto L9;
|
||||
*/
|
||||
@Override // android.view.View
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public android.view.WindowInsets onApplyWindowInsets(android.view.WindowInsets r8) {
|
||||
/*
|
||||
r7 = this;
|
||||
r7.pullChildren()
|
||||
androidx.core.view.WindowInsetsCompat r8 = androidx.core.view.WindowInsetsCompat.toWindowInsetsCompat(r8, r7)
|
||||
android.graphics.Rect r2 = new android.graphics.Rect
|
||||
int r0 = r8.getSystemWindowInsetLeft()
|
||||
int r1 = r8.getSystemWindowInsetTop()
|
||||
int r3 = r8.getSystemWindowInsetRight()
|
||||
int r4 = r8.getSystemWindowInsetBottom()
|
||||
r2.<init>(r0, r1, r3, r4)
|
||||
androidx.appcompat.widget.ActionBarContainer r1 = r7.mActionBarTop
|
||||
r3 = 1
|
||||
r4 = 1
|
||||
r5 = 0
|
||||
r6 = 1
|
||||
r0 = r7
|
||||
boolean r0 = r0.applyInsets(r1, r2, r3, r4, r5, r6)
|
||||
android.graphics.Rect r1 = r7.mBaseContentInsets
|
||||
androidx.core.view.ViewCompat.computeSystemWindowInsets(r7, r8, r1)
|
||||
android.graphics.Rect r1 = r7.mBaseContentInsets
|
||||
int r1 = r1.left
|
||||
android.graphics.Rect r2 = r7.mBaseContentInsets
|
||||
int r2 = r2.top
|
||||
android.graphics.Rect r3 = r7.mBaseContentInsets
|
||||
int r3 = r3.right
|
||||
android.graphics.Rect r4 = r7.mBaseContentInsets
|
||||
int r4 = r4.bottom
|
||||
androidx.core.view.WindowInsetsCompat r1 = r8.inset(r1, r2, r3, r4)
|
||||
r7.mBaseInnerInsets = r1
|
||||
androidx.core.view.WindowInsetsCompat r2 = r7.mLastBaseInnerInsets
|
||||
boolean r1 = r2.equals(r1)
|
||||
if (r1 != 0) goto L4f
|
||||
androidx.core.view.WindowInsetsCompat r0 = r7.mBaseInnerInsets
|
||||
r7.mLastBaseInnerInsets = r0
|
||||
r0 = 1
|
||||
L4f:
|
||||
android.graphics.Rect r1 = r7.mLastBaseContentInsets
|
||||
android.graphics.Rect r2 = r7.mBaseContentInsets
|
||||
boolean r1 = r1.equals(r2)
|
||||
if (r1 != 0) goto L61
|
||||
android.graphics.Rect r0 = r7.mLastBaseContentInsets
|
||||
android.graphics.Rect r1 = r7.mBaseContentInsets
|
||||
r0.set(r1)
|
||||
goto L63
|
||||
L61:
|
||||
if (r0 == 0) goto L66
|
||||
L63:
|
||||
r7.requestLayout()
|
||||
L66:
|
||||
androidx.core.view.WindowInsetsCompat r8 = r8.consumeDisplayCutout()
|
||||
androidx.core.view.WindowInsetsCompat r8 = r8.consumeSystemWindowInsets()
|
||||
androidx.core.view.WindowInsetsCompat r8 = r8.consumeStableInsets()
|
||||
android.view.WindowInsets r8 = r8.toWindowInsets()
|
||||
return r8
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActionBarOverlayLayout.onApplyWindowInsets(android.view.WindowInsets):android.view.WindowInsets");
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.view.ViewGroup
|
||||
public LayoutParams generateDefaultLayoutParams() {
|
||||
return new LayoutParams(-1, -1);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
||||
return new LayoutParams(getContext(), attributeSet);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return new LayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return layoutParams instanceof LayoutParams;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int measuredHeight;
|
||||
pullChildren();
|
||||
measureChildWithMargins(this.mActionBarTop, i, 0, i2, 0);
|
||||
LayoutParams layoutParams = (LayoutParams) this.mActionBarTop.getLayoutParams();
|
||||
int max = Math.max(0, this.mActionBarTop.getMeasuredWidth() + layoutParams.leftMargin + layoutParams.rightMargin);
|
||||
int max2 = Math.max(0, this.mActionBarTop.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin);
|
||||
int combineMeasuredStates = View.combineMeasuredStates(0, this.mActionBarTop.getMeasuredState());
|
||||
boolean z = (ViewCompat.getWindowSystemUiVisibility(this) & 256) != 0;
|
||||
if (z) {
|
||||
measuredHeight = this.mActionBarHeight;
|
||||
if (this.mHasNonEmbeddedTabs && this.mActionBarTop.getTabContainer() != null) {
|
||||
measuredHeight += this.mActionBarHeight;
|
||||
}
|
||||
} else {
|
||||
measuredHeight = this.mActionBarTop.getVisibility() != 8 ? this.mActionBarTop.getMeasuredHeight() : 0;
|
||||
}
|
||||
this.mContentInsets.set(this.mBaseContentInsets);
|
||||
this.mInnerInsets = this.mBaseInnerInsets;
|
||||
if (!this.mOverlayMode && !z) {
|
||||
this.mContentInsets.top += measuredHeight;
|
||||
Rect rect = this.mContentInsets;
|
||||
rect.bottom = rect.bottom;
|
||||
this.mInnerInsets = this.mInnerInsets.inset(0, measuredHeight, 0, 0);
|
||||
} else {
|
||||
this.mInnerInsets = new WindowInsetsCompat.Builder(this.mInnerInsets).setSystemWindowInsets(Insets.of(this.mInnerInsets.getSystemWindowInsetLeft(), this.mInnerInsets.getSystemWindowInsetTop() + measuredHeight, this.mInnerInsets.getSystemWindowInsetRight(), this.mInnerInsets.getSystemWindowInsetBottom())).build();
|
||||
}
|
||||
applyInsets(this.mContent, this.mContentInsets, true, true, true, true);
|
||||
if (!this.mLastInnerInsets.equals(this.mInnerInsets)) {
|
||||
WindowInsetsCompat windowInsetsCompat = this.mInnerInsets;
|
||||
this.mLastInnerInsets = windowInsetsCompat;
|
||||
ViewCompat.dispatchApplyWindowInsets(this.mContent, windowInsetsCompat);
|
||||
}
|
||||
measureChildWithMargins(this.mContent, i, 0, i2, 0);
|
||||
LayoutParams layoutParams2 = (LayoutParams) this.mContent.getLayoutParams();
|
||||
int max3 = Math.max(max, this.mContent.getMeasuredWidth() + layoutParams2.leftMargin + layoutParams2.rightMargin);
|
||||
int max4 = Math.max(max2, this.mContent.getMeasuredHeight() + layoutParams2.topMargin + layoutParams2.bottomMargin);
|
||||
int combineMeasuredStates2 = View.combineMeasuredStates(combineMeasuredStates, this.mContent.getMeasuredState());
|
||||
setMeasuredDimension(View.resolveSizeAndState(Math.max(max3 + getPaddingLeft() + getPaddingRight(), getSuggestedMinimumWidth()), i, combineMeasuredStates2), View.resolveSizeAndState(Math.max(max4 + getPaddingTop() + getPaddingBottom(), getSuggestedMinimumHeight()), i2, combineMeasuredStates2 << 16));
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
int childCount = getChildCount();
|
||||
int paddingLeft = getPaddingLeft();
|
||||
int paddingTop = getPaddingTop();
|
||||
for (int i5 = 0; i5 < childCount; i5++) {
|
||||
View childAt = getChildAt(i5);
|
||||
if (childAt.getVisibility() != 8) {
|
||||
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
||||
int measuredWidth = childAt.getMeasuredWidth();
|
||||
int measuredHeight = childAt.getMeasuredHeight();
|
||||
int i6 = layoutParams.leftMargin + paddingLeft;
|
||||
int i7 = layoutParams.topMargin + paddingTop;
|
||||
childAt.layout(i6, i7, measuredWidth + i6, measuredHeight + i7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void draw(Canvas canvas) {
|
||||
super.draw(canvas);
|
||||
if (this.mWindowContentOverlay == null || this.mIgnoreWindowContentOverlay) {
|
||||
return;
|
||||
}
|
||||
int bottom = this.mActionBarTop.getVisibility() == 0 ? (int) (this.mActionBarTop.getBottom() + this.mActionBarTop.getTranslationY() + 0.5f) : 0;
|
||||
this.mWindowContentOverlay.setBounds(0, bottom, getWidth(), this.mWindowContentOverlay.getIntrinsicHeight() + bottom);
|
||||
this.mWindowContentOverlay.draw(canvas);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent3
|
||||
public void onNestedScroll(View view, int i, int i2, int i3, int i4, int i5, int[] iArr) {
|
||||
onNestedScroll(view, i, i2, i3, i4, i5);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent2
|
||||
public boolean onStartNestedScroll(View view, View view2, int i, int i2) {
|
||||
return i2 == 0 && onStartNestedScroll(view, view2, i);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent2
|
||||
public void onNestedScrollAccepted(View view, View view2, int i, int i2) {
|
||||
if (i2 == 0) {
|
||||
onNestedScrollAccepted(view, view2, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent2
|
||||
public void onStopNestedScroll(View view, int i) {
|
||||
if (i == 0) {
|
||||
onStopNestedScroll(view);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent2
|
||||
public void onNestedScroll(View view, int i, int i2, int i3, int i4, int i5) {
|
||||
if (i5 == 0) {
|
||||
onNestedScroll(view, i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent2
|
||||
public void onNestedPreScroll(View view, int i, int i2, int[] iArr, int i3) {
|
||||
if (i3 == 0) {
|
||||
onNestedPreScroll(view, i, i2, iArr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public boolean onStartNestedScroll(View view, View view2, int i) {
|
||||
if ((i & 2) == 0 || this.mActionBarTop.getVisibility() != 0) {
|
||||
return false;
|
||||
}
|
||||
return this.mHideOnContentScroll;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onNestedScrollAccepted(View view, View view2, int i) {
|
||||
this.mParentHelper.onNestedScrollAccepted(view, view2, i);
|
||||
this.mHideOnContentScrollReference = getActionBarHideOffset();
|
||||
haltActionBarHideOffsetAnimations();
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.mActionBarVisibilityCallback;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.onContentScrollStarted();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onNestedScroll(View view, int i, int i2, int i3, int i4) {
|
||||
int i5 = this.mHideOnContentScrollReference + i2;
|
||||
this.mHideOnContentScrollReference = i5;
|
||||
setActionBarHideOffset(i5);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onStopNestedScroll(View view) {
|
||||
if (this.mHideOnContentScroll && !this.mAnimatingForFling) {
|
||||
if (this.mHideOnContentScrollReference <= this.mActionBarTop.getHeight()) {
|
||||
postRemoveActionBarHideOffset();
|
||||
} else {
|
||||
postAddActionBarHideOffset();
|
||||
}
|
||||
}
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.mActionBarVisibilityCallback;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.onContentScrollStopped();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public boolean onNestedFling(View view, float f, float f2, boolean z) {
|
||||
if (!this.mHideOnContentScroll || !z) {
|
||||
return false;
|
||||
}
|
||||
if (shouldHideActionBarOnFling(f2)) {
|
||||
addActionBarHideOffset();
|
||||
} else {
|
||||
removeActionBarHideOffset();
|
||||
}
|
||||
this.mAnimatingForFling = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, androidx.core.view.NestedScrollingParent
|
||||
public int getNestedScrollAxes() {
|
||||
return this.mParentHelper.getNestedScrollAxes();
|
||||
}
|
||||
|
||||
void pullChildren() {
|
||||
if (this.mContent == null) {
|
||||
this.mContent = (ContentFrameLayout) findViewById(R.id.action_bar_activity_content);
|
||||
this.mActionBarTop = (ActionBarContainer) findViewById(R.id.action_bar_container);
|
||||
this.mDecorToolbar = getDecorToolbar(findViewById(R.id.action_bar));
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private DecorToolbar getDecorToolbar(View view) {
|
||||
if (view instanceof DecorToolbar) {
|
||||
return (DecorToolbar) view;
|
||||
}
|
||||
if (view instanceof Toolbar) {
|
||||
return ((Toolbar) view).getWrapper();
|
||||
}
|
||||
throw new IllegalStateException("Can't make a decor toolbar out of " + view.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
public void setHideOnContentScrollEnabled(boolean z) {
|
||||
if (z != this.mHideOnContentScroll) {
|
||||
this.mHideOnContentScroll = z;
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
haltActionBarHideOffsetAnimations();
|
||||
setActionBarHideOffset(0);
|
||||
}
|
||||
}
|
||||
|
||||
public int getActionBarHideOffset() {
|
||||
ActionBarContainer actionBarContainer = this.mActionBarTop;
|
||||
if (actionBarContainer != null) {
|
||||
return -((int) actionBarContainer.getTranslationY());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setActionBarHideOffset(int i) {
|
||||
haltActionBarHideOffsetAnimations();
|
||||
this.mActionBarTop.setTranslationY(-Math.max(0, Math.min(i, this.mActionBarTop.getHeight())));
|
||||
}
|
||||
|
||||
void haltActionBarHideOffsetAnimations() {
|
||||
removeCallbacks(this.mRemoveActionBarHideOffset);
|
||||
removeCallbacks(this.mAddActionBarHideOffset);
|
||||
ViewPropertyAnimator viewPropertyAnimator = this.mCurrentActionBarTopAnimator;
|
||||
if (viewPropertyAnimator != null) {
|
||||
viewPropertyAnimator.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void postRemoveActionBarHideOffset() {
|
||||
haltActionBarHideOffsetAnimations();
|
||||
postDelayed(this.mRemoveActionBarHideOffset, 600L);
|
||||
}
|
||||
|
||||
private void postAddActionBarHideOffset() {
|
||||
haltActionBarHideOffsetAnimations();
|
||||
postDelayed(this.mAddActionBarHideOffset, 600L);
|
||||
}
|
||||
|
||||
private void removeActionBarHideOffset() {
|
||||
haltActionBarHideOffsetAnimations();
|
||||
this.mRemoveActionBarHideOffset.run();
|
||||
}
|
||||
|
||||
private void addActionBarHideOffset() {
|
||||
haltActionBarHideOffsetAnimations();
|
||||
this.mAddActionBarHideOffset.run();
|
||||
}
|
||||
|
||||
private boolean shouldHideActionBarOnFling(float f) {
|
||||
this.mFlingEstimator.fling(0, 0, 0, (int) f, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
return this.mFlingEstimator.getFinalY() > this.mActionBarTop.getHeight();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setWindowCallback(Window.Callback callback) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setWindowCallback(callback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setWindowTitle(CharSequence charSequence) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setWindowTitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public CharSequence getTitle() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.getTitle();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void initFeature(int i) {
|
||||
pullChildren();
|
||||
if (i == 2) {
|
||||
this.mDecorToolbar.initProgress();
|
||||
} else if (i == 5) {
|
||||
this.mDecorToolbar.initIndeterminateProgress();
|
||||
} else {
|
||||
if (i != 109) {
|
||||
return;
|
||||
}
|
||||
setOverlayMode(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean hasIcon() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.hasIcon();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean hasLogo() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.hasLogo();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setIcon(int i) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setIcon(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setIcon(Drawable drawable) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setIcon(drawable);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setLogo(int i) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setLogo(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean canShowOverflowMenu() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.canShowOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean isOverflowMenuShowing() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.isOverflowMenuShowing();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean isOverflowMenuShowPending() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.isOverflowMenuShowPending();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean showOverflowMenu() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.showOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean hideOverflowMenu() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.hideOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setMenuPrepared() {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setMenuPrepared();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setMenu(Menu menu, MenuPresenter.Callback callback) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setMenu(menu, callback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void saveToolbarHierarchyState(SparseArray<Parcelable> sparseArray) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.saveHierarchyState(sparseArray);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void restoreToolbarHierarchyState(SparseArray<Parcelable> sparseArray) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.restoreHierarchyState(sparseArray);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void dismissPopups() {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.dismissPopupMenus();
|
||||
}
|
||||
|
||||
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2) {
|
||||
super(i, i2);
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
super(layoutParams);
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) {
|
||||
super(marginLayoutParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,705 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.ActionBarPolicy;
|
||||
import androidx.appcompat.view.menu.ActionMenuItemView;
|
||||
import androidx.appcompat.view.menu.BaseMenuPresenter;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuItemImpl;
|
||||
import androidx.appcompat.view.menu.MenuPopupHelper;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import androidx.appcompat.view.menu.ShowableListMenu;
|
||||
import androidx.appcompat.view.menu.SubMenuBuilder;
|
||||
import androidx.appcompat.widget.ActionMenuView;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ActionProvider;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ActionMenuPresenter extends BaseMenuPresenter implements ActionProvider.SubUiVisibilityListener {
|
||||
private static final String TAG = "ActionMenuPresenter";
|
||||
private final SparseBooleanArray mActionButtonGroups;
|
||||
ActionButtonSubmenu mActionButtonPopup;
|
||||
private int mActionItemWidthLimit;
|
||||
private boolean mExpandedActionViewsExclusive;
|
||||
private int mMaxItems;
|
||||
private boolean mMaxItemsSet;
|
||||
private int mMinCellSize;
|
||||
int mOpenSubMenuId;
|
||||
OverflowMenuButton mOverflowButton;
|
||||
OverflowPopup mOverflowPopup;
|
||||
private Drawable mPendingOverflowIcon;
|
||||
private boolean mPendingOverflowIconSet;
|
||||
private ActionMenuPopupCallback mPopupCallback;
|
||||
final PopupPresenterCallback mPopupPresenterCallback;
|
||||
OpenOverflowRunnable mPostedOpenRunnable;
|
||||
private boolean mReserveOverflow;
|
||||
private boolean mReserveOverflowSet;
|
||||
private boolean mStrictWidthLimit;
|
||||
private int mWidthLimit;
|
||||
private boolean mWidthLimitSet;
|
||||
|
||||
public boolean isOverflowReserved() {
|
||||
return this.mReserveOverflow;
|
||||
}
|
||||
|
||||
public void setExpandedActionViewsExclusive(boolean z) {
|
||||
this.mExpandedActionViewsExclusive = z;
|
||||
}
|
||||
|
||||
public void setItemLimit(int i) {
|
||||
this.mMaxItems = i;
|
||||
this.mMaxItemsSet = true;
|
||||
}
|
||||
|
||||
public void setReserveOverflow(boolean z) {
|
||||
this.mReserveOverflow = z;
|
||||
this.mReserveOverflowSet = true;
|
||||
}
|
||||
|
||||
public void setWidthLimit(int i, boolean z) {
|
||||
this.mWidthLimit = i;
|
||||
this.mStrictWidthLimit = z;
|
||||
this.mWidthLimitSet = true;
|
||||
}
|
||||
|
||||
public ActionMenuPresenter(Context context) {
|
||||
super(context, R.layout.abc_action_menu_layout, R.layout.abc_action_menu_item_layout);
|
||||
this.mActionButtonGroups = new SparseBooleanArray();
|
||||
this.mPopupPresenterCallback = new PopupPresenterCallback();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public void initForMenu(Context context, MenuBuilder menuBuilder) {
|
||||
super.initForMenu(context, menuBuilder);
|
||||
Resources resources = context.getResources();
|
||||
ActionBarPolicy actionBarPolicy = ActionBarPolicy.get(context);
|
||||
if (!this.mReserveOverflowSet) {
|
||||
this.mReserveOverflow = actionBarPolicy.showsOverflowMenuButton();
|
||||
}
|
||||
if (!this.mWidthLimitSet) {
|
||||
this.mWidthLimit = actionBarPolicy.getEmbeddedMenuWidthLimit();
|
||||
}
|
||||
if (!this.mMaxItemsSet) {
|
||||
this.mMaxItems = actionBarPolicy.getMaxActionButtons();
|
||||
}
|
||||
int i = this.mWidthLimit;
|
||||
if (this.mReserveOverflow) {
|
||||
if (this.mOverflowButton == null) {
|
||||
OverflowMenuButton overflowMenuButton = new OverflowMenuButton(this.mSystemContext);
|
||||
this.mOverflowButton = overflowMenuButton;
|
||||
if (this.mPendingOverflowIconSet) {
|
||||
overflowMenuButton.setImageDrawable(this.mPendingOverflowIcon);
|
||||
this.mPendingOverflowIcon = null;
|
||||
this.mPendingOverflowIconSet = false;
|
||||
}
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
this.mOverflowButton.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
}
|
||||
i -= this.mOverflowButton.getMeasuredWidth();
|
||||
} else {
|
||||
this.mOverflowButton = null;
|
||||
}
|
||||
this.mActionItemWidthLimit = i;
|
||||
this.mMinCellSize = (int) (resources.getDisplayMetrics().density * 56.0f);
|
||||
}
|
||||
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
if (!this.mMaxItemsSet) {
|
||||
this.mMaxItems = ActionBarPolicy.get(this.mContext).getMaxActionButtons();
|
||||
}
|
||||
if (this.mMenu != null) {
|
||||
this.mMenu.onItemsChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOverflowIcon(Drawable drawable) {
|
||||
OverflowMenuButton overflowMenuButton = this.mOverflowButton;
|
||||
if (overflowMenuButton != null) {
|
||||
overflowMenuButton.setImageDrawable(drawable);
|
||||
} else {
|
||||
this.mPendingOverflowIconSet = true;
|
||||
this.mPendingOverflowIcon = drawable;
|
||||
}
|
||||
}
|
||||
|
||||
public Drawable getOverflowIcon() {
|
||||
OverflowMenuButton overflowMenuButton = this.mOverflowButton;
|
||||
if (overflowMenuButton != null) {
|
||||
return overflowMenuButton.getDrawable();
|
||||
}
|
||||
if (this.mPendingOverflowIconSet) {
|
||||
return this.mPendingOverflowIcon;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public MenuView getMenuView(ViewGroup viewGroup) {
|
||||
MenuView menuView = this.mMenuView;
|
||||
MenuView menuView2 = super.getMenuView(viewGroup);
|
||||
if (menuView != menuView2) {
|
||||
((ActionMenuView) menuView2).setPresenter(this);
|
||||
}
|
||||
return menuView2;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public View getItemView(MenuItemImpl menuItemImpl, View view, ViewGroup viewGroup) {
|
||||
View actionView = menuItemImpl.getActionView();
|
||||
if (actionView == null || menuItemImpl.hasCollapsibleActionView()) {
|
||||
actionView = super.getItemView(menuItemImpl, view, viewGroup);
|
||||
}
|
||||
actionView.setVisibility(menuItemImpl.isActionViewExpanded() ? 8 : 0);
|
||||
ActionMenuView actionMenuView = (ActionMenuView) viewGroup;
|
||||
ViewGroup.LayoutParams layoutParams = actionView.getLayoutParams();
|
||||
if (!actionMenuView.checkLayoutParams(layoutParams)) {
|
||||
actionView.setLayoutParams(actionMenuView.generateLayoutParams(layoutParams));
|
||||
}
|
||||
return actionView;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public void bindItemView(MenuItemImpl menuItemImpl, MenuView.ItemView itemView) {
|
||||
itemView.initialize(menuItemImpl, 0);
|
||||
ActionMenuItemView actionMenuItemView = (ActionMenuItemView) itemView;
|
||||
actionMenuItemView.setItemInvoker((ActionMenuView) this.mMenuView);
|
||||
if (this.mPopupCallback == null) {
|
||||
this.mPopupCallback = new ActionMenuPopupCallback();
|
||||
}
|
||||
actionMenuItemView.setPopupCallback(this.mPopupCallback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public boolean shouldIncludeItem(int i, MenuItemImpl menuItemImpl) {
|
||||
return menuItemImpl.isActionButton();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public void updateMenuView(boolean z) {
|
||||
int size;
|
||||
super.updateMenuView(z);
|
||||
((View) this.mMenuView).requestLayout();
|
||||
if (this.mMenu != null) {
|
||||
ArrayList<MenuItemImpl> actionItems = this.mMenu.getActionItems();
|
||||
int size2 = actionItems.size();
|
||||
for (int i = 0; i < size2; i++) {
|
||||
ActionProvider supportActionProvider = actionItems.get(i).getSupportActionProvider();
|
||||
if (supportActionProvider != null) {
|
||||
supportActionProvider.setSubUiVisibilityListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<MenuItemImpl> nonActionItems = this.mMenu != null ? this.mMenu.getNonActionItems() : null;
|
||||
if (this.mReserveOverflow && nonActionItems != null && ((size = nonActionItems.size()) != 1 ? size > 0 : (!nonActionItems.get(0).isActionViewExpanded()))) {
|
||||
if (this.mOverflowButton == null) {
|
||||
this.mOverflowButton = new OverflowMenuButton(this.mSystemContext);
|
||||
}
|
||||
ViewGroup viewGroup = (ViewGroup) this.mOverflowButton.getParent();
|
||||
if (viewGroup != this.mMenuView) {
|
||||
if (viewGroup != null) {
|
||||
viewGroup.removeView(this.mOverflowButton);
|
||||
}
|
||||
ActionMenuView actionMenuView = (ActionMenuView) this.mMenuView;
|
||||
actionMenuView.addView(this.mOverflowButton, actionMenuView.generateOverflowButtonLayoutParams());
|
||||
}
|
||||
} else {
|
||||
OverflowMenuButton overflowMenuButton = this.mOverflowButton;
|
||||
if (overflowMenuButton != null && overflowMenuButton.getParent() == this.mMenuView) {
|
||||
((ViewGroup) this.mMenuView).removeView(this.mOverflowButton);
|
||||
}
|
||||
}
|
||||
((ActionMenuView) this.mMenuView).setOverflowReserved(this.mReserveOverflow);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public boolean filterLeftoverView(ViewGroup viewGroup, int i) {
|
||||
if (viewGroup.getChildAt(i) == this.mOverflowButton) {
|
||||
return false;
|
||||
}
|
||||
return super.filterLeftoverView(viewGroup, i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean onSubMenuSelected(SubMenuBuilder subMenuBuilder) {
|
||||
boolean z = false;
|
||||
if (!subMenuBuilder.hasVisibleItems()) {
|
||||
return false;
|
||||
}
|
||||
SubMenuBuilder subMenuBuilder2 = subMenuBuilder;
|
||||
while (subMenuBuilder2.getParentMenu() != this.mMenu) {
|
||||
subMenuBuilder2 = (SubMenuBuilder) subMenuBuilder2.getParentMenu();
|
||||
}
|
||||
View findViewForItem = findViewForItem(subMenuBuilder2.getItem());
|
||||
if (findViewForItem == null) {
|
||||
return false;
|
||||
}
|
||||
this.mOpenSubMenuId = subMenuBuilder.getItem().getItemId();
|
||||
int size = subMenuBuilder.size();
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= size) {
|
||||
break;
|
||||
}
|
||||
MenuItem item = subMenuBuilder.getItem(i);
|
||||
if (item.isVisible() && item.getIcon() != null) {
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
ActionButtonSubmenu actionButtonSubmenu = new ActionButtonSubmenu(this.mContext, subMenuBuilder, findViewForItem);
|
||||
this.mActionButtonPopup = actionButtonSubmenu;
|
||||
actionButtonSubmenu.setForceShowIcon(z);
|
||||
this.mActionButtonPopup.show();
|
||||
super.onSubMenuSelected(subMenuBuilder);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private View findViewForItem(MenuItem menuItem) {
|
||||
ViewGroup viewGroup = (ViewGroup) this.mMenuView;
|
||||
if (viewGroup == null) {
|
||||
return null;
|
||||
}
|
||||
int childCount = viewGroup.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = viewGroup.getChildAt(i);
|
||||
if ((childAt instanceof MenuView.ItemView) && ((MenuView.ItemView) childAt).getItemData() == menuItem) {
|
||||
return childAt;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean showOverflowMenu() {
|
||||
if (!this.mReserveOverflow || isOverflowMenuShowing() || this.mMenu == null || this.mMenuView == null || this.mPostedOpenRunnable != null || this.mMenu.getNonActionItems().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
this.mPostedOpenRunnable = new OpenOverflowRunnable(new OverflowPopup(this.mContext, this.mMenu, this.mOverflowButton, true));
|
||||
((View) this.mMenuView).post(this.mPostedOpenRunnable);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hideOverflowMenu() {
|
||||
if (this.mPostedOpenRunnable != null && this.mMenuView != null) {
|
||||
((View) this.mMenuView).removeCallbacks(this.mPostedOpenRunnable);
|
||||
this.mPostedOpenRunnable = null;
|
||||
return true;
|
||||
}
|
||||
OverflowPopup overflowPopup = this.mOverflowPopup;
|
||||
if (overflowPopup == null) {
|
||||
return false;
|
||||
}
|
||||
overflowPopup.dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean dismissPopupMenus() {
|
||||
return hideOverflowMenu() | hideSubMenus();
|
||||
}
|
||||
|
||||
public boolean hideSubMenus() {
|
||||
ActionButtonSubmenu actionButtonSubmenu = this.mActionButtonPopup;
|
||||
if (actionButtonSubmenu == null) {
|
||||
return false;
|
||||
}
|
||||
actionButtonSubmenu.dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowing() {
|
||||
OverflowPopup overflowPopup = this.mOverflowPopup;
|
||||
return overflowPopup != null && overflowPopup.isShowing();
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowPending() {
|
||||
return this.mPostedOpenRunnable != null || isOverflowMenuShowing();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean flagActionItems() {
|
||||
ArrayList<MenuItemImpl> arrayList;
|
||||
int i;
|
||||
int i2;
|
||||
int i3;
|
||||
int i4;
|
||||
ActionMenuPresenter actionMenuPresenter = this;
|
||||
View view = null;
|
||||
int i5 = 0;
|
||||
if (actionMenuPresenter.mMenu != null) {
|
||||
arrayList = actionMenuPresenter.mMenu.getVisibleItems();
|
||||
i = arrayList.size();
|
||||
} else {
|
||||
arrayList = null;
|
||||
i = 0;
|
||||
}
|
||||
int i6 = actionMenuPresenter.mMaxItems;
|
||||
int i7 = actionMenuPresenter.mActionItemWidthLimit;
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
ViewGroup viewGroup = (ViewGroup) actionMenuPresenter.mMenuView;
|
||||
boolean z = false;
|
||||
int i8 = 0;
|
||||
int i9 = 0;
|
||||
for (int i10 = 0; i10 < i; i10++) {
|
||||
MenuItemImpl menuItemImpl = arrayList.get(i10);
|
||||
if (menuItemImpl.requiresActionButton()) {
|
||||
i8++;
|
||||
} else if (menuItemImpl.requestsActionButton()) {
|
||||
i9++;
|
||||
} else {
|
||||
z = true;
|
||||
}
|
||||
if (actionMenuPresenter.mExpandedActionViewsExclusive && menuItemImpl.isActionViewExpanded()) {
|
||||
i6 = 0;
|
||||
}
|
||||
}
|
||||
if (actionMenuPresenter.mReserveOverflow && (z || i9 + i8 > i6)) {
|
||||
i6--;
|
||||
}
|
||||
int i11 = i6 - i8;
|
||||
SparseBooleanArray sparseBooleanArray = actionMenuPresenter.mActionButtonGroups;
|
||||
sparseBooleanArray.clear();
|
||||
if (actionMenuPresenter.mStrictWidthLimit) {
|
||||
int i12 = actionMenuPresenter.mMinCellSize;
|
||||
i3 = i7 / i12;
|
||||
i2 = i12 + ((i7 % i12) / i3);
|
||||
} else {
|
||||
i2 = 0;
|
||||
i3 = 0;
|
||||
}
|
||||
int i13 = 0;
|
||||
int i14 = 0;
|
||||
while (i13 < i) {
|
||||
MenuItemImpl menuItemImpl2 = arrayList.get(i13);
|
||||
if (menuItemImpl2.requiresActionButton()) {
|
||||
View itemView = actionMenuPresenter.getItemView(menuItemImpl2, view, viewGroup);
|
||||
if (actionMenuPresenter.mStrictWidthLimit) {
|
||||
i3 -= ActionMenuView.measureChildForCells(itemView, i2, i3, makeMeasureSpec, i5);
|
||||
} else {
|
||||
itemView.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
}
|
||||
int measuredWidth = itemView.getMeasuredWidth();
|
||||
i7 -= measuredWidth;
|
||||
if (i14 == 0) {
|
||||
i14 = measuredWidth;
|
||||
}
|
||||
int groupId = menuItemImpl2.getGroupId();
|
||||
if (groupId != 0) {
|
||||
sparseBooleanArray.put(groupId, true);
|
||||
}
|
||||
menuItemImpl2.setIsActionButton(true);
|
||||
i4 = i;
|
||||
} else if (menuItemImpl2.requestsActionButton()) {
|
||||
int groupId2 = menuItemImpl2.getGroupId();
|
||||
boolean z2 = sparseBooleanArray.get(groupId2);
|
||||
boolean z3 = (i11 > 0 || z2) && i7 > 0 && (!actionMenuPresenter.mStrictWidthLimit || i3 > 0);
|
||||
boolean z4 = z3;
|
||||
i4 = i;
|
||||
if (z3) {
|
||||
View itemView2 = actionMenuPresenter.getItemView(menuItemImpl2, null, viewGroup);
|
||||
if (actionMenuPresenter.mStrictWidthLimit) {
|
||||
int measureChildForCells = ActionMenuView.measureChildForCells(itemView2, i2, i3, makeMeasureSpec, 0);
|
||||
i3 -= measureChildForCells;
|
||||
if (measureChildForCells == 0) {
|
||||
z4 = false;
|
||||
}
|
||||
} else {
|
||||
itemView2.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
}
|
||||
boolean z5 = z4;
|
||||
int measuredWidth2 = itemView2.getMeasuredWidth();
|
||||
i7 -= measuredWidth2;
|
||||
if (i14 == 0) {
|
||||
i14 = measuredWidth2;
|
||||
}
|
||||
z3 = z5 & (!actionMenuPresenter.mStrictWidthLimit ? i7 + i14 <= 0 : i7 < 0);
|
||||
}
|
||||
if (z3 && groupId2 != 0) {
|
||||
sparseBooleanArray.put(groupId2, true);
|
||||
} else if (z2) {
|
||||
sparseBooleanArray.put(groupId2, false);
|
||||
for (int i15 = 0; i15 < i13; i15++) {
|
||||
MenuItemImpl menuItemImpl3 = arrayList.get(i15);
|
||||
if (menuItemImpl3.getGroupId() == groupId2) {
|
||||
if (menuItemImpl3.isActionButton()) {
|
||||
i11++;
|
||||
}
|
||||
menuItemImpl3.setIsActionButton(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (z3) {
|
||||
i11--;
|
||||
}
|
||||
menuItemImpl2.setIsActionButton(z3);
|
||||
} else {
|
||||
i4 = i;
|
||||
menuItemImpl2.setIsActionButton(false);
|
||||
i13++;
|
||||
view = null;
|
||||
actionMenuPresenter = this;
|
||||
i = i4;
|
||||
i5 = 0;
|
||||
}
|
||||
i13++;
|
||||
view = null;
|
||||
actionMenuPresenter = this;
|
||||
i = i4;
|
||||
i5 = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
dismissPopupMenus();
|
||||
super.onCloseMenu(menuBuilder, z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public Parcelable onSaveInstanceState() {
|
||||
SavedState savedState = new SavedState();
|
||||
savedState.openSubMenuId = this.mOpenSubMenuId;
|
||||
return savedState;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onRestoreInstanceState(Parcelable parcelable) {
|
||||
MenuItem findItem;
|
||||
if (parcelable instanceof SavedState) {
|
||||
SavedState savedState = (SavedState) parcelable;
|
||||
if (savedState.openSubMenuId <= 0 || (findItem = this.mMenu.findItem(savedState.openSubMenuId)) == null) {
|
||||
return;
|
||||
}
|
||||
onSubMenuSelected((SubMenuBuilder) findItem.getSubMenu());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider.SubUiVisibilityListener
|
||||
public void onSubUiVisibilityChanged(boolean z) {
|
||||
if (z) {
|
||||
super.onSubMenuSelected(null);
|
||||
} else if (this.mMenu != null) {
|
||||
this.mMenu.close(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMenuView(ActionMenuView actionMenuView) {
|
||||
this.mMenuView = actionMenuView;
|
||||
actionMenuView.initialize(this.mMenu);
|
||||
}
|
||||
|
||||
private static class SavedState implements Parcelable {
|
||||
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { // from class: androidx.appcompat.widget.ActionMenuPresenter.SavedState.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public SavedState createFromParcel(Parcel parcel) {
|
||||
return new SavedState(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public SavedState[] newArray(int i) {
|
||||
return new SavedState[i];
|
||||
}
|
||||
};
|
||||
public int openSubMenuId;
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
SavedState() {
|
||||
}
|
||||
|
||||
SavedState(Parcel parcel) {
|
||||
this.openSubMenuId = parcel.readInt();
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeInt(this.openSubMenuId);
|
||||
}
|
||||
}
|
||||
|
||||
private class OverflowMenuButton extends AppCompatImageView implements ActionMenuView.ActionMenuChildView {
|
||||
@Override // androidx.appcompat.widget.ActionMenuView.ActionMenuChildView
|
||||
public boolean needsDividerAfter() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActionMenuView.ActionMenuChildView
|
||||
public boolean needsDividerBefore() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public OverflowMenuButton(Context context) {
|
||||
super(context, null, R.attr.actionOverflowButtonStyle);
|
||||
setClickable(true);
|
||||
setFocusable(true);
|
||||
setVisibility(0);
|
||||
setEnabled(true);
|
||||
TooltipCompat.setTooltipText(this, getContentDescription());
|
||||
setOnTouchListener(new ForwardingListener(this) { // from class: androidx.appcompat.widget.ActionMenuPresenter.OverflowMenuButton.1
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public ShowableListMenu getPopup() {
|
||||
if (ActionMenuPresenter.this.mOverflowPopup == null) {
|
||||
return null;
|
||||
}
|
||||
return ActionMenuPresenter.this.mOverflowPopup.getPopup();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public boolean onForwardingStarted() {
|
||||
ActionMenuPresenter.this.showOverflowMenu();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public boolean onForwardingStopped() {
|
||||
if (ActionMenuPresenter.this.mPostedOpenRunnable != null) {
|
||||
return false;
|
||||
}
|
||||
ActionMenuPresenter.this.hideOverflowMenu();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean performClick() {
|
||||
if (super.performClick()) {
|
||||
return true;
|
||||
}
|
||||
playSoundEffect(0);
|
||||
ActionMenuPresenter.this.showOverflowMenu();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
protected boolean setFrame(int i, int i2, int i3, int i4) {
|
||||
boolean frame = super.setFrame(i, i2, i3, i4);
|
||||
Drawable drawable = getDrawable();
|
||||
Drawable background = getBackground();
|
||||
if (drawable != null && background != null) {
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
int max = Math.max(width, height) / 2;
|
||||
int paddingLeft = (width + (getPaddingLeft() - getPaddingRight())) / 2;
|
||||
int paddingTop = (height + (getPaddingTop() - getPaddingBottom())) / 2;
|
||||
DrawableCompat.setHotspotBounds(background, paddingLeft - max, paddingTop - max, paddingLeft + max, paddingTop + max);
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
private class OverflowPopup extends MenuPopupHelper {
|
||||
public OverflowPopup(Context context, MenuBuilder menuBuilder, View view, boolean z) {
|
||||
super(context, menuBuilder, view, z, R.attr.actionOverflowMenuStyle);
|
||||
setGravity(GravityCompat.END);
|
||||
setPresenterCallback(ActionMenuPresenter.this.mPopupPresenterCallback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopupHelper
|
||||
protected void onDismiss() {
|
||||
if (ActionMenuPresenter.this.mMenu != null) {
|
||||
ActionMenuPresenter.this.mMenu.close();
|
||||
}
|
||||
ActionMenuPresenter.this.mOverflowPopup = null;
|
||||
super.onDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private class ActionButtonSubmenu extends MenuPopupHelper {
|
||||
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenuBuilder, View view) {
|
||||
super(context, subMenuBuilder, view, false, R.attr.actionOverflowMenuStyle);
|
||||
if (!((MenuItemImpl) subMenuBuilder.getItem()).isActionButton()) {
|
||||
setAnchorView(ActionMenuPresenter.this.mOverflowButton == null ? (View) ActionMenuPresenter.this.mMenuView : ActionMenuPresenter.this.mOverflowButton);
|
||||
}
|
||||
setPresenterCallback(ActionMenuPresenter.this.mPopupPresenterCallback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopupHelper
|
||||
protected void onDismiss() {
|
||||
ActionMenuPresenter.this.mActionButtonPopup = null;
|
||||
ActionMenuPresenter.this.mOpenSubMenuId = 0;
|
||||
super.onDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private class PopupPresenterCallback implements MenuPresenter.Callback {
|
||||
PopupPresenterCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public boolean onOpenSubMenu(MenuBuilder menuBuilder) {
|
||||
if (menuBuilder == ActionMenuPresenter.this.mMenu) {
|
||||
return false;
|
||||
}
|
||||
ActionMenuPresenter.this.mOpenSubMenuId = ((SubMenuBuilder) menuBuilder).getItem().getItemId();
|
||||
MenuPresenter.Callback callback = ActionMenuPresenter.this.getCallback();
|
||||
if (callback != null) {
|
||||
return callback.onOpenSubMenu(menuBuilder);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
if (menuBuilder instanceof SubMenuBuilder) {
|
||||
menuBuilder.getRootMenu().close(false);
|
||||
}
|
||||
MenuPresenter.Callback callback = ActionMenuPresenter.this.getCallback();
|
||||
if (callback != null) {
|
||||
callback.onCloseMenu(menuBuilder, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class OpenOverflowRunnable implements Runnable {
|
||||
private OverflowPopup mPopup;
|
||||
|
||||
public OpenOverflowRunnable(OverflowPopup overflowPopup) {
|
||||
this.mPopup = overflowPopup;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (ActionMenuPresenter.this.mMenu != null) {
|
||||
ActionMenuPresenter.this.mMenu.changeMenuMode();
|
||||
}
|
||||
View view = (View) ActionMenuPresenter.this.mMenuView;
|
||||
if (view != null && view.getWindowToken() != null && this.mPopup.tryShow()) {
|
||||
ActionMenuPresenter.this.mOverflowPopup = this.mPopup;
|
||||
}
|
||||
ActionMenuPresenter.this.mPostedOpenRunnable = null;
|
||||
}
|
||||
}
|
||||
|
||||
private class ActionMenuPopupCallback extends ActionMenuItemView.PopupCallback {
|
||||
ActionMenuPopupCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ActionMenuItemView.PopupCallback
|
||||
public ShowableListMenu getPopup() {
|
||||
if (ActionMenuPresenter.this.mActionButtonPopup != null) {
|
||||
return ActionMenuPresenter.this.mActionButtonPopup.getPopup();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,680 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import androidx.appcompat.view.menu.ActionMenuItemView;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuItemImpl;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.ItemInvoker, MenuView {
|
||||
static final int GENERATED_ITEM_PADDING = 4;
|
||||
static final int MIN_CELL_SIZE = 56;
|
||||
private static final String TAG = "ActionMenuView";
|
||||
private MenuPresenter.Callback mActionMenuPresenterCallback;
|
||||
private boolean mFormatItems;
|
||||
private int mFormatItemsWidth;
|
||||
private int mGeneratedItemPadding;
|
||||
private MenuBuilder mMenu;
|
||||
MenuBuilder.Callback mMenuBuilderCallback;
|
||||
private int mMinCellSize;
|
||||
OnMenuItemClickListener mOnMenuItemClickListener;
|
||||
private Context mPopupContext;
|
||||
private int mPopupTheme;
|
||||
private ActionMenuPresenter mPresenter;
|
||||
private boolean mReserveOverflow;
|
||||
|
||||
public interface ActionMenuChildView {
|
||||
boolean needsDividerAfter();
|
||||
|
||||
boolean needsDividerBefore();
|
||||
}
|
||||
|
||||
public interface OnMenuItemClickListener {
|
||||
boolean onMenuItemClick(MenuItem menuItem);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getPopupTheme() {
|
||||
return this.mPopupTheme;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView
|
||||
public int getWindowAnimations() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView
|
||||
public void initialize(MenuBuilder menuBuilder) {
|
||||
this.mMenu = menuBuilder;
|
||||
}
|
||||
|
||||
public boolean isOverflowReserved() {
|
||||
return this.mReserveOverflow;
|
||||
}
|
||||
|
||||
public MenuBuilder peekMenu() {
|
||||
return this.mMenu;
|
||||
}
|
||||
|
||||
public void setMenuCallbacks(MenuPresenter.Callback callback, MenuBuilder.Callback callback2) {
|
||||
this.mActionMenuPresenterCallback = callback;
|
||||
this.mMenuBuilderCallback = callback2;
|
||||
}
|
||||
|
||||
public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
|
||||
this.mOnMenuItemClickListener = onMenuItemClickListener;
|
||||
}
|
||||
|
||||
public void setOverflowReserved(boolean z) {
|
||||
this.mReserveOverflow = z;
|
||||
}
|
||||
|
||||
public ActionMenuView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActionMenuView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
setBaselineAligned(false);
|
||||
float f = context.getResources().getDisplayMetrics().density;
|
||||
this.mMinCellSize = (int) (56.0f * f);
|
||||
this.mGeneratedItemPadding = (int) (f * 4.0f);
|
||||
this.mPopupContext = context;
|
||||
this.mPopupTheme = 0;
|
||||
}
|
||||
|
||||
public void setPopupTheme(int i) {
|
||||
if (this.mPopupTheme != i) {
|
||||
this.mPopupTheme = i;
|
||||
if (i == 0) {
|
||||
this.mPopupContext = getContext();
|
||||
} else {
|
||||
this.mPopupContext = new ContextThemeWrapper(getContext(), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setPresenter(ActionMenuPresenter actionMenuPresenter) {
|
||||
this.mPresenter = actionMenuPresenter;
|
||||
actionMenuPresenter.setMenuView(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.updateMenuView(false);
|
||||
if (this.mPresenter.isOverflowMenuShowing()) {
|
||||
this.mPresenter.hideOverflowMenu();
|
||||
this.mPresenter.showOverflowMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
MenuBuilder menuBuilder;
|
||||
boolean z = this.mFormatItems;
|
||||
boolean z2 = View.MeasureSpec.getMode(i) == 1073741824;
|
||||
this.mFormatItems = z2;
|
||||
if (z != z2) {
|
||||
this.mFormatItemsWidth = 0;
|
||||
}
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
if (this.mFormatItems && (menuBuilder = this.mMenu) != null && size != this.mFormatItemsWidth) {
|
||||
this.mFormatItemsWidth = size;
|
||||
menuBuilder.onItemsChanged(true);
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
if (this.mFormatItems && childCount > 0) {
|
||||
onMeasureExactFormat(i, i2);
|
||||
return;
|
||||
}
|
||||
for (int i3 = 0; i3 < childCount; i3++) {
|
||||
LayoutParams layoutParams = (LayoutParams) getChildAt(i3).getLayoutParams();
|
||||
layoutParams.rightMargin = 0;
|
||||
layoutParams.leftMargin = 0;
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
/* JADX WARN: Type inference failed for: r14v12 */
|
||||
/* JADX WARN: Type inference failed for: r14v8 */
|
||||
/* JADX WARN: Type inference failed for: r14v9, types: [boolean, int] */
|
||||
private void onMeasureExactFormat(int i, int i2) {
|
||||
int i3;
|
||||
int i4;
|
||||
boolean z;
|
||||
int i5;
|
||||
boolean z2;
|
||||
boolean z3;
|
||||
int i6;
|
||||
?? r14;
|
||||
int mode = View.MeasureSpec.getMode(i2);
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
int size2 = View.MeasureSpec.getSize(i2);
|
||||
int paddingLeft = getPaddingLeft() + getPaddingRight();
|
||||
int paddingTop = getPaddingTop() + getPaddingBottom();
|
||||
int childMeasureSpec = getChildMeasureSpec(i2, paddingTop, -2);
|
||||
int i7 = size - paddingLeft;
|
||||
int i8 = this.mMinCellSize;
|
||||
int i9 = i7 / i8;
|
||||
int i10 = i7 % i8;
|
||||
if (i9 == 0) {
|
||||
setMeasuredDimension(i7, 0);
|
||||
return;
|
||||
}
|
||||
int i11 = i8 + (i10 / i9);
|
||||
int childCount = getChildCount();
|
||||
int i12 = 0;
|
||||
int i13 = 0;
|
||||
boolean z4 = false;
|
||||
int i14 = 0;
|
||||
int i15 = 0;
|
||||
int i16 = 0;
|
||||
long j = 0;
|
||||
while (i13 < childCount) {
|
||||
View childAt = getChildAt(i13);
|
||||
int i17 = size2;
|
||||
if (childAt.getVisibility() != 8) {
|
||||
boolean z5 = childAt instanceof ActionMenuItemView;
|
||||
int i18 = i14 + 1;
|
||||
if (z5) {
|
||||
int i19 = this.mGeneratedItemPadding;
|
||||
i6 = i18;
|
||||
r14 = 0;
|
||||
childAt.setPadding(i19, 0, i19, 0);
|
||||
} else {
|
||||
i6 = i18;
|
||||
r14 = 0;
|
||||
}
|
||||
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
||||
layoutParams.expanded = r14;
|
||||
layoutParams.extraPixels = r14;
|
||||
layoutParams.cellsUsed = r14;
|
||||
layoutParams.expandable = r14;
|
||||
layoutParams.leftMargin = r14;
|
||||
layoutParams.rightMargin = r14;
|
||||
layoutParams.preventEdgeOffset = z5 && ((ActionMenuItemView) childAt).hasText();
|
||||
int measureChildForCells = measureChildForCells(childAt, i11, layoutParams.isOverflowButton ? 1 : i9, childMeasureSpec, paddingTop);
|
||||
i15 = Math.max(i15, measureChildForCells);
|
||||
if (layoutParams.expandable) {
|
||||
i16++;
|
||||
}
|
||||
if (layoutParams.isOverflowButton) {
|
||||
z4 = true;
|
||||
}
|
||||
i9 -= measureChildForCells;
|
||||
i12 = Math.max(i12, childAt.getMeasuredHeight());
|
||||
if (measureChildForCells == 1) {
|
||||
j |= 1 << i13;
|
||||
i12 = i12;
|
||||
}
|
||||
i14 = i6;
|
||||
}
|
||||
i13++;
|
||||
size2 = i17;
|
||||
}
|
||||
int i20 = size2;
|
||||
boolean z6 = z4 && i14 == 2;
|
||||
boolean z7 = false;
|
||||
while (i16 > 0 && i9 > 0) {
|
||||
int i21 = 0;
|
||||
int i22 = 0;
|
||||
int i23 = Integer.MAX_VALUE;
|
||||
long j2 = 0;
|
||||
while (i22 < childCount) {
|
||||
boolean z8 = z7;
|
||||
LayoutParams layoutParams2 = (LayoutParams) getChildAt(i22).getLayoutParams();
|
||||
int i24 = i12;
|
||||
if (layoutParams2.expandable) {
|
||||
if (layoutParams2.cellsUsed < i23) {
|
||||
i23 = layoutParams2.cellsUsed;
|
||||
j2 = 1 << i22;
|
||||
i21 = 1;
|
||||
} else if (layoutParams2.cellsUsed == i23) {
|
||||
i21++;
|
||||
j2 |= 1 << i22;
|
||||
}
|
||||
}
|
||||
i22++;
|
||||
i12 = i24;
|
||||
z7 = z8;
|
||||
}
|
||||
z = z7;
|
||||
i5 = i12;
|
||||
j |= j2;
|
||||
if (i21 > i9) {
|
||||
i3 = mode;
|
||||
i4 = i7;
|
||||
break;
|
||||
}
|
||||
int i25 = i23 + 1;
|
||||
int i26 = 0;
|
||||
while (i26 < childCount) {
|
||||
View childAt2 = getChildAt(i26);
|
||||
LayoutParams layoutParams3 = (LayoutParams) childAt2.getLayoutParams();
|
||||
int i27 = i7;
|
||||
int i28 = mode;
|
||||
long j3 = 1 << i26;
|
||||
if ((j2 & j3) == 0) {
|
||||
if (layoutParams3.cellsUsed == i25) {
|
||||
j |= j3;
|
||||
}
|
||||
z3 = z6;
|
||||
} else {
|
||||
if (z6 && layoutParams3.preventEdgeOffset && i9 == 1) {
|
||||
int i29 = this.mGeneratedItemPadding;
|
||||
z3 = z6;
|
||||
childAt2.setPadding(i29 + i11, 0, i29, 0);
|
||||
} else {
|
||||
z3 = z6;
|
||||
}
|
||||
layoutParams3.cellsUsed++;
|
||||
layoutParams3.expanded = true;
|
||||
i9--;
|
||||
}
|
||||
i26++;
|
||||
mode = i28;
|
||||
i7 = i27;
|
||||
z6 = z3;
|
||||
}
|
||||
i12 = i5;
|
||||
z7 = true;
|
||||
}
|
||||
i3 = mode;
|
||||
i4 = i7;
|
||||
z = z7;
|
||||
i5 = i12;
|
||||
boolean z9 = !z4 && i14 == 1;
|
||||
if (i9 <= 0 || j == 0 || (i9 >= i14 - 1 && !z9 && i15 <= 1)) {
|
||||
z2 = z;
|
||||
} else {
|
||||
float bitCount = Long.bitCount(j);
|
||||
if (!z9) {
|
||||
if ((j & 1) != 0 && !((LayoutParams) getChildAt(0).getLayoutParams()).preventEdgeOffset) {
|
||||
bitCount -= 0.5f;
|
||||
}
|
||||
int i30 = childCount - 1;
|
||||
if ((j & (1 << i30)) != 0 && !((LayoutParams) getChildAt(i30).getLayoutParams()).preventEdgeOffset) {
|
||||
bitCount -= 0.5f;
|
||||
}
|
||||
}
|
||||
int i31 = bitCount > 0.0f ? (int) ((i9 * i11) / bitCount) : 0;
|
||||
z2 = z;
|
||||
for (int i32 = 0; i32 < childCount; i32++) {
|
||||
if ((j & (1 << i32)) != 0) {
|
||||
View childAt3 = getChildAt(i32);
|
||||
LayoutParams layoutParams4 = (LayoutParams) childAt3.getLayoutParams();
|
||||
if (childAt3 instanceof ActionMenuItemView) {
|
||||
layoutParams4.extraPixels = i31;
|
||||
layoutParams4.expanded = true;
|
||||
if (i32 == 0 && !layoutParams4.preventEdgeOffset) {
|
||||
layoutParams4.leftMargin = (-i31) / 2;
|
||||
}
|
||||
} else if (layoutParams4.isOverflowButton) {
|
||||
layoutParams4.extraPixels = i31;
|
||||
layoutParams4.expanded = true;
|
||||
layoutParams4.rightMargin = (-i31) / 2;
|
||||
} else {
|
||||
if (i32 != 0) {
|
||||
layoutParams4.leftMargin = i31 / 2;
|
||||
}
|
||||
if (i32 != childCount - 1) {
|
||||
layoutParams4.rightMargin = i31 / 2;
|
||||
}
|
||||
}
|
||||
z2 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (z2) {
|
||||
for (int i33 = 0; i33 < childCount; i33++) {
|
||||
View childAt4 = getChildAt(i33);
|
||||
LayoutParams layoutParams5 = (LayoutParams) childAt4.getLayoutParams();
|
||||
if (layoutParams5.expanded) {
|
||||
childAt4.measure(View.MeasureSpec.makeMeasureSpec((layoutParams5.cellsUsed * i11) + layoutParams5.extraPixels, BasicMeasure.EXACTLY), childMeasureSpec);
|
||||
}
|
||||
}
|
||||
}
|
||||
setMeasuredDimension(i4, i3 != 1073741824 ? i5 : i20);
|
||||
}
|
||||
|
||||
static int measureChildForCells(View view, int i, int i2, int i3, int i4) {
|
||||
int i5;
|
||||
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i3) - i4, View.MeasureSpec.getMode(i3));
|
||||
ActionMenuItemView actionMenuItemView = view instanceof ActionMenuItemView ? (ActionMenuItemView) view : null;
|
||||
boolean z = actionMenuItemView != null && actionMenuItemView.hasText();
|
||||
if (i2 > 0) {
|
||||
i5 = 2;
|
||||
if (!z || i2 >= 2) {
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i2 * i, Integer.MIN_VALUE), makeMeasureSpec);
|
||||
int measuredWidth = view.getMeasuredWidth();
|
||||
int i6 = measuredWidth / i;
|
||||
if (measuredWidth % i != 0) {
|
||||
i6++;
|
||||
}
|
||||
if (!z || i6 >= 2) {
|
||||
i5 = i6;
|
||||
}
|
||||
layoutParams.expandable = layoutParams.isOverflowButton && z;
|
||||
layoutParams.cellsUsed = i5;
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i * i5, BasicMeasure.EXACTLY), makeMeasureSpec);
|
||||
return i5;
|
||||
}
|
||||
}
|
||||
i5 = 0;
|
||||
layoutParams.expandable = layoutParams.isOverflowButton && z;
|
||||
layoutParams.cellsUsed = i5;
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i * i5, BasicMeasure.EXACTLY), makeMeasureSpec);
|
||||
return i5;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
int width;
|
||||
int i5;
|
||||
if (!this.mFormatItems) {
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
return;
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
int i6 = (i4 - i2) / 2;
|
||||
int dividerWidth = getDividerWidth();
|
||||
int i7 = i3 - i;
|
||||
int paddingRight = (i7 - getPaddingRight()) - getPaddingLeft();
|
||||
boolean isLayoutRtl = ViewUtils.isLayoutRtl(this);
|
||||
int i8 = 0;
|
||||
int i9 = 0;
|
||||
for (int i10 = 0; i10 < childCount; i10++) {
|
||||
View childAt = getChildAt(i10);
|
||||
if (childAt.getVisibility() != 8) {
|
||||
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
||||
if (layoutParams.isOverflowButton) {
|
||||
int measuredWidth = childAt.getMeasuredWidth();
|
||||
if (hasSupportDividerBeforeChildAt(i10)) {
|
||||
measuredWidth += dividerWidth;
|
||||
}
|
||||
int measuredHeight = childAt.getMeasuredHeight();
|
||||
if (isLayoutRtl) {
|
||||
i5 = getPaddingLeft() + layoutParams.leftMargin;
|
||||
width = i5 + measuredWidth;
|
||||
} else {
|
||||
width = (getWidth() - getPaddingRight()) - layoutParams.rightMargin;
|
||||
i5 = width - measuredWidth;
|
||||
}
|
||||
int i11 = i6 - (measuredHeight / 2);
|
||||
childAt.layout(i5, i11, width, measuredHeight + i11);
|
||||
paddingRight -= measuredWidth;
|
||||
i8 = 1;
|
||||
} else {
|
||||
paddingRight -= (childAt.getMeasuredWidth() + layoutParams.leftMargin) + layoutParams.rightMargin;
|
||||
hasSupportDividerBeforeChildAt(i10);
|
||||
i9++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (childCount == 1 && i8 == 0) {
|
||||
View childAt2 = getChildAt(0);
|
||||
int measuredWidth2 = childAt2.getMeasuredWidth();
|
||||
int measuredHeight2 = childAt2.getMeasuredHeight();
|
||||
int i12 = (i7 / 2) - (measuredWidth2 / 2);
|
||||
int i13 = i6 - (measuredHeight2 / 2);
|
||||
childAt2.layout(i12, i13, measuredWidth2 + i12, measuredHeight2 + i13);
|
||||
return;
|
||||
}
|
||||
int i14 = i9 - (i8 ^ 1);
|
||||
int max = Math.max(0, i14 > 0 ? paddingRight / i14 : 0);
|
||||
if (isLayoutRtl) {
|
||||
int width2 = getWidth() - getPaddingRight();
|
||||
for (int i15 = 0; i15 < childCount; i15++) {
|
||||
View childAt3 = getChildAt(i15);
|
||||
LayoutParams layoutParams2 = (LayoutParams) childAt3.getLayoutParams();
|
||||
if (childAt3.getVisibility() != 8 && !layoutParams2.isOverflowButton) {
|
||||
int i16 = width2 - layoutParams2.rightMargin;
|
||||
int measuredWidth3 = childAt3.getMeasuredWidth();
|
||||
int measuredHeight3 = childAt3.getMeasuredHeight();
|
||||
int i17 = i6 - (measuredHeight3 / 2);
|
||||
childAt3.layout(i16 - measuredWidth3, i17, i16, measuredHeight3 + i17);
|
||||
width2 = i16 - ((measuredWidth3 + layoutParams2.leftMargin) + max);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
int paddingLeft = getPaddingLeft();
|
||||
for (int i18 = 0; i18 < childCount; i18++) {
|
||||
View childAt4 = getChildAt(i18);
|
||||
LayoutParams layoutParams3 = (LayoutParams) childAt4.getLayoutParams();
|
||||
if (childAt4.getVisibility() != 8 && !layoutParams3.isOverflowButton) {
|
||||
int i19 = paddingLeft + layoutParams3.leftMargin;
|
||||
int measuredWidth4 = childAt4.getMeasuredWidth();
|
||||
int measuredHeight4 = childAt4.getMeasuredHeight();
|
||||
int i20 = i6 - (measuredHeight4 / 2);
|
||||
childAt4.layout(i19, i20, i19 + measuredWidth4, measuredHeight4 + i20);
|
||||
paddingLeft = i19 + measuredWidth4 + layoutParams3.rightMargin + max;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
dismissPopupMenus();
|
||||
}
|
||||
|
||||
public void setOverflowIcon(Drawable drawable) {
|
||||
getMenu();
|
||||
this.mPresenter.setOverflowIcon(drawable);
|
||||
}
|
||||
|
||||
public Drawable getOverflowIcon() {
|
||||
getMenu();
|
||||
return this.mPresenter.getOverflowIcon();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
||||
public LayoutParams generateDefaultLayoutParams() {
|
||||
LayoutParams layoutParams = new LayoutParams(-2, -2);
|
||||
layoutParams.gravity = 16;
|
||||
return layoutParams;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
||||
public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
||||
return new LayoutParams(getContext(), attributeSet);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
||||
public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
LayoutParams layoutParams2;
|
||||
if (layoutParams != null) {
|
||||
if (layoutParams instanceof LayoutParams) {
|
||||
layoutParams2 = new LayoutParams((LayoutParams) layoutParams);
|
||||
} else {
|
||||
layoutParams2 = new LayoutParams(layoutParams);
|
||||
}
|
||||
if (layoutParams2.gravity <= 0) {
|
||||
layoutParams2.gravity = 16;
|
||||
}
|
||||
return layoutParams2;
|
||||
}
|
||||
return generateDefaultLayoutParams();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return layoutParams instanceof LayoutParams;
|
||||
}
|
||||
|
||||
public LayoutParams generateOverflowButtonLayoutParams() {
|
||||
LayoutParams generateDefaultLayoutParams = generateDefaultLayoutParams();
|
||||
generateDefaultLayoutParams.isOverflowButton = true;
|
||||
return generateDefaultLayoutParams;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.ItemInvoker
|
||||
public boolean invokeItem(MenuItemImpl menuItemImpl) {
|
||||
return this.mMenu.performItemAction(menuItemImpl, 0);
|
||||
}
|
||||
|
||||
public Menu getMenu() {
|
||||
if (this.mMenu == null) {
|
||||
Context context = getContext();
|
||||
MenuBuilder menuBuilder = new MenuBuilder(context);
|
||||
this.mMenu = menuBuilder;
|
||||
menuBuilder.setCallback(new MenuBuilderCallback());
|
||||
ActionMenuPresenter actionMenuPresenter = new ActionMenuPresenter(context);
|
||||
this.mPresenter = actionMenuPresenter;
|
||||
actionMenuPresenter.setReserveOverflow(true);
|
||||
ActionMenuPresenter actionMenuPresenter2 = this.mPresenter;
|
||||
MenuPresenter.Callback callback = this.mActionMenuPresenterCallback;
|
||||
if (callback == null) {
|
||||
callback = new ActionMenuPresenterCallback();
|
||||
}
|
||||
actionMenuPresenter2.setCallback(callback);
|
||||
this.mMenu.addMenuPresenter(this.mPresenter, this.mPopupContext);
|
||||
this.mPresenter.setMenuView(this);
|
||||
}
|
||||
return this.mMenu;
|
||||
}
|
||||
|
||||
public boolean showOverflowMenu() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.showOverflowMenu();
|
||||
}
|
||||
|
||||
public boolean hideOverflowMenu() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.hideOverflowMenu();
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowing() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.isOverflowMenuShowing();
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowPending() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.isOverflowMenuShowPending();
|
||||
}
|
||||
|
||||
public void dismissPopupMenus() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.dismissPopupMenus();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean hasSupportDividerBeforeChildAt(int i) {
|
||||
boolean z = false;
|
||||
if (i == 0) {
|
||||
return false;
|
||||
}
|
||||
KeyEvent.Callback childAt = getChildAt(i - 1);
|
||||
KeyEvent.Callback childAt2 = getChildAt(i);
|
||||
if (i < getChildCount() && (childAt instanceof ActionMenuChildView)) {
|
||||
z = ((ActionMenuChildView) childAt).needsDividerAfter();
|
||||
}
|
||||
return (i <= 0 || !(childAt2 instanceof ActionMenuChildView)) ? z : z | ((ActionMenuChildView) childAt2).needsDividerBefore();
|
||||
}
|
||||
|
||||
public void setExpandedActionViewsExclusive(boolean z) {
|
||||
this.mPresenter.setExpandedActionViewsExclusive(z);
|
||||
}
|
||||
|
||||
private class MenuBuilderCallback implements MenuBuilder.Callback {
|
||||
MenuBuilderCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public boolean onMenuItemSelected(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
return ActionMenuView.this.mOnMenuItemClickListener != null && ActionMenuView.this.mOnMenuItemClickListener.onMenuItemClick(menuItem);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public void onMenuModeChange(MenuBuilder menuBuilder) {
|
||||
if (ActionMenuView.this.mMenuBuilderCallback != null) {
|
||||
ActionMenuView.this.mMenuBuilderCallback.onMenuModeChange(menuBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ActionMenuPresenterCallback implements MenuPresenter.Callback {
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public boolean onOpenSubMenu(MenuBuilder menuBuilder) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionMenuPresenterCallback() {
|
||||
}
|
||||
}
|
||||
|
||||
public static class LayoutParams extends LinearLayoutCompat.LayoutParams {
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public int cellsUsed;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public boolean expandable;
|
||||
boolean expanded;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public int extraPixels;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public boolean isOverflowButton;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public boolean preventEdgeOffset;
|
||||
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
super(layoutParams);
|
||||
}
|
||||
|
||||
public LayoutParams(LayoutParams layoutParams) {
|
||||
super((ViewGroup.LayoutParams) layoutParams);
|
||||
this.isOverflowButton = layoutParams.isOverflowButton;
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2) {
|
||||
super(i, i2);
|
||||
this.isOverflowButton = false;
|
||||
}
|
||||
|
||||
LayoutParams(int i, int i2, boolean z) {
|
||||
super(i, i2);
|
||||
this.isOverflowButton = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,504 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.database.DataSetObservable;
|
||||
import android.os.AsyncTask;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ActivityChooserModel extends DataSetObservable {
|
||||
static final String ATTRIBUTE_ACTIVITY = "activity";
|
||||
static final String ATTRIBUTE_TIME = "time";
|
||||
static final String ATTRIBUTE_WEIGHT = "weight";
|
||||
static final boolean DEBUG = false;
|
||||
private static final int DEFAULT_ACTIVITY_INFLATION = 5;
|
||||
private static final float DEFAULT_HISTORICAL_RECORD_WEIGHT = 1.0f;
|
||||
public static final String DEFAULT_HISTORY_FILE_NAME = "activity_choser_model_history.xml";
|
||||
public static final int DEFAULT_HISTORY_MAX_LENGTH = 50;
|
||||
private static final String HISTORY_FILE_EXTENSION = ".xml";
|
||||
private static final int INVALID_INDEX = -1;
|
||||
static final String LOG_TAG = "ActivityChooserModel";
|
||||
static final String TAG_HISTORICAL_RECORD = "historical-record";
|
||||
static final String TAG_HISTORICAL_RECORDS = "historical-records";
|
||||
private OnChooseActivityListener mActivityChoserModelPolicy;
|
||||
final Context mContext;
|
||||
final String mHistoryFileName;
|
||||
private Intent mIntent;
|
||||
private static final Object sRegistryLock = new Object();
|
||||
private static final Map<String, ActivityChooserModel> sDataModelRegistry = new HashMap();
|
||||
private final Object mInstanceLock = new Object();
|
||||
private final List<ActivityResolveInfo> mActivities = new ArrayList();
|
||||
private final List<HistoricalRecord> mHistoricalRecords = new ArrayList();
|
||||
private ActivitySorter mActivitySorter = new DefaultSorter();
|
||||
private int mHistoryMaxSize = 50;
|
||||
boolean mCanReadHistoricalData = true;
|
||||
private boolean mReadShareHistoryCalled = false;
|
||||
private boolean mHistoricalRecordsChanged = true;
|
||||
private boolean mReloadActivities = false;
|
||||
|
||||
public interface ActivityChooserModelClient {
|
||||
void setActivityChooserModel(ActivityChooserModel activityChooserModel);
|
||||
}
|
||||
|
||||
public interface ActivitySorter {
|
||||
void sort(Intent intent, List<ActivityResolveInfo> list, List<HistoricalRecord> list2);
|
||||
}
|
||||
|
||||
public interface OnChooseActivityListener {
|
||||
boolean onChooseActivity(ActivityChooserModel activityChooserModel, Intent intent);
|
||||
}
|
||||
|
||||
public static ActivityChooserModel get(Context context, String str) {
|
||||
ActivityChooserModel activityChooserModel;
|
||||
synchronized (sRegistryLock) {
|
||||
Map<String, ActivityChooserModel> map = sDataModelRegistry;
|
||||
activityChooserModel = map.get(str);
|
||||
if (activityChooserModel == null) {
|
||||
activityChooserModel = new ActivityChooserModel(context, str);
|
||||
map.put(str, activityChooserModel);
|
||||
}
|
||||
}
|
||||
return activityChooserModel;
|
||||
}
|
||||
|
||||
private ActivityChooserModel(Context context, String str) {
|
||||
this.mContext = context.getApplicationContext();
|
||||
if (TextUtils.isEmpty(str) || str.endsWith(HISTORY_FILE_EXTENSION)) {
|
||||
this.mHistoryFileName = str;
|
||||
return;
|
||||
}
|
||||
this.mHistoryFileName = str + HISTORY_FILE_EXTENSION;
|
||||
}
|
||||
|
||||
public void setIntent(Intent intent) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
if (this.mIntent == intent) {
|
||||
return;
|
||||
}
|
||||
this.mIntent = intent;
|
||||
this.mReloadActivities = true;
|
||||
ensureConsistentState();
|
||||
}
|
||||
}
|
||||
|
||||
public Intent getIntent() {
|
||||
Intent intent;
|
||||
synchronized (this.mInstanceLock) {
|
||||
intent = this.mIntent;
|
||||
}
|
||||
return intent;
|
||||
}
|
||||
|
||||
public int getActivityCount() {
|
||||
int size;
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
size = this.mActivities.size();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public ResolveInfo getActivity(int i) {
|
||||
ResolveInfo resolveInfo;
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
resolveInfo = this.mActivities.get(i).resolveInfo;
|
||||
}
|
||||
return resolveInfo;
|
||||
}
|
||||
|
||||
public int getActivityIndex(ResolveInfo resolveInfo) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
List<ActivityResolveInfo> list = this.mActivities;
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (list.get(i).resolveInfo == resolveInfo) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public Intent chooseActivity(int i) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
if (this.mIntent == null) {
|
||||
return null;
|
||||
}
|
||||
ensureConsistentState();
|
||||
ActivityResolveInfo activityResolveInfo = this.mActivities.get(i);
|
||||
ComponentName componentName = new ComponentName(activityResolveInfo.resolveInfo.activityInfo.packageName, activityResolveInfo.resolveInfo.activityInfo.name);
|
||||
Intent intent = new Intent(this.mIntent);
|
||||
intent.setComponent(componentName);
|
||||
if (this.mActivityChoserModelPolicy != null) {
|
||||
if (this.mActivityChoserModelPolicy.onChooseActivity(this, new Intent(intent))) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
addHistoricalRecord(new HistoricalRecord(componentName, System.currentTimeMillis(), 1.0f));
|
||||
return intent;
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnChooseActivityListener(OnChooseActivityListener onChooseActivityListener) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
this.mActivityChoserModelPolicy = onChooseActivityListener;
|
||||
}
|
||||
}
|
||||
|
||||
public ResolveInfo getDefaultActivity() {
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
if (this.mActivities.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return this.mActivities.get(0).resolveInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefaultActivity(int i) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
ActivityResolveInfo activityResolveInfo = this.mActivities.get(i);
|
||||
ActivityResolveInfo activityResolveInfo2 = this.mActivities.get(0);
|
||||
addHistoricalRecord(new HistoricalRecord(new ComponentName(activityResolveInfo.resolveInfo.activityInfo.packageName, activityResolveInfo.resolveInfo.activityInfo.name), System.currentTimeMillis(), activityResolveInfo2 != null ? (activityResolveInfo2.weight - activityResolveInfo.weight) + 5.0f : 1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
private void persistHistoricalDataIfNeeded() {
|
||||
if (!this.mReadShareHistoryCalled) {
|
||||
throw new IllegalStateException("No preceding call to #readHistoricalData");
|
||||
}
|
||||
if (this.mHistoricalRecordsChanged) {
|
||||
this.mHistoricalRecordsChanged = false;
|
||||
if (TextUtils.isEmpty(this.mHistoryFileName)) {
|
||||
return;
|
||||
}
|
||||
new PersistHistoryAsyncTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new ArrayList(this.mHistoricalRecords), this.mHistoryFileName);
|
||||
}
|
||||
}
|
||||
|
||||
public void setActivitySorter(ActivitySorter activitySorter) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
if (this.mActivitySorter == activitySorter) {
|
||||
return;
|
||||
}
|
||||
this.mActivitySorter = activitySorter;
|
||||
if (sortActivitiesIfNeeded()) {
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setHistoryMaxSize(int i) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
if (this.mHistoryMaxSize == i) {
|
||||
return;
|
||||
}
|
||||
this.mHistoryMaxSize = i;
|
||||
pruneExcessiveHistoricalRecordsIfNeeded();
|
||||
if (sortActivitiesIfNeeded()) {
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getHistoryMaxSize() {
|
||||
int i;
|
||||
synchronized (this.mInstanceLock) {
|
||||
i = this.mHistoryMaxSize;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getHistorySize() {
|
||||
int size;
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
size = this.mHistoricalRecords.size();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
private void ensureConsistentState() {
|
||||
boolean loadActivitiesIfNeeded = loadActivitiesIfNeeded() | readHistoricalDataIfNeeded();
|
||||
pruneExcessiveHistoricalRecordsIfNeeded();
|
||||
if (loadActivitiesIfNeeded) {
|
||||
sortActivitiesIfNeeded();
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean sortActivitiesIfNeeded() {
|
||||
if (this.mActivitySorter == null || this.mIntent == null || this.mActivities.isEmpty() || this.mHistoricalRecords.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
this.mActivitySorter.sort(this.mIntent, this.mActivities, Collections.unmodifiableList(this.mHistoricalRecords));
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean loadActivitiesIfNeeded() {
|
||||
if (!this.mReloadActivities || this.mIntent == null) {
|
||||
return false;
|
||||
}
|
||||
this.mReloadActivities = false;
|
||||
this.mActivities.clear();
|
||||
List<ResolveInfo> queryIntentActivities = this.mContext.getPackageManager().queryIntentActivities(this.mIntent, 0);
|
||||
int size = queryIntentActivities.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.mActivities.add(new ActivityResolveInfo(queryIntentActivities.get(i)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean readHistoricalDataIfNeeded() {
|
||||
if (!this.mCanReadHistoricalData || !this.mHistoricalRecordsChanged || TextUtils.isEmpty(this.mHistoryFileName)) {
|
||||
return false;
|
||||
}
|
||||
this.mCanReadHistoricalData = false;
|
||||
this.mReadShareHistoryCalled = true;
|
||||
readHistoricalDataImpl();
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean addHistoricalRecord(HistoricalRecord historicalRecord) {
|
||||
boolean add = this.mHistoricalRecords.add(historicalRecord);
|
||||
if (add) {
|
||||
this.mHistoricalRecordsChanged = true;
|
||||
pruneExcessiveHistoricalRecordsIfNeeded();
|
||||
persistHistoricalDataIfNeeded();
|
||||
sortActivitiesIfNeeded();
|
||||
notifyChanged();
|
||||
}
|
||||
return add;
|
||||
}
|
||||
|
||||
private void pruneExcessiveHistoricalRecordsIfNeeded() {
|
||||
int size = this.mHistoricalRecords.size() - this.mHistoryMaxSize;
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
this.mHistoricalRecordsChanged = true;
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.mHistoricalRecords.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class HistoricalRecord {
|
||||
public final ComponentName activity;
|
||||
public final long time;
|
||||
public final float weight;
|
||||
|
||||
public HistoricalRecord(String str, long j, float f) {
|
||||
this(ComponentName.unflattenFromString(str), j, f);
|
||||
}
|
||||
|
||||
public HistoricalRecord(ComponentName componentName, long j, float f) {
|
||||
this.activity = componentName;
|
||||
this.time = j;
|
||||
this.weight = f;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
ComponentName componentName = this.activity;
|
||||
int hashCode = componentName == null ? 0 : componentName.hashCode();
|
||||
long j = this.time;
|
||||
return ((((hashCode + 31) * 31) + ((int) (j ^ (j >>> 32)))) * 31) + Float.floatToIntBits(this.weight);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
HistoricalRecord historicalRecord = (HistoricalRecord) obj;
|
||||
ComponentName componentName = this.activity;
|
||||
if (componentName == null) {
|
||||
if (historicalRecord.activity != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!componentName.equals(historicalRecord.activity)) {
|
||||
return false;
|
||||
}
|
||||
return this.time == historicalRecord.time && Float.floatToIntBits(this.weight) == Float.floatToIntBits(historicalRecord.weight);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[; activity:" + this.activity + "; time:" + this.time + "; weight:" + new BigDecimal(this.weight) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public static final class ActivityResolveInfo implements Comparable<ActivityResolveInfo> {
|
||||
public final ResolveInfo resolveInfo;
|
||||
public float weight;
|
||||
|
||||
public ActivityResolveInfo(ResolveInfo resolveInfo) {
|
||||
this.resolveInfo = resolveInfo;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return Float.floatToIntBits(this.weight) + 31;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
return obj != null && getClass() == obj.getClass() && Float.floatToIntBits(this.weight) == Float.floatToIntBits(((ActivityResolveInfo) obj).weight);
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(ActivityResolveInfo activityResolveInfo) {
|
||||
return Float.floatToIntBits(activityResolveInfo.weight) - Float.floatToIntBits(this.weight);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[resolveInfo:" + this.resolveInfo.toString() + "; weight:" + new BigDecimal(this.weight) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
private static final class DefaultSorter implements ActivitySorter {
|
||||
private static final float WEIGHT_DECAY_COEFFICIENT = 0.95f;
|
||||
private final Map<ComponentName, ActivityResolveInfo> mPackageNameToActivityMap = new HashMap();
|
||||
|
||||
DefaultSorter() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActivityChooserModel.ActivitySorter
|
||||
public void sort(Intent intent, List<ActivityResolveInfo> list, List<HistoricalRecord> list2) {
|
||||
Map<ComponentName, ActivityResolveInfo> map = this.mPackageNameToActivityMap;
|
||||
map.clear();
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ActivityResolveInfo activityResolveInfo = list.get(i);
|
||||
activityResolveInfo.weight = 0.0f;
|
||||
map.put(new ComponentName(activityResolveInfo.resolveInfo.activityInfo.packageName, activityResolveInfo.resolveInfo.activityInfo.name), activityResolveInfo);
|
||||
}
|
||||
float f = 1.0f;
|
||||
for (int size2 = list2.size() - 1; size2 >= 0; size2--) {
|
||||
HistoricalRecord historicalRecord = list2.get(size2);
|
||||
ActivityResolveInfo activityResolveInfo2 = map.get(historicalRecord.activity);
|
||||
if (activityResolveInfo2 != null) {
|
||||
activityResolveInfo2.weight += historicalRecord.weight * f;
|
||||
f *= WEIGHT_DECAY_COEFFICIENT;
|
||||
}
|
||||
}
|
||||
Collections.sort(list);
|
||||
}
|
||||
}
|
||||
|
||||
private void readHistoricalDataImpl() {
|
||||
XmlPullParser newPullParser;
|
||||
try {
|
||||
FileInputStream openFileInput = this.mContext.openFileInput(this.mHistoryFileName);
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
newPullParser = Xml.newPullParser();
|
||||
newPullParser.setInput(openFileInput, "UTF-8");
|
||||
for (int i = 0; i != 1 && i != 2; i = newPullParser.next()) {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(LOG_TAG, "Error reading historical recrod file: " + this.mHistoryFileName, e);
|
||||
if (openFileInput == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (XmlPullParserException e2) {
|
||||
Log.e(LOG_TAG, "Error reading historical recrod file: " + this.mHistoryFileName, e2);
|
||||
if (openFileInput == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!TAG_HISTORICAL_RECORDS.equals(newPullParser.getName())) {
|
||||
throw new XmlPullParserException("Share records file does not start with historical-records tag.");
|
||||
}
|
||||
List<HistoricalRecord> list = this.mHistoricalRecords;
|
||||
list.clear();
|
||||
while (true) {
|
||||
int next = newPullParser.next();
|
||||
if (next == 1) {
|
||||
if (openFileInput == null) {
|
||||
return;
|
||||
}
|
||||
} else if (next != 3 && next != 4) {
|
||||
if (!TAG_HISTORICAL_RECORD.equals(newPullParser.getName())) {
|
||||
throw new XmlPullParserException("Share records file not well-formed.");
|
||||
}
|
||||
list.add(new HistoricalRecord(newPullParser.getAttributeValue(null, ATTRIBUTE_ACTIVITY), Long.parseLong(newPullParser.getAttributeValue(null, ATTRIBUTE_TIME)), Float.parseFloat(newPullParser.getAttributeValue(null, ATTRIBUTE_WEIGHT))));
|
||||
}
|
||||
}
|
||||
try {
|
||||
openFileInput.close();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (openFileInput != null) {
|
||||
try {
|
||||
openFileInput.close();
|
||||
} catch (IOException unused2) {
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (FileNotFoundException unused3) {
|
||||
}
|
||||
}
|
||||
|
||||
private final class PersistHistoryAsyncTask extends AsyncTask<Object, Void, Void> {
|
||||
PersistHistoryAsyncTask() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:12:0x006d, code lost:
|
||||
|
||||
if (r15 != null) goto L43;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:16:0x006f, code lost:
|
||||
|
||||
r15.close();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:31:0x00b2, code lost:
|
||||
|
||||
if (r15 == null) goto L30;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:35:0x0092, code lost:
|
||||
|
||||
if (r15 == null) goto L30;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:39:0x00d2, code lost:
|
||||
|
||||
if (r15 == null) goto L30;
|
||||
*/
|
||||
@Override // android.os.AsyncTask
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public java.lang.Void doInBackground(java.lang.Object... r15) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 243
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActivityChooserModel.PersistHistoryAsyncTask.doInBackground(java.lang.Object[]):java.lang.Void");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,588 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.menu.ShowableListMenu;
|
||||
import androidx.appcompat.widget.ActivityChooserModel;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
import androidx.core.view.ActionProvider;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActivityChooserView extends ViewGroup implements ActivityChooserModel.ActivityChooserModelClient {
|
||||
private final View mActivityChooserContent;
|
||||
private final Drawable mActivityChooserContentBackground;
|
||||
final ActivityChooserViewAdapter mAdapter;
|
||||
private final Callbacks mCallbacks;
|
||||
private int mDefaultActionButtonContentDescription;
|
||||
final FrameLayout mDefaultActivityButton;
|
||||
private final ImageView mDefaultActivityButtonImage;
|
||||
final FrameLayout mExpandActivityOverflowButton;
|
||||
private final ImageView mExpandActivityOverflowButtonImage;
|
||||
int mInitialActivityCount;
|
||||
private boolean mIsAttachedToWindow;
|
||||
boolean mIsSelectingDefaultActivity;
|
||||
private final int mListPopupMaxWidth;
|
||||
private ListPopupWindow mListPopupWindow;
|
||||
final DataSetObserver mModelDataSetObserver;
|
||||
PopupWindow.OnDismissListener mOnDismissListener;
|
||||
private final ViewTreeObserver.OnGlobalLayoutListener mOnGlobalLayoutListener;
|
||||
ActionProvider mProvider;
|
||||
|
||||
public void setDefaultActionButtonContentDescription(int i) {
|
||||
this.mDefaultActionButtonContentDescription = i;
|
||||
}
|
||||
|
||||
public void setInitialActivityCount(int i) {
|
||||
this.mInitialActivityCount = i;
|
||||
}
|
||||
|
||||
public void setOnDismissListener(PopupWindow.OnDismissListener onDismissListener) {
|
||||
this.mOnDismissListener = onDismissListener;
|
||||
}
|
||||
|
||||
public void setProvider(ActionProvider actionProvider) {
|
||||
this.mProvider = actionProvider;
|
||||
}
|
||||
|
||||
public ActivityChooserView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActivityChooserView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public ActivityChooserView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.mModelDataSetObserver = new DataSetObserver() { // from class: androidx.appcompat.widget.ActivityChooserView.1
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onChanged() {
|
||||
super.onChanged();
|
||||
ActivityChooserView.this.mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onInvalidated() {
|
||||
super.onInvalidated();
|
||||
ActivityChooserView.this.mAdapter.notifyDataSetInvalidated();
|
||||
}
|
||||
};
|
||||
this.mOnGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { // from class: androidx.appcompat.widget.ActivityChooserView.2
|
||||
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
||||
public void onGlobalLayout() {
|
||||
if (ActivityChooserView.this.isShowingPopup()) {
|
||||
if (!ActivityChooserView.this.isShown()) {
|
||||
ActivityChooserView.this.getListPopupWindow().dismiss();
|
||||
return;
|
||||
}
|
||||
ActivityChooserView.this.getListPopupWindow().show();
|
||||
if (ActivityChooserView.this.mProvider != null) {
|
||||
ActivityChooserView.this.mProvider.subUiVisibilityChanged(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.mInitialActivityCount = 4;
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ActivityChooserView, i, 0);
|
||||
ViewCompat.saveAttributeDataForStyleable(this, context, R.styleable.ActivityChooserView, attributeSet, obtainStyledAttributes, i, 0);
|
||||
this.mInitialActivityCount = obtainStyledAttributes.getInt(R.styleable.ActivityChooserView_initialActivityCount, 4);
|
||||
Drawable drawable = obtainStyledAttributes.getDrawable(R.styleable.ActivityChooserView_expandActivityOverflowButtonDrawable);
|
||||
obtainStyledAttributes.recycle();
|
||||
LayoutInflater.from(getContext()).inflate(R.layout.abc_activity_chooser_view, (ViewGroup) this, true);
|
||||
Callbacks callbacks = new Callbacks();
|
||||
this.mCallbacks = callbacks;
|
||||
View findViewById = findViewById(R.id.activity_chooser_view_content);
|
||||
this.mActivityChooserContent = findViewById;
|
||||
this.mActivityChooserContentBackground = findViewById.getBackground();
|
||||
FrameLayout frameLayout = (FrameLayout) findViewById(R.id.default_activity_button);
|
||||
this.mDefaultActivityButton = frameLayout;
|
||||
frameLayout.setOnClickListener(callbacks);
|
||||
frameLayout.setOnLongClickListener(callbacks);
|
||||
this.mDefaultActivityButtonImage = (ImageView) frameLayout.findViewById(R.id.image);
|
||||
FrameLayout frameLayout2 = (FrameLayout) findViewById(R.id.expand_activities_button);
|
||||
frameLayout2.setOnClickListener(callbacks);
|
||||
frameLayout2.setAccessibilityDelegate(new View.AccessibilityDelegate() { // from class: androidx.appcompat.widget.ActivityChooserView.3
|
||||
@Override // android.view.View.AccessibilityDelegate
|
||||
public void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfo accessibilityNodeInfo) {
|
||||
super.onInitializeAccessibilityNodeInfo(view, accessibilityNodeInfo);
|
||||
AccessibilityNodeInfoCompat.wrap(accessibilityNodeInfo).setCanOpenPopup(true);
|
||||
}
|
||||
});
|
||||
frameLayout2.setOnTouchListener(new ForwardingListener(frameLayout2) { // from class: androidx.appcompat.widget.ActivityChooserView.4
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public ShowableListMenu getPopup() {
|
||||
return ActivityChooserView.this.getListPopupWindow();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
protected boolean onForwardingStarted() {
|
||||
ActivityChooserView.this.showPopup();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
protected boolean onForwardingStopped() {
|
||||
ActivityChooserView.this.dismissPopup();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
this.mExpandActivityOverflowButton = frameLayout2;
|
||||
ImageView imageView = (ImageView) frameLayout2.findViewById(R.id.image);
|
||||
this.mExpandActivityOverflowButtonImage = imageView;
|
||||
imageView.setImageDrawable(drawable);
|
||||
ActivityChooserViewAdapter activityChooserViewAdapter = new ActivityChooserViewAdapter();
|
||||
this.mAdapter = activityChooserViewAdapter;
|
||||
activityChooserViewAdapter.registerDataSetObserver(new DataSetObserver() { // from class: androidx.appcompat.widget.ActivityChooserView.5
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onChanged() {
|
||||
super.onChanged();
|
||||
ActivityChooserView.this.updateAppearance();
|
||||
}
|
||||
});
|
||||
Resources resources = context.getResources();
|
||||
this.mListPopupMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2, resources.getDimensionPixelSize(R.dimen.abc_config_prefDialogWidth));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActivityChooserModel.ActivityChooserModelClient
|
||||
public void setActivityChooserModel(ActivityChooserModel activityChooserModel) {
|
||||
this.mAdapter.setDataModel(activityChooserModel);
|
||||
if (isShowingPopup()) {
|
||||
dismissPopup();
|
||||
showPopup();
|
||||
}
|
||||
}
|
||||
|
||||
public void setExpandActivityOverflowButtonDrawable(Drawable drawable) {
|
||||
this.mExpandActivityOverflowButtonImage.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
public void setExpandActivityOverflowButtonContentDescription(int i) {
|
||||
this.mExpandActivityOverflowButtonImage.setContentDescription(getContext().getString(i));
|
||||
}
|
||||
|
||||
public boolean showPopup() {
|
||||
if (isShowingPopup() || !this.mIsAttachedToWindow) {
|
||||
return false;
|
||||
}
|
||||
this.mIsSelectingDefaultActivity = false;
|
||||
showPopupUnchecked(this.mInitialActivityCount);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Type inference failed for: r0v15 */
|
||||
/* JADX WARN: Type inference failed for: r0v6 */
|
||||
/* JADX WARN: Type inference failed for: r0v7, types: [boolean, int] */
|
||||
void showPopupUnchecked(int i) {
|
||||
if (this.mAdapter.getDataModel() == null) {
|
||||
throw new IllegalStateException("No data model. Did you call #setDataModel?");
|
||||
}
|
||||
getViewTreeObserver().addOnGlobalLayoutListener(this.mOnGlobalLayoutListener);
|
||||
?? r0 = this.mDefaultActivityButton.getVisibility() == 0 ? 1 : 0;
|
||||
int activityCount = this.mAdapter.getActivityCount();
|
||||
if (i != Integer.MAX_VALUE && activityCount > i + r0) {
|
||||
this.mAdapter.setShowFooterView(true);
|
||||
this.mAdapter.setMaxActivityCount(i - 1);
|
||||
} else {
|
||||
this.mAdapter.setShowFooterView(false);
|
||||
this.mAdapter.setMaxActivityCount(i);
|
||||
}
|
||||
ListPopupWindow listPopupWindow = getListPopupWindow();
|
||||
if (listPopupWindow.isShowing()) {
|
||||
return;
|
||||
}
|
||||
if (this.mIsSelectingDefaultActivity || r0 == 0) {
|
||||
this.mAdapter.setShowDefaultActivity(true, r0);
|
||||
} else {
|
||||
this.mAdapter.setShowDefaultActivity(false, false);
|
||||
}
|
||||
listPopupWindow.setContentWidth(Math.min(this.mAdapter.measureContentWidth(), this.mListPopupMaxWidth));
|
||||
listPopupWindow.show();
|
||||
ActionProvider actionProvider = this.mProvider;
|
||||
if (actionProvider != null) {
|
||||
actionProvider.subUiVisibilityChanged(true);
|
||||
}
|
||||
listPopupWindow.getListView().setContentDescription(getContext().getString(R.string.abc_activitychooserview_choose_application));
|
||||
listPopupWindow.getListView().setSelector(new ColorDrawable(0));
|
||||
}
|
||||
|
||||
public boolean dismissPopup() {
|
||||
if (!isShowingPopup()) {
|
||||
return true;
|
||||
}
|
||||
getListPopupWindow().dismiss();
|
||||
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
|
||||
if (!viewTreeObserver.isAlive()) {
|
||||
return true;
|
||||
}
|
||||
viewTreeObserver.removeGlobalOnLayoutListener(this.mOnGlobalLayoutListener);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isShowingPopup() {
|
||||
return getListPopupWindow().isShowing();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
ActivityChooserModel dataModel = this.mAdapter.getDataModel();
|
||||
if (dataModel != null) {
|
||||
dataModel.registerObserver(this.mModelDataSetObserver);
|
||||
}
|
||||
this.mIsAttachedToWindow = true;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
ActivityChooserModel dataModel = this.mAdapter.getDataModel();
|
||||
if (dataModel != null) {
|
||||
dataModel.unregisterObserver(this.mModelDataSetObserver);
|
||||
}
|
||||
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
|
||||
if (viewTreeObserver.isAlive()) {
|
||||
viewTreeObserver.removeGlobalOnLayoutListener(this.mOnGlobalLayoutListener);
|
||||
}
|
||||
if (isShowingPopup()) {
|
||||
dismissPopup();
|
||||
}
|
||||
this.mIsAttachedToWindow = false;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
View view = this.mActivityChooserContent;
|
||||
if (this.mDefaultActivityButton.getVisibility() != 0) {
|
||||
i2 = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i2), BasicMeasure.EXACTLY);
|
||||
}
|
||||
measureChild(view, i, i2);
|
||||
setMeasuredDimension(view.getMeasuredWidth(), view.getMeasuredHeight());
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
this.mActivityChooserContent.layout(0, 0, i3 - i, i4 - i2);
|
||||
if (isShowingPopup()) {
|
||||
return;
|
||||
}
|
||||
dismissPopup();
|
||||
}
|
||||
|
||||
public ActivityChooserModel getDataModel() {
|
||||
return this.mAdapter.getDataModel();
|
||||
}
|
||||
|
||||
ListPopupWindow getListPopupWindow() {
|
||||
if (this.mListPopupWindow == null) {
|
||||
ListPopupWindow listPopupWindow = new ListPopupWindow(getContext());
|
||||
this.mListPopupWindow = listPopupWindow;
|
||||
listPopupWindow.setAdapter(this.mAdapter);
|
||||
this.mListPopupWindow.setAnchorView(this);
|
||||
this.mListPopupWindow.setModal(true);
|
||||
this.mListPopupWindow.setOnItemClickListener(this.mCallbacks);
|
||||
this.mListPopupWindow.setOnDismissListener(this.mCallbacks);
|
||||
}
|
||||
return this.mListPopupWindow;
|
||||
}
|
||||
|
||||
void updateAppearance() {
|
||||
if (this.mAdapter.getCount() > 0) {
|
||||
this.mExpandActivityOverflowButton.setEnabled(true);
|
||||
} else {
|
||||
this.mExpandActivityOverflowButton.setEnabled(false);
|
||||
}
|
||||
int activityCount = this.mAdapter.getActivityCount();
|
||||
int historySize = this.mAdapter.getHistorySize();
|
||||
if (activityCount == 1 || (activityCount > 1 && historySize > 0)) {
|
||||
this.mDefaultActivityButton.setVisibility(0);
|
||||
ResolveInfo defaultActivity = this.mAdapter.getDefaultActivity();
|
||||
PackageManager packageManager = getContext().getPackageManager();
|
||||
this.mDefaultActivityButtonImage.setImageDrawable(defaultActivity.loadIcon(packageManager));
|
||||
if (this.mDefaultActionButtonContentDescription != 0) {
|
||||
this.mDefaultActivityButton.setContentDescription(getContext().getString(this.mDefaultActionButtonContentDescription, defaultActivity.loadLabel(packageManager)));
|
||||
}
|
||||
} else {
|
||||
this.mDefaultActivityButton.setVisibility(8);
|
||||
}
|
||||
if (this.mDefaultActivityButton.getVisibility() == 0) {
|
||||
this.mActivityChooserContent.setBackgroundDrawable(this.mActivityChooserContentBackground);
|
||||
} else {
|
||||
this.mActivityChooserContent.setBackgroundDrawable(null);
|
||||
}
|
||||
}
|
||||
|
||||
private class Callbacks implements AdapterView.OnItemClickListener, View.OnClickListener, View.OnLongClickListener, PopupWindow.OnDismissListener {
|
||||
Callbacks() {
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemClickListener
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
|
||||
int itemViewType = ((ActivityChooserViewAdapter) adapterView.getAdapter()).getItemViewType(i);
|
||||
if (itemViewType != 0) {
|
||||
if (itemViewType == 1) {
|
||||
ActivityChooserView.this.showPopupUnchecked(Integer.MAX_VALUE);
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
ActivityChooserView.this.dismissPopup();
|
||||
if (ActivityChooserView.this.mIsSelectingDefaultActivity) {
|
||||
if (i > 0) {
|
||||
ActivityChooserView.this.mAdapter.getDataModel().setDefaultActivity(i);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!ActivityChooserView.this.mAdapter.getShowDefaultActivity()) {
|
||||
i++;
|
||||
}
|
||||
Intent chooseActivity = ActivityChooserView.this.mAdapter.getDataModel().chooseActivity(i);
|
||||
if (chooseActivity != null) {
|
||||
chooseActivity.addFlags(524288);
|
||||
ActivityChooserView.this.getContext().startActivity(chooseActivity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (view == ActivityChooserView.this.mDefaultActivityButton) {
|
||||
ActivityChooserView.this.dismissPopup();
|
||||
Intent chooseActivity = ActivityChooserView.this.mAdapter.getDataModel().chooseActivity(ActivityChooserView.this.mAdapter.getDataModel().getActivityIndex(ActivityChooserView.this.mAdapter.getDefaultActivity()));
|
||||
if (chooseActivity != null) {
|
||||
chooseActivity.addFlags(524288);
|
||||
ActivityChooserView.this.getContext().startActivity(chooseActivity);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (view == ActivityChooserView.this.mExpandActivityOverflowButton) {
|
||||
ActivityChooserView.this.mIsSelectingDefaultActivity = false;
|
||||
ActivityChooserView activityChooserView = ActivityChooserView.this;
|
||||
activityChooserView.showPopupUnchecked(activityChooserView.mInitialActivityCount);
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnLongClickListener
|
||||
public boolean onLongClick(View view) {
|
||||
if (view == ActivityChooserView.this.mDefaultActivityButton) {
|
||||
if (ActivityChooserView.this.mAdapter.getCount() > 0) {
|
||||
ActivityChooserView.this.mIsSelectingDefaultActivity = true;
|
||||
ActivityChooserView activityChooserView = ActivityChooserView.this;
|
||||
activityChooserView.showPopupUnchecked(activityChooserView.mInitialActivityCount);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow.OnDismissListener
|
||||
public void onDismiss() {
|
||||
notifyOnDismissListener();
|
||||
if (ActivityChooserView.this.mProvider != null) {
|
||||
ActivityChooserView.this.mProvider.subUiVisibilityChanged(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyOnDismissListener() {
|
||||
if (ActivityChooserView.this.mOnDismissListener != null) {
|
||||
ActivityChooserView.this.mOnDismissListener.onDismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ActivityChooserViewAdapter extends BaseAdapter {
|
||||
private static final int ITEM_VIEW_TYPE_ACTIVITY = 0;
|
||||
private static final int ITEM_VIEW_TYPE_COUNT = 3;
|
||||
private static final int ITEM_VIEW_TYPE_FOOTER = 1;
|
||||
public static final int MAX_ACTIVITY_COUNT_DEFAULT = 4;
|
||||
public static final int MAX_ACTIVITY_COUNT_UNLIMITED = Integer.MAX_VALUE;
|
||||
private ActivityChooserModel mDataModel;
|
||||
private boolean mHighlightDefaultActivity;
|
||||
private int mMaxActivityCount = 4;
|
||||
private boolean mShowDefaultActivity;
|
||||
private boolean mShowFooterView;
|
||||
|
||||
public ActivityChooserModel getDataModel() {
|
||||
return this.mDataModel;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
public boolean getShowDefaultActivity() {
|
||||
return this.mShowDefaultActivity;
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter, android.widget.Adapter
|
||||
public int getViewTypeCount() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
ActivityChooserViewAdapter() {
|
||||
}
|
||||
|
||||
public void setDataModel(ActivityChooserModel activityChooserModel) {
|
||||
ActivityChooserModel dataModel = ActivityChooserView.this.mAdapter.getDataModel();
|
||||
if (dataModel != null && ActivityChooserView.this.isShown()) {
|
||||
dataModel.unregisterObserver(ActivityChooserView.this.mModelDataSetObserver);
|
||||
}
|
||||
this.mDataModel = activityChooserModel;
|
||||
if (activityChooserModel != null && ActivityChooserView.this.isShown()) {
|
||||
activityChooserModel.registerObserver(ActivityChooserView.this.mModelDataSetObserver);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter, android.widget.Adapter
|
||||
public int getItemViewType(int i) {
|
||||
return (this.mShowFooterView && i == getCount() - 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
int activityCount = this.mDataModel.getActivityCount();
|
||||
if (!this.mShowDefaultActivity && this.mDataModel.getDefaultActivity() != null) {
|
||||
activityCount--;
|
||||
}
|
||||
int min = Math.min(activityCount, this.mMaxActivityCount);
|
||||
return this.mShowFooterView ? min + 1 : min;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public Object getItem(int i) {
|
||||
int itemViewType = getItemViewType(i);
|
||||
if (itemViewType != 0) {
|
||||
if (itemViewType == 1) {
|
||||
return null;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (!this.mShowDefaultActivity && this.mDataModel.getDefaultActivity() != null) {
|
||||
i++;
|
||||
}
|
||||
return this.mDataModel.getActivity(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
int itemViewType = getItemViewType(i);
|
||||
if (itemViewType != 0) {
|
||||
if (itemViewType == 1) {
|
||||
if (view != null && view.getId() == 1) {
|
||||
return view;
|
||||
}
|
||||
View inflate = LayoutInflater.from(ActivityChooserView.this.getContext()).inflate(R.layout.abc_activity_chooser_view_list_item, viewGroup, false);
|
||||
inflate.setId(1);
|
||||
((TextView) inflate.findViewById(R.id.title)).setText(ActivityChooserView.this.getContext().getString(R.string.abc_activity_chooser_view_see_all));
|
||||
return inflate;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (view == null || view.getId() != R.id.list_item) {
|
||||
view = LayoutInflater.from(ActivityChooserView.this.getContext()).inflate(R.layout.abc_activity_chooser_view_list_item, viewGroup, false);
|
||||
}
|
||||
PackageManager packageManager = ActivityChooserView.this.getContext().getPackageManager();
|
||||
ImageView imageView = (ImageView) view.findViewById(R.id.icon);
|
||||
ResolveInfo resolveInfo = (ResolveInfo) getItem(i);
|
||||
imageView.setImageDrawable(resolveInfo.loadIcon(packageManager));
|
||||
((TextView) view.findViewById(R.id.title)).setText(resolveInfo.loadLabel(packageManager));
|
||||
if (this.mShowDefaultActivity && i == 0 && this.mHighlightDefaultActivity) {
|
||||
view.setActivated(true);
|
||||
} else {
|
||||
view.setActivated(false);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
public int measureContentWidth() {
|
||||
int i = this.mMaxActivityCount;
|
||||
this.mMaxActivityCount = Integer.MAX_VALUE;
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
int count = getCount();
|
||||
View view = null;
|
||||
int i2 = 0;
|
||||
for (int i3 = 0; i3 < count; i3++) {
|
||||
view = getView(i3, view, null);
|
||||
view.measure(makeMeasureSpec, makeMeasureSpec2);
|
||||
i2 = Math.max(i2, view.getMeasuredWidth());
|
||||
}
|
||||
this.mMaxActivityCount = i;
|
||||
return i2;
|
||||
}
|
||||
|
||||
public void setMaxActivityCount(int i) {
|
||||
if (this.mMaxActivityCount != i) {
|
||||
this.mMaxActivityCount = i;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ResolveInfo getDefaultActivity() {
|
||||
return this.mDataModel.getDefaultActivity();
|
||||
}
|
||||
|
||||
public void setShowFooterView(boolean z) {
|
||||
if (this.mShowFooterView != z) {
|
||||
this.mShowFooterView = z;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int getActivityCount() {
|
||||
return this.mDataModel.getActivityCount();
|
||||
}
|
||||
|
||||
public int getHistorySize() {
|
||||
return this.mDataModel.getHistorySize();
|
||||
}
|
||||
|
||||
public void setShowDefaultActivity(boolean z, boolean z2) {
|
||||
if (this.mShowDefaultActivity == z && this.mHighlightDefaultActivity == z2) {
|
||||
return;
|
||||
}
|
||||
this.mShowDefaultActivity = z;
|
||||
this.mHighlightDefaultActivity = z2;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public static class InnerLayout extends LinearLayout {
|
||||
private static final int[] TINT_ATTRS = {android.R.attr.background};
|
||||
|
||||
public InnerLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, TINT_ATTRS);
|
||||
setBackgroundDrawable(obtainStyledAttributes.getDrawable(0));
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AlertDialogLayout extends LinearLayoutCompat {
|
||||
public AlertDialogLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AlertDialogLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
if (tryOnMeasure(i, i2)) {
|
||||
return;
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
private boolean tryOnMeasure(int i, int i2) {
|
||||
int i3;
|
||||
int i4;
|
||||
int i5;
|
||||
int i6;
|
||||
int childCount = getChildCount();
|
||||
View view = null;
|
||||
View view2 = null;
|
||||
View view3 = null;
|
||||
for (int i7 = 0; i7 < childCount; i7++) {
|
||||
View childAt = getChildAt(i7);
|
||||
if (childAt.getVisibility() != 8) {
|
||||
int id = childAt.getId();
|
||||
if (id == R.id.topPanel) {
|
||||
view = childAt;
|
||||
} else if (id == R.id.buttonPanel) {
|
||||
view2 = childAt;
|
||||
} else {
|
||||
if ((id != R.id.contentPanel && id != R.id.customPanel) || view3 != null) {
|
||||
return false;
|
||||
}
|
||||
view3 = childAt;
|
||||
}
|
||||
}
|
||||
}
|
||||
int mode = View.MeasureSpec.getMode(i2);
|
||||
int size = View.MeasureSpec.getSize(i2);
|
||||
int mode2 = View.MeasureSpec.getMode(i);
|
||||
int paddingTop = getPaddingTop() + getPaddingBottom();
|
||||
if (view != null) {
|
||||
view.measure(i, 0);
|
||||
paddingTop += view.getMeasuredHeight();
|
||||
i3 = View.combineMeasuredStates(0, view.getMeasuredState());
|
||||
} else {
|
||||
i3 = 0;
|
||||
}
|
||||
if (view2 != null) {
|
||||
view2.measure(i, 0);
|
||||
i4 = resolveMinimumHeight(view2);
|
||||
i5 = view2.getMeasuredHeight() - i4;
|
||||
paddingTop += i4;
|
||||
i3 = View.combineMeasuredStates(i3, view2.getMeasuredState());
|
||||
} else {
|
||||
i4 = 0;
|
||||
i5 = 0;
|
||||
}
|
||||
if (view3 != null) {
|
||||
view3.measure(i, mode == 0 ? 0 : View.MeasureSpec.makeMeasureSpec(Math.max(0, size - paddingTop), mode));
|
||||
i6 = view3.getMeasuredHeight();
|
||||
paddingTop += i6;
|
||||
i3 = View.combineMeasuredStates(i3, view3.getMeasuredState());
|
||||
} else {
|
||||
i6 = 0;
|
||||
}
|
||||
int i8 = size - paddingTop;
|
||||
if (view2 != null) {
|
||||
int i9 = paddingTop - i4;
|
||||
int min = Math.min(i8, i5);
|
||||
if (min > 0) {
|
||||
i8 -= min;
|
||||
i4 += min;
|
||||
}
|
||||
view2.measure(i, View.MeasureSpec.makeMeasureSpec(i4, BasicMeasure.EXACTLY));
|
||||
paddingTop = i9 + view2.getMeasuredHeight();
|
||||
i3 = View.combineMeasuredStates(i3, view2.getMeasuredState());
|
||||
}
|
||||
if (view3 != null && i8 > 0) {
|
||||
view3.measure(i, View.MeasureSpec.makeMeasureSpec(i6 + i8, mode));
|
||||
paddingTop = (paddingTop - i6) + view3.getMeasuredHeight();
|
||||
i3 = View.combineMeasuredStates(i3, view3.getMeasuredState());
|
||||
}
|
||||
int i10 = 0;
|
||||
for (int i11 = 0; i11 < childCount; i11++) {
|
||||
View childAt2 = getChildAt(i11);
|
||||
if (childAt2.getVisibility() != 8) {
|
||||
i10 = Math.max(i10, childAt2.getMeasuredWidth());
|
||||
}
|
||||
}
|
||||
setMeasuredDimension(View.resolveSizeAndState(i10 + getPaddingLeft() + getPaddingRight(), i, i3), View.resolveSizeAndState(paddingTop, i2, 0));
|
||||
if (mode2 == 1073741824) {
|
||||
return true;
|
||||
}
|
||||
forceUniformWidth(childCount, i2);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void forceUniformWidth(int i, int i2) {
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), BasicMeasure.EXACTLY);
|
||||
for (int i3 = 0; i3 < i; i3++) {
|
||||
View childAt = getChildAt(i3);
|
||||
if (childAt.getVisibility() != 8) {
|
||||
LinearLayoutCompat.LayoutParams layoutParams = (LinearLayoutCompat.LayoutParams) childAt.getLayoutParams();
|
||||
if (layoutParams.width == -1) {
|
||||
int i4 = layoutParams.height;
|
||||
layoutParams.height = childAt.getMeasuredHeight();
|
||||
measureChildWithMargins(childAt, makeMeasureSpec, 0, i2, 0);
|
||||
layoutParams.height = i4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int resolveMinimumHeight(View view) {
|
||||
int minimumHeight = ViewCompat.getMinimumHeight(view);
|
||||
if (minimumHeight > 0) {
|
||||
return minimumHeight;
|
||||
}
|
||||
if (view instanceof ViewGroup) {
|
||||
ViewGroup viewGroup = (ViewGroup) view;
|
||||
if (viewGroup.getChildCount() == 1) {
|
||||
return resolveMinimumHeight(viewGroup.getChildAt(0));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:25:0x00a8 */
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup, android.view.View
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
protected void onLayout(boolean r18, int r19, int r20, int r21, int r22) {
|
||||
/*
|
||||
r17 = this;
|
||||
r6 = r17
|
||||
int r7 = r17.getPaddingLeft()
|
||||
int r0 = r21 - r19
|
||||
int r1 = r17.getPaddingRight()
|
||||
int r8 = r0 - r1
|
||||
int r0 = r0 - r7
|
||||
int r1 = r17.getPaddingRight()
|
||||
int r9 = r0 - r1
|
||||
int r0 = r17.getMeasuredHeight()
|
||||
int r10 = r17.getChildCount()
|
||||
int r1 = r17.getGravity()
|
||||
r2 = r1 & 112(0x70, float:1.57E-43)
|
||||
r3 = 8388615(0x800007, float:1.1754953E-38)
|
||||
r11 = r1 & r3
|
||||
r1 = 16
|
||||
if (r2 == r1) goto L40
|
||||
r1 = 80
|
||||
if (r2 == r1) goto L35
|
||||
int r0 = r17.getPaddingTop()
|
||||
goto L4b
|
||||
L35:
|
||||
int r1 = r17.getPaddingTop()
|
||||
int r1 = r1 + r22
|
||||
int r1 = r1 - r20
|
||||
int r0 = r1 - r0
|
||||
goto L4b
|
||||
L40:
|
||||
int r1 = r17.getPaddingTop()
|
||||
int r2 = r22 - r20
|
||||
int r2 = r2 - r0
|
||||
int r2 = r2 / 2
|
||||
int r0 = r1 + r2
|
||||
L4b:
|
||||
android.graphics.drawable.Drawable r1 = r17.getDividerDrawable()
|
||||
r2 = 0
|
||||
if (r1 != 0) goto L54
|
||||
r12 = 0
|
||||
goto L59
|
||||
L54:
|
||||
int r1 = r1.getIntrinsicHeight()
|
||||
r12 = r1
|
||||
L59:
|
||||
r13 = 0
|
||||
L5a:
|
||||
if (r13 >= r10) goto Lbf
|
||||
android.view.View r1 = r6.getChildAt(r13)
|
||||
if (r1 == 0) goto Lbc
|
||||
int r2 = r1.getVisibility()
|
||||
r3 = 8
|
||||
if (r2 == r3) goto Lbc
|
||||
int r4 = r1.getMeasuredWidth()
|
||||
int r14 = r1.getMeasuredHeight()
|
||||
android.view.ViewGroup$LayoutParams r2 = r1.getLayoutParams()
|
||||
r15 = r2
|
||||
androidx.appcompat.widget.LinearLayoutCompat$LayoutParams r15 = (androidx.appcompat.widget.LinearLayoutCompat.LayoutParams) r15
|
||||
int r2 = r15.gravity
|
||||
if (r2 >= 0) goto L7e
|
||||
r2 = r11
|
||||
L7e:
|
||||
int r3 = androidx.core.view.ViewCompat.getLayoutDirection(r17)
|
||||
int r2 = androidx.core.view.GravityCompat.getAbsoluteGravity(r2, r3)
|
||||
r2 = r2 & 7
|
||||
r3 = 1
|
||||
if (r2 == r3) goto L97
|
||||
r3 = 5
|
||||
if (r2 == r3) goto L92
|
||||
int r2 = r15.leftMargin
|
||||
int r2 = r2 + r7
|
||||
goto La2
|
||||
L92:
|
||||
int r2 = r8 - r4
|
||||
int r3 = r15.rightMargin
|
||||
goto La1
|
||||
L97:
|
||||
int r2 = r9 - r4
|
||||
int r2 = r2 / 2
|
||||
int r2 = r2 + r7
|
||||
int r3 = r15.leftMargin
|
||||
int r2 = r2 + r3
|
||||
int r3 = r15.rightMargin
|
||||
La1:
|
||||
int r2 = r2 - r3
|
||||
La2:
|
||||
boolean r3 = r6.hasDividerBeforeChildAt(r13)
|
||||
if (r3 == 0) goto La9
|
||||
int r0 = r0 + r12
|
||||
La9:
|
||||
int r3 = r15.topMargin
|
||||
int r16 = r0 + r3
|
||||
r0 = r17
|
||||
r3 = r16
|
||||
r5 = r14
|
||||
r0.setChildFrame(r1, r2, r3, r4, r5)
|
||||
int r0 = r15.bottomMargin
|
||||
int r14 = r14 + r0
|
||||
int r16 = r16 + r14
|
||||
r0 = r16
|
||||
Lbc:
|
||||
int r13 = r13 + 1
|
||||
goto L5a
|
||||
Lbf:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AlertDialogLayout.onLayout(boolean, int, int, int, int):void");
|
||||
}
|
||||
|
||||
private void setChildFrame(View view, int i, int i2, int i3, int i4) {
|
||||
view.layout(i, i2, i3 + i, i4 + i2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.method.KeyListener;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private static final int[] TINT_ATTRS = {R.attr.popupBackground};
|
||||
private final AppCompatEmojiEditTextHelper mAppCompatEmojiEditTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatAutoCompleteTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatAutoCompleteTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, androidx.appcompat.R.attr.autoCompleteTextViewStyle);
|
||||
}
|
||||
|
||||
public AppCompatAutoCompleteTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(getContext(), attributeSet, TINT_ATTRS, i, 0);
|
||||
if (obtainStyledAttributes.hasValue(0)) {
|
||||
setDropDownBackgroundDrawable(obtainStyledAttributes.getDrawable(0));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper = new AppCompatEmojiEditTextHelper(this);
|
||||
this.mAppCompatEmojiEditTextHelper = appCompatEmojiEditTextHelper;
|
||||
appCompatEmojiEditTextHelper.loadFromAttributes(attributeSet, i);
|
||||
initEmojiKeyListener(appCompatEmojiEditTextHelper);
|
||||
}
|
||||
|
||||
void initEmojiKeyListener(AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper) {
|
||||
KeyListener keyListener = getKeyListener();
|
||||
if (appCompatEmojiEditTextHelper.isEmojiCapableKeyListener(keyListener)) {
|
||||
boolean isFocusable = super.isFocusable();
|
||||
boolean isClickable = super.isClickable();
|
||||
boolean isLongClickable = super.isLongClickable();
|
||||
int inputType = super.getInputType();
|
||||
KeyListener keyListener2 = appCompatEmojiEditTextHelper.getKeyListener(keyListener);
|
||||
if (keyListener2 == keyListener) {
|
||||
return;
|
||||
}
|
||||
super.setKeyListener(keyListener2);
|
||||
super.setRawInputType(inputType);
|
||||
super.setFocusable(isFocusable);
|
||||
super.setClickable(isClickable);
|
||||
super.setLongClickable(isLongClickable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.AutoCompleteTextView
|
||||
public void setDropDownBackgroundResource(int i) {
|
||||
setDropDownBackgroundDrawable(AppCompatResources.getDrawable(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
return this.mAppCompatEmojiEditTextHelper.onCreateInputConnection(AppCompatHintHelper.onCreateInputConnection(super.onCreateInputConnection(editorInfo), editorInfo, this), editorInfo);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public ActionMode.Callback getCustomSelectionActionModeCallback() {
|
||||
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setKeyListener(KeyListener keyListener) {
|
||||
super.setKeyListener(this.mAppCompatEmojiEditTextHelper.getKeyListener(keyListener));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
this.mAppCompatEmojiEditTextHelper.setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return this.mAppCompatEmojiEditTextHelper.isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatBackgroundHelper {
|
||||
private TintInfo mBackgroundTint;
|
||||
private TintInfo mInternalBackgroundTint;
|
||||
private TintInfo mTmpInfo;
|
||||
private final View mView;
|
||||
private int mBackgroundResId = -1;
|
||||
private final AppCompatDrawableManager mDrawableManager = AppCompatDrawableManager.get();
|
||||
|
||||
private boolean shouldApplyFrameworkTintUsingColorFilter() {
|
||||
int i = Build.VERSION.SDK_INT;
|
||||
return i > 21 ? this.mInternalBackgroundTint != null : i == 21;
|
||||
}
|
||||
|
||||
AppCompatBackgroundHelper(View view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attributeSet, R.styleable.ViewBackgroundHelper, i, 0);
|
||||
View view = this.mView;
|
||||
ViewCompat.saveAttributeDataForStyleable(view, view.getContext(), R.styleable.ViewBackgroundHelper, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0);
|
||||
try {
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.ViewBackgroundHelper_android_background)) {
|
||||
this.mBackgroundResId = obtainStyledAttributes.getResourceId(R.styleable.ViewBackgroundHelper_android_background, -1);
|
||||
ColorStateList tintList = this.mDrawableManager.getTintList(this.mView.getContext(), this.mBackgroundResId);
|
||||
if (tintList != null) {
|
||||
setInternalBackgroundTint(tintList);
|
||||
}
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.ViewBackgroundHelper_backgroundTint)) {
|
||||
ViewCompat.setBackgroundTintList(this.mView, obtainStyledAttributes.getColorStateList(R.styleable.ViewBackgroundHelper_backgroundTint));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.ViewBackgroundHelper_backgroundTintMode)) {
|
||||
ViewCompat.setBackgroundTintMode(this.mView, DrawableUtils.parseTintMode(obtainStyledAttributes.getInt(R.styleable.ViewBackgroundHelper_backgroundTintMode, -1), null));
|
||||
}
|
||||
} finally {
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
void onSetBackgroundResource(int i) {
|
||||
this.mBackgroundResId = i;
|
||||
AppCompatDrawableManager appCompatDrawableManager = this.mDrawableManager;
|
||||
setInternalBackgroundTint(appCompatDrawableManager != null ? appCompatDrawableManager.getTintList(this.mView.getContext(), i) : null);
|
||||
applySupportBackgroundTint();
|
||||
}
|
||||
|
||||
void onSetBackgroundDrawable(Drawable drawable) {
|
||||
this.mBackgroundResId = -1;
|
||||
setInternalBackgroundTint(null);
|
||||
applySupportBackgroundTint();
|
||||
}
|
||||
|
||||
void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
if (this.mBackgroundTint == null) {
|
||||
this.mBackgroundTint = new TintInfo();
|
||||
}
|
||||
this.mBackgroundTint.mTintList = colorStateList;
|
||||
this.mBackgroundTint.mHasTintList = true;
|
||||
applySupportBackgroundTint();
|
||||
}
|
||||
|
||||
ColorStateList getSupportBackgroundTintList() {
|
||||
TintInfo tintInfo = this.mBackgroundTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
if (this.mBackgroundTint == null) {
|
||||
this.mBackgroundTint = new TintInfo();
|
||||
}
|
||||
this.mBackgroundTint.mTintMode = mode;
|
||||
this.mBackgroundTint.mHasTintMode = true;
|
||||
applySupportBackgroundTint();
|
||||
}
|
||||
|
||||
PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
TintInfo tintInfo = this.mBackgroundTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintMode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void applySupportBackgroundTint() {
|
||||
Drawable background = this.mView.getBackground();
|
||||
if (background != null) {
|
||||
if (shouldApplyFrameworkTintUsingColorFilter() && applyFrameworkTintUsingColorFilter(background)) {
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo = this.mBackgroundTint;
|
||||
if (tintInfo != null) {
|
||||
AppCompatDrawableManager.tintDrawable(background, tintInfo, this.mView.getDrawableState());
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo2 = this.mInternalBackgroundTint;
|
||||
if (tintInfo2 != null) {
|
||||
AppCompatDrawableManager.tintDrawable(background, tintInfo2, this.mView.getDrawableState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setInternalBackgroundTint(ColorStateList colorStateList) {
|
||||
if (colorStateList != null) {
|
||||
if (this.mInternalBackgroundTint == null) {
|
||||
this.mInternalBackgroundTint = new TintInfo();
|
||||
}
|
||||
this.mInternalBackgroundTint.mTintList = colorStateList;
|
||||
this.mInternalBackgroundTint.mHasTintList = true;
|
||||
} else {
|
||||
this.mInternalBackgroundTint = null;
|
||||
}
|
||||
applySupportBackgroundTint();
|
||||
}
|
||||
|
||||
private boolean applyFrameworkTintUsingColorFilter(Drawable drawable) {
|
||||
if (this.mTmpInfo == null) {
|
||||
this.mTmpInfo = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.mTmpInfo;
|
||||
tintInfo.clear();
|
||||
ColorStateList backgroundTintList = ViewCompat.getBackgroundTintList(this.mView);
|
||||
if (backgroundTintList != null) {
|
||||
tintInfo.mHasTintList = true;
|
||||
tintInfo.mTintList = backgroundTintList;
|
||||
}
|
||||
PorterDuff.Mode backgroundTintMode = ViewCompat.getBackgroundTintMode(this.mView);
|
||||
if (backgroundTintMode != null) {
|
||||
tintInfo.mHasTintMode = true;
|
||||
tintInfo.mTintMode = backgroundTintMode;
|
||||
}
|
||||
if (!tintInfo.mHasTintList && !tintInfo.mHasTintMode) {
|
||||
return false;
|
||||
}
|
||||
AppCompatDrawableManager.tintDrawable(drawable, tintInfo, this.mView.getDrawableState());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.InputFilter;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.Button;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.AutoSizeableTextView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatButton extends Button implements TintableBackgroundView, AutoSizeableTextView, TintableCompoundDrawablesView, EmojiCompatConfigurationView {
|
||||
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.buttonStyle);
|
||||
}
|
||||
|
||||
public AppCompatButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
getEmojiTextViewHelper().loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
super.onInitializeAccessibilityEvent(accessibilityEvent);
|
||||
accessibilityEvent.setClassName(Button.class.getName());
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
|
||||
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
|
||||
accessibilityNodeInfo.setClassName(Button.class.getName());
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onLayout(z, i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextSize(int i, float f) {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
super.setTextSize(i, f);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setTextSize(i, f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
protected void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
||||
super.onTextChanged(charSequence, i, i2, i3);
|
||||
if (this.mTextHelper == null || ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE || !this.mTextHelper.isAutoSizeEnabled()) {
|
||||
return;
|
||||
}
|
||||
this.mTextHelper.autoSizeText();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public void setAutoSizeTextTypeWithDefaults(int i) {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
super.setAutoSizeTextTypeWithDefaults(i);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAutoSizeTextTypeWithDefaults(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
super.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeTextType() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return super.getAutoSizeTextType() == 1 ? 1 : 0;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeTextType();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeStepGranularity() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return super.getAutoSizeStepGranularity();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeStepGranularity();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeMinTextSize() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return super.getAutoSizeMinTextSize();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeMinTextSize();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeMaxTextSize() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return super.getAutoSizeMaxTextSize();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeMaxTextSize();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int[] getAutoSizeTextAvailableSizes() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return super.getAutoSizeTextAvailableSizes();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
return appCompatTextHelper != null ? appCompatTextHelper.getAutoSizeTextAvailableSizes() : new int[0];
|
||||
}
|
||||
|
||||
public void setSupportAllCaps(boolean z) {
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAllCaps(z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public ActionMode.Callback getCustomSelectionActionModeCallback() {
|
||||
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setFilters(InputFilter[] inputFilterArr) {
|
||||
super.setFilters(getEmojiTextViewHelper().getFilters(inputFilterArr));
|
||||
}
|
||||
|
||||
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
|
||||
if (this.mAppCompatEmojiTextHelper == null) {
|
||||
this.mAppCompatEmojiTextHelper = new AppCompatEmojiTextHelper(this);
|
||||
}
|
||||
return this.mAppCompatEmojiTextHelper;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAllCaps(boolean z) {
|
||||
super.setAllCaps(z);
|
||||
getEmojiTextViewHelper().setAllCaps(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
getEmojiTextViewHelper().setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return getEmojiTextViewHelper().isEnabled();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.InputFilter;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.CheckBox;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableCompoundButton;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatCheckBox extends CheckBox implements TintableCompoundButton, TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatCompoundButtonHelper mCompoundButtonHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatCheckBox(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatCheckBox(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.checkboxStyle);
|
||||
}
|
||||
|
||||
public AppCompatCheckBox(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = new AppCompatCompoundButtonHelper(this);
|
||||
this.mCompoundButtonHelper = appCompatCompoundButtonHelper;
|
||||
appCompatCompoundButtonHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
getEmojiTextViewHelper().loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
|
||||
if (this.mAppCompatEmojiTextHelper == null) {
|
||||
this.mAppCompatEmojiTextHelper = new AppCompatEmojiTextHelper(this);
|
||||
}
|
||||
return this.mAppCompatEmojiTextHelper;
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(Drawable drawable) {
|
||||
super.setButtonDrawable(drawable);
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.onSetButtonDrawable();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(int i) {
|
||||
setButtonDrawable(AppCompatResources.getDrawable(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton, android.widget.TextView
|
||||
public int getCompoundPaddingLeft() {
|
||||
int compoundPaddingLeft = super.getCompoundPaddingLeft();
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
return appCompatCompoundButtonHelper != null ? appCompatCompoundButtonHelper.getCompoundPaddingLeft(compoundPaddingLeft) : compoundPaddingLeft;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintList(ColorStateList colorStateList) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.setSupportButtonTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public ColorStateList getSupportButtonTintList() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.getSupportButtonTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.setSupportButtonTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public PorterDuff.Mode getSupportButtonTintMode() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.getSupportButtonTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setFilters(InputFilter[] inputFilterArr) {
|
||||
super.setFilters(getEmojiTextViewHelper().getFilters(inputFilterArr));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAllCaps(boolean z) {
|
||||
super.setAllCaps(z);
|
||||
getEmojiTextViewHelper().setAllCaps(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
getEmojiTextViewHelper().setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return getEmojiTextViewHelper().isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.CheckedTextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.core.widget.TintableCheckedTextView;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatCheckedTextView extends CheckedTextView implements TintableCheckedTextView, TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatCheckedTextViewHelper mCheckedHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatCheckedTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatCheckedTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.checkedTextViewStyle);
|
||||
}
|
||||
|
||||
public AppCompatCheckedTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = new AppCompatCheckedTextViewHelper(this);
|
||||
this.mCheckedHelper = appCompatCheckedTextViewHelper;
|
||||
appCompatCheckedTextViewHelper.loadFromAttributes(attributeSet, i);
|
||||
getEmojiTextViewHelper().loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.CheckedTextView
|
||||
public void setCheckMarkDrawable(Drawable drawable) {
|
||||
super.setCheckMarkDrawable(drawable);
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
appCompatCheckedTextViewHelper.onSetCheckMarkDrawable();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CheckedTextView
|
||||
public void setCheckMarkDrawable(int i) {
|
||||
setCheckMarkDrawable(AppCompatResources.getDrawable(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCheckedTextView
|
||||
public void setSupportCheckMarkTintList(ColorStateList colorStateList) {
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
appCompatCheckedTextViewHelper.setSupportCheckMarkTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCheckedTextView
|
||||
public ColorStateList getSupportCheckMarkTintList() {
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
return appCompatCheckedTextViewHelper.getSupportCheckMarkTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCheckedTextView
|
||||
public void setSupportCheckMarkTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
appCompatCheckedTextViewHelper.setSupportCheckMarkTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCheckedTextView
|
||||
public PorterDuff.Mode getSupportCheckMarkTintMode() {
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
return appCompatCheckedTextViewHelper.getSupportCheckMarkTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CheckedTextView, android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
appCompatCheckedTextViewHelper.applyCheckMarkTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
return AppCompatHintHelper.onCreateInputConnection(super.onCreateInputConnection(editorInfo), editorInfo, this);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public ActionMode.Callback getCustomSelectionActionModeCallback() {
|
||||
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
|
||||
}
|
||||
|
||||
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
|
||||
if (this.mAppCompatEmojiTextHelper == null) {
|
||||
this.mAppCompatEmojiTextHelper = new AppCompatEmojiTextHelper(this);
|
||||
}
|
||||
return this.mAppCompatEmojiTextHelper;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAllCaps(boolean z) {
|
||||
super.setAllCaps(z);
|
||||
getEmojiTextViewHelper().setAllCaps(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
getEmojiTextViewHelper().setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return getEmojiTextViewHelper().isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.CheckedTextView;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.widget.CheckedTextViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatCheckedTextViewHelper {
|
||||
private ColorStateList mCheckMarkTintList = null;
|
||||
private PorterDuff.Mode mCheckMarkTintMode = null;
|
||||
private boolean mHasCheckMarkTint = false;
|
||||
private boolean mHasCheckMarkTintMode = false;
|
||||
private boolean mSkipNextApply;
|
||||
private final CheckedTextView mView;
|
||||
|
||||
ColorStateList getSupportCheckMarkTintList() {
|
||||
return this.mCheckMarkTintList;
|
||||
}
|
||||
|
||||
PorterDuff.Mode getSupportCheckMarkTintMode() {
|
||||
return this.mCheckMarkTintMode;
|
||||
}
|
||||
|
||||
AppCompatCheckedTextViewHelper(CheckedTextView checkedTextView) {
|
||||
this.mView = checkedTextView;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:11:0x0062 A[Catch: all -> 0x008a, TryCatch #1 {all -> 0x008a, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005a, B:11:0x0062, B:12:0x006d, B:14:0x0075, B:21:0x003d, B:23:0x0045, B:25:0x004d), top: B:2:0x001f }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x0075 A[Catch: all -> 0x008a, TRY_LEAVE, TryCatch #1 {all -> 0x008a, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005a, B:11:0x0062, B:12:0x006d, B:14:0x0075, B:21:0x003d, B:23:0x0045, B:25:0x004d), top: B:2:0x001f }] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
void loadFromAttributes(android.util.AttributeSet r11, int r12) {
|
||||
/*
|
||||
r10 = this;
|
||||
android.widget.CheckedTextView r0 = r10.mView
|
||||
android.content.Context r0 = r0.getContext()
|
||||
int[] r1 = androidx.appcompat.R.styleable.CheckedTextView
|
||||
r2 = 0
|
||||
androidx.appcompat.widget.TintTypedArray r0 = androidx.appcompat.widget.TintTypedArray.obtainStyledAttributes(r0, r11, r1, r12, r2)
|
||||
android.widget.CheckedTextView r3 = r10.mView
|
||||
android.content.Context r4 = r3.getContext()
|
||||
int[] r5 = androidx.appcompat.R.styleable.CheckedTextView
|
||||
android.content.res.TypedArray r7 = r0.getWrappedTypeArray()
|
||||
r9 = 0
|
||||
r6 = r11
|
||||
r8 = r12
|
||||
androidx.core.view.ViewCompat.saveAttributeDataForStyleable(r3, r4, r5, r6, r7, r8, r9)
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkCompat // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L3d
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkCompat // Catch: java.lang.Throwable -> L8a
|
||||
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L3d
|
||||
android.widget.CheckedTextView r12 = r10.mView // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
android.content.Context r1 = r12.getContext() // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
r12.setCheckMarkDrawable(r11) // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
goto L5a
|
||||
L3d:
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_android_checkMark // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L5a
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_android_checkMark // Catch: java.lang.Throwable -> L8a
|
||||
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L5a
|
||||
android.widget.CheckedTextView r12 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
android.content.Context r1 = r12.getContext() // Catch: java.lang.Throwable -> L8a
|
||||
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: java.lang.Throwable -> L8a
|
||||
r12.setCheckMarkDrawable(r11) // Catch: java.lang.Throwable -> L8a
|
||||
L5a:
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTint // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L6d
|
||||
android.widget.CheckedTextView r11 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
int r12 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTint // Catch: java.lang.Throwable -> L8a
|
||||
android.content.res.ColorStateList r12 = r0.getColorStateList(r12) // Catch: java.lang.Throwable -> L8a
|
||||
androidx.core.widget.CheckedTextViewCompat.setCheckMarkTintList(r11, r12) // Catch: java.lang.Throwable -> L8a
|
||||
L6d:
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTintMode // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L86
|
||||
android.widget.CheckedTextView r11 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
int r12 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTintMode // Catch: java.lang.Throwable -> L8a
|
||||
r1 = -1
|
||||
int r12 = r0.getInt(r12, r1) // Catch: java.lang.Throwable -> L8a
|
||||
r1 = 0
|
||||
android.graphics.PorterDuff$Mode r12 = androidx.appcompat.widget.DrawableUtils.parseTintMode(r12, r1) // Catch: java.lang.Throwable -> L8a
|
||||
androidx.core.widget.CheckedTextViewCompat.setCheckMarkTintMode(r11, r12) // Catch: java.lang.Throwable -> L8a
|
||||
L86:
|
||||
r0.recycle()
|
||||
return
|
||||
L8a:
|
||||
r11 = move-exception
|
||||
r0.recycle()
|
||||
throw r11
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatCheckedTextViewHelper.loadFromAttributes(android.util.AttributeSet, int):void");
|
||||
}
|
||||
|
||||
void setSupportCheckMarkTintList(ColorStateList colorStateList) {
|
||||
this.mCheckMarkTintList = colorStateList;
|
||||
this.mHasCheckMarkTint = true;
|
||||
applyCheckMarkTint();
|
||||
}
|
||||
|
||||
void setSupportCheckMarkTintMode(PorterDuff.Mode mode) {
|
||||
this.mCheckMarkTintMode = mode;
|
||||
this.mHasCheckMarkTintMode = true;
|
||||
applyCheckMarkTint();
|
||||
}
|
||||
|
||||
void onSetCheckMarkDrawable() {
|
||||
if (this.mSkipNextApply) {
|
||||
this.mSkipNextApply = false;
|
||||
} else {
|
||||
this.mSkipNextApply = true;
|
||||
applyCheckMarkTint();
|
||||
}
|
||||
}
|
||||
|
||||
void applyCheckMarkTint() {
|
||||
Drawable checkMarkDrawable = CheckedTextViewCompat.getCheckMarkDrawable(this.mView);
|
||||
if (checkMarkDrawable != null) {
|
||||
if (this.mHasCheckMarkTint || this.mHasCheckMarkTintMode) {
|
||||
Drawable mutate = DrawableCompat.wrap(checkMarkDrawable).mutate();
|
||||
if (this.mHasCheckMarkTint) {
|
||||
DrawableCompat.setTintList(mutate, this.mCheckMarkTintList);
|
||||
}
|
||||
if (this.mHasCheckMarkTintMode) {
|
||||
DrawableCompat.setTintMode(mutate, this.mCheckMarkTintMode);
|
||||
}
|
||||
if (mutate.isStateful()) {
|
||||
mutate.setState(this.mView.getDrawableState());
|
||||
}
|
||||
this.mView.setCheckMarkDrawable(mutate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.CompoundButton;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.widget.CompoundButtonCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatCompoundButtonHelper {
|
||||
private ColorStateList mButtonTintList = null;
|
||||
private PorterDuff.Mode mButtonTintMode = null;
|
||||
private boolean mHasButtonTint = false;
|
||||
private boolean mHasButtonTintMode = false;
|
||||
private boolean mSkipNextApply;
|
||||
private final CompoundButton mView;
|
||||
|
||||
int getCompoundPaddingLeft(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
ColorStateList getSupportButtonTintList() {
|
||||
return this.mButtonTintList;
|
||||
}
|
||||
|
||||
PorterDuff.Mode getSupportButtonTintMode() {
|
||||
return this.mButtonTintMode;
|
||||
}
|
||||
|
||||
AppCompatCompoundButtonHelper(CompoundButton compoundButton) {
|
||||
this.mView = compoundButton;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:11:0x0062 A[Catch: all -> 0x008a, TryCatch #1 {all -> 0x008a, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005a, B:11:0x0062, B:12:0x006d, B:14:0x0075, B:21:0x003d, B:23:0x0045, B:25:0x004d), top: B:2:0x001f }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x0075 A[Catch: all -> 0x008a, TRY_LEAVE, TryCatch #1 {all -> 0x008a, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005a, B:11:0x0062, B:12:0x006d, B:14:0x0075, B:21:0x003d, B:23:0x0045, B:25:0x004d), top: B:2:0x001f }] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
void loadFromAttributes(android.util.AttributeSet r11, int r12) {
|
||||
/*
|
||||
r10 = this;
|
||||
android.widget.CompoundButton r0 = r10.mView
|
||||
android.content.Context r0 = r0.getContext()
|
||||
int[] r1 = androidx.appcompat.R.styleable.CompoundButton
|
||||
r2 = 0
|
||||
androidx.appcompat.widget.TintTypedArray r0 = androidx.appcompat.widget.TintTypedArray.obtainStyledAttributes(r0, r11, r1, r12, r2)
|
||||
android.widget.CompoundButton r3 = r10.mView
|
||||
android.content.Context r4 = r3.getContext()
|
||||
int[] r5 = androidx.appcompat.R.styleable.CompoundButton
|
||||
android.content.res.TypedArray r7 = r0.getWrappedTypeArray()
|
||||
r9 = 0
|
||||
r6 = r11
|
||||
r8 = r12
|
||||
androidx.core.view.ViewCompat.saveAttributeDataForStyleable(r3, r4, r5, r6, r7, r8, r9)
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonCompat // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L3d
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonCompat // Catch: java.lang.Throwable -> L8a
|
||||
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L3d
|
||||
android.widget.CompoundButton r12 = r10.mView // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
android.content.Context r1 = r12.getContext() // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
r12.setButtonDrawable(r11) // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
goto L5a
|
||||
L3d:
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_android_button // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L5a
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_android_button // Catch: java.lang.Throwable -> L8a
|
||||
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L5a
|
||||
android.widget.CompoundButton r12 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
android.content.Context r1 = r12.getContext() // Catch: java.lang.Throwable -> L8a
|
||||
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: java.lang.Throwable -> L8a
|
||||
r12.setButtonDrawable(r11) // Catch: java.lang.Throwable -> L8a
|
||||
L5a:
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonTint // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L6d
|
||||
android.widget.CompoundButton r11 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
int r12 = androidx.appcompat.R.styleable.CompoundButton_buttonTint // Catch: java.lang.Throwable -> L8a
|
||||
android.content.res.ColorStateList r12 = r0.getColorStateList(r12) // Catch: java.lang.Throwable -> L8a
|
||||
androidx.core.widget.CompoundButtonCompat.setButtonTintList(r11, r12) // Catch: java.lang.Throwable -> L8a
|
||||
L6d:
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonTintMode // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L86
|
||||
android.widget.CompoundButton r11 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
int r12 = androidx.appcompat.R.styleable.CompoundButton_buttonTintMode // Catch: java.lang.Throwable -> L8a
|
||||
r1 = -1
|
||||
int r12 = r0.getInt(r12, r1) // Catch: java.lang.Throwable -> L8a
|
||||
r1 = 0
|
||||
android.graphics.PorterDuff$Mode r12 = androidx.appcompat.widget.DrawableUtils.parseTintMode(r12, r1) // Catch: java.lang.Throwable -> L8a
|
||||
androidx.core.widget.CompoundButtonCompat.setButtonTintMode(r11, r12) // Catch: java.lang.Throwable -> L8a
|
||||
L86:
|
||||
r0.recycle()
|
||||
return
|
||||
L8a:
|
||||
r11 = move-exception
|
||||
r0.recycle()
|
||||
throw r11
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatCompoundButtonHelper.loadFromAttributes(android.util.AttributeSet, int):void");
|
||||
}
|
||||
|
||||
void setSupportButtonTintList(ColorStateList colorStateList) {
|
||||
this.mButtonTintList = colorStateList;
|
||||
this.mHasButtonTint = true;
|
||||
applyButtonTint();
|
||||
}
|
||||
|
||||
void setSupportButtonTintMode(PorterDuff.Mode mode) {
|
||||
this.mButtonTintMode = mode;
|
||||
this.mHasButtonTintMode = true;
|
||||
applyButtonTint();
|
||||
}
|
||||
|
||||
void onSetButtonDrawable() {
|
||||
if (this.mSkipNextApply) {
|
||||
this.mSkipNextApply = false;
|
||||
} else {
|
||||
this.mSkipNextApply = true;
|
||||
applyButtonTint();
|
||||
}
|
||||
}
|
||||
|
||||
void applyButtonTint() {
|
||||
Drawable buttonDrawable = CompoundButtonCompat.getButtonDrawable(this.mView);
|
||||
if (buttonDrawable != null) {
|
||||
if (this.mHasButtonTint || this.mHasButtonTintMode) {
|
||||
Drawable mutate = DrawableCompat.wrap(buttonDrawable).mutate();
|
||||
if (this.mHasButtonTint) {
|
||||
DrawableCompat.setTintList(mutate, this.mButtonTintList);
|
||||
}
|
||||
if (this.mHasButtonTintMode) {
|
||||
DrawableCompat.setTintMode(mutate, this.mButtonTintMode);
|
||||
}
|
||||
if (mutate.isStateful()) {
|
||||
mutate.setState(this.mView.getDrawableState());
|
||||
}
|
||||
this.mView.setButtonDrawable(mutate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.widget.ResourceManagerInternal;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class AppCompatDrawableManager {
|
||||
private static final boolean DEBUG = false;
|
||||
private static final PorterDuff.Mode DEFAULT_MODE = PorterDuff.Mode.SRC_IN;
|
||||
private static AppCompatDrawableManager INSTANCE = null;
|
||||
private static final String TAG = "AppCompatDrawableManag";
|
||||
private ResourceManagerInternal mResourceManager;
|
||||
|
||||
public static synchronized void preload() {
|
||||
synchronized (AppCompatDrawableManager.class) {
|
||||
if (INSTANCE == null) {
|
||||
AppCompatDrawableManager appCompatDrawableManager = new AppCompatDrawableManager();
|
||||
INSTANCE = appCompatDrawableManager;
|
||||
appCompatDrawableManager.mResourceManager = ResourceManagerInternal.get();
|
||||
INSTANCE.mResourceManager.setHooks(new ResourceManagerInternal.ResourceManagerHooks() { // from class: androidx.appcompat.widget.AppCompatDrawableManager.1
|
||||
private final int[] COLORFILTER_TINT_COLOR_CONTROL_NORMAL = {R.drawable.abc_textfield_search_default_mtrl_alpha, R.drawable.abc_textfield_default_mtrl_alpha, R.drawable.abc_ab_share_pack_mtrl_alpha};
|
||||
private final int[] TINT_COLOR_CONTROL_NORMAL = {R.drawable.abc_ic_commit_search_api_mtrl_alpha, R.drawable.abc_seekbar_tick_mark_material, R.drawable.abc_ic_menu_share_mtrl_alpha, R.drawable.abc_ic_menu_copy_mtrl_am_alpha, R.drawable.abc_ic_menu_cut_mtrl_alpha, R.drawable.abc_ic_menu_selectall_mtrl_alpha, R.drawable.abc_ic_menu_paste_mtrl_am_alpha};
|
||||
private final int[] COLORFILTER_COLOR_CONTROL_ACTIVATED = {R.drawable.abc_textfield_activated_mtrl_alpha, R.drawable.abc_textfield_search_activated_mtrl_alpha, R.drawable.abc_cab_background_top_mtrl_alpha, R.drawable.abc_text_cursor_material, R.drawable.abc_text_select_handle_left_mtrl, R.drawable.abc_text_select_handle_middle_mtrl, R.drawable.abc_text_select_handle_right_mtrl};
|
||||
private final int[] COLORFILTER_COLOR_BACKGROUND_MULTIPLY = {R.drawable.abc_popup_background_mtrl_mult, R.drawable.abc_cab_background_internal_bg, R.drawable.abc_menu_hardkey_panel_mtrl_mult};
|
||||
private final int[] TINT_COLOR_CONTROL_STATE_LIST = {R.drawable.abc_tab_indicator_material, R.drawable.abc_textfield_search_material};
|
||||
private final int[] TINT_CHECKABLE_BUTTON_LIST = {R.drawable.abc_btn_check_material, R.drawable.abc_btn_radio_material, R.drawable.abc_btn_check_material_anim, R.drawable.abc_btn_radio_material_anim};
|
||||
|
||||
private ColorStateList createDefaultButtonColorStateList(Context context) {
|
||||
return createButtonColorStateList(context, ThemeUtils.getThemeAttrColor(context, R.attr.colorButtonNormal));
|
||||
}
|
||||
|
||||
private ColorStateList createBorderlessButtonColorStateList(Context context) {
|
||||
return createButtonColorStateList(context, 0);
|
||||
}
|
||||
|
||||
private ColorStateList createColoredButtonColorStateList(Context context) {
|
||||
return createButtonColorStateList(context, ThemeUtils.getThemeAttrColor(context, R.attr.colorAccent));
|
||||
}
|
||||
|
||||
private ColorStateList createButtonColorStateList(Context context, int i) {
|
||||
int themeAttrColor = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlHighlight);
|
||||
return new ColorStateList(new int[][]{ThemeUtils.DISABLED_STATE_SET, ThemeUtils.PRESSED_STATE_SET, ThemeUtils.FOCUSED_STATE_SET, ThemeUtils.EMPTY_STATE_SET}, new int[]{ThemeUtils.getDisabledThemeAttrColor(context, R.attr.colorButtonNormal), ColorUtils.compositeColors(themeAttrColor, i), ColorUtils.compositeColors(themeAttrColor, i), i});
|
||||
}
|
||||
|
||||
private ColorStateList createSwitchThumbColorStateList(Context context) {
|
||||
int[][] iArr = new int[3][];
|
||||
int[] iArr2 = new int[3];
|
||||
ColorStateList themeAttrColorStateList = ThemeUtils.getThemeAttrColorStateList(context, R.attr.colorSwitchThumbNormal);
|
||||
if (themeAttrColorStateList != null && themeAttrColorStateList.isStateful()) {
|
||||
int[] iArr3 = ThemeUtils.DISABLED_STATE_SET;
|
||||
iArr[0] = iArr3;
|
||||
iArr2[0] = themeAttrColorStateList.getColorForState(iArr3, 0);
|
||||
iArr[1] = ThemeUtils.CHECKED_STATE_SET;
|
||||
iArr2[1] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated);
|
||||
iArr[2] = ThemeUtils.EMPTY_STATE_SET;
|
||||
iArr2[2] = themeAttrColorStateList.getDefaultColor();
|
||||
} else {
|
||||
iArr[0] = ThemeUtils.DISABLED_STATE_SET;
|
||||
iArr2[0] = ThemeUtils.getDisabledThemeAttrColor(context, R.attr.colorSwitchThumbNormal);
|
||||
iArr[1] = ThemeUtils.CHECKED_STATE_SET;
|
||||
iArr2[1] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated);
|
||||
iArr[2] = ThemeUtils.EMPTY_STATE_SET;
|
||||
iArr2[2] = ThemeUtils.getThemeAttrColor(context, R.attr.colorSwitchThumbNormal);
|
||||
}
|
||||
return new ColorStateList(iArr, iArr2);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
|
||||
public Drawable createDrawableFor(ResourceManagerInternal resourceManagerInternal, Context context, int i) {
|
||||
if (i == R.drawable.abc_cab_background_top_material) {
|
||||
return new LayerDrawable(new Drawable[]{resourceManagerInternal.getDrawable(context, R.drawable.abc_cab_background_internal_bg), resourceManagerInternal.getDrawable(context, R.drawable.abc_cab_background_top_mtrl_alpha)});
|
||||
}
|
||||
if (i == R.drawable.abc_ratingbar_material) {
|
||||
return getRatingBarLayerDrawable(resourceManagerInternal, context, R.dimen.abc_star_big);
|
||||
}
|
||||
if (i == R.drawable.abc_ratingbar_indicator_material) {
|
||||
return getRatingBarLayerDrawable(resourceManagerInternal, context, R.dimen.abc_star_medium);
|
||||
}
|
||||
if (i == R.drawable.abc_ratingbar_small_material) {
|
||||
return getRatingBarLayerDrawable(resourceManagerInternal, context, R.dimen.abc_star_small);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private LayerDrawable getRatingBarLayerDrawable(ResourceManagerInternal resourceManagerInternal, Context context, int i) {
|
||||
BitmapDrawable bitmapDrawable;
|
||||
BitmapDrawable bitmapDrawable2;
|
||||
BitmapDrawable bitmapDrawable3;
|
||||
int dimensionPixelSize = context.getResources().getDimensionPixelSize(i);
|
||||
Drawable drawable = resourceManagerInternal.getDrawable(context, R.drawable.abc_star_black_48dp);
|
||||
Drawable drawable2 = resourceManagerInternal.getDrawable(context, R.drawable.abc_star_half_black_48dp);
|
||||
if ((drawable instanceof BitmapDrawable) && drawable.getIntrinsicWidth() == dimensionPixelSize && drawable.getIntrinsicHeight() == dimensionPixelSize) {
|
||||
bitmapDrawable = (BitmapDrawable) drawable;
|
||||
bitmapDrawable2 = new BitmapDrawable(bitmapDrawable.getBitmap());
|
||||
} else {
|
||||
Bitmap createBitmap = Bitmap.createBitmap(dimensionPixelSize, dimensionPixelSize, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(createBitmap);
|
||||
drawable.setBounds(0, 0, dimensionPixelSize, dimensionPixelSize);
|
||||
drawable.draw(canvas);
|
||||
bitmapDrawable = new BitmapDrawable(createBitmap);
|
||||
bitmapDrawable2 = new BitmapDrawable(createBitmap);
|
||||
}
|
||||
bitmapDrawable2.setTileModeX(Shader.TileMode.REPEAT);
|
||||
if ((drawable2 instanceof BitmapDrawable) && drawable2.getIntrinsicWidth() == dimensionPixelSize && drawable2.getIntrinsicHeight() == dimensionPixelSize) {
|
||||
bitmapDrawable3 = (BitmapDrawable) drawable2;
|
||||
} else {
|
||||
Bitmap createBitmap2 = Bitmap.createBitmap(dimensionPixelSize, dimensionPixelSize, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas2 = new Canvas(createBitmap2);
|
||||
drawable2.setBounds(0, 0, dimensionPixelSize, dimensionPixelSize);
|
||||
drawable2.draw(canvas2);
|
||||
bitmapDrawable3 = new BitmapDrawable(createBitmap2);
|
||||
}
|
||||
LayerDrawable layerDrawable = new LayerDrawable(new Drawable[]{bitmapDrawable, bitmapDrawable3, bitmapDrawable2});
|
||||
layerDrawable.setId(0, android.R.id.background);
|
||||
layerDrawable.setId(1, android.R.id.secondaryProgress);
|
||||
layerDrawable.setId(2, android.R.id.progress);
|
||||
return layerDrawable;
|
||||
}
|
||||
|
||||
private void setPorterDuffColorFilter(Drawable drawable, int i, PorterDuff.Mode mode) {
|
||||
if (DrawableUtils.canSafelyMutateDrawable(drawable)) {
|
||||
drawable = drawable.mutate();
|
||||
}
|
||||
if (mode == null) {
|
||||
mode = AppCompatDrawableManager.DEFAULT_MODE;
|
||||
}
|
||||
drawable.setColorFilter(AppCompatDrawableManager.getPorterDuffColorFilter(i, mode));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
|
||||
public boolean tintDrawable(Context context, int i, Drawable drawable) {
|
||||
if (i == R.drawable.abc_seekbar_track_material) {
|
||||
LayerDrawable layerDrawable = (LayerDrawable) drawable;
|
||||
setPorterDuffColorFilter(layerDrawable.findDrawableByLayerId(android.R.id.background), ThemeUtils.getThemeAttrColor(context, R.attr.colorControlNormal), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
setPorterDuffColorFilter(layerDrawable.findDrawableByLayerId(android.R.id.secondaryProgress), ThemeUtils.getThemeAttrColor(context, R.attr.colorControlNormal), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
setPorterDuffColorFilter(layerDrawable.findDrawableByLayerId(android.R.id.progress), ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
return true;
|
||||
}
|
||||
if (i != R.drawable.abc_ratingbar_material && i != R.drawable.abc_ratingbar_indicator_material && i != R.drawable.abc_ratingbar_small_material) {
|
||||
return false;
|
||||
}
|
||||
LayerDrawable layerDrawable2 = (LayerDrawable) drawable;
|
||||
setPorterDuffColorFilter(layerDrawable2.findDrawableByLayerId(android.R.id.background), ThemeUtils.getDisabledThemeAttrColor(context, R.attr.colorControlNormal), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
setPorterDuffColorFilter(layerDrawable2.findDrawableByLayerId(android.R.id.secondaryProgress), ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
setPorterDuffColorFilter(layerDrawable2.findDrawableByLayerId(android.R.id.progress), ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean arrayContains(int[] iArr, int i) {
|
||||
for (int i2 : iArr) {
|
||||
if (i2 == i) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
|
||||
public ColorStateList getTintListForDrawableRes(Context context, int i) {
|
||||
if (i == R.drawable.abc_edit_text_material) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_edittext);
|
||||
}
|
||||
if (i == R.drawable.abc_switch_track_mtrl_alpha) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_switch_track);
|
||||
}
|
||||
if (i == R.drawable.abc_switch_thumb_material) {
|
||||
return createSwitchThumbColorStateList(context);
|
||||
}
|
||||
if (i == R.drawable.abc_btn_default_mtrl_shape) {
|
||||
return createDefaultButtonColorStateList(context);
|
||||
}
|
||||
if (i == R.drawable.abc_btn_borderless_material) {
|
||||
return createBorderlessButtonColorStateList(context);
|
||||
}
|
||||
if (i == R.drawable.abc_btn_colored_material) {
|
||||
return createColoredButtonColorStateList(context);
|
||||
}
|
||||
if (i == R.drawable.abc_spinner_mtrl_am_alpha || i == R.drawable.abc_spinner_textfield_background_material) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_spinner);
|
||||
}
|
||||
if (arrayContains(this.TINT_COLOR_CONTROL_NORMAL, i)) {
|
||||
return ThemeUtils.getThemeAttrColorStateList(context, R.attr.colorControlNormal);
|
||||
}
|
||||
if (arrayContains(this.TINT_COLOR_CONTROL_STATE_LIST, i)) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_default);
|
||||
}
|
||||
if (arrayContains(this.TINT_CHECKABLE_BUTTON_LIST, i)) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_btn_checkable);
|
||||
}
|
||||
if (i == R.drawable.abc_seekbar_thumb_material) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_seek_thumb);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:15:0x006d A[RETURN] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:7:0x0052 */
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public boolean tintDrawableUsingColorFilter(android.content.Context r7, int r8, android.graphics.drawable.Drawable r9) {
|
||||
/*
|
||||
r6 = this;
|
||||
android.graphics.PorterDuff$Mode r0 = androidx.appcompat.widget.AppCompatDrawableManager.access$000()
|
||||
int[] r1 = r6.COLORFILTER_TINT_COLOR_CONTROL_NORMAL
|
||||
boolean r1 = r6.arrayContains(r1, r8)
|
||||
r2 = 1
|
||||
r3 = 0
|
||||
r4 = -1
|
||||
if (r1 == 0) goto L15
|
||||
int r8 = androidx.appcompat.R.attr.colorControlNormal
|
||||
L11:
|
||||
r1 = r0
|
||||
L12:
|
||||
r0 = -1
|
||||
r5 = 1
|
||||
goto L50
|
||||
L15:
|
||||
int[] r1 = r6.COLORFILTER_COLOR_CONTROL_ACTIVATED
|
||||
boolean r1 = r6.arrayContains(r1, r8)
|
||||
if (r1 == 0) goto L20
|
||||
int r8 = androidx.appcompat.R.attr.colorControlActivated
|
||||
goto L11
|
||||
L20:
|
||||
int[] r1 = r6.COLORFILTER_COLOR_BACKGROUND_MULTIPLY
|
||||
boolean r1 = r6.arrayContains(r1, r8)
|
||||
r5 = 16842801(0x1010031, float:2.3693695E-38)
|
||||
if (r1 == 0) goto L32
|
||||
android.graphics.PorterDuff$Mode r0 = android.graphics.PorterDuff.Mode.MULTIPLY
|
||||
L2d:
|
||||
r1 = r0
|
||||
r8 = 16842801(0x1010031, float:2.3693695E-38)
|
||||
goto L12
|
||||
L32:
|
||||
int r1 = androidx.appcompat.R.drawable.abc_list_divider_mtrl_alpha
|
||||
if (r8 != r1) goto L47
|
||||
r8 = 1109603123(0x42233333, float:40.8)
|
||||
int r8 = java.lang.Math.round(r8)
|
||||
r1 = 16842800(0x1010030, float:2.3693693E-38)
|
||||
r1 = r0
|
||||
r5 = 1
|
||||
r0 = r8
|
||||
r8 = 16842800(0x1010030, float:2.3693693E-38)
|
||||
goto L50
|
||||
L47:
|
||||
int r1 = androidx.appcompat.R.drawable.abc_dialog_material_background
|
||||
if (r8 != r1) goto L4c
|
||||
goto L2d
|
||||
L4c:
|
||||
r1 = r0
|
||||
r8 = 0
|
||||
r0 = -1
|
||||
r5 = 0
|
||||
L50:
|
||||
if (r5 == 0) goto L6d
|
||||
boolean r3 = androidx.appcompat.widget.DrawableUtils.canSafelyMutateDrawable(r9)
|
||||
if (r3 == 0) goto L5c
|
||||
android.graphics.drawable.Drawable r9 = r9.mutate()
|
||||
L5c:
|
||||
int r7 = androidx.appcompat.widget.ThemeUtils.getThemeAttrColor(r7, r8)
|
||||
android.graphics.PorterDuffColorFilter r7 = androidx.appcompat.widget.AppCompatDrawableManager.getPorterDuffColorFilter(r7, r1)
|
||||
r9.setColorFilter(r7)
|
||||
if (r0 == r4) goto L6c
|
||||
r9.setAlpha(r0)
|
||||
L6c:
|
||||
return r2
|
||||
L6d:
|
||||
return r3
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatDrawableManager.AnonymousClass1.tintDrawableUsingColorFilter(android.content.Context, int, android.graphics.drawable.Drawable):boolean");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
|
||||
public PorterDuff.Mode getTintModeForDrawableRes(int i) {
|
||||
if (i == R.drawable.abc_switch_thumb_material) {
|
||||
return PorterDuff.Mode.MULTIPLY;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized AppCompatDrawableManager get() {
|
||||
AppCompatDrawableManager appCompatDrawableManager;
|
||||
synchronized (AppCompatDrawableManager.class) {
|
||||
if (INSTANCE == null) {
|
||||
preload();
|
||||
}
|
||||
appCompatDrawableManager = INSTANCE;
|
||||
}
|
||||
return appCompatDrawableManager;
|
||||
}
|
||||
|
||||
public synchronized Drawable getDrawable(Context context, int i) {
|
||||
return this.mResourceManager.getDrawable(context, i);
|
||||
}
|
||||
|
||||
synchronized Drawable getDrawable(Context context, int i, boolean z) {
|
||||
return this.mResourceManager.getDrawable(context, i, z);
|
||||
}
|
||||
|
||||
public synchronized void onConfigurationChanged(Context context) {
|
||||
this.mResourceManager.onConfigurationChanged(context);
|
||||
}
|
||||
|
||||
synchronized Drawable onDrawableLoadedFromResources(Context context, VectorEnabledTintResources vectorEnabledTintResources, int i) {
|
||||
return this.mResourceManager.onDrawableLoadedFromResources(context, vectorEnabledTintResources, i);
|
||||
}
|
||||
|
||||
boolean tintDrawableUsingColorFilter(Context context, int i, Drawable drawable) {
|
||||
return this.mResourceManager.tintDrawableUsingColorFilter(context, i, drawable);
|
||||
}
|
||||
|
||||
synchronized ColorStateList getTintList(Context context, int i) {
|
||||
return this.mResourceManager.getTintList(context, i);
|
||||
}
|
||||
|
||||
static void tintDrawable(Drawable drawable, TintInfo tintInfo, int[] iArr) {
|
||||
ResourceManagerInternal.tintDrawable(drawable, tintInfo, iArr);
|
||||
}
|
||||
|
||||
public static synchronized PorterDuffColorFilter getPorterDuffColorFilter(int i, PorterDuff.Mode mode) {
|
||||
PorterDuffColorFilter porterDuffColorFilter;
|
||||
synchronized (AppCompatDrawableManager.class) {
|
||||
porterDuffColorFilter = ResourceManagerInternal.getPorterDuffColorFilter(i, mode);
|
||||
}
|
||||
return porterDuffColorFilter;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.Editable;
|
||||
import android.text.method.KeyListener;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.DragEvent;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.textclassifier.TextClassifier;
|
||||
import android.widget.EditText;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.view.ContentInfoCompat;
|
||||
import androidx.core.view.OnReceiveContentViewBehavior;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat;
|
||||
import androidx.core.view.inputmethod.InputConnectionCompat;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.core.widget.TextViewOnReceiveContentListener;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatEditText extends EditText implements TintableBackgroundView, OnReceiveContentViewBehavior, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private final AppCompatEmojiEditTextHelper mAppCompatEmojiEditTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final TextViewOnReceiveContentListener mDefaultOnReceiveContentListener;
|
||||
private SuperCaller mSuperCaller;
|
||||
private final AppCompatTextClassifierHelper mTextClassifierHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatEditText(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatEditText(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.editTextStyle);
|
||||
}
|
||||
|
||||
public AppCompatEditText(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
this.mTextClassifierHelper = new AppCompatTextClassifierHelper(this);
|
||||
this.mDefaultOnReceiveContentListener = new TextViewOnReceiveContentListener();
|
||||
AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper = new AppCompatEmojiEditTextHelper(this);
|
||||
this.mAppCompatEmojiEditTextHelper = appCompatEmojiEditTextHelper;
|
||||
appCompatEmojiEditTextHelper.loadFromAttributes(attributeSet, i);
|
||||
initEmojiKeyListener(appCompatEmojiEditTextHelper);
|
||||
}
|
||||
|
||||
void initEmojiKeyListener(AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper) {
|
||||
KeyListener keyListener = getKeyListener();
|
||||
if (appCompatEmojiEditTextHelper.isEmojiCapableKeyListener(keyListener)) {
|
||||
boolean isFocusable = super.isFocusable();
|
||||
boolean isClickable = super.isClickable();
|
||||
boolean isLongClickable = super.isLongClickable();
|
||||
int inputType = super.getInputType();
|
||||
KeyListener keyListener2 = appCompatEmojiEditTextHelper.getKeyListener(keyListener);
|
||||
if (keyListener2 == keyListener) {
|
||||
return;
|
||||
}
|
||||
super.setKeyListener(keyListener2);
|
||||
super.setRawInputType(inputType);
|
||||
super.setFocusable(isFocusable);
|
||||
super.setClickable(isClickable);
|
||||
super.setLongClickable(isLongClickable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.EditText, android.widget.TextView
|
||||
public Editable getText() {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return super.getText();
|
||||
}
|
||||
return super.getEditableText();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
String[] onReceiveContentMimeTypes;
|
||||
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
|
||||
this.mTextHelper.populateSurroundingTextIfNeeded(this, onCreateInputConnection, editorInfo);
|
||||
InputConnection onCreateInputConnection2 = AppCompatHintHelper.onCreateInputConnection(onCreateInputConnection, editorInfo, this);
|
||||
if (onCreateInputConnection2 != null && Build.VERSION.SDK_INT <= 30 && (onReceiveContentMimeTypes = ViewCompat.getOnReceiveContentMimeTypes(this)) != null) {
|
||||
EditorInfoCompat.setContentMimeTypes(editorInfo, onReceiveContentMimeTypes);
|
||||
onCreateInputConnection2 = InputConnectionCompat.createWrapper(this, onCreateInputConnection2, editorInfo);
|
||||
}
|
||||
return this.mAppCompatEmojiEditTextHelper.onCreateInputConnection(onCreateInputConnection2, editorInfo);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public ActionMode.Callback getCustomSelectionActionModeCallback() {
|
||||
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
|
||||
}
|
||||
|
||||
private SuperCaller getSuperCaller() {
|
||||
if (this.mSuperCaller == null) {
|
||||
this.mSuperCaller = new SuperCaller();
|
||||
}
|
||||
return this.mSuperCaller;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextClassifier(TextClassifier textClassifier) {
|
||||
AppCompatTextClassifierHelper appCompatTextClassifierHelper;
|
||||
if (Build.VERSION.SDK_INT >= 28 || (appCompatTextClassifierHelper = this.mTextClassifierHelper) == null) {
|
||||
getSuperCaller().setTextClassifier(textClassifier);
|
||||
} else {
|
||||
appCompatTextClassifierHelper.setTextClassifier(textClassifier);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public TextClassifier getTextClassifier() {
|
||||
AppCompatTextClassifierHelper appCompatTextClassifierHelper;
|
||||
if (Build.VERSION.SDK_INT >= 28 || (appCompatTextClassifierHelper = this.mTextClassifierHelper) == null) {
|
||||
return getSuperCaller().getTextClassifier();
|
||||
}
|
||||
return appCompatTextClassifierHelper.getTextClassifier();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public boolean onDragEvent(DragEvent dragEvent) {
|
||||
if (AppCompatReceiveContentHelper.maybeHandleDragEventViaPerformReceiveContent(this, dragEvent)) {
|
||||
return true;
|
||||
}
|
||||
return super.onDragEvent(dragEvent);
|
||||
}
|
||||
|
||||
@Override // android.widget.EditText, android.widget.TextView
|
||||
public boolean onTextContextMenuItem(int i) {
|
||||
if (AppCompatReceiveContentHelper.maybeHandleMenuActionViaPerformReceiveContent(this, i)) {
|
||||
return true;
|
||||
}
|
||||
return super.onTextContextMenuItem(i);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.OnReceiveContentViewBehavior
|
||||
public ContentInfoCompat onReceiveContent(ContentInfoCompat contentInfoCompat) {
|
||||
return this.mDefaultOnReceiveContentListener.onReceiveContent(this, contentInfoCompat);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setKeyListener(KeyListener keyListener) {
|
||||
super.setKeyListener(this.mAppCompatEmojiEditTextHelper.getKeyListener(keyListener));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
this.mAppCompatEmojiEditTextHelper.setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return this.mAppCompatEmojiEditTextHelper.isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
class SuperCaller {
|
||||
SuperCaller() {
|
||||
}
|
||||
|
||||
public TextClassifier getTextClassifier() {
|
||||
return AppCompatEditText.super.getTextClassifier();
|
||||
}
|
||||
|
||||
public void setTextClassifier(TextClassifier textClassifier) {
|
||||
AppCompatEditText.super.setTextClassifier(textClassifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.TypedArray;
|
||||
import android.text.method.KeyListener;
|
||||
import android.text.method.NumberKeyListener;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.EditText;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.emoji2.viewsintegration.EmojiEditTextHelper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatEmojiEditTextHelper {
|
||||
private final EmojiEditTextHelper mEmojiEditTextHelper;
|
||||
private final EditText mView;
|
||||
|
||||
AppCompatEmojiEditTextHelper(EditText editText) {
|
||||
this.mView = editText;
|
||||
this.mEmojiEditTextHelper = new EmojiEditTextHelper(editText, false);
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
TypedArray obtainStyledAttributes = this.mView.getContext().obtainStyledAttributes(attributeSet, R.styleable.AppCompatTextView, i, 0);
|
||||
try {
|
||||
boolean z = obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_emojiCompatEnabled) ? obtainStyledAttributes.getBoolean(R.styleable.AppCompatTextView_emojiCompatEnabled, true) : true;
|
||||
obtainStyledAttributes.recycle();
|
||||
setEnabled(z);
|
||||
} catch (Throwable th) {
|
||||
obtainStyledAttributes.recycle();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isEmojiCapableKeyListener(KeyListener keyListener) {
|
||||
return !(keyListener instanceof NumberKeyListener);
|
||||
}
|
||||
|
||||
void setEnabled(boolean z) {
|
||||
this.mEmojiEditTextHelper.setEnabled(z);
|
||||
}
|
||||
|
||||
boolean isEnabled() {
|
||||
return this.mEmojiEditTextHelper.isEnabled();
|
||||
}
|
||||
|
||||
KeyListener getKeyListener(KeyListener keyListener) {
|
||||
return isEmojiCapableKeyListener(keyListener) ? this.mEmojiEditTextHelper.getKeyListener(keyListener) : keyListener;
|
||||
}
|
||||
|
||||
InputConnection onCreateInputConnection(InputConnection inputConnection, EditorInfo editorInfo) {
|
||||
return this.mEmojiEditTextHelper.onCreateInputConnection(inputConnection, editorInfo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.TypedArray;
|
||||
import android.text.InputFilter;
|
||||
import android.text.method.TransformationMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.emoji2.viewsintegration.EmojiTextViewHelper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatEmojiTextHelper {
|
||||
private final EmojiTextViewHelper mEmojiTextViewHelper;
|
||||
private final TextView mView;
|
||||
|
||||
AppCompatEmojiTextHelper(TextView textView) {
|
||||
this.mView = textView;
|
||||
this.mEmojiTextViewHelper = new EmojiTextViewHelper(textView, false);
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
TypedArray obtainStyledAttributes = this.mView.getContext().obtainStyledAttributes(attributeSet, R.styleable.AppCompatTextView, i, 0);
|
||||
try {
|
||||
boolean z = obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_emojiCompatEnabled) ? obtainStyledAttributes.getBoolean(R.styleable.AppCompatTextView_emojiCompatEnabled, true) : true;
|
||||
obtainStyledAttributes.recycle();
|
||||
setEnabled(z);
|
||||
} catch (Throwable th) {
|
||||
obtainStyledAttributes.recycle();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
void setEnabled(boolean z) {
|
||||
this.mEmojiTextViewHelper.setEnabled(z);
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.mEmojiTextViewHelper.isEnabled();
|
||||
}
|
||||
|
||||
InputFilter[] getFilters(InputFilter[] inputFilterArr) {
|
||||
return this.mEmojiTextViewHelper.getFilters(inputFilterArr);
|
||||
}
|
||||
|
||||
void setAllCaps(boolean z) {
|
||||
this.mEmojiTextViewHelper.setAllCaps(z);
|
||||
}
|
||||
|
||||
public TransformationMethod wrapTransformationMethod(TransformationMethod transformationMethod) {
|
||||
return this.mEmojiTextViewHelper.wrapTransformationMethod(transformationMethod);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatHintHelper {
|
||||
static InputConnection onCreateInputConnection(InputConnection inputConnection, EditorInfo editorInfo, View view) {
|
||||
if (inputConnection != null && editorInfo.hintText == null) {
|
||||
ViewParent parent = view.getParent();
|
||||
while (true) {
|
||||
if (!(parent instanceof View)) {
|
||||
break;
|
||||
}
|
||||
if (parent instanceof WithHint) {
|
||||
editorInfo.hintText = ((WithHint) parent).getHint();
|
||||
break;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
}
|
||||
return inputConnection;
|
||||
}
|
||||
|
||||
private AppCompatHintHelper() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageButton;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableImageSourceView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatImageButton extends ImageButton implements TintableBackgroundView, TintableImageSourceView {
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private boolean mHasLevel;
|
||||
private final AppCompatImageHelper mImageHelper;
|
||||
|
||||
public AppCompatImageButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatImageButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.imageButtonStyle);
|
||||
}
|
||||
|
||||
public AppCompatImageButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
this.mHasLevel = false;
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatImageHelper appCompatImageHelper = new AppCompatImageHelper(this);
|
||||
this.mImageHelper = appCompatImageHelper;
|
||||
appCompatImageHelper.loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageResource(int i) {
|
||||
this.mImageHelper.setImageResource(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageDrawable(Drawable drawable) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null && drawable != null && !this.mHasLevel) {
|
||||
appCompatImageHelper.obtainLevelFromDrawable(drawable);
|
||||
}
|
||||
super.setImageDrawable(drawable);
|
||||
AppCompatImageHelper appCompatImageHelper2 = this.mImageHelper;
|
||||
if (appCompatImageHelper2 != null) {
|
||||
appCompatImageHelper2.applySupportImageTint();
|
||||
if (this.mHasLevel) {
|
||||
return;
|
||||
}
|
||||
this.mImageHelper.applyImageLevel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageBitmap(Bitmap bitmap) {
|
||||
super.setImageBitmap(bitmap);
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageURI(Uri uri) {
|
||||
super.setImageURI(uri);
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintList(ColorStateList colorStateList) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.setSupportImageTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public ColorStateList getSupportImageTintList() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.getSupportImageTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.setSupportImageTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public PorterDuff.Mode getSupportImageTintMode() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.getSupportImageTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
public boolean hasOverlappingRendering() {
|
||||
return this.mImageHelper.hasOverlappingRendering() && super.hasOverlappingRendering();
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageLevel(int i) {
|
||||
super.setImageLevel(i);
|
||||
this.mHasLevel = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.widget.ImageViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatImageHelper {
|
||||
private TintInfo mImageTint;
|
||||
private TintInfo mInternalImageTint;
|
||||
private int mLevel = 0;
|
||||
private TintInfo mTmpInfo;
|
||||
private final ImageView mView;
|
||||
|
||||
private boolean shouldApplyFrameworkTintUsingColorFilter() {
|
||||
int i = Build.VERSION.SDK_INT;
|
||||
return i > 21 ? this.mInternalImageTint != null : i == 21;
|
||||
}
|
||||
|
||||
public AppCompatImageHelper(ImageView imageView) {
|
||||
this.mView = imageView;
|
||||
}
|
||||
|
||||
public void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
int resourceId;
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attributeSet, R.styleable.AppCompatImageView, i, 0);
|
||||
ImageView imageView = this.mView;
|
||||
ViewCompat.saveAttributeDataForStyleable(imageView, imageView.getContext(), R.styleable.AppCompatImageView, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0);
|
||||
try {
|
||||
Drawable drawable = this.mView.getDrawable();
|
||||
if (drawable == null && (resourceId = obtainStyledAttributes.getResourceId(R.styleable.AppCompatImageView_srcCompat, -1)) != -1 && (drawable = AppCompatResources.getDrawable(this.mView.getContext(), resourceId)) != null) {
|
||||
this.mView.setImageDrawable(drawable);
|
||||
}
|
||||
if (drawable != null) {
|
||||
DrawableUtils.fixDrawable(drawable);
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatImageView_tint)) {
|
||||
ImageViewCompat.setImageTintList(this.mView, obtainStyledAttributes.getColorStateList(R.styleable.AppCompatImageView_tint));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatImageView_tintMode)) {
|
||||
ImageViewCompat.setImageTintMode(this.mView, DrawableUtils.parseTintMode(obtainStyledAttributes.getInt(R.styleable.AppCompatImageView_tintMode, -1), null));
|
||||
}
|
||||
} finally {
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public void setImageResource(int i) {
|
||||
if (i != 0) {
|
||||
Drawable drawable = AppCompatResources.getDrawable(this.mView.getContext(), i);
|
||||
if (drawable != null) {
|
||||
DrawableUtils.fixDrawable(drawable);
|
||||
}
|
||||
this.mView.setImageDrawable(drawable);
|
||||
} else {
|
||||
this.mView.setImageDrawable(null);
|
||||
}
|
||||
applySupportImageTint();
|
||||
}
|
||||
|
||||
boolean hasOverlappingRendering() {
|
||||
return !(this.mView.getBackground() instanceof RippleDrawable);
|
||||
}
|
||||
|
||||
void setSupportImageTintList(ColorStateList colorStateList) {
|
||||
if (this.mImageTint == null) {
|
||||
this.mImageTint = new TintInfo();
|
||||
}
|
||||
this.mImageTint.mTintList = colorStateList;
|
||||
this.mImageTint.mHasTintList = true;
|
||||
applySupportImageTint();
|
||||
}
|
||||
|
||||
ColorStateList getSupportImageTintList() {
|
||||
TintInfo tintInfo = this.mImageTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void setSupportImageTintMode(PorterDuff.Mode mode) {
|
||||
if (this.mImageTint == null) {
|
||||
this.mImageTint = new TintInfo();
|
||||
}
|
||||
this.mImageTint.mTintMode = mode;
|
||||
this.mImageTint.mHasTintMode = true;
|
||||
applySupportImageTint();
|
||||
}
|
||||
|
||||
PorterDuff.Mode getSupportImageTintMode() {
|
||||
TintInfo tintInfo = this.mImageTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintMode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void applySupportImageTint() {
|
||||
Drawable drawable = this.mView.getDrawable();
|
||||
if (drawable != null) {
|
||||
DrawableUtils.fixDrawable(drawable);
|
||||
}
|
||||
if (drawable != null) {
|
||||
if (shouldApplyFrameworkTintUsingColorFilter() && applyFrameworkTintUsingColorFilter(drawable)) {
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo = this.mImageTint;
|
||||
if (tintInfo != null) {
|
||||
AppCompatDrawableManager.tintDrawable(drawable, tintInfo, this.mView.getDrawableState());
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo2 = this.mInternalImageTint;
|
||||
if (tintInfo2 != null) {
|
||||
AppCompatDrawableManager.tintDrawable(drawable, tintInfo2, this.mView.getDrawableState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setInternalImageTint(ColorStateList colorStateList) {
|
||||
if (colorStateList != null) {
|
||||
if (this.mInternalImageTint == null) {
|
||||
this.mInternalImageTint = new TintInfo();
|
||||
}
|
||||
this.mInternalImageTint.mTintList = colorStateList;
|
||||
this.mInternalImageTint.mHasTintList = true;
|
||||
} else {
|
||||
this.mInternalImageTint = null;
|
||||
}
|
||||
applySupportImageTint();
|
||||
}
|
||||
|
||||
private boolean applyFrameworkTintUsingColorFilter(Drawable drawable) {
|
||||
if (this.mTmpInfo == null) {
|
||||
this.mTmpInfo = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.mTmpInfo;
|
||||
tintInfo.clear();
|
||||
ColorStateList imageTintList = ImageViewCompat.getImageTintList(this.mView);
|
||||
if (imageTintList != null) {
|
||||
tintInfo.mHasTintList = true;
|
||||
tintInfo.mTintList = imageTintList;
|
||||
}
|
||||
PorterDuff.Mode imageTintMode = ImageViewCompat.getImageTintMode(this.mView);
|
||||
if (imageTintMode != null) {
|
||||
tintInfo.mHasTintMode = true;
|
||||
tintInfo.mTintMode = imageTintMode;
|
||||
}
|
||||
if (!tintInfo.mHasTintList && !tintInfo.mHasTintMode) {
|
||||
return false;
|
||||
}
|
||||
AppCompatDrawableManager.tintDrawable(drawable, tintInfo, this.mView.getDrawableState());
|
||||
return true;
|
||||
}
|
||||
|
||||
void obtainLevelFromDrawable(Drawable drawable) {
|
||||
this.mLevel = drawable.getLevel();
|
||||
}
|
||||
|
||||
void applyImageLevel() {
|
||||
if (this.mView.getDrawable() != null) {
|
||||
this.mView.getDrawable().setLevel(this.mLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableImageSourceView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatImageView extends ImageView implements TintableBackgroundView, TintableImageSourceView {
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private boolean mHasLevel;
|
||||
private final AppCompatImageHelper mImageHelper;
|
||||
|
||||
public AppCompatImageView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatImageView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public AppCompatImageView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
this.mHasLevel = false;
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatImageHelper appCompatImageHelper = new AppCompatImageHelper(this);
|
||||
this.mImageHelper = appCompatImageHelper;
|
||||
appCompatImageHelper.loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageResource(int i) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.setImageResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageDrawable(Drawable drawable) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null && drawable != null && !this.mHasLevel) {
|
||||
appCompatImageHelper.obtainLevelFromDrawable(drawable);
|
||||
}
|
||||
super.setImageDrawable(drawable);
|
||||
AppCompatImageHelper appCompatImageHelper2 = this.mImageHelper;
|
||||
if (appCompatImageHelper2 != null) {
|
||||
appCompatImageHelper2.applySupportImageTint();
|
||||
if (this.mHasLevel) {
|
||||
return;
|
||||
}
|
||||
this.mImageHelper.applyImageLevel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageBitmap(Bitmap bitmap) {
|
||||
super.setImageBitmap(bitmap);
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageURI(Uri uri) {
|
||||
super.setImageURI(uri);
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintList(ColorStateList colorStateList) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.setSupportImageTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public ColorStateList getSupportImageTintList() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.getSupportImageTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.setSupportImageTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public PorterDuff.Mode getSupportImageTintMode() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.getSupportImageTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
public boolean hasOverlappingRendering() {
|
||||
return this.mImageHelper.hasOverlappingRendering() && super.hasOverlappingRendering();
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageLevel(int i) {
|
||||
super.setImageLevel(i);
|
||||
this.mHasLevel = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.method.KeyListener;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.MultiAutoCompleteTextView;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatMultiAutoCompleteTextView extends MultiAutoCompleteTextView implements TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private static final int[] TINT_ATTRS = {R.attr.popupBackground};
|
||||
private final AppCompatEmojiEditTextHelper mAppCompatEmojiEditTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatMultiAutoCompleteTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatMultiAutoCompleteTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, androidx.appcompat.R.attr.autoCompleteTextViewStyle);
|
||||
}
|
||||
|
||||
public AppCompatMultiAutoCompleteTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(getContext(), attributeSet, TINT_ATTRS, i, 0);
|
||||
if (obtainStyledAttributes.hasValue(0)) {
|
||||
setDropDownBackgroundDrawable(obtainStyledAttributes.getDrawable(0));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper = new AppCompatEmojiEditTextHelper(this);
|
||||
this.mAppCompatEmojiEditTextHelper = appCompatEmojiEditTextHelper;
|
||||
appCompatEmojiEditTextHelper.loadFromAttributes(attributeSet, i);
|
||||
initEmojiKeyListener(appCompatEmojiEditTextHelper);
|
||||
}
|
||||
|
||||
void initEmojiKeyListener(AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper) {
|
||||
KeyListener keyListener = getKeyListener();
|
||||
if (appCompatEmojiEditTextHelper.isEmojiCapableKeyListener(keyListener)) {
|
||||
boolean isFocusable = super.isFocusable();
|
||||
boolean isClickable = super.isClickable();
|
||||
boolean isLongClickable = super.isLongClickable();
|
||||
int inputType = super.getInputType();
|
||||
KeyListener keyListener2 = appCompatEmojiEditTextHelper.getKeyListener(keyListener);
|
||||
if (keyListener2 == keyListener) {
|
||||
return;
|
||||
}
|
||||
super.setKeyListener(keyListener2);
|
||||
super.setRawInputType(inputType);
|
||||
super.setFocusable(isFocusable);
|
||||
super.setClickable(isClickable);
|
||||
super.setLongClickable(isLongClickable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.AutoCompleteTextView
|
||||
public void setDropDownBackgroundResource(int i) {
|
||||
setDropDownBackgroundDrawable(AppCompatResources.getDrawable(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
return this.mAppCompatEmojiEditTextHelper.onCreateInputConnection(AppCompatHintHelper.onCreateInputConnection(super.onCreateInputConnection(editorInfo), editorInfo, this), editorInfo);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setKeyListener(KeyListener keyListener) {
|
||||
super.setKeyListener(this.mAppCompatEmojiEditTextHelper.getKeyListener(keyListener));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
this.mAppCompatEmojiEditTextHelper.setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return this.mAppCompatEmojiEditTextHelper.isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.PopupWindow;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.widget.PopupWindowCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatPopupWindow extends PopupWindow {
|
||||
private static final boolean COMPAT_OVERLAP_ANCHOR = false;
|
||||
private boolean mOverlapAnchor;
|
||||
|
||||
public AppCompatPopupWindow(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
init(context, attributeSet, i, 0);
|
||||
}
|
||||
|
||||
public AppCompatPopupWindow(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
init(context, attributeSet, i, i2);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.PopupWindow, i, i2);
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.PopupWindow_overlapAnchor)) {
|
||||
setSupportOverlapAnchor(obtainStyledAttributes.getBoolean(R.styleable.PopupWindow_overlapAnchor, false));
|
||||
}
|
||||
setBackgroundDrawable(obtainStyledAttributes.getDrawable(R.styleable.PopupWindow_android_popupBackground));
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow
|
||||
public void showAsDropDown(View view, int i, int i2) {
|
||||
if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
|
||||
i2 -= view.getHeight();
|
||||
}
|
||||
super.showAsDropDown(view, i, i2);
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow
|
||||
public void showAsDropDown(View view, int i, int i2, int i3) {
|
||||
if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
|
||||
i2 -= view.getHeight();
|
||||
}
|
||||
super.showAsDropDown(view, i, i2, i3);
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow
|
||||
public void update(View view, int i, int i2, int i3, int i4) {
|
||||
if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
|
||||
i2 -= view.getHeight();
|
||||
}
|
||||
super.update(view, i, i2, i3, i4);
|
||||
}
|
||||
|
||||
private void setSupportOverlapAnchor(boolean z) {
|
||||
if (COMPAT_OVERLAP_ANCHOR) {
|
||||
this.mOverlapAnchor = z;
|
||||
} else {
|
||||
PopupWindowCompat.setOverlapAnchor(this, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ClipDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.RoundRectShape;
|
||||
import android.graphics.drawable.shapes.Shape;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ProgressBar;
|
||||
import androidx.core.graphics.drawable.WrappedDrawable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatProgressBarHelper {
|
||||
private static final int[] TINT_ATTRS = {R.attr.indeterminateDrawable, R.attr.progressDrawable};
|
||||
private Bitmap mSampleTile;
|
||||
private final ProgressBar mView;
|
||||
|
||||
Bitmap getSampleTile() {
|
||||
return this.mSampleTile;
|
||||
}
|
||||
|
||||
AppCompatProgressBarHelper(ProgressBar progressBar) {
|
||||
this.mView = progressBar;
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attributeSet, TINT_ATTRS, i, 0);
|
||||
Drawable drawableIfKnown = obtainStyledAttributes.getDrawableIfKnown(0);
|
||||
if (drawableIfKnown != null) {
|
||||
this.mView.setIndeterminateDrawable(tileifyIndeterminate(drawableIfKnown));
|
||||
}
|
||||
Drawable drawableIfKnown2 = obtainStyledAttributes.getDrawableIfKnown(1);
|
||||
if (drawableIfKnown2 != null) {
|
||||
this.mView.setProgressDrawable(tileify(drawableIfKnown2, false));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
Drawable tileify(Drawable drawable, boolean z) {
|
||||
if (drawable instanceof WrappedDrawable) {
|
||||
WrappedDrawable wrappedDrawable = (WrappedDrawable) drawable;
|
||||
Drawable wrappedDrawable2 = wrappedDrawable.getWrappedDrawable();
|
||||
if (wrappedDrawable2 != null) {
|
||||
wrappedDrawable.setWrappedDrawable(tileify(wrappedDrawable2, z));
|
||||
}
|
||||
} else {
|
||||
if (drawable instanceof LayerDrawable) {
|
||||
LayerDrawable layerDrawable = (LayerDrawable) drawable;
|
||||
int numberOfLayers = layerDrawable.getNumberOfLayers();
|
||||
Drawable[] drawableArr = new Drawable[numberOfLayers];
|
||||
for (int i = 0; i < numberOfLayers; i++) {
|
||||
int id = layerDrawable.getId(i);
|
||||
drawableArr[i] = tileify(layerDrawable.getDrawable(i), id == 16908301 || id == 16908303);
|
||||
}
|
||||
LayerDrawable layerDrawable2 = new LayerDrawable(drawableArr);
|
||||
for (int i2 = 0; i2 < numberOfLayers; i2++) {
|
||||
layerDrawable2.setId(i2, layerDrawable.getId(i2));
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
Api23Impl.transferLayerProperties(layerDrawable, layerDrawable2, i2);
|
||||
}
|
||||
}
|
||||
return layerDrawable2;
|
||||
}
|
||||
if (drawable instanceof BitmapDrawable) {
|
||||
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
|
||||
Bitmap bitmap = bitmapDrawable.getBitmap();
|
||||
if (this.mSampleTile == null) {
|
||||
this.mSampleTile = bitmap;
|
||||
}
|
||||
ShapeDrawable shapeDrawable = new ShapeDrawable(getDrawableShape());
|
||||
shapeDrawable.getPaint().setShader(new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.CLAMP));
|
||||
shapeDrawable.getPaint().setColorFilter(bitmapDrawable.getPaint().getColorFilter());
|
||||
return z ? new ClipDrawable(shapeDrawable, 3, 1) : shapeDrawable;
|
||||
}
|
||||
}
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private Drawable tileifyIndeterminate(Drawable drawable) {
|
||||
if (!(drawable instanceof AnimationDrawable)) {
|
||||
return drawable;
|
||||
}
|
||||
AnimationDrawable animationDrawable = (AnimationDrawable) drawable;
|
||||
int numberOfFrames = animationDrawable.getNumberOfFrames();
|
||||
AnimationDrawable animationDrawable2 = new AnimationDrawable();
|
||||
animationDrawable2.setOneShot(animationDrawable.isOneShot());
|
||||
for (int i = 0; i < numberOfFrames; i++) {
|
||||
Drawable tileify = tileify(animationDrawable.getFrame(i), true);
|
||||
tileify.setLevel(10000);
|
||||
animationDrawable2.addFrame(tileify, animationDrawable.getDuration(i));
|
||||
}
|
||||
animationDrawable2.setLevel(10000);
|
||||
return animationDrawable2;
|
||||
}
|
||||
|
||||
private Shape getDrawableShape() {
|
||||
return new RoundRectShape(new float[]{5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f}, null, null);
|
||||
}
|
||||
|
||||
private static class Api23Impl {
|
||||
private Api23Impl() {
|
||||
}
|
||||
|
||||
public static void transferLayerProperties(LayerDrawable layerDrawable, LayerDrawable layerDrawable2, int i) {
|
||||
layerDrawable2.setLayerGravity(i, layerDrawable.getLayerGravity(i));
|
||||
layerDrawable2.setLayerWidth(i, layerDrawable.getLayerWidth(i));
|
||||
layerDrawable2.setLayerHeight(i, layerDrawable.getLayerHeight(i));
|
||||
layerDrawable2.setLayerInsetLeft(i, layerDrawable.getLayerInsetLeft(i));
|
||||
layerDrawable2.setLayerInsetRight(i, layerDrawable.getLayerInsetRight(i));
|
||||
layerDrawable2.setLayerInsetTop(i, layerDrawable.getLayerInsetTop(i));
|
||||
layerDrawable2.setLayerInsetBottom(i, layerDrawable.getLayerInsetBottom(i));
|
||||
layerDrawable2.setLayerInsetStart(i, layerDrawable.getLayerInsetStart(i));
|
||||
layerDrawable2.setLayerInsetEnd(i, layerDrawable.getLayerInsetEnd(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.InputFilter;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.RadioButton;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableCompoundButton;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatRadioButton extends RadioButton implements TintableCompoundButton, TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatCompoundButtonHelper mCompoundButtonHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatRadioButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatRadioButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.radioButtonStyle);
|
||||
}
|
||||
|
||||
public AppCompatRadioButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = new AppCompatCompoundButtonHelper(this);
|
||||
this.mCompoundButtonHelper = appCompatCompoundButtonHelper;
|
||||
appCompatCompoundButtonHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
getEmojiTextViewHelper().loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
|
||||
if (this.mAppCompatEmojiTextHelper == null) {
|
||||
this.mAppCompatEmojiTextHelper = new AppCompatEmojiTextHelper(this);
|
||||
}
|
||||
return this.mAppCompatEmojiTextHelper;
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(Drawable drawable) {
|
||||
super.setButtonDrawable(drawable);
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.onSetButtonDrawable();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(int i) {
|
||||
setButtonDrawable(AppCompatResources.getDrawable(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton, android.widget.TextView
|
||||
public int getCompoundPaddingLeft() {
|
||||
int compoundPaddingLeft = super.getCompoundPaddingLeft();
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
return appCompatCompoundButtonHelper != null ? appCompatCompoundButtonHelper.getCompoundPaddingLeft(compoundPaddingLeft) : compoundPaddingLeft;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintList(ColorStateList colorStateList) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.setSupportButtonTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public ColorStateList getSupportButtonTintList() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.getSupportButtonTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.setSupportButtonTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public PorterDuff.Mode getSupportButtonTintMode() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.getSupportButtonTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setFilters(InputFilter[] inputFilterArr) {
|
||||
super.setFilters(getEmojiTextViewHelper().getFilters(inputFilterArr));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAllCaps(boolean z) {
|
||||
super.setAllCaps(z);
|
||||
getEmojiTextViewHelper().setAllCaps(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
getEmojiTextViewHelper().setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return getEmojiTextViewHelper().isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.RatingBar;
|
||||
import androidx.appcompat.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatRatingBar extends RatingBar {
|
||||
private final AppCompatProgressBarHelper mAppCompatProgressBarHelper;
|
||||
|
||||
public AppCompatRatingBar(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatRatingBar(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.ratingBarStyle);
|
||||
}
|
||||
|
||||
public AppCompatRatingBar(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatProgressBarHelper appCompatProgressBarHelper = new AppCompatProgressBarHelper(this);
|
||||
this.mAppCompatProgressBarHelper = appCompatProgressBarHelper;
|
||||
appCompatProgressBarHelper.loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.RatingBar, android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
protected synchronized void onMeasure(int i, int i2) {
|
||||
super.onMeasure(i, i2);
|
||||
Bitmap sampleTile = this.mAppCompatProgressBarHelper.getSampleTile();
|
||||
if (sampleTile != null) {
|
||||
setMeasuredDimension(View.resolveSizeAndState(sampleTile.getWidth() * getNumStars(), i, 0), getMeasuredHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.os.Build;
|
||||
import android.text.Selection;
|
||||
import android.text.Spannable;
|
||||
import android.util.Log;
|
||||
import android.view.DragEvent;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.core.view.ContentInfoCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AppCompatReceiveContentHelper {
|
||||
private static final String LOG_TAG = "ReceiveContent";
|
||||
|
||||
private AppCompatReceiveContentHelper() {
|
||||
}
|
||||
|
||||
static boolean maybeHandleMenuActionViaPerformReceiveContent(TextView textView, int i) {
|
||||
if (Build.VERSION.SDK_INT >= 31 || ViewCompat.getOnReceiveContentMimeTypes(textView) == null || !(i == 16908322 || i == 16908337)) {
|
||||
return false;
|
||||
}
|
||||
ClipboardManager clipboardManager = (ClipboardManager) textView.getContext().getSystemService("clipboard");
|
||||
ClipData primaryClip = clipboardManager == null ? null : clipboardManager.getPrimaryClip();
|
||||
if (primaryClip != null && primaryClip.getItemCount() > 0) {
|
||||
ViewCompat.performReceiveContent(textView, new ContentInfoCompat.Builder(primaryClip, 1).setFlags(i != 16908322 ? 1 : 0).build());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean maybeHandleDragEventViaPerformReceiveContent(View view, DragEvent dragEvent) {
|
||||
if (Build.VERSION.SDK_INT < 31 && Build.VERSION.SDK_INT >= 24 && dragEvent.getLocalState() == null && ViewCompat.getOnReceiveContentMimeTypes(view) != null) {
|
||||
Activity tryGetActivity = tryGetActivity(view);
|
||||
if (tryGetActivity == null) {
|
||||
Log.i(LOG_TAG, "Can't handle drop: no activity: view=" + view);
|
||||
return false;
|
||||
}
|
||||
if (dragEvent.getAction() == 1) {
|
||||
return !(view instanceof TextView);
|
||||
}
|
||||
if (dragEvent.getAction() == 3) {
|
||||
if (view instanceof TextView) {
|
||||
return OnDropApi24Impl.onDropForTextView(dragEvent, (TextView) view, tryGetActivity);
|
||||
}
|
||||
return OnDropApi24Impl.onDropForView(dragEvent, view, tryGetActivity);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final class OnDropApi24Impl {
|
||||
private OnDropApi24Impl() {
|
||||
}
|
||||
|
||||
static boolean onDropForTextView(DragEvent dragEvent, TextView textView, Activity activity) {
|
||||
activity.requestDragAndDropPermissions(dragEvent);
|
||||
int offsetForPosition = textView.getOffsetForPosition(dragEvent.getX(), dragEvent.getY());
|
||||
textView.beginBatchEdit();
|
||||
try {
|
||||
Selection.setSelection((Spannable) textView.getText(), offsetForPosition);
|
||||
ViewCompat.performReceiveContent(textView, new ContentInfoCompat.Builder(dragEvent.getClipData(), 3).build());
|
||||
textView.endBatchEdit();
|
||||
return true;
|
||||
} catch (Throwable th) {
|
||||
textView.endBatchEdit();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean onDropForView(DragEvent dragEvent, View view, Activity activity) {
|
||||
activity.requestDragAndDropPermissions(dragEvent);
|
||||
ViewCompat.performReceiveContent(view, new ContentInfoCompat.Builder(dragEvent.getClipData(), 3).build());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static Activity tryGetActivity(View view) {
|
||||
for (Context context = view.getContext(); context instanceof ContextWrapper; context = ((ContextWrapper) context).getBaseContext()) {
|
||||
if (context instanceof Activity) {
|
||||
return (Activity) context;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.SeekBar;
|
||||
import androidx.appcompat.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatSeekBar extends SeekBar {
|
||||
private final AppCompatSeekBarHelper mAppCompatSeekBarHelper;
|
||||
|
||||
public AppCompatSeekBar(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatSeekBar(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.seekBarStyle);
|
||||
}
|
||||
|
||||
public AppCompatSeekBar(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatSeekBarHelper appCompatSeekBarHelper = new AppCompatSeekBarHelper(this);
|
||||
this.mAppCompatSeekBarHelper = appCompatSeekBarHelper;
|
||||
appCompatSeekBarHelper.loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
protected synchronized void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
this.mAppCompatSeekBarHelper.drawTickMarks(canvas);
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
this.mAppCompatSeekBarHelper.drawableStateChanged();
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
public void jumpDrawablesToCurrentState() {
|
||||
super.jumpDrawablesToCurrentState();
|
||||
this.mAppCompatSeekBarHelper.jumpDrawablesToCurrentState();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.SeekBar;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatSeekBarHelper extends AppCompatProgressBarHelper {
|
||||
private boolean mHasTickMarkTint;
|
||||
private boolean mHasTickMarkTintMode;
|
||||
private Drawable mTickMark;
|
||||
private ColorStateList mTickMarkTintList;
|
||||
private PorterDuff.Mode mTickMarkTintMode;
|
||||
private final SeekBar mView;
|
||||
|
||||
Drawable getTickMark() {
|
||||
return this.mTickMark;
|
||||
}
|
||||
|
||||
ColorStateList getTickMarkTintList() {
|
||||
return this.mTickMarkTintList;
|
||||
}
|
||||
|
||||
PorterDuff.Mode getTickMarkTintMode() {
|
||||
return this.mTickMarkTintMode;
|
||||
}
|
||||
|
||||
AppCompatSeekBarHelper(SeekBar seekBar) {
|
||||
super(seekBar);
|
||||
this.mTickMarkTintList = null;
|
||||
this.mTickMarkTintMode = null;
|
||||
this.mHasTickMarkTint = false;
|
||||
this.mHasTickMarkTintMode = false;
|
||||
this.mView = seekBar;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatProgressBarHelper
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
super.loadFromAttributes(attributeSet, i);
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attributeSet, R.styleable.AppCompatSeekBar, i, 0);
|
||||
SeekBar seekBar = this.mView;
|
||||
ViewCompat.saveAttributeDataForStyleable(seekBar, seekBar.getContext(), R.styleable.AppCompatSeekBar, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0);
|
||||
Drawable drawableIfKnown = obtainStyledAttributes.getDrawableIfKnown(R.styleable.AppCompatSeekBar_android_thumb);
|
||||
if (drawableIfKnown != null) {
|
||||
this.mView.setThumb(drawableIfKnown);
|
||||
}
|
||||
setTickMark(obtainStyledAttributes.getDrawable(R.styleable.AppCompatSeekBar_tickMark));
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatSeekBar_tickMarkTintMode)) {
|
||||
this.mTickMarkTintMode = DrawableUtils.parseTintMode(obtainStyledAttributes.getInt(R.styleable.AppCompatSeekBar_tickMarkTintMode, -1), this.mTickMarkTintMode);
|
||||
this.mHasTickMarkTintMode = true;
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatSeekBar_tickMarkTint)) {
|
||||
this.mTickMarkTintList = obtainStyledAttributes.getColorStateList(R.styleable.AppCompatSeekBar_tickMarkTint);
|
||||
this.mHasTickMarkTint = true;
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
applyTickMarkTint();
|
||||
}
|
||||
|
||||
void setTickMark(Drawable drawable) {
|
||||
Drawable drawable2 = this.mTickMark;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setCallback(null);
|
||||
}
|
||||
this.mTickMark = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this.mView);
|
||||
DrawableCompat.setLayoutDirection(drawable, ViewCompat.getLayoutDirection(this.mView));
|
||||
if (drawable.isStateful()) {
|
||||
drawable.setState(this.mView.getDrawableState());
|
||||
}
|
||||
applyTickMarkTint();
|
||||
}
|
||||
this.mView.invalidate();
|
||||
}
|
||||
|
||||
void setTickMarkTintList(ColorStateList colorStateList) {
|
||||
this.mTickMarkTintList = colorStateList;
|
||||
this.mHasTickMarkTint = true;
|
||||
applyTickMarkTint();
|
||||
}
|
||||
|
||||
void setTickMarkTintMode(PorterDuff.Mode mode) {
|
||||
this.mTickMarkTintMode = mode;
|
||||
this.mHasTickMarkTintMode = true;
|
||||
applyTickMarkTint();
|
||||
}
|
||||
|
||||
private void applyTickMarkTint() {
|
||||
Drawable drawable = this.mTickMark;
|
||||
if (drawable != null) {
|
||||
if (this.mHasTickMarkTint || this.mHasTickMarkTintMode) {
|
||||
Drawable wrap = DrawableCompat.wrap(drawable.mutate());
|
||||
this.mTickMark = wrap;
|
||||
if (this.mHasTickMarkTint) {
|
||||
DrawableCompat.setTintList(wrap, this.mTickMarkTintList);
|
||||
}
|
||||
if (this.mHasTickMarkTintMode) {
|
||||
DrawableCompat.setTintMode(this.mTickMark, this.mTickMarkTintMode);
|
||||
}
|
||||
if (this.mTickMark.isStateful()) {
|
||||
this.mTickMark.setState(this.mView.getDrawableState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void jumpDrawablesToCurrentState() {
|
||||
Drawable drawable = this.mTickMark;
|
||||
if (drawable != null) {
|
||||
drawable.jumpToCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
void drawableStateChanged() {
|
||||
Drawable drawable = this.mTickMark;
|
||||
if (drawable != null && drawable.isStateful() && drawable.setState(this.mView.getDrawableState())) {
|
||||
this.mView.invalidateDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
void drawTickMarks(Canvas canvas) {
|
||||
if (this.mTickMark != null) {
|
||||
int max = this.mView.getMax();
|
||||
if (max > 1) {
|
||||
int intrinsicWidth = this.mTickMark.getIntrinsicWidth();
|
||||
int intrinsicHeight = this.mTickMark.getIntrinsicHeight();
|
||||
int i = intrinsicWidth >= 0 ? intrinsicWidth / 2 : 1;
|
||||
int i2 = intrinsicHeight >= 0 ? intrinsicHeight / 2 : 1;
|
||||
this.mTickMark.setBounds(-i, -i2, i, i2);
|
||||
float width = ((this.mView.getWidth() - this.mView.getPaddingLeft()) - this.mView.getPaddingRight()) / max;
|
||||
int save = canvas.save();
|
||||
canvas.translate(this.mView.getPaddingLeft(), this.mView.getHeight() / 2);
|
||||
for (int i3 = 0; i3 <= max; i3++) {
|
||||
this.mTickMark.draw(canvas);
|
||||
canvas.translate(width, 0.0f);
|
||||
}
|
||||
canvas.restoreToCount(save);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,840 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import androidx.activity.ComponentDialog$$ExternalSyntheticApiModelOutline0;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.util.ObjectsCompat;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatSpinner extends Spinner implements TintableBackgroundView {
|
||||
private static final int[] ATTRS_ANDROID_SPINNERMODE = {R.attr.spinnerMode};
|
||||
private static final int MAX_ITEMS_MEASURED = 15;
|
||||
private static final int MODE_DIALOG = 0;
|
||||
private static final int MODE_DROPDOWN = 1;
|
||||
private static final int MODE_THEME = -1;
|
||||
private static final String TAG = "AppCompatSpinner";
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
int mDropDownWidth;
|
||||
private ForwardingListener mForwardingListener;
|
||||
private SpinnerPopup mPopup;
|
||||
private final Context mPopupContext;
|
||||
private final boolean mPopupSet;
|
||||
private SpinnerAdapter mTempAdapter;
|
||||
final Rect mTempRect;
|
||||
|
||||
interface SpinnerPopup {
|
||||
void dismiss();
|
||||
|
||||
Drawable getBackground();
|
||||
|
||||
CharSequence getHintText();
|
||||
|
||||
int getHorizontalOffset();
|
||||
|
||||
int getHorizontalOriginalOffset();
|
||||
|
||||
int getVerticalOffset();
|
||||
|
||||
boolean isShowing();
|
||||
|
||||
void setAdapter(ListAdapter listAdapter);
|
||||
|
||||
void setBackgroundDrawable(Drawable drawable);
|
||||
|
||||
void setHorizontalOffset(int i);
|
||||
|
||||
void setHorizontalOriginalOffset(int i);
|
||||
|
||||
void setPromptText(CharSequence charSequence);
|
||||
|
||||
void setVerticalOffset(int i);
|
||||
|
||||
void show(int i, int i2);
|
||||
}
|
||||
|
||||
final SpinnerPopup getInternalPopup() {
|
||||
return this.mPopup;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public Context getPopupContext() {
|
||||
return this.mPopupContext;
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context) {
|
||||
this(context, (AttributeSet) null);
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, int i) {
|
||||
this(context, null, androidx.appcompat.R.attr.spinnerStyle, i);
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, androidx.appcompat.R.attr.spinnerStyle);
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, AttributeSet attributeSet, int i) {
|
||||
this(context, attributeSet, i, -1);
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
this(context, attributeSet, i, i2, null);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:28:0x004f, code lost:
|
||||
|
||||
if (r11 != null) goto L16;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:29:0x0051, code lost:
|
||||
|
||||
r11.recycle();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:32:0x0062, code lost:
|
||||
|
||||
if (r11 == null) goto L31;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public AppCompatSpinner(android.content.Context r7, android.util.AttributeSet r8, int r9, int r10, android.content.res.Resources.Theme r11) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 230
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatSpinner.<init>(android.content.Context, android.util.AttributeSet, int, int, android.content.res.Resources$Theme):void");
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setPopupBackgroundDrawable(Drawable drawable) {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
spinnerPopup.setBackgroundDrawable(drawable);
|
||||
} else {
|
||||
super.setPopupBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setPopupBackgroundResource(int i) {
|
||||
setPopupBackgroundDrawable(AppCompatResources.getDrawable(getPopupContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public Drawable getPopupBackground() {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
return spinnerPopup.getBackground();
|
||||
}
|
||||
return super.getPopupBackground();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setDropDownVerticalOffset(int i) {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
spinnerPopup.setVerticalOffset(i);
|
||||
} else {
|
||||
super.setDropDownVerticalOffset(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public int getDropDownVerticalOffset() {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
return spinnerPopup.getVerticalOffset();
|
||||
}
|
||||
return super.getDropDownVerticalOffset();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setDropDownHorizontalOffset(int i) {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
spinnerPopup.setHorizontalOriginalOffset(i);
|
||||
this.mPopup.setHorizontalOffset(i);
|
||||
} else {
|
||||
super.setDropDownHorizontalOffset(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public int getDropDownHorizontalOffset() {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
return spinnerPopup.getHorizontalOffset();
|
||||
}
|
||||
return super.getDropDownHorizontalOffset();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setDropDownWidth(int i) {
|
||||
if (this.mPopup != null) {
|
||||
this.mDropDownWidth = i;
|
||||
} else {
|
||||
super.setDropDownWidth(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public int getDropDownWidth() {
|
||||
return this.mPopup != null ? this.mDropDownWidth : super.getDropDownWidth();
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView
|
||||
public void setAdapter(SpinnerAdapter spinnerAdapter) {
|
||||
if (!this.mPopupSet) {
|
||||
this.mTempAdapter = spinnerAdapter;
|
||||
return;
|
||||
}
|
||||
super.setAdapter(spinnerAdapter);
|
||||
if (this.mPopup != null) {
|
||||
Context context = this.mPopupContext;
|
||||
if (context == null) {
|
||||
context = getContext();
|
||||
}
|
||||
this.mPopup.setAdapter(new DropDownAdapter(spinnerAdapter, context.getTheme()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.widget.AdapterView, android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup == null || !spinnerPopup.isShowing()) {
|
||||
return;
|
||||
}
|
||||
this.mPopup.dismiss();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
ForwardingListener forwardingListener = this.mForwardingListener;
|
||||
if (forwardingListener == null || !forwardingListener.onTouch(this, motionEvent)) {
|
||||
return super.onTouchEvent(motionEvent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.widget.AbsSpinner, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
super.onMeasure(i, i2);
|
||||
if (this.mPopup == null || View.MeasureSpec.getMode(i) != Integer.MIN_VALUE) {
|
||||
return;
|
||||
}
|
||||
setMeasuredDimension(Math.min(Math.max(getMeasuredWidth(), compatMeasureContentWidth(getAdapter(), getBackground())), View.MeasureSpec.getSize(i)), getMeasuredHeight());
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.view.View
|
||||
public boolean performClick() {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
if (spinnerPopup.isShowing()) {
|
||||
return true;
|
||||
}
|
||||
showPopup();
|
||||
return true;
|
||||
}
|
||||
return super.performClick();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setPrompt(CharSequence charSequence) {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
spinnerPopup.setPromptText(charSequence);
|
||||
} else {
|
||||
super.setPrompt(charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public CharSequence getPrompt() {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
return spinnerPopup != null ? spinnerPopup.getHintText() : super.getPrompt();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
}
|
||||
|
||||
int compatMeasureContentWidth(SpinnerAdapter spinnerAdapter, Drawable drawable) {
|
||||
int i = 0;
|
||||
if (spinnerAdapter == null) {
|
||||
return 0;
|
||||
}
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 0);
|
||||
int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), 0);
|
||||
int max = Math.max(0, getSelectedItemPosition());
|
||||
int min = Math.min(spinnerAdapter.getCount(), max + 15);
|
||||
View view = null;
|
||||
int i2 = 0;
|
||||
for (int max2 = Math.max(0, max - (15 - (min - max))); max2 < min; max2++) {
|
||||
int itemViewType = spinnerAdapter.getItemViewType(max2);
|
||||
if (itemViewType != i) {
|
||||
view = null;
|
||||
i = itemViewType;
|
||||
}
|
||||
view = spinnerAdapter.getView(max2, view, this);
|
||||
if (view.getLayoutParams() == null) {
|
||||
view.setLayoutParams(new ViewGroup.LayoutParams(-2, -2));
|
||||
}
|
||||
view.measure(makeMeasureSpec, makeMeasureSpec2);
|
||||
i2 = Math.max(i2, view.getMeasuredWidth());
|
||||
}
|
||||
if (drawable == null) {
|
||||
return i2;
|
||||
}
|
||||
drawable.getPadding(this.mTempRect);
|
||||
return i2 + this.mTempRect.left + this.mTempRect.right;
|
||||
}
|
||||
|
||||
void showPopup() {
|
||||
this.mPopup.show(Api17Impl.getTextDirection(this), Api17Impl.getTextAlignment(this));
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.widget.AbsSpinner, android.view.View
|
||||
public Parcelable onSaveInstanceState() {
|
||||
SavedState savedState = new SavedState(super.onSaveInstanceState());
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
savedState.mShowDropdown = spinnerPopup != null && spinnerPopup.isShowing();
|
||||
return savedState;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.widget.AbsSpinner, android.view.View
|
||||
public void onRestoreInstanceState(Parcelable parcelable) {
|
||||
ViewTreeObserver viewTreeObserver;
|
||||
SavedState savedState = (SavedState) parcelable;
|
||||
super.onRestoreInstanceState(savedState.getSuperState());
|
||||
if (!savedState.mShowDropdown || (viewTreeObserver = getViewTreeObserver()) == null) {
|
||||
return;
|
||||
}
|
||||
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { // from class: androidx.appcompat.widget.AppCompatSpinner.2
|
||||
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
||||
public void onGlobalLayout() {
|
||||
if (!AppCompatSpinner.this.getInternalPopup().isShowing()) {
|
||||
AppCompatSpinner.this.showPopup();
|
||||
}
|
||||
ViewTreeObserver viewTreeObserver2 = AppCompatSpinner.this.getViewTreeObserver();
|
||||
if (viewTreeObserver2 != null) {
|
||||
Api16Impl.removeOnGlobalLayoutListener(viewTreeObserver2, this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static class SavedState extends View.BaseSavedState {
|
||||
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { // from class: androidx.appcompat.widget.AppCompatSpinner.SavedState.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public SavedState createFromParcel(Parcel parcel) {
|
||||
return new SavedState(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public SavedState[] newArray(int i) {
|
||||
return new SavedState[i];
|
||||
}
|
||||
};
|
||||
boolean mShowDropdown;
|
||||
|
||||
SavedState(Parcelable parcelable) {
|
||||
super(parcelable);
|
||||
}
|
||||
|
||||
SavedState(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.mShowDropdown = parcel.readByte() != 0;
|
||||
}
|
||||
|
||||
@Override // android.view.View.BaseSavedState, android.view.AbsSavedState, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeByte(this.mShowDropdown ? (byte) 1 : (byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
private static class DropDownAdapter implements ListAdapter, SpinnerAdapter {
|
||||
private SpinnerAdapter mAdapter;
|
||||
private ListAdapter mListAdapter;
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getItemViewType(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getViewTypeCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public DropDownAdapter(SpinnerAdapter spinnerAdapter, Resources.Theme theme) {
|
||||
this.mAdapter = spinnerAdapter;
|
||||
if (spinnerAdapter instanceof ListAdapter) {
|
||||
this.mListAdapter = (ListAdapter) spinnerAdapter;
|
||||
}
|
||||
if (theme != null) {
|
||||
if (Build.VERSION.SDK_INT >= 23 && ComponentDialog$$ExternalSyntheticApiModelOutline0.m33m((Object) spinnerAdapter)) {
|
||||
Api23Impl.setDropDownViewTheme(ComponentDialog$$ExternalSyntheticApiModelOutline0.m16m((Object) spinnerAdapter), theme);
|
||||
} else if (spinnerAdapter instanceof ThemedSpinnerAdapter) {
|
||||
ThemedSpinnerAdapter themedSpinnerAdapter = (ThemedSpinnerAdapter) spinnerAdapter;
|
||||
if (themedSpinnerAdapter.getDropDownViewTheme() == null) {
|
||||
themedSpinnerAdapter.setDropDownViewTheme(theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter == null) {
|
||||
return 0;
|
||||
}
|
||||
return spinnerAdapter.getCount();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public Object getItem(int i) {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter == null) {
|
||||
return null;
|
||||
}
|
||||
return spinnerAdapter.getItem(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter == null) {
|
||||
return -1L;
|
||||
}
|
||||
return spinnerAdapter.getItemId(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
return getDropDownView(i, view, viewGroup);
|
||||
}
|
||||
|
||||
@Override // android.widget.SpinnerAdapter
|
||||
public View getDropDownView(int i, View view, ViewGroup viewGroup) {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter == null) {
|
||||
return null;
|
||||
}
|
||||
return spinnerAdapter.getDropDownView(i, view, viewGroup);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public boolean hasStableIds() {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
return spinnerAdapter != null && spinnerAdapter.hasStableIds();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public void registerDataSetObserver(DataSetObserver dataSetObserver) {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter != null) {
|
||||
spinnerAdapter.registerDataSetObserver(dataSetObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public void unregisterDataSetObserver(DataSetObserver dataSetObserver) {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter != null) {
|
||||
spinnerAdapter.unregisterDataSetObserver(dataSetObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ListAdapter
|
||||
public boolean areAllItemsEnabled() {
|
||||
ListAdapter listAdapter = this.mListAdapter;
|
||||
if (listAdapter != null) {
|
||||
return listAdapter.areAllItemsEnabled();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.ListAdapter
|
||||
public boolean isEnabled(int i) {
|
||||
ListAdapter listAdapter = this.mListAdapter;
|
||||
if (listAdapter != null) {
|
||||
return listAdapter.isEnabled(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public boolean isEmpty() {
|
||||
return getCount() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
class DialogPopup implements SpinnerPopup, DialogInterface.OnClickListener {
|
||||
private ListAdapter mListAdapter;
|
||||
AlertDialog mPopup;
|
||||
private CharSequence mPrompt;
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public Drawable getBackground() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public CharSequence getHintText() {
|
||||
return this.mPrompt;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public int getHorizontalOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public int getHorizontalOriginalOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public int getVerticalOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setAdapter(ListAdapter listAdapter) {
|
||||
this.mListAdapter = listAdapter;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setPromptText(CharSequence charSequence) {
|
||||
this.mPrompt = charSequence;
|
||||
}
|
||||
|
||||
DialogPopup() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void dismiss() {
|
||||
AlertDialog alertDialog = this.mPopup;
|
||||
if (alertDialog != null) {
|
||||
alertDialog.dismiss();
|
||||
this.mPopup = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public boolean isShowing() {
|
||||
AlertDialog alertDialog = this.mPopup;
|
||||
if (alertDialog != null) {
|
||||
return alertDialog.isShowing();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void show(int i, int i2) {
|
||||
if (this.mListAdapter == null) {
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(AppCompatSpinner.this.getPopupContext());
|
||||
CharSequence charSequence = this.mPrompt;
|
||||
if (charSequence != null) {
|
||||
builder.setTitle(charSequence);
|
||||
}
|
||||
AlertDialog create = builder.setSingleChoiceItems(this.mListAdapter, AppCompatSpinner.this.getSelectedItemPosition(), this).create();
|
||||
this.mPopup = create;
|
||||
ListView listView = create.getListView();
|
||||
Api17Impl.setTextDirection(listView, i);
|
||||
Api17Impl.setTextAlignment(listView, i2);
|
||||
this.mPopup.show();
|
||||
}
|
||||
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
AppCompatSpinner.this.setSelection(i);
|
||||
if (AppCompatSpinner.this.getOnItemClickListener() != null) {
|
||||
AppCompatSpinner.this.performItemClick(null, i, this.mListAdapter.getItemId(i));
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
Log.e(AppCompatSpinner.TAG, "Cannot set popup background for MODE_DIALOG, ignoring");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setVerticalOffset(int i) {
|
||||
Log.e(AppCompatSpinner.TAG, "Cannot set vertical offset for MODE_DIALOG, ignoring");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setHorizontalOffset(int i) {
|
||||
Log.e(AppCompatSpinner.TAG, "Cannot set horizontal offset for MODE_DIALOG, ignoring");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setHorizontalOriginalOffset(int i) {
|
||||
Log.e(AppCompatSpinner.TAG, "Cannot set horizontal (original) offset for MODE_DIALOG, ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
class DropdownPopup extends ListPopupWindow implements SpinnerPopup {
|
||||
ListAdapter mAdapter;
|
||||
private CharSequence mHintText;
|
||||
private int mOriginalHorizontalOffset;
|
||||
private final Rect mVisibleRect;
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public CharSequence getHintText() {
|
||||
return this.mHintText;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public int getHorizontalOriginalOffset() {
|
||||
return this.mOriginalHorizontalOffset;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setHorizontalOriginalOffset(int i) {
|
||||
this.mOriginalHorizontalOffset = i;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setPromptText(CharSequence charSequence) {
|
||||
this.mHintText = charSequence;
|
||||
}
|
||||
|
||||
public DropdownPopup(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.mVisibleRect = new Rect();
|
||||
setAnchorView(AppCompatSpinner.this);
|
||||
setModal(true);
|
||||
setPromptPosition(0);
|
||||
setOnItemClickListener(new AdapterView.OnItemClickListener() { // from class: androidx.appcompat.widget.AppCompatSpinner.DropdownPopup.1
|
||||
@Override // android.widget.AdapterView.OnItemClickListener
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i2, long j) {
|
||||
AppCompatSpinner.this.setSelection(i2);
|
||||
if (AppCompatSpinner.this.getOnItemClickListener() != null) {
|
||||
AppCompatSpinner.this.performItemClick(view, i2, DropdownPopup.this.mAdapter.getItemId(i2));
|
||||
}
|
||||
DropdownPopup.this.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ListPopupWindow, androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setAdapter(ListAdapter listAdapter) {
|
||||
super.setAdapter(listAdapter);
|
||||
this.mAdapter = listAdapter;
|
||||
}
|
||||
|
||||
void computeContentWidth() {
|
||||
int i;
|
||||
int horizontalOriginalOffset;
|
||||
Drawable background = getBackground();
|
||||
if (background != null) {
|
||||
background.getPadding(AppCompatSpinner.this.mTempRect);
|
||||
i = ViewUtils.isLayoutRtl(AppCompatSpinner.this) ? AppCompatSpinner.this.mTempRect.right : -AppCompatSpinner.this.mTempRect.left;
|
||||
} else {
|
||||
Rect rect = AppCompatSpinner.this.mTempRect;
|
||||
AppCompatSpinner.this.mTempRect.right = 0;
|
||||
rect.left = 0;
|
||||
i = 0;
|
||||
}
|
||||
int paddingLeft = AppCompatSpinner.this.getPaddingLeft();
|
||||
int paddingRight = AppCompatSpinner.this.getPaddingRight();
|
||||
int width = AppCompatSpinner.this.getWidth();
|
||||
if (AppCompatSpinner.this.mDropDownWidth == -2) {
|
||||
int compatMeasureContentWidth = AppCompatSpinner.this.compatMeasureContentWidth((SpinnerAdapter) this.mAdapter, getBackground());
|
||||
int i2 = (AppCompatSpinner.this.getContext().getResources().getDisplayMetrics().widthPixels - AppCompatSpinner.this.mTempRect.left) - AppCompatSpinner.this.mTempRect.right;
|
||||
if (compatMeasureContentWidth > i2) {
|
||||
compatMeasureContentWidth = i2;
|
||||
}
|
||||
setContentWidth(Math.max(compatMeasureContentWidth, (width - paddingLeft) - paddingRight));
|
||||
} else if (AppCompatSpinner.this.mDropDownWidth == -1) {
|
||||
setContentWidth((width - paddingLeft) - paddingRight);
|
||||
} else {
|
||||
setContentWidth(AppCompatSpinner.this.mDropDownWidth);
|
||||
}
|
||||
if (ViewUtils.isLayoutRtl(AppCompatSpinner.this)) {
|
||||
horizontalOriginalOffset = i + (((width - paddingRight) - getWidth()) - getHorizontalOriginalOffset());
|
||||
} else {
|
||||
horizontalOriginalOffset = i + paddingLeft + getHorizontalOriginalOffset();
|
||||
}
|
||||
setHorizontalOffset(horizontalOriginalOffset);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void show(int i, int i2) {
|
||||
ViewTreeObserver viewTreeObserver;
|
||||
boolean isShowing = isShowing();
|
||||
computeContentWidth();
|
||||
setInputMethodMode(2);
|
||||
super.show();
|
||||
ListView listView = getListView();
|
||||
listView.setChoiceMode(1);
|
||||
Api17Impl.setTextDirection(listView, i);
|
||||
Api17Impl.setTextAlignment(listView, i2);
|
||||
setSelection(AppCompatSpinner.this.getSelectedItemPosition());
|
||||
if (isShowing || (viewTreeObserver = AppCompatSpinner.this.getViewTreeObserver()) == null) {
|
||||
return;
|
||||
}
|
||||
final ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { // from class: androidx.appcompat.widget.AppCompatSpinner.DropdownPopup.2
|
||||
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
||||
public void onGlobalLayout() {
|
||||
DropdownPopup dropdownPopup = DropdownPopup.this;
|
||||
if (!dropdownPopup.isVisibleToUser(AppCompatSpinner.this)) {
|
||||
DropdownPopup.this.dismiss();
|
||||
} else {
|
||||
DropdownPopup.this.computeContentWidth();
|
||||
DropdownPopup.super.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
viewTreeObserver.addOnGlobalLayoutListener(onGlobalLayoutListener);
|
||||
setOnDismissListener(new PopupWindow.OnDismissListener() { // from class: androidx.appcompat.widget.AppCompatSpinner.DropdownPopup.3
|
||||
@Override // android.widget.PopupWindow.OnDismissListener
|
||||
public void onDismiss() {
|
||||
ViewTreeObserver viewTreeObserver2 = AppCompatSpinner.this.getViewTreeObserver();
|
||||
if (viewTreeObserver2 != null) {
|
||||
viewTreeObserver2.removeGlobalOnLayoutListener(onGlobalLayoutListener);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
boolean isVisibleToUser(View view) {
|
||||
return ViewCompat.isAttachedToWindow(view) && view.getGlobalVisibleRect(this.mVisibleRect);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Api23Impl {
|
||||
private Api23Impl() {
|
||||
}
|
||||
|
||||
static void setDropDownViewTheme(android.widget.ThemedSpinnerAdapter themedSpinnerAdapter, Resources.Theme theme) {
|
||||
if (ObjectsCompat.equals(themedSpinnerAdapter.getDropDownViewTheme(), theme)) {
|
||||
return;
|
||||
}
|
||||
themedSpinnerAdapter.setDropDownViewTheme(theme);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Api17Impl {
|
||||
private Api17Impl() {
|
||||
}
|
||||
|
||||
static int getTextAlignment(View view) {
|
||||
return view.getTextAlignment();
|
||||
}
|
||||
|
||||
static void setTextAlignment(View view, int i) {
|
||||
view.setTextAlignment(i);
|
||||
}
|
||||
|
||||
static int getTextDirection(View view) {
|
||||
return view.getTextDirection();
|
||||
}
|
||||
|
||||
static void setTextDirection(View view, int i) {
|
||||
view.setTextDirection(i);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Api16Impl {
|
||||
private Api16Impl() {
|
||||
}
|
||||
|
||||
static void removeOnGlobalLayoutListener(ViewTreeObserver viewTreeObserver, ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener) {
|
||||
viewTreeObserver.removeOnGlobalLayoutListener(onGlobalLayoutListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.view.textclassifier.TextClassificationManager;
|
||||
import android.view.textclassifier.TextClassifier;
|
||||
import android.widget.TextView;
|
||||
import androidx.core.util.Preconditions;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AppCompatTextClassifierHelper {
|
||||
private TextClassifier mTextClassifier;
|
||||
private TextView mTextView;
|
||||
|
||||
public void setTextClassifier(TextClassifier textClassifier) {
|
||||
this.mTextClassifier = textClassifier;
|
||||
}
|
||||
|
||||
AppCompatTextClassifierHelper(TextView textView) {
|
||||
this.mTextView = (TextView) Preconditions.checkNotNull(textView);
|
||||
}
|
||||
|
||||
public TextClassifier getTextClassifier() {
|
||||
TextClassifier textClassifier = this.mTextClassifier;
|
||||
return textClassifier == null ? Api26Impl.getTextClassifier(this.mTextView) : textClassifier;
|
||||
}
|
||||
|
||||
private static final class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static TextClassifier getTextClassifier(TextView textView) {
|
||||
TextClassificationManager textClassificationManager = (TextClassificationManager) textView.getContext().getSystemService(TextClassificationManager.class);
|
||||
if (textClassificationManager != null) {
|
||||
return textClassificationManager.getTextClassifier();
|
||||
}
|
||||
return TextClassifier.NO_OP;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,626 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.LocaleList;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatTextHelper {
|
||||
private static final int MONOSPACE = 3;
|
||||
private static final int SANS = 1;
|
||||
private static final int SERIF = 2;
|
||||
private static final int TEXT_FONT_WEIGHT_UNSPECIFIED = -1;
|
||||
private boolean mAsyncFontPending;
|
||||
private final AppCompatTextViewAutoSizeHelper mAutoSizeTextHelper;
|
||||
private TintInfo mDrawableBottomTint;
|
||||
private TintInfo mDrawableEndTint;
|
||||
private TintInfo mDrawableLeftTint;
|
||||
private TintInfo mDrawableRightTint;
|
||||
private TintInfo mDrawableStartTint;
|
||||
private TintInfo mDrawableTint;
|
||||
private TintInfo mDrawableTopTint;
|
||||
private Typeface mFontTypeface;
|
||||
private final TextView mView;
|
||||
private int mStyle = 0;
|
||||
private int mFontWeight = -1;
|
||||
|
||||
private void setCompoundTints() {
|
||||
TintInfo tintInfo = this.mDrawableTint;
|
||||
this.mDrawableLeftTint = tintInfo;
|
||||
this.mDrawableTopTint = tintInfo;
|
||||
this.mDrawableRightTint = tintInfo;
|
||||
this.mDrawableBottomTint = tintInfo;
|
||||
this.mDrawableStartTint = tintInfo;
|
||||
this.mDrawableEndTint = tintInfo;
|
||||
}
|
||||
|
||||
AppCompatTextHelper(TextView textView) {
|
||||
this.mView = textView;
|
||||
this.mAutoSizeTextHelper = new AppCompatTextViewAutoSizeHelper(textView);
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
ColorStateList colorStateList;
|
||||
String str;
|
||||
boolean z;
|
||||
boolean z2;
|
||||
ColorStateList colorStateList2;
|
||||
String str2;
|
||||
ColorStateList colorStateList3;
|
||||
boolean z3;
|
||||
int i2;
|
||||
Context context = this.mView.getContext();
|
||||
AppCompatDrawableManager appCompatDrawableManager = AppCompatDrawableManager.get();
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.AppCompatTextHelper, i, 0);
|
||||
TextView textView = this.mView;
|
||||
ViewCompat.saveAttributeDataForStyleable(textView, textView.getContext(), R.styleable.AppCompatTextHelper, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0);
|
||||
int resourceId = obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_textAppearance, -1);
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableLeft)) {
|
||||
this.mDrawableLeftTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableLeft, 0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableTop)) {
|
||||
this.mDrawableTopTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableTop, 0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableRight)) {
|
||||
this.mDrawableRightTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableRight, 0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableBottom)) {
|
||||
this.mDrawableBottomTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableBottom, 0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableStart)) {
|
||||
this.mDrawableStartTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableStart, 0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableEnd)) {
|
||||
this.mDrawableEndTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableEnd, 0));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
boolean z4 = this.mView.getTransformationMethod() instanceof PasswordTransformationMethod;
|
||||
if (resourceId != -1) {
|
||||
TintTypedArray obtainStyledAttributes2 = TintTypedArray.obtainStyledAttributes(context, resourceId, R.styleable.TextAppearance);
|
||||
if (z4 || !obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_textAllCaps)) {
|
||||
z = false;
|
||||
z2 = false;
|
||||
} else {
|
||||
z = obtainStyledAttributes2.getBoolean(R.styleable.TextAppearance_textAllCaps, false);
|
||||
z2 = true;
|
||||
}
|
||||
updateTypefaceAndStyle(context, obtainStyledAttributes2);
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
colorStateList3 = obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_android_textColor) ? obtainStyledAttributes2.getColorStateList(R.styleable.TextAppearance_android_textColor) : null;
|
||||
colorStateList = obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_android_textColorHint) ? obtainStyledAttributes2.getColorStateList(R.styleable.TextAppearance_android_textColorHint) : null;
|
||||
colorStateList2 = obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_android_textColorLink) ? obtainStyledAttributes2.getColorStateList(R.styleable.TextAppearance_android_textColorLink) : null;
|
||||
} else {
|
||||
colorStateList = null;
|
||||
colorStateList2 = null;
|
||||
colorStateList3 = null;
|
||||
}
|
||||
str2 = obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_textLocale) ? obtainStyledAttributes2.getString(R.styleable.TextAppearance_textLocale) : null;
|
||||
str = (Build.VERSION.SDK_INT < 26 || !obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_fontVariationSettings)) ? null : obtainStyledAttributes2.getString(R.styleable.TextAppearance_fontVariationSettings);
|
||||
obtainStyledAttributes2.recycle();
|
||||
} else {
|
||||
colorStateList = null;
|
||||
str = null;
|
||||
z = false;
|
||||
z2 = false;
|
||||
colorStateList2 = null;
|
||||
str2 = null;
|
||||
colorStateList3 = null;
|
||||
}
|
||||
TintTypedArray obtainStyledAttributes3 = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.TextAppearance, i, 0);
|
||||
if (z4 || !obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_textAllCaps)) {
|
||||
z3 = z2;
|
||||
} else {
|
||||
z = obtainStyledAttributes3.getBoolean(R.styleable.TextAppearance_textAllCaps, false);
|
||||
z3 = true;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
if (obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_android_textColor)) {
|
||||
colorStateList3 = obtainStyledAttributes3.getColorStateList(R.styleable.TextAppearance_android_textColor);
|
||||
}
|
||||
if (obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_android_textColorHint)) {
|
||||
colorStateList = obtainStyledAttributes3.getColorStateList(R.styleable.TextAppearance_android_textColorHint);
|
||||
}
|
||||
if (obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_android_textColorLink)) {
|
||||
colorStateList2 = obtainStyledAttributes3.getColorStateList(R.styleable.TextAppearance_android_textColorLink);
|
||||
}
|
||||
}
|
||||
if (obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_textLocale)) {
|
||||
str2 = obtainStyledAttributes3.getString(R.styleable.TextAppearance_textLocale);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 26 && obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_fontVariationSettings)) {
|
||||
str = obtainStyledAttributes3.getString(R.styleable.TextAppearance_fontVariationSettings);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 28 && obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_android_textSize) && obtainStyledAttributes3.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, -1) == 0) {
|
||||
this.mView.setTextSize(0, 0.0f);
|
||||
}
|
||||
updateTypefaceAndStyle(context, obtainStyledAttributes3);
|
||||
obtainStyledAttributes3.recycle();
|
||||
if (colorStateList3 != null) {
|
||||
this.mView.setTextColor(colorStateList3);
|
||||
}
|
||||
if (colorStateList != null) {
|
||||
this.mView.setHintTextColor(colorStateList);
|
||||
}
|
||||
if (colorStateList2 != null) {
|
||||
this.mView.setLinkTextColor(colorStateList2);
|
||||
}
|
||||
if (!z4 && z3) {
|
||||
setAllCaps(z);
|
||||
}
|
||||
Typeface typeface = this.mFontTypeface;
|
||||
if (typeface != null) {
|
||||
if (this.mFontWeight == -1) {
|
||||
this.mView.setTypeface(typeface, this.mStyle);
|
||||
} else {
|
||||
this.mView.setTypeface(typeface);
|
||||
}
|
||||
}
|
||||
if (str != null) {
|
||||
Api26Impl.setFontVariationSettings(this.mView, str);
|
||||
}
|
||||
if (str2 != null) {
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
Api24Impl.setTextLocales(this.mView, Api24Impl.forLanguageTags(str2));
|
||||
} else {
|
||||
Api17Impl.setTextLocale(this.mView, Api21Impl.forLanguageTag(str2.split(",")[0]));
|
||||
}
|
||||
}
|
||||
this.mAutoSizeTextHelper.loadFromAttributes(attributeSet, i);
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE && this.mAutoSizeTextHelper.getAutoSizeTextType() != 0) {
|
||||
int[] autoSizeTextAvailableSizes = this.mAutoSizeTextHelper.getAutoSizeTextAvailableSizes();
|
||||
if (autoSizeTextAvailableSizes.length > 0) {
|
||||
if (Api26Impl.getAutoSizeStepGranularity(this.mView) != -1.0f) {
|
||||
Api26Impl.setAutoSizeTextTypeUniformWithConfiguration(this.mView, this.mAutoSizeTextHelper.getAutoSizeMinTextSize(), this.mAutoSizeTextHelper.getAutoSizeMaxTextSize(), this.mAutoSizeTextHelper.getAutoSizeStepGranularity(), 0);
|
||||
} else {
|
||||
Api26Impl.setAutoSizeTextTypeUniformWithPresetSizes(this.mView, autoSizeTextAvailableSizes, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
TintTypedArray obtainStyledAttributes4 = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.AppCompatTextView);
|
||||
int resourceId2 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableLeftCompat, -1);
|
||||
Drawable drawable = resourceId2 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId2) : null;
|
||||
int resourceId3 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableTopCompat, -1);
|
||||
Drawable drawable2 = resourceId3 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId3) : null;
|
||||
int resourceId4 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableRightCompat, -1);
|
||||
Drawable drawable3 = resourceId4 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId4) : null;
|
||||
int resourceId5 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableBottomCompat, -1);
|
||||
Drawable drawable4 = resourceId5 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId5) : null;
|
||||
int resourceId6 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableStartCompat, -1);
|
||||
Drawable drawable5 = resourceId6 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId6) : null;
|
||||
int resourceId7 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableEndCompat, -1);
|
||||
setCompoundDrawables(drawable, drawable2, drawable3, drawable4, drawable5, resourceId7 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId7) : null);
|
||||
if (obtainStyledAttributes4.hasValue(R.styleable.AppCompatTextView_drawableTint)) {
|
||||
TextViewCompat.setCompoundDrawableTintList(this.mView, obtainStyledAttributes4.getColorStateList(R.styleable.AppCompatTextView_drawableTint));
|
||||
}
|
||||
if (obtainStyledAttributes4.hasValue(R.styleable.AppCompatTextView_drawableTintMode)) {
|
||||
i2 = -1;
|
||||
TextViewCompat.setCompoundDrawableTintMode(this.mView, DrawableUtils.parseTintMode(obtainStyledAttributes4.getInt(R.styleable.AppCompatTextView_drawableTintMode, -1), null));
|
||||
} else {
|
||||
i2 = -1;
|
||||
}
|
||||
int dimensionPixelSize = obtainStyledAttributes4.getDimensionPixelSize(R.styleable.AppCompatTextView_firstBaselineToTopHeight, i2);
|
||||
int dimensionPixelSize2 = obtainStyledAttributes4.getDimensionPixelSize(R.styleable.AppCompatTextView_lastBaselineToBottomHeight, i2);
|
||||
int dimensionPixelSize3 = obtainStyledAttributes4.getDimensionPixelSize(R.styleable.AppCompatTextView_lineHeight, i2);
|
||||
obtainStyledAttributes4.recycle();
|
||||
if (dimensionPixelSize != i2) {
|
||||
TextViewCompat.setFirstBaselineToTopHeight(this.mView, dimensionPixelSize);
|
||||
}
|
||||
if (dimensionPixelSize2 != i2) {
|
||||
TextViewCompat.setLastBaselineToBottomHeight(this.mView, dimensionPixelSize2);
|
||||
}
|
||||
if (dimensionPixelSize3 != i2) {
|
||||
TextViewCompat.setLineHeight(this.mView, dimensionPixelSize3);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTypefaceAndStyle(Context context, TintTypedArray tintTypedArray) {
|
||||
int i;
|
||||
String string;
|
||||
this.mStyle = tintTypedArray.getInt(R.styleable.TextAppearance_android_textStyle, this.mStyle);
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
int i2 = tintTypedArray.getInt(R.styleable.TextAppearance_android_textFontWeight, -1);
|
||||
this.mFontWeight = i2;
|
||||
if (i2 != -1) {
|
||||
this.mStyle &= 2;
|
||||
}
|
||||
}
|
||||
if (tintTypedArray.hasValue(R.styleable.TextAppearance_android_fontFamily) || tintTypedArray.hasValue(R.styleable.TextAppearance_fontFamily)) {
|
||||
this.mFontTypeface = null;
|
||||
if (tintTypedArray.hasValue(R.styleable.TextAppearance_fontFamily)) {
|
||||
i = R.styleable.TextAppearance_fontFamily;
|
||||
} else {
|
||||
i = R.styleable.TextAppearance_android_fontFamily;
|
||||
}
|
||||
final int i3 = this.mFontWeight;
|
||||
final int i4 = this.mStyle;
|
||||
if (!context.isRestricted()) {
|
||||
final WeakReference weakReference = new WeakReference(this.mView);
|
||||
try {
|
||||
Typeface font = tintTypedArray.getFont(i, this.mStyle, new ResourcesCompat.FontCallback() { // from class: androidx.appcompat.widget.AppCompatTextHelper.1
|
||||
@Override // androidx.core.content.res.ResourcesCompat.FontCallback
|
||||
/* renamed from: onFontRetrievalFailed */
|
||||
public void m80xb24343b7(int i5) {
|
||||
}
|
||||
|
||||
@Override // androidx.core.content.res.ResourcesCompat.FontCallback
|
||||
/* renamed from: onFontRetrieved */
|
||||
public void m81x46c88379(Typeface typeface) {
|
||||
int i5;
|
||||
if (Build.VERSION.SDK_INT >= 28 && (i5 = i3) != -1) {
|
||||
typeface = Api28Impl.create(typeface, i5, (i4 & 2) != 0);
|
||||
}
|
||||
AppCompatTextHelper.this.onAsyncTypefaceReceived(weakReference, typeface);
|
||||
}
|
||||
});
|
||||
if (font != null) {
|
||||
if (Build.VERSION.SDK_INT < 28 || this.mFontWeight == -1) {
|
||||
this.mFontTypeface = font;
|
||||
} else {
|
||||
this.mFontTypeface = Api28Impl.create(Typeface.create(font, 0), this.mFontWeight, (this.mStyle & 2) != 0);
|
||||
}
|
||||
}
|
||||
this.mAsyncFontPending = this.mFontTypeface == null;
|
||||
} catch (Resources.NotFoundException | UnsupportedOperationException unused) {
|
||||
}
|
||||
}
|
||||
if (this.mFontTypeface != null || (string = tintTypedArray.getString(i)) == null) {
|
||||
return;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 28 && this.mFontWeight != -1) {
|
||||
this.mFontTypeface = Api28Impl.create(Typeface.create(string, 0), this.mFontWeight, (this.mStyle & 2) != 0);
|
||||
return;
|
||||
} else {
|
||||
this.mFontTypeface = Typeface.create(string, this.mStyle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (tintTypedArray.hasValue(R.styleable.TextAppearance_android_typeface)) {
|
||||
this.mAsyncFontPending = false;
|
||||
int i5 = tintTypedArray.getInt(R.styleable.TextAppearance_android_typeface, 1);
|
||||
if (i5 == 1) {
|
||||
this.mFontTypeface = Typeface.SANS_SERIF;
|
||||
} else if (i5 == 2) {
|
||||
this.mFontTypeface = Typeface.SERIF;
|
||||
} else {
|
||||
if (i5 != 3) {
|
||||
return;
|
||||
}
|
||||
this.mFontTypeface = Typeface.MONOSPACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onAsyncTypefaceReceived(WeakReference<TextView> weakReference, final Typeface typeface) {
|
||||
if (this.mAsyncFontPending) {
|
||||
this.mFontTypeface = typeface;
|
||||
final TextView textView = weakReference.get();
|
||||
if (textView != null) {
|
||||
if (ViewCompat.isAttachedToWindow(textView)) {
|
||||
final int i = this.mStyle;
|
||||
textView.post(new Runnable() { // from class: androidx.appcompat.widget.AppCompatTextHelper.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
textView.setTypeface(typeface, i);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
textView.setTypeface(typeface, this.mStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onSetTextAppearance(Context context, int i) {
|
||||
String string;
|
||||
ColorStateList colorStateList;
|
||||
ColorStateList colorStateList2;
|
||||
ColorStateList colorStateList3;
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, i, R.styleable.TextAppearance);
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.TextAppearance_textAllCaps)) {
|
||||
setAllCaps(obtainStyledAttributes.getBoolean(R.styleable.TextAppearance_textAllCaps, false));
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.TextAppearance_android_textColor) && (colorStateList3 = obtainStyledAttributes.getColorStateList(R.styleable.TextAppearance_android_textColor)) != null) {
|
||||
this.mView.setTextColor(colorStateList3);
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.TextAppearance_android_textColorLink) && (colorStateList2 = obtainStyledAttributes.getColorStateList(R.styleable.TextAppearance_android_textColorLink)) != null) {
|
||||
this.mView.setLinkTextColor(colorStateList2);
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.TextAppearance_android_textColorHint) && (colorStateList = obtainStyledAttributes.getColorStateList(R.styleable.TextAppearance_android_textColorHint)) != null) {
|
||||
this.mView.setHintTextColor(colorStateList);
|
||||
}
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.TextAppearance_android_textSize) && obtainStyledAttributes.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, -1) == 0) {
|
||||
this.mView.setTextSize(0, 0.0f);
|
||||
}
|
||||
updateTypefaceAndStyle(context, obtainStyledAttributes);
|
||||
if (Build.VERSION.SDK_INT >= 26 && obtainStyledAttributes.hasValue(R.styleable.TextAppearance_fontVariationSettings) && (string = obtainStyledAttributes.getString(R.styleable.TextAppearance_fontVariationSettings)) != null) {
|
||||
Api26Impl.setFontVariationSettings(this.mView, string);
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
Typeface typeface = this.mFontTypeface;
|
||||
if (typeface != null) {
|
||||
this.mView.setTypeface(typeface, this.mStyle);
|
||||
}
|
||||
}
|
||||
|
||||
void setAllCaps(boolean z) {
|
||||
this.mView.setAllCaps(z);
|
||||
}
|
||||
|
||||
void onSetCompoundDrawables() {
|
||||
applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
void applyCompoundDrawablesTints() {
|
||||
if (this.mDrawableLeftTint != null || this.mDrawableTopTint != null || this.mDrawableRightTint != null || this.mDrawableBottomTint != null) {
|
||||
Drawable[] compoundDrawables = this.mView.getCompoundDrawables();
|
||||
applyCompoundDrawableTint(compoundDrawables[0], this.mDrawableLeftTint);
|
||||
applyCompoundDrawableTint(compoundDrawables[1], this.mDrawableTopTint);
|
||||
applyCompoundDrawableTint(compoundDrawables[2], this.mDrawableRightTint);
|
||||
applyCompoundDrawableTint(compoundDrawables[3], this.mDrawableBottomTint);
|
||||
}
|
||||
if (this.mDrawableStartTint == null && this.mDrawableEndTint == null) {
|
||||
return;
|
||||
}
|
||||
Drawable[] compoundDrawablesRelative = Api17Impl.getCompoundDrawablesRelative(this.mView);
|
||||
applyCompoundDrawableTint(compoundDrawablesRelative[0], this.mDrawableStartTint);
|
||||
applyCompoundDrawableTint(compoundDrawablesRelative[2], this.mDrawableEndTint);
|
||||
}
|
||||
|
||||
private void applyCompoundDrawableTint(Drawable drawable, TintInfo tintInfo) {
|
||||
if (drawable == null || tintInfo == null) {
|
||||
return;
|
||||
}
|
||||
AppCompatDrawableManager.tintDrawable(drawable, tintInfo, this.mView.getDrawableState());
|
||||
}
|
||||
|
||||
private static TintInfo createTintInfo(Context context, AppCompatDrawableManager appCompatDrawableManager, int i) {
|
||||
ColorStateList tintList = appCompatDrawableManager.getTintList(context, i);
|
||||
if (tintList == null) {
|
||||
return null;
|
||||
}
|
||||
TintInfo tintInfo = new TintInfo();
|
||||
tintInfo.mHasTintList = true;
|
||||
tintInfo.mTintList = tintList;
|
||||
return tintInfo;
|
||||
}
|
||||
|
||||
void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return;
|
||||
}
|
||||
autoSizeText();
|
||||
}
|
||||
|
||||
void setTextSize(int i, float f) {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE || isAutoSizeEnabled()) {
|
||||
return;
|
||||
}
|
||||
setTextSizeInternal(i, f);
|
||||
}
|
||||
|
||||
void autoSizeText() {
|
||||
this.mAutoSizeTextHelper.autoSizeText();
|
||||
}
|
||||
|
||||
boolean isAutoSizeEnabled() {
|
||||
return this.mAutoSizeTextHelper.isAutoSizeEnabled();
|
||||
}
|
||||
|
||||
private void setTextSizeInternal(int i, float f) {
|
||||
this.mAutoSizeTextHelper.setTextSizeInternal(i, f);
|
||||
}
|
||||
|
||||
void setAutoSizeTextTypeWithDefaults(int i) {
|
||||
this.mAutoSizeTextHelper.setAutoSizeTextTypeWithDefaults(i);
|
||||
}
|
||||
|
||||
void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
|
||||
this.mAutoSizeTextHelper.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException {
|
||||
this.mAutoSizeTextHelper.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
}
|
||||
|
||||
int getAutoSizeTextType() {
|
||||
return this.mAutoSizeTextHelper.getAutoSizeTextType();
|
||||
}
|
||||
|
||||
int getAutoSizeStepGranularity() {
|
||||
return this.mAutoSizeTextHelper.getAutoSizeStepGranularity();
|
||||
}
|
||||
|
||||
int getAutoSizeMinTextSize() {
|
||||
return this.mAutoSizeTextHelper.getAutoSizeMinTextSize();
|
||||
}
|
||||
|
||||
int getAutoSizeMaxTextSize() {
|
||||
return this.mAutoSizeTextHelper.getAutoSizeMaxTextSize();
|
||||
}
|
||||
|
||||
int[] getAutoSizeTextAvailableSizes() {
|
||||
return this.mAutoSizeTextHelper.getAutoSizeTextAvailableSizes();
|
||||
}
|
||||
|
||||
ColorStateList getCompoundDrawableTintList() {
|
||||
TintInfo tintInfo = this.mDrawableTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void setCompoundDrawableTintList(ColorStateList colorStateList) {
|
||||
if (this.mDrawableTint == null) {
|
||||
this.mDrawableTint = new TintInfo();
|
||||
}
|
||||
this.mDrawableTint.mTintList = colorStateList;
|
||||
this.mDrawableTint.mHasTintList = colorStateList != null;
|
||||
setCompoundTints();
|
||||
}
|
||||
|
||||
PorterDuff.Mode getCompoundDrawableTintMode() {
|
||||
TintInfo tintInfo = this.mDrawableTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintMode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void setCompoundDrawableTintMode(PorterDuff.Mode mode) {
|
||||
if (this.mDrawableTint == null) {
|
||||
this.mDrawableTint = new TintInfo();
|
||||
}
|
||||
this.mDrawableTint.mTintMode = mode;
|
||||
this.mDrawableTint.mHasTintMode = mode != null;
|
||||
setCompoundTints();
|
||||
}
|
||||
|
||||
private void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4, Drawable drawable5, Drawable drawable6) {
|
||||
if (drawable5 != null || drawable6 != null) {
|
||||
Drawable[] compoundDrawablesRelative = Api17Impl.getCompoundDrawablesRelative(this.mView);
|
||||
TextView textView = this.mView;
|
||||
if (drawable5 == null) {
|
||||
drawable5 = compoundDrawablesRelative[0];
|
||||
}
|
||||
if (drawable2 == null) {
|
||||
drawable2 = compoundDrawablesRelative[1];
|
||||
}
|
||||
if (drawable6 == null) {
|
||||
drawable6 = compoundDrawablesRelative[2];
|
||||
}
|
||||
if (drawable4 == null) {
|
||||
drawable4 = compoundDrawablesRelative[3];
|
||||
}
|
||||
Api17Impl.setCompoundDrawablesRelativeWithIntrinsicBounds(textView, drawable5, drawable2, drawable6, drawable4);
|
||||
return;
|
||||
}
|
||||
if (drawable == null && drawable2 == null && drawable3 == null && drawable4 == null) {
|
||||
return;
|
||||
}
|
||||
Drawable[] compoundDrawablesRelative2 = Api17Impl.getCompoundDrawablesRelative(this.mView);
|
||||
Drawable drawable7 = compoundDrawablesRelative2[0];
|
||||
if (drawable7 != null || compoundDrawablesRelative2[2] != null) {
|
||||
TextView textView2 = this.mView;
|
||||
if (drawable2 == null) {
|
||||
drawable2 = compoundDrawablesRelative2[1];
|
||||
}
|
||||
Drawable drawable8 = compoundDrawablesRelative2[2];
|
||||
if (drawable4 == null) {
|
||||
drawable4 = compoundDrawablesRelative2[3];
|
||||
}
|
||||
Api17Impl.setCompoundDrawablesRelativeWithIntrinsicBounds(textView2, drawable7, drawable2, drawable8, drawable4);
|
||||
return;
|
||||
}
|
||||
Drawable[] compoundDrawables = this.mView.getCompoundDrawables();
|
||||
TextView textView3 = this.mView;
|
||||
if (drawable == null) {
|
||||
drawable = compoundDrawables[0];
|
||||
}
|
||||
if (drawable2 == null) {
|
||||
drawable2 = compoundDrawables[1];
|
||||
}
|
||||
if (drawable3 == null) {
|
||||
drawable3 = compoundDrawables[2];
|
||||
}
|
||||
if (drawable4 == null) {
|
||||
drawable4 = compoundDrawables[3];
|
||||
}
|
||||
textView3.setCompoundDrawablesWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
|
||||
}
|
||||
|
||||
void populateSurroundingTextIfNeeded(TextView textView, InputConnection inputConnection, EditorInfo editorInfo) {
|
||||
if (Build.VERSION.SDK_INT >= 30 || inputConnection == null) {
|
||||
return;
|
||||
}
|
||||
EditorInfoCompat.setInitialSurroundingText(editorInfo, textView.getText());
|
||||
}
|
||||
|
||||
static class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static boolean setFontVariationSettings(TextView textView, String str) {
|
||||
return textView.setFontVariationSettings(str);
|
||||
}
|
||||
|
||||
static int getAutoSizeStepGranularity(TextView textView) {
|
||||
return textView.getAutoSizeStepGranularity();
|
||||
}
|
||||
|
||||
static void setAutoSizeTextTypeUniformWithConfiguration(TextView textView, int i, int i2, int i3, int i4) {
|
||||
textView.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
static void setAutoSizeTextTypeUniformWithPresetSizes(TextView textView, int[] iArr, int i) {
|
||||
textView.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api24Impl {
|
||||
private Api24Impl() {
|
||||
}
|
||||
|
||||
static void setTextLocales(TextView textView, LocaleList localeList) {
|
||||
textView.setTextLocales(localeList);
|
||||
}
|
||||
|
||||
static LocaleList forLanguageTags(String str) {
|
||||
return LocaleList.forLanguageTags(str);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api17Impl {
|
||||
private Api17Impl() {
|
||||
}
|
||||
|
||||
static void setTextLocale(TextView textView, Locale locale) {
|
||||
textView.setTextLocale(locale);
|
||||
}
|
||||
|
||||
static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
|
||||
}
|
||||
|
||||
static Drawable[] getCompoundDrawablesRelative(TextView textView) {
|
||||
return textView.getCompoundDrawablesRelative();
|
||||
}
|
||||
}
|
||||
|
||||
static class Api21Impl {
|
||||
private Api21Impl() {
|
||||
}
|
||||
|
||||
static Locale forLanguageTag(String str) {
|
||||
return Locale.forLanguageTag(str);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api28Impl {
|
||||
private Api28Impl() {
|
||||
}
|
||||
|
||||
static Typeface create(Typeface typeface, int i, boolean z) {
|
||||
return Typeface.create(typeface, i, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user