diff --git a/app/src/main/java/com/simplemobiletools/gallery/Utils.java b/app/src/main/java/com/simplemobiletools/gallery/Utils.java index 56bc50e20..20cec3c1b 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/Utils.java +++ b/app/src/main/java/com/simplemobiletools/gallery/Utils.java @@ -1,13 +1,20 @@ package com.simplemobiletools.gallery; import android.Manifest; +import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; import android.content.res.Resources; +import android.os.Build; import android.support.v4.content.ContextCompat; import android.support.v7.app.ActionBar; +import android.util.DisplayMetrics; import android.util.TypedValue; +import android.view.Display; +import android.view.KeyCharacterMap; +import android.view.KeyEvent; import android.view.View; +import android.view.ViewConfiguration; import android.view.Window; import android.webkit.MimeTypeMap; import android.widget.Toast; @@ -46,9 +53,28 @@ public class Utils { return 0; } - public static boolean hasNavBar(Resources res) { - int id = res.getIdentifier("config_showNavigationBar", "bool", "android"); - return id > 0 && res.getBoolean(id); + public static boolean hasNavBar(Activity act) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + Display display = act.getWindowManager().getDefaultDisplay(); + + DisplayMetrics realDisplayMetrics = new DisplayMetrics(); + display.getRealMetrics(realDisplayMetrics); + + int realHeight = realDisplayMetrics.heightPixels; + int realWidth = realDisplayMetrics.widthPixels; + + DisplayMetrics displayMetrics = new DisplayMetrics(); + display.getMetrics(displayMetrics); + + int displayHeight = displayMetrics.heightPixels; + int displayWidth = displayMetrics.widthPixels; + + return (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0; + } else { + boolean hasMenuKey = ViewConfiguration.get(act).hasPermanentMenuKey(); + boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK); + return !hasMenuKey && !hasBackKey; + } } public static boolean hasStoragePermission(Context cxt) { diff --git a/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java b/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java index 82c86fc32..57e24cddc 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java +++ b/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java @@ -103,15 +103,16 @@ public class VideoFragment extends ViewPagerFragment final int height = Utils.getNavBarHeight(res); final int left = mTimeHolder.getPaddingLeft(); final int top = mTimeHolder.getPaddingTop(); - final int right = mTimeHolder.getPaddingRight(); - final int bottom = mTimeHolder.getPaddingBottom(); + int right = mTimeHolder.getPaddingRight(); + int bottom = mTimeHolder.getPaddingBottom(); - if (Utils.hasNavBar(res)) { + if (Utils.hasNavBar(getActivity())) { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { - mTimeHolder.setPadding(left, top, right, bottom + height); + bottom += height; } else { - mTimeHolder.setPadding(left, top, right + height, bottom); + right += height; } + mTimeHolder.setPadding(left, top, right, bottom); } mCurrTimeView = (TextView) view.findViewById(R.id.video_curr_time); diff --git a/app/src/main/res/layout/activity_medium.xml b/app/src/main/res/layout/activity_medium.xml index ff8eb2e52..d3240bdd9 100644 --- a/app/src/main/res/layout/activity_medium.xml +++ b/app/src/main/res/layout/activity_medium.xml @@ -13,8 +13,8 @@ + 200dp + 150dp + 60dp + 240dp + 16dp + 32dp + 12dp + 50dp + 60dp + 64dp + + 18sp + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 498fbc15c..6e3e99650 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -8,4 +8,8 @@ 24dp 8dp 40dp + 50dp + 56dp + + 14sp diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 14401f3be..268af1d35 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -5,6 +5,7 @@ @color/colorPrimaryDark @color/colorAccent @style/AppTheme.ActionBarStyle + @dimen/normal_text_size