ADD week 5
This commit is contained in:
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
Reference in New Issue
Block a user