Rabbit-R1/original r1/java/sources/androidx/appcompat/view/ActionBarPolicy.java
2024-05-21 17:08:36 -04:00

76 lines
2.4 KiB
Java

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