Initial commit
This commit is contained in:
84
sources/androidx/appcompat/view/ActionBarPolicy.java
Normal file
84
sources/androidx/appcompat/view/ActionBarPolicy.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package androidx.appcompat.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import android.view.ViewConfiguration;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.R$bool;
|
||||
import androidx.appcompat.R$dimen;
|
||||
import androidx.appcompat.R$styleable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarPolicy {
|
||||
private Context a;
|
||||
|
||||
private ActionBarPolicy(Context context) {
|
||||
this.a = context;
|
||||
}
|
||||
|
||||
public static ActionBarPolicy a(Context context) {
|
||||
return new ActionBarPolicy(context);
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return this.a.getResources().getDisplayMetrics().widthPixels / 2;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
Configuration configuration = this.a.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 d() {
|
||||
return this.a.getResources().getDimensionPixelSize(R$dimen.abc_action_bar_stacked_tab_max_width);
|
||||
}
|
||||
|
||||
public int e() {
|
||||
TypedArray obtainStyledAttributes = this.a.obtainStyledAttributes(null, R$styleable.ActionBar, R$attr.actionBarStyle, 0);
|
||||
int layoutDimension = obtainStyledAttributes.getLayoutDimension(R$styleable.ActionBar_height, 0);
|
||||
Resources resources = this.a.getResources();
|
||||
if (!f()) {
|
||||
layoutDimension = Math.min(layoutDimension, resources.getDimensionPixelSize(R$dimen.abc_action_bar_stacked_max_height));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
return layoutDimension;
|
||||
}
|
||||
|
||||
public boolean f() {
|
||||
return this.a.getResources().getBoolean(R$bool.abc_action_bar_embed_tabs);
|
||||
}
|
||||
|
||||
public boolean g() {
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
return true;
|
||||
}
|
||||
return !ViewConfiguration.get(this.a).hasPermanentMenuKey();
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return this.a.getApplicationInfo().targetSdkVersion < 14;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user