package androidx.appcompat.view; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import androidx.annotation.RestrictTo; import androidx.appcompat.R; @RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX}) public class ActionBarPolicy { private Context mContext; private ActionBarPolicy(Context context) { this.mContext = context; } public static ActionBarPolicy get(Context context) { return new ActionBarPolicy(context); } public boolean enableHomeButtonByDefault() { return this.mContext.getApplicationInfo().targetSdkVersion < 14; } public int getEmbeddedMenuWidthLimit() { return this.mContext.getResources().getDisplayMetrics().widthPixels / 2; } public int getMaxActionButtons() { Configuration configuration = this.mContext.getResources().getConfiguration(); int i = configuration.screenWidthDp; int i2 = configuration.screenHeightDp; if (configuration.smallestScreenWidthDp > 600 || i > 600) { return 5; } if (i > 960 && i2 > 720) { return 5; } if (i > 720 && i2 > 960) { return 5; } if (i >= 500) { return 4; } if (i > 640 && i2 > 480) { return 4; } if (i <= 480 || i2 <= 640) { return i >= 360 ? 3 : 2; } return 4; } public int getStackedTabMaxWidth() { return this.mContext.getResources().getDimensionPixelSize(R.dimen.abc_action_bar_stacked_tab_max_width); } public int getTabContainerHeight() { TypedArray obtainStyledAttributes = this.mContext.obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0); int layoutDimension = obtainStyledAttributes.getLayoutDimension(R.styleable.ActionBar_height, 0); Resources resources = this.mContext.getResources(); if (!hasEmbeddedTabs()) { layoutDimension = Math.min(layoutDimension, resources.getDimensionPixelSize(R.dimen.abc_action_bar_stacked_max_height)); } obtainStyledAttributes.recycle(); return layoutDimension; } public boolean hasEmbeddedTabs() { return this.mContext.getResources().getBoolean(R.bool.abc_action_bar_embed_tabs); } public boolean showsOverflowMenuButton() { return true; } }