Refactoring

This commit is contained in:
M66B
2021-12-30 15:33:09 +01:00
parent ca71550be7
commit dcdf09f841
2 changed files with 13 additions and 8 deletions

View File

@@ -62,6 +62,7 @@ import android.text.Spannable;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.Time;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -612,6 +613,17 @@ public class Helper {
// View
static int getActionBarHeight(Context context) {
int actionBarHeight;
TypedValue tv = new TypedValue();
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
DisplayMetrics dm = context.getResources().getDisplayMetrics();
return TypedValue.complexToDimensionPixelSize(tv.data, dm);
}
else
return Helper.dp2pixels(context, 56);
}
static Intent getChooser(Context context, Intent intent) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
PackageManager pm = context.getPackageManager();