1319 lines
50 KiB
Java
1319 lines
50 KiB
Java
package androidx.appcompat.app;
|
|
|
|
import android.app.Activity;
|
|
import android.app.Dialog;
|
|
import android.content.Context;
|
|
import android.content.res.Configuration;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.util.TypedValue;
|
|
import android.view.ContextThemeWrapper;
|
|
import android.view.KeyCharacterMap;
|
|
import android.view.KeyEvent;
|
|
import android.view.LayoutInflater;
|
|
import android.view.Menu;
|
|
import android.view.MenuInflater;
|
|
import android.view.MenuItem;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.animation.AccelerateInterpolator;
|
|
import android.view.animation.DecelerateInterpolator;
|
|
import android.view.animation.Interpolator;
|
|
import android.widget.SpinnerAdapter;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.appcompat.R;
|
|
import androidx.appcompat.app.ActionBar;
|
|
import androidx.appcompat.content.res.AppCompatResources;
|
|
import androidx.appcompat.view.ActionBarPolicy;
|
|
import androidx.appcompat.view.ActionMode;
|
|
import androidx.appcompat.view.SupportMenuInflater;
|
|
import androidx.appcompat.view.ViewPropertyAnimatorCompatSet;
|
|
import androidx.appcompat.view.menu.MenuBuilder;
|
|
import androidx.appcompat.view.menu.MenuPopupHelper;
|
|
import androidx.appcompat.view.menu.SubMenuBuilder;
|
|
import androidx.appcompat.widget.ActionBarContainer;
|
|
import androidx.appcompat.widget.ActionBarContextView;
|
|
import androidx.appcompat.widget.ActionBarOverlayLayout;
|
|
import androidx.appcompat.widget.DecorToolbar;
|
|
import androidx.appcompat.widget.ScrollingTabContainerView;
|
|
import androidx.appcompat.widget.Toolbar;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.ViewPropertyAnimatorCompat;
|
|
import androidx.core.view.ViewPropertyAnimatorListener;
|
|
import androidx.core.view.ViewPropertyAnimatorListenerAdapter;
|
|
import androidx.core.view.ViewPropertyAnimatorUpdateListener;
|
|
import androidx.fragment.app.FragmentActivity;
|
|
import androidx.fragment.app.FragmentTransaction;
|
|
import c.d.b.a.a;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.ArrayList;
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public class WindowDecorActionBar extends ActionBar implements ActionBarOverlayLayout.ActionBarVisibilityCallback {
|
|
private static final long FADE_IN_DURATION_MS = 200;
|
|
private static final long FADE_OUT_DURATION_MS = 100;
|
|
private static final int INVALID_POSITION = -1;
|
|
private static final String TAG = "WindowDecorActionBar";
|
|
private static final Interpolator sHideInterpolator = new AccelerateInterpolator();
|
|
private static final Interpolator sShowInterpolator = new DecelerateInterpolator();
|
|
public ActionModeImpl mActionMode;
|
|
private Activity mActivity;
|
|
public ActionBarContainer mContainerView;
|
|
public boolean mContentAnimations = true;
|
|
public View mContentView;
|
|
public Context mContext;
|
|
public ActionBarContextView mContextView;
|
|
private int mCurWindowVisibility = 0;
|
|
public ViewPropertyAnimatorCompatSet mCurrentShowAnim;
|
|
public DecorToolbar mDecorToolbar;
|
|
public ActionMode mDeferredDestroyActionMode;
|
|
public ActionMode.Callback mDeferredModeDestroyCallback;
|
|
private boolean mDisplayHomeAsUpSet;
|
|
private boolean mHasEmbeddedTabs;
|
|
public boolean mHiddenByApp;
|
|
public boolean mHiddenBySystem;
|
|
public final ViewPropertyAnimatorListener mHideListener = new AnonymousClass1();
|
|
public boolean mHideOnContentScroll;
|
|
private boolean mLastMenuVisibility;
|
|
private ArrayList<ActionBar.OnMenuVisibilityListener> mMenuVisibilityListeners = new ArrayList<>();
|
|
private boolean mNowShowing = true;
|
|
public ActionBarOverlayLayout mOverlayLayout;
|
|
private int mSavedTabPosition = -1;
|
|
private TabImpl mSelectedTab;
|
|
private boolean mShowHideAnimationEnabled;
|
|
public final ViewPropertyAnimatorListener mShowListener = new AnonymousClass2();
|
|
private boolean mShowingForMode;
|
|
public ScrollingTabContainerView mTabScrollView;
|
|
private ArrayList<TabImpl> mTabs = new ArrayList<>();
|
|
private Context mThemedContext;
|
|
public final ViewPropertyAnimatorUpdateListener mUpdateListener = new AnonymousClass3();
|
|
|
|
/* renamed from: androidx.appcompat.app.WindowDecorActionBar$1 reason: invalid class name */
|
|
public class AnonymousClass1 extends ViewPropertyAnimatorListenerAdapter {
|
|
public AnonymousClass1() {
|
|
}
|
|
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
|
public void onAnimationEnd(View view) {
|
|
View view2;
|
|
WindowDecorActionBar windowDecorActionBar = WindowDecorActionBar.this;
|
|
if (windowDecorActionBar.mContentAnimations && (view2 = windowDecorActionBar.mContentView) != null) {
|
|
view2.setTranslationY(0.0f);
|
|
WindowDecorActionBar.this.mContainerView.setTranslationY(0.0f);
|
|
}
|
|
WindowDecorActionBar.this.mContainerView.setVisibility(8);
|
|
WindowDecorActionBar.this.mContainerView.setTransitioning(false);
|
|
WindowDecorActionBar windowDecorActionBar2 = WindowDecorActionBar.this;
|
|
windowDecorActionBar2.mCurrentShowAnim = null;
|
|
windowDecorActionBar2.completeDeferredDestroyActionMode();
|
|
ActionBarOverlayLayout actionBarOverlayLayout = WindowDecorActionBar.this.mOverlayLayout;
|
|
if (actionBarOverlayLayout != null) {
|
|
ViewCompat.requestApplyInsets(actionBarOverlayLayout);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.appcompat.app.WindowDecorActionBar$2 reason: invalid class name */
|
|
public class AnonymousClass2 extends ViewPropertyAnimatorListenerAdapter {
|
|
public AnonymousClass2() {
|
|
}
|
|
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
|
public void onAnimationEnd(View view) {
|
|
WindowDecorActionBar windowDecorActionBar = WindowDecorActionBar.this;
|
|
windowDecorActionBar.mCurrentShowAnim = null;
|
|
windowDecorActionBar.mContainerView.requestLayout();
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.appcompat.app.WindowDecorActionBar$3 reason: invalid class name */
|
|
public class AnonymousClass3 implements ViewPropertyAnimatorUpdateListener {
|
|
public AnonymousClass3() {
|
|
}
|
|
|
|
@Override // androidx.core.view.ViewPropertyAnimatorUpdateListener
|
|
public void onAnimationUpdate(View view) {
|
|
((View) WindowDecorActionBar.this.mContainerView.getParent()).invalidate();
|
|
}
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public class ActionModeImpl extends ActionMode implements MenuBuilder.Callback {
|
|
private final Context mActionModeContext;
|
|
private ActionMode.Callback mCallback;
|
|
private WeakReference<View> mCustomView;
|
|
private final MenuBuilder mMenu;
|
|
|
|
public ActionModeImpl(Context context, ActionMode.Callback callback) {
|
|
this.mActionModeContext = context;
|
|
this.mCallback = callback;
|
|
MenuBuilder defaultShowAsAction = new MenuBuilder(context).setDefaultShowAsAction(1);
|
|
this.mMenu = defaultShowAsAction;
|
|
defaultShowAsAction.setCallback(this);
|
|
}
|
|
|
|
public boolean dispatchOnCreate() {
|
|
this.mMenu.stopDispatchingItemsChanged();
|
|
try {
|
|
return this.mCallback.onCreateActionMode(this, this.mMenu);
|
|
} finally {
|
|
this.mMenu.startDispatchingItemsChanged();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public void finish() {
|
|
WindowDecorActionBar windowDecorActionBar = WindowDecorActionBar.this;
|
|
if (windowDecorActionBar.mActionMode == this) {
|
|
if (!WindowDecorActionBar.checkShowingFlags(windowDecorActionBar.mHiddenByApp, windowDecorActionBar.mHiddenBySystem, false)) {
|
|
WindowDecorActionBar windowDecorActionBar2 = WindowDecorActionBar.this;
|
|
windowDecorActionBar2.mDeferredDestroyActionMode = this;
|
|
windowDecorActionBar2.mDeferredModeDestroyCallback = this.mCallback;
|
|
} else {
|
|
this.mCallback.onDestroyActionMode(this);
|
|
}
|
|
this.mCallback = null;
|
|
WindowDecorActionBar.this.animateToMode(false);
|
|
WindowDecorActionBar.this.mContextView.closeMode();
|
|
WindowDecorActionBar.this.mDecorToolbar.getViewGroup().sendAccessibilityEvent(32);
|
|
WindowDecorActionBar windowDecorActionBar3 = WindowDecorActionBar.this;
|
|
windowDecorActionBar3.mOverlayLayout.setHideOnContentScrollEnabled(windowDecorActionBar3.mHideOnContentScroll);
|
|
WindowDecorActionBar.this.mActionMode = null;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public View getCustomView() {
|
|
WeakReference<View> weakReference = this.mCustomView;
|
|
if (weakReference != null) {
|
|
return weakReference.get();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public Menu getMenu() {
|
|
return this.mMenu;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public MenuInflater getMenuInflater() {
|
|
return new SupportMenuInflater(this.mActionModeContext);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public CharSequence getSubtitle() {
|
|
return WindowDecorActionBar.this.mContextView.getSubtitle();
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public CharSequence getTitle() {
|
|
return WindowDecorActionBar.this.mContextView.getTitle();
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public void invalidate() {
|
|
if (WindowDecorActionBar.this.mActionMode == this) {
|
|
this.mMenu.stopDispatchingItemsChanged();
|
|
try {
|
|
this.mCallback.onPrepareActionMode(this, this.mMenu);
|
|
} finally {
|
|
this.mMenu.startDispatchingItemsChanged();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public boolean isTitleOptional() {
|
|
return WindowDecorActionBar.this.mContextView.isTitleOptional();
|
|
}
|
|
|
|
public void onCloseMenu(MenuBuilder menuBuilder, boolean z2) {
|
|
}
|
|
|
|
public void onCloseSubMenu(SubMenuBuilder subMenuBuilder) {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
|
public boolean onMenuItemSelected(@NonNull MenuBuilder menuBuilder, @NonNull MenuItem menuItem) {
|
|
ActionMode.Callback callback = this.mCallback;
|
|
if (callback != null) {
|
|
return callback.onActionItemClicked(this, menuItem);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
|
public void onMenuModeChange(@NonNull MenuBuilder menuBuilder) {
|
|
if (this.mCallback != null) {
|
|
invalidate();
|
|
WindowDecorActionBar.this.mContextView.showOverflowMenu();
|
|
}
|
|
}
|
|
|
|
public boolean onSubMenuSelected(SubMenuBuilder subMenuBuilder) {
|
|
if (this.mCallback == null) {
|
|
return false;
|
|
}
|
|
if (!subMenuBuilder.hasVisibleItems()) {
|
|
return true;
|
|
}
|
|
new MenuPopupHelper(WindowDecorActionBar.this.getThemedContext(), subMenuBuilder).show();
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public void setCustomView(View view) {
|
|
WindowDecorActionBar.this.mContextView.setCustomView(view);
|
|
this.mCustomView = new WeakReference<>(view);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public void setSubtitle(int i) {
|
|
setSubtitle(WindowDecorActionBar.this.mContext.getResources().getString(i));
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public void setSubtitle(CharSequence charSequence) {
|
|
WindowDecorActionBar.this.mContextView.setSubtitle(charSequence);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public void setTitle(int i) {
|
|
setTitle(WindowDecorActionBar.this.mContext.getResources().getString(i));
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public void setTitle(CharSequence charSequence) {
|
|
WindowDecorActionBar.this.mContextView.setTitle(charSequence);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode
|
|
public void setTitleOptionalHint(boolean z2) {
|
|
super.setTitleOptionalHint(z2);
|
|
WindowDecorActionBar.this.mContextView.setTitleOptional(z2);
|
|
}
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public class TabImpl extends ActionBar.Tab {
|
|
private ActionBar.TabListener mCallback;
|
|
private CharSequence mContentDesc;
|
|
private View mCustomView;
|
|
private Drawable mIcon;
|
|
private int mPosition = -1;
|
|
private Object mTag;
|
|
private CharSequence mText;
|
|
|
|
public TabImpl() {
|
|
}
|
|
|
|
public ActionBar.TabListener getCallback() {
|
|
return this.mCallback;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public CharSequence getContentDescription() {
|
|
return this.mContentDesc;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public View getCustomView() {
|
|
return this.mCustomView;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public Drawable getIcon() {
|
|
return this.mIcon;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public int getPosition() {
|
|
return this.mPosition;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public Object getTag() {
|
|
return this.mTag;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public CharSequence getText() {
|
|
return this.mText;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public void select() {
|
|
WindowDecorActionBar.this.selectTab(this);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public ActionBar.Tab setContentDescription(int i) {
|
|
return setContentDescription(WindowDecorActionBar.this.mContext.getResources().getText(i));
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public ActionBar.Tab setContentDescription(CharSequence charSequence) {
|
|
this.mContentDesc = charSequence;
|
|
int i = this.mPosition;
|
|
if (i >= 0) {
|
|
WindowDecorActionBar.this.mTabScrollView.updateTab(i);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public ActionBar.Tab setCustomView(int i) {
|
|
return setCustomView(LayoutInflater.from(WindowDecorActionBar.this.getThemedContext()).inflate(i, (ViewGroup) null));
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public ActionBar.Tab setCustomView(View view) {
|
|
this.mCustomView = view;
|
|
int i = this.mPosition;
|
|
if (i >= 0) {
|
|
WindowDecorActionBar.this.mTabScrollView.updateTab(i);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public ActionBar.Tab setIcon(int i) {
|
|
return setIcon(AppCompatResources.getDrawable(WindowDecorActionBar.this.mContext, i));
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public ActionBar.Tab setIcon(Drawable drawable) {
|
|
this.mIcon = drawable;
|
|
int i = this.mPosition;
|
|
if (i >= 0) {
|
|
WindowDecorActionBar.this.mTabScrollView.updateTab(i);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public void setPosition(int i) {
|
|
this.mPosition = i;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public ActionBar.Tab setTabListener(ActionBar.TabListener tabListener) {
|
|
this.mCallback = tabListener;
|
|
return this;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public ActionBar.Tab setTag(Object obj) {
|
|
this.mTag = obj;
|
|
return this;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public ActionBar.Tab setText(int i) {
|
|
return setText(WindowDecorActionBar.this.mContext.getResources().getText(i));
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar.Tab
|
|
public ActionBar.Tab setText(CharSequence charSequence) {
|
|
this.mText = charSequence;
|
|
int i = this.mPosition;
|
|
if (i >= 0) {
|
|
WindowDecorActionBar.this.mTabScrollView.updateTab(i);
|
|
}
|
|
return this;
|
|
}
|
|
}
|
|
|
|
public WindowDecorActionBar(Activity activity, boolean z2) {
|
|
this.mActivity = activity;
|
|
View decorView = activity.getWindow().getDecorView();
|
|
init(decorView);
|
|
if (!z2) {
|
|
this.mContentView = decorView.findViewById(16908290);
|
|
}
|
|
}
|
|
|
|
public WindowDecorActionBar(Dialog dialog) {
|
|
init(dialog.getWindow().getDecorView());
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public WindowDecorActionBar(View view) {
|
|
init(view);
|
|
}
|
|
|
|
public static boolean checkShowingFlags(boolean z2, boolean z3, boolean z4) {
|
|
if (z4) {
|
|
return true;
|
|
}
|
|
return !z2 && !z3;
|
|
}
|
|
|
|
private void cleanupTabs() {
|
|
if (this.mSelectedTab != null) {
|
|
selectTab(null);
|
|
}
|
|
this.mTabs.clear();
|
|
ScrollingTabContainerView scrollingTabContainerView = this.mTabScrollView;
|
|
if (scrollingTabContainerView != null) {
|
|
scrollingTabContainerView.removeAllTabs();
|
|
}
|
|
this.mSavedTabPosition = -1;
|
|
}
|
|
|
|
private void configureTab(ActionBar.Tab tab, int i) {
|
|
TabImpl tabImpl = (TabImpl) tab;
|
|
if (tabImpl.getCallback() != null) {
|
|
tabImpl.setPosition(i);
|
|
this.mTabs.add(i, tabImpl);
|
|
int size = this.mTabs.size();
|
|
while (true) {
|
|
i++;
|
|
if (i < size) {
|
|
this.mTabs.get(i).setPosition(i);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
} else {
|
|
throw new IllegalStateException("Action Bar Tab must have a Callback");
|
|
}
|
|
}
|
|
|
|
private void ensureTabsExist() {
|
|
if (this.mTabScrollView == null) {
|
|
ScrollingTabContainerView scrollingTabContainerView = new ScrollingTabContainerView(this.mContext);
|
|
if (this.mHasEmbeddedTabs) {
|
|
scrollingTabContainerView.setVisibility(0);
|
|
this.mDecorToolbar.setEmbeddedTabView(scrollingTabContainerView);
|
|
} else {
|
|
if (getNavigationMode() == 2) {
|
|
scrollingTabContainerView.setVisibility(0);
|
|
ActionBarOverlayLayout actionBarOverlayLayout = this.mOverlayLayout;
|
|
if (actionBarOverlayLayout != null) {
|
|
ViewCompat.requestApplyInsets(actionBarOverlayLayout);
|
|
}
|
|
} else {
|
|
scrollingTabContainerView.setVisibility(8);
|
|
}
|
|
this.mContainerView.setTabContainer(scrollingTabContainerView);
|
|
}
|
|
this.mTabScrollView = scrollingTabContainerView;
|
|
}
|
|
}
|
|
|
|
private DecorToolbar getDecorToolbar(View view) {
|
|
if (view instanceof DecorToolbar) {
|
|
return (DecorToolbar) view;
|
|
}
|
|
if (view instanceof Toolbar) {
|
|
return ((Toolbar) view).getWrapper();
|
|
}
|
|
StringBuilder K = a.K("Can't make a decor toolbar out of ");
|
|
K.append(view != null ? view.getClass().getSimpleName() : "null");
|
|
throw new IllegalStateException(K.toString());
|
|
}
|
|
|
|
private void hideForActionMode() {
|
|
if (this.mShowingForMode) {
|
|
this.mShowingForMode = false;
|
|
ActionBarOverlayLayout actionBarOverlayLayout = this.mOverlayLayout;
|
|
if (actionBarOverlayLayout != null) {
|
|
actionBarOverlayLayout.setShowingForActionMode(false);
|
|
}
|
|
updateVisibility(false);
|
|
}
|
|
}
|
|
|
|
private void init(View view) {
|
|
ActionBarOverlayLayout actionBarOverlayLayout = (ActionBarOverlayLayout) view.findViewById(R.id.decor_content_parent);
|
|
this.mOverlayLayout = actionBarOverlayLayout;
|
|
if (actionBarOverlayLayout != null) {
|
|
actionBarOverlayLayout.setActionBarVisibilityCallback(this);
|
|
}
|
|
this.mDecorToolbar = getDecorToolbar(view.findViewById(R.id.action_bar));
|
|
this.mContextView = (ActionBarContextView) view.findViewById(R.id.action_context_bar);
|
|
ActionBarContainer actionBarContainer = (ActionBarContainer) view.findViewById(R.id.action_bar_container);
|
|
this.mContainerView = actionBarContainer;
|
|
DecorToolbar decorToolbar = this.mDecorToolbar;
|
|
if (decorToolbar == null || this.mContextView == null || actionBarContainer == null) {
|
|
throw new IllegalStateException(getClass().getSimpleName() + " can only be used with a compatible window decor layout");
|
|
}
|
|
this.mContext = decorToolbar.getContext();
|
|
boolean z2 = (this.mDecorToolbar.getDisplayOptions() & 4) != 0;
|
|
if (z2) {
|
|
this.mDisplayHomeAsUpSet = true;
|
|
}
|
|
ActionBarPolicy actionBarPolicy = ActionBarPolicy.get(this.mContext);
|
|
setHomeButtonEnabled(actionBarPolicy.enableHomeButtonByDefault() || z2);
|
|
setHasEmbeddedTabs(actionBarPolicy.hasEmbeddedTabs());
|
|
TypedArray obtainStyledAttributes = this.mContext.obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);
|
|
if (obtainStyledAttributes.getBoolean(R.styleable.ActionBar_hideOnContentScroll, false)) {
|
|
setHideOnContentScrollEnabled(true);
|
|
}
|
|
int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(R.styleable.ActionBar_elevation, 0);
|
|
if (dimensionPixelSize != 0) {
|
|
setElevation((float) dimensionPixelSize);
|
|
}
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
|
|
private void setHasEmbeddedTabs(boolean z2) {
|
|
this.mHasEmbeddedTabs = z2;
|
|
if (!z2) {
|
|
this.mDecorToolbar.setEmbeddedTabView(null);
|
|
this.mContainerView.setTabContainer(this.mTabScrollView);
|
|
} else {
|
|
this.mContainerView.setTabContainer(null);
|
|
this.mDecorToolbar.setEmbeddedTabView(this.mTabScrollView);
|
|
}
|
|
boolean z3 = true;
|
|
boolean z4 = getNavigationMode() == 2;
|
|
ScrollingTabContainerView scrollingTabContainerView = this.mTabScrollView;
|
|
if (scrollingTabContainerView != null) {
|
|
if (z4) {
|
|
scrollingTabContainerView.setVisibility(0);
|
|
ActionBarOverlayLayout actionBarOverlayLayout = this.mOverlayLayout;
|
|
if (actionBarOverlayLayout != null) {
|
|
ViewCompat.requestApplyInsets(actionBarOverlayLayout);
|
|
}
|
|
} else {
|
|
scrollingTabContainerView.setVisibility(8);
|
|
}
|
|
}
|
|
this.mDecorToolbar.setCollapsible(!this.mHasEmbeddedTabs && z4);
|
|
ActionBarOverlayLayout actionBarOverlayLayout2 = this.mOverlayLayout;
|
|
if (this.mHasEmbeddedTabs || !z4) {
|
|
z3 = false;
|
|
}
|
|
actionBarOverlayLayout2.setHasNonEmbeddedTabs(z3);
|
|
}
|
|
|
|
private boolean shouldAnimateContextView() {
|
|
return ViewCompat.isLaidOut(this.mContainerView);
|
|
}
|
|
|
|
private void showForActionMode() {
|
|
if (!this.mShowingForMode) {
|
|
this.mShowingForMode = true;
|
|
ActionBarOverlayLayout actionBarOverlayLayout = this.mOverlayLayout;
|
|
if (actionBarOverlayLayout != null) {
|
|
actionBarOverlayLayout.setShowingForActionMode(true);
|
|
}
|
|
updateVisibility(false);
|
|
}
|
|
}
|
|
|
|
private void updateVisibility(boolean z2) {
|
|
if (checkShowingFlags(this.mHiddenByApp, this.mHiddenBySystem, this.mShowingForMode)) {
|
|
if (!this.mNowShowing) {
|
|
this.mNowShowing = true;
|
|
doShow(z2);
|
|
}
|
|
} else if (this.mNowShowing) {
|
|
this.mNowShowing = false;
|
|
doHide(z2);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void addOnMenuVisibilityListener(ActionBar.OnMenuVisibilityListener onMenuVisibilityListener) {
|
|
this.mMenuVisibilityListeners.add(onMenuVisibilityListener);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void addTab(ActionBar.Tab tab) {
|
|
addTab(tab, this.mTabs.isEmpty());
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void addTab(ActionBar.Tab tab, int i) {
|
|
addTab(tab, i, this.mTabs.isEmpty());
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void addTab(ActionBar.Tab tab, int i, boolean z2) {
|
|
ensureTabsExist();
|
|
this.mTabScrollView.addTab(tab, i, z2);
|
|
configureTab(tab, i);
|
|
if (z2) {
|
|
selectTab(tab);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void addTab(ActionBar.Tab tab, boolean z2) {
|
|
ensureTabsExist();
|
|
this.mTabScrollView.addTab(tab, z2);
|
|
configureTab(tab, this.mTabs.size());
|
|
if (z2) {
|
|
selectTab(tab);
|
|
}
|
|
}
|
|
|
|
public void animateToMode(boolean z2) {
|
|
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat;
|
|
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat2;
|
|
if (z2) {
|
|
showForActionMode();
|
|
} else {
|
|
hideForActionMode();
|
|
}
|
|
if (shouldAnimateContextView()) {
|
|
if (z2) {
|
|
viewPropertyAnimatorCompat = this.mDecorToolbar.setupAnimatorToVisibility(4, 100);
|
|
viewPropertyAnimatorCompat2 = this.mContextView.setupAnimatorToVisibility(0, FADE_IN_DURATION_MS);
|
|
} else {
|
|
viewPropertyAnimatorCompat2 = this.mDecorToolbar.setupAnimatorToVisibility(0, FADE_IN_DURATION_MS);
|
|
viewPropertyAnimatorCompat = this.mContextView.setupAnimatorToVisibility(8, 100);
|
|
}
|
|
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet = new ViewPropertyAnimatorCompatSet();
|
|
viewPropertyAnimatorCompatSet.playSequentially(viewPropertyAnimatorCompat, viewPropertyAnimatorCompat2);
|
|
viewPropertyAnimatorCompatSet.start();
|
|
} else if (z2) {
|
|
this.mDecorToolbar.setVisibility(4);
|
|
this.mContextView.setVisibility(0);
|
|
} else {
|
|
this.mDecorToolbar.setVisibility(0);
|
|
this.mContextView.setVisibility(8);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public boolean collapseActionView() {
|
|
DecorToolbar decorToolbar = this.mDecorToolbar;
|
|
if (decorToolbar == null || !decorToolbar.hasExpandedActionView()) {
|
|
return false;
|
|
}
|
|
this.mDecorToolbar.collapseActionView();
|
|
return true;
|
|
}
|
|
|
|
public void completeDeferredDestroyActionMode() {
|
|
ActionMode.Callback callback = this.mDeferredModeDestroyCallback;
|
|
if (callback != null) {
|
|
callback.onDestroyActionMode(this.mDeferredDestroyActionMode);
|
|
this.mDeferredDestroyActionMode = null;
|
|
this.mDeferredModeDestroyCallback = null;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void dispatchMenuVisibilityChanged(boolean z2) {
|
|
if (z2 != this.mLastMenuVisibility) {
|
|
this.mLastMenuVisibility = z2;
|
|
int size = this.mMenuVisibilityListeners.size();
|
|
for (int i = 0; i < size; i++) {
|
|
this.mMenuVisibilityListeners.get(i).onMenuVisibilityChanged(z2);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void doHide(boolean z2) {
|
|
View view;
|
|
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet = this.mCurrentShowAnim;
|
|
if (viewPropertyAnimatorCompatSet != null) {
|
|
viewPropertyAnimatorCompatSet.cancel();
|
|
}
|
|
if (this.mCurWindowVisibility != 0 || (!this.mShowHideAnimationEnabled && !z2)) {
|
|
this.mHideListener.onAnimationEnd(null);
|
|
return;
|
|
}
|
|
this.mContainerView.setAlpha(1.0f);
|
|
this.mContainerView.setTransitioning(true);
|
|
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet2 = new ViewPropertyAnimatorCompatSet();
|
|
float f = (float) (-this.mContainerView.getHeight());
|
|
if (z2) {
|
|
int[] iArr = {0, 0};
|
|
this.mContainerView.getLocationInWindow(iArr);
|
|
f -= (float) iArr[1];
|
|
}
|
|
ViewPropertyAnimatorCompat translationY = ViewCompat.animate(this.mContainerView).translationY(f);
|
|
translationY.setUpdateListener(this.mUpdateListener);
|
|
viewPropertyAnimatorCompatSet2.play(translationY);
|
|
if (this.mContentAnimations && (view = this.mContentView) != null) {
|
|
viewPropertyAnimatorCompatSet2.play(ViewCompat.animate(view).translationY(f));
|
|
}
|
|
viewPropertyAnimatorCompatSet2.setInterpolator(sHideInterpolator);
|
|
viewPropertyAnimatorCompatSet2.setDuration(250);
|
|
viewPropertyAnimatorCompatSet2.setListener(this.mHideListener);
|
|
this.mCurrentShowAnim = viewPropertyAnimatorCompatSet2;
|
|
viewPropertyAnimatorCompatSet2.start();
|
|
}
|
|
|
|
public void doShow(boolean z2) {
|
|
View view;
|
|
View view2;
|
|
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet = this.mCurrentShowAnim;
|
|
if (viewPropertyAnimatorCompatSet != null) {
|
|
viewPropertyAnimatorCompatSet.cancel();
|
|
}
|
|
this.mContainerView.setVisibility(0);
|
|
if (this.mCurWindowVisibility != 0 || (!this.mShowHideAnimationEnabled && !z2)) {
|
|
this.mContainerView.setAlpha(1.0f);
|
|
this.mContainerView.setTranslationY(0.0f);
|
|
if (this.mContentAnimations && (view = this.mContentView) != null) {
|
|
view.setTranslationY(0.0f);
|
|
}
|
|
this.mShowListener.onAnimationEnd(null);
|
|
} else {
|
|
this.mContainerView.setTranslationY(0.0f);
|
|
float f = (float) (-this.mContainerView.getHeight());
|
|
if (z2) {
|
|
int[] iArr = {0, 0};
|
|
this.mContainerView.getLocationInWindow(iArr);
|
|
f -= (float) iArr[1];
|
|
}
|
|
this.mContainerView.setTranslationY(f);
|
|
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet2 = new ViewPropertyAnimatorCompatSet();
|
|
ViewPropertyAnimatorCompat translationY = ViewCompat.animate(this.mContainerView).translationY(0.0f);
|
|
translationY.setUpdateListener(this.mUpdateListener);
|
|
viewPropertyAnimatorCompatSet2.play(translationY);
|
|
if (this.mContentAnimations && (view2 = this.mContentView) != null) {
|
|
view2.setTranslationY(f);
|
|
viewPropertyAnimatorCompatSet2.play(ViewCompat.animate(this.mContentView).translationY(0.0f));
|
|
}
|
|
viewPropertyAnimatorCompatSet2.setInterpolator(sShowInterpolator);
|
|
viewPropertyAnimatorCompatSet2.setDuration(250);
|
|
viewPropertyAnimatorCompatSet2.setListener(this.mShowListener);
|
|
this.mCurrentShowAnim = viewPropertyAnimatorCompatSet2;
|
|
viewPropertyAnimatorCompatSet2.start();
|
|
}
|
|
ActionBarOverlayLayout actionBarOverlayLayout = this.mOverlayLayout;
|
|
if (actionBarOverlayLayout != null) {
|
|
ViewCompat.requestApplyInsets(actionBarOverlayLayout);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
|
|
public void enableContentAnimations(boolean z2) {
|
|
this.mContentAnimations = z2;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public View getCustomView() {
|
|
return this.mDecorToolbar.getCustomView();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public int getDisplayOptions() {
|
|
return this.mDecorToolbar.getDisplayOptions();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public float getElevation() {
|
|
return ViewCompat.getElevation(this.mContainerView);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public int getHeight() {
|
|
return this.mContainerView.getHeight();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public int getHideOffset() {
|
|
return this.mOverlayLayout.getActionBarHideOffset();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public int getNavigationItemCount() {
|
|
int navigationMode = this.mDecorToolbar.getNavigationMode();
|
|
if (navigationMode == 1) {
|
|
return this.mDecorToolbar.getDropdownItemCount();
|
|
}
|
|
if (navigationMode != 2) {
|
|
return 0;
|
|
}
|
|
return this.mTabs.size();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public int getNavigationMode() {
|
|
return this.mDecorToolbar.getNavigationMode();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public int getSelectedNavigationIndex() {
|
|
TabImpl tabImpl;
|
|
int navigationMode = this.mDecorToolbar.getNavigationMode();
|
|
if (navigationMode == 1) {
|
|
return this.mDecorToolbar.getDropdownSelectedPosition();
|
|
}
|
|
if (navigationMode == 2 && (tabImpl = this.mSelectedTab) != null) {
|
|
return tabImpl.getPosition();
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public ActionBar.Tab getSelectedTab() {
|
|
return this.mSelectedTab;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public CharSequence getSubtitle() {
|
|
return this.mDecorToolbar.getSubtitle();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public ActionBar.Tab getTabAt(int i) {
|
|
return this.mTabs.get(i);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public int getTabCount() {
|
|
return this.mTabs.size();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public Context getThemedContext() {
|
|
if (this.mThemedContext == null) {
|
|
TypedValue typedValue = new TypedValue();
|
|
this.mContext.getTheme().resolveAttribute(R.attr.actionBarWidgetTheme, typedValue, true);
|
|
int i = typedValue.resourceId;
|
|
if (i != 0) {
|
|
this.mThemedContext = new ContextThemeWrapper(this.mContext, i);
|
|
} else {
|
|
this.mThemedContext = this.mContext;
|
|
}
|
|
}
|
|
return this.mThemedContext;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public CharSequence getTitle() {
|
|
return this.mDecorToolbar.getTitle();
|
|
}
|
|
|
|
public boolean hasIcon() {
|
|
return this.mDecorToolbar.hasIcon();
|
|
}
|
|
|
|
public boolean hasLogo() {
|
|
return this.mDecorToolbar.hasLogo();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void hide() {
|
|
if (!this.mHiddenByApp) {
|
|
this.mHiddenByApp = true;
|
|
updateVisibility(false);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
|
|
public void hideForSystem() {
|
|
if (!this.mHiddenBySystem) {
|
|
this.mHiddenBySystem = true;
|
|
updateVisibility(true);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public boolean isHideOnContentScrollEnabled() {
|
|
return this.mOverlayLayout.isHideOnContentScrollEnabled();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public boolean isShowing() {
|
|
int height = getHeight();
|
|
return this.mNowShowing && (height == 0 || getHideOffset() < height);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public boolean isTitleTruncated() {
|
|
DecorToolbar decorToolbar = this.mDecorToolbar;
|
|
return decorToolbar != null && decorToolbar.isTitleTruncated();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public ActionBar.Tab newTab() {
|
|
return new TabImpl();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void onConfigurationChanged(Configuration configuration) {
|
|
setHasEmbeddedTabs(ActionBarPolicy.get(this.mContext).hasEmbeddedTabs());
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
|
|
public void onContentScrollStarted() {
|
|
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet = this.mCurrentShowAnim;
|
|
if (viewPropertyAnimatorCompatSet != null) {
|
|
viewPropertyAnimatorCompatSet.cancel();
|
|
this.mCurrentShowAnim = null;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
|
|
public void onContentScrollStopped() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public boolean onKeyShortcut(int i, KeyEvent keyEvent) {
|
|
Menu menu;
|
|
ActionModeImpl actionModeImpl = this.mActionMode;
|
|
if (actionModeImpl == null || (menu = actionModeImpl.getMenu()) == null) {
|
|
return false;
|
|
}
|
|
boolean z2 = true;
|
|
if (KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() == 1) {
|
|
z2 = false;
|
|
}
|
|
menu.setQwertyMode(z2);
|
|
return menu.performShortcut(i, keyEvent, 0);
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
|
|
public void onWindowVisibilityChanged(int i) {
|
|
this.mCurWindowVisibility = i;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void removeAllTabs() {
|
|
cleanupTabs();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void removeOnMenuVisibilityListener(ActionBar.OnMenuVisibilityListener onMenuVisibilityListener) {
|
|
this.mMenuVisibilityListeners.remove(onMenuVisibilityListener);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void removeTab(ActionBar.Tab tab) {
|
|
removeTabAt(tab.getPosition());
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void removeTabAt(int i) {
|
|
if (this.mTabScrollView != null) {
|
|
TabImpl tabImpl = this.mSelectedTab;
|
|
int position = tabImpl != null ? tabImpl.getPosition() : this.mSavedTabPosition;
|
|
this.mTabScrollView.removeTabAt(i);
|
|
TabImpl remove = this.mTabs.remove(i);
|
|
if (remove != null) {
|
|
remove.setPosition(-1);
|
|
}
|
|
int size = this.mTabs.size();
|
|
for (int i2 = i; i2 < size; i2++) {
|
|
this.mTabs.get(i2).setPosition(i2);
|
|
}
|
|
if (position == i) {
|
|
selectTab(this.mTabs.isEmpty() ? null : this.mTabs.get(Math.max(0, i - 1)));
|
|
}
|
|
}
|
|
}
|
|
|
|
@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 selectTab(ActionBar.Tab tab) {
|
|
int i = -1;
|
|
if (getNavigationMode() != 2) {
|
|
if (tab != null) {
|
|
i = tab.getPosition();
|
|
}
|
|
this.mSavedTabPosition = i;
|
|
return;
|
|
}
|
|
FragmentTransaction disallowAddToBackStack = (!(this.mActivity instanceof FragmentActivity) || this.mDecorToolbar.getViewGroup().isInEditMode()) ? null : ((FragmentActivity) this.mActivity).getSupportFragmentManager().beginTransaction().disallowAddToBackStack();
|
|
TabImpl tabImpl = this.mSelectedTab;
|
|
if (tabImpl != tab) {
|
|
ScrollingTabContainerView scrollingTabContainerView = this.mTabScrollView;
|
|
if (tab != null) {
|
|
i = tab.getPosition();
|
|
}
|
|
scrollingTabContainerView.setTabSelected(i);
|
|
TabImpl tabImpl2 = this.mSelectedTab;
|
|
if (tabImpl2 != null) {
|
|
tabImpl2.getCallback().onTabUnselected(this.mSelectedTab, disallowAddToBackStack);
|
|
}
|
|
TabImpl tabImpl3 = (TabImpl) tab;
|
|
this.mSelectedTab = tabImpl3;
|
|
if (tabImpl3 != null) {
|
|
tabImpl3.getCallback().onTabSelected(this.mSelectedTab, disallowAddToBackStack);
|
|
}
|
|
} else if (tabImpl != null) {
|
|
tabImpl.getCallback().onTabReselected(this.mSelectedTab, disallowAddToBackStack);
|
|
this.mTabScrollView.animateToTab(tab.getPosition());
|
|
}
|
|
if (disallowAddToBackStack != null && !disallowAddToBackStack.isEmpty()) {
|
|
disallowAddToBackStack.commit();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setBackgroundDrawable(Drawable drawable) {
|
|
this.mContainerView.setPrimaryBackground(drawable);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setCustomView(int i) {
|
|
setCustomView(LayoutInflater.from(getThemedContext()).inflate(i, this.mDecorToolbar.getViewGroup(), false));
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setCustomView(View view) {
|
|
this.mDecorToolbar.setCustomView(view);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setCustomView(View view, ActionBar.LayoutParams layoutParams) {
|
|
view.setLayoutParams(layoutParams);
|
|
this.mDecorToolbar.setCustomView(view);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setDefaultDisplayHomeAsUpEnabled(boolean z2) {
|
|
if (!this.mDisplayHomeAsUpSet) {
|
|
setDisplayHomeAsUpEnabled(z2);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setDisplayHomeAsUpEnabled(boolean z2) {
|
|
setDisplayOptions(z2 ? 4 : 0, 4);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setDisplayOptions(int i) {
|
|
if ((i & 4) != 0) {
|
|
this.mDisplayHomeAsUpSet = true;
|
|
}
|
|
this.mDecorToolbar.setDisplayOptions(i);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setDisplayOptions(int i, int i2) {
|
|
int displayOptions = this.mDecorToolbar.getDisplayOptions();
|
|
if ((i2 & 4) != 0) {
|
|
this.mDisplayHomeAsUpSet = true;
|
|
}
|
|
this.mDecorToolbar.setDisplayOptions((i & i2) | ((~i2) & displayOptions));
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setDisplayShowCustomEnabled(boolean z2) {
|
|
setDisplayOptions(z2 ? 16 : 0, 16);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setDisplayShowHomeEnabled(boolean z2) {
|
|
setDisplayOptions(z2 ? 2 : 0, 2);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setDisplayShowTitleEnabled(boolean z2) {
|
|
setDisplayOptions(z2 ? 8 : 0, 8);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setDisplayUseLogoEnabled(boolean z2) {
|
|
setDisplayOptions(z2 ? 1 : 0, 1);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setElevation(float f) {
|
|
ViewCompat.setElevation(this.mContainerView, f);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setHideOffset(int i) {
|
|
if (i == 0 || this.mOverlayLayout.isInOverlayMode()) {
|
|
this.mOverlayLayout.setActionBarHideOffset(i);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Action bar must be in overlay mode (Window.FEATURE_OVERLAY_ACTION_BAR) to set a non-zero hide offset");
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setHideOnContentScrollEnabled(boolean z2) {
|
|
if (!z2 || this.mOverlayLayout.isInOverlayMode()) {
|
|
this.mHideOnContentScroll = z2;
|
|
this.mOverlayLayout.setHideOnContentScrollEnabled(z2);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Action bar must be in overlay mode (Window.FEATURE_OVERLAY_ACTION_BAR) to enable hide on content scroll");
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setHomeActionContentDescription(int i) {
|
|
this.mDecorToolbar.setNavigationContentDescription(i);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setHomeActionContentDescription(CharSequence charSequence) {
|
|
this.mDecorToolbar.setNavigationContentDescription(charSequence);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setHomeAsUpIndicator(int i) {
|
|
this.mDecorToolbar.setNavigationIcon(i);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setHomeAsUpIndicator(Drawable drawable) {
|
|
this.mDecorToolbar.setNavigationIcon(drawable);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setHomeButtonEnabled(boolean z2) {
|
|
this.mDecorToolbar.setHomeButtonEnabled(z2);
|
|
}
|
|
|
|
@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 setListNavigationCallbacks(SpinnerAdapter spinnerAdapter, ActionBar.OnNavigationListener onNavigationListener) {
|
|
this.mDecorToolbar.setDropdownParams(spinnerAdapter, new NavItemSelectedListener(onNavigationListener));
|
|
}
|
|
|
|
@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 setNavigationMode(int i) {
|
|
ActionBarOverlayLayout actionBarOverlayLayout;
|
|
int navigationMode = this.mDecorToolbar.getNavigationMode();
|
|
if (navigationMode == 2) {
|
|
this.mSavedTabPosition = getSelectedNavigationIndex();
|
|
selectTab(null);
|
|
this.mTabScrollView.setVisibility(8);
|
|
}
|
|
if (!(navigationMode == i || this.mHasEmbeddedTabs || (actionBarOverlayLayout = this.mOverlayLayout) == null)) {
|
|
ViewCompat.requestApplyInsets(actionBarOverlayLayout);
|
|
}
|
|
this.mDecorToolbar.setNavigationMode(i);
|
|
boolean z2 = false;
|
|
if (i == 2) {
|
|
ensureTabsExist();
|
|
this.mTabScrollView.setVisibility(0);
|
|
int i2 = this.mSavedTabPosition;
|
|
if (i2 != -1) {
|
|
setSelectedNavigationItem(i2);
|
|
this.mSavedTabPosition = -1;
|
|
}
|
|
}
|
|
this.mDecorToolbar.setCollapsible(i == 2 && !this.mHasEmbeddedTabs);
|
|
ActionBarOverlayLayout actionBarOverlayLayout2 = this.mOverlayLayout;
|
|
if (i == 2 && !this.mHasEmbeddedTabs) {
|
|
z2 = true;
|
|
}
|
|
actionBarOverlayLayout2.setHasNonEmbeddedTabs(z2);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setSelectedNavigationItem(int i) {
|
|
int navigationMode = this.mDecorToolbar.getNavigationMode();
|
|
if (navigationMode == 1) {
|
|
this.mDecorToolbar.setDropdownSelectedPosition(i);
|
|
} else if (navigationMode == 2) {
|
|
selectTab(this.mTabs.get(i));
|
|
} else {
|
|
throw new IllegalStateException("setSelectedNavigationIndex not valid for current navigation mode");
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setShowHideAnimationEnabled(boolean z2) {
|
|
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet;
|
|
this.mShowHideAnimationEnabled = z2;
|
|
if (!z2 && (viewPropertyAnimatorCompatSet = this.mCurrentShowAnim) != null) {
|
|
viewPropertyAnimatorCompatSet.cancel();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setSplitBackgroundDrawable(Drawable drawable) {
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setStackedBackgroundDrawable(Drawable drawable) {
|
|
this.mContainerView.setStackedBackground(drawable);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setSubtitle(int i) {
|
|
setSubtitle(this.mContext.getString(i));
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setSubtitle(CharSequence charSequence) {
|
|
this.mDecorToolbar.setSubtitle(charSequence);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setTitle(int i) {
|
|
setTitle(this.mContext.getString(i));
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setTitle(CharSequence charSequence) {
|
|
this.mDecorToolbar.setTitle(charSequence);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void setWindowTitle(CharSequence charSequence) {
|
|
this.mDecorToolbar.setWindowTitle(charSequence);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public void show() {
|
|
if (this.mHiddenByApp) {
|
|
this.mHiddenByApp = false;
|
|
updateVisibility(false);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
|
|
public void showForSystem() {
|
|
if (this.mHiddenBySystem) {
|
|
this.mHiddenBySystem = false;
|
|
updateVisibility(true);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.ActionBar
|
|
public ActionMode startActionMode(ActionMode.Callback callback) {
|
|
ActionModeImpl actionModeImpl = this.mActionMode;
|
|
if (actionModeImpl != null) {
|
|
actionModeImpl.finish();
|
|
}
|
|
this.mOverlayLayout.setHideOnContentScrollEnabled(false);
|
|
this.mContextView.killMode();
|
|
ActionModeImpl actionModeImpl2 = new ActionModeImpl(this.mContextView.getContext(), callback);
|
|
if (!actionModeImpl2.dispatchOnCreate()) {
|
|
return null;
|
|
}
|
|
this.mActionMode = actionModeImpl2;
|
|
actionModeImpl2.invalidate();
|
|
this.mContextView.initForMode(actionModeImpl2);
|
|
animateToMode(true);
|
|
this.mContextView.sendAccessibilityEvent(32);
|
|
return actionModeImpl2;
|
|
}
|
|
}
|