From ebcc328d2ec5327b3b4d94259d9b095eba4abce0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 16 Jun 2016 16:14:02 +0200 Subject: [PATCH] add extra bottom padding to time holder only if the device has software nav bar --- .../main/java/com/simplemobiletools/gallery/Utils.java | 5 +++++ .../gallery/fragments/VideoFragment.java | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/simplemobiletools/gallery/Utils.java b/app/src/main/java/com/simplemobiletools/gallery/Utils.java index ddf73bb3e..2310ed368 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/Utils.java +++ b/app/src/main/java/com/simplemobiletools/gallery/Utils.java @@ -28,6 +28,11 @@ 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 hasStoragePermission(Context cxt) { return ContextCompat.checkSelfPermission(cxt, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; } 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 3c52d3765..a60f5f782 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java +++ b/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java @@ -105,10 +105,12 @@ public class VideoFragment extends ViewPagerFragment final int right = timeHolder.getPaddingRight(); final int bottom = timeHolder.getPaddingBottom(); - if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { - timeHolder.setPadding(left, top, right, bottom + height); - } else { - timeHolder.setPadding(left, top, right + height, bottom); + if (Utils.hasNavBar(res)) { + if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { + timeHolder.setPadding(left, top, right, bottom + height); + } else { + timeHolder.setPadding(left, top, right + height, bottom); + } } currTimeView = (TextView) view.findViewById(R.id.video_curr_time);