diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index 9ae24e5d8..55ad0345c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -52,7 +52,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList override fun onResume() { super.onResume() - supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background)) + supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.gradient_background_flipped)) if (config.blackBackground) { updateStatusbarColor(Color.BLACK) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 644db9dde..582cc0789 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -82,6 +82,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_medium) + + top_shadow.layoutParams.height = getStatusBarHeight() + getActionBarHeight() + if (isOreoPlus()) { + window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) + } + (MediaActivity.mMedia.clone() as ArrayList).filter { it is Medium }.mapTo(mMediaFiles) { it as Medium } handlePermission(PERMISSION_WRITE_STORAGE) { @@ -113,7 +120,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } initBottomActions() - supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background)) if (config.maxBrightness) { val attributes = window.attributes @@ -127,6 +133,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (config.blackBackground) { updateStatusbarColor(Color.BLACK) } + + supportActionBar?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + if (isLollipopPlus()) { + window.statusBarColor = Color.TRANSPARENT + } } override fun onPause() { @@ -247,7 +258,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View (it as MyPagerAdapter).toggleFullscreen(mIsFullScreen) checkSystemUI() if (!bottom_actions.isGone()) { - bottom_actions.animate().alpha(if (mIsFullScreen) 0f else 1f).start() + val newAlpha = if (mIsFullScreen) 0f else 1f + bottom_actions.animate().alpha(newAlpha).start() + top_shadow.animate().alpha(newAlpha).start() arrayOf(bottom_favorite, bottom_edit, bottom_share, bottom_delete, bottom_rotate, bottom_properties, bottom_change_orientation, bottom_slideshow, bottom_show_on_map, bottom_toggle_file_visibility, bottom_rename).forEach { it.isClickable = !mIsFullScreen diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt index 380aaa184..639cefbf1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt @@ -278,3 +278,19 @@ fun BaseSimpleActivity.showRecycleBinEmptyingDialog(callback: () -> Unit) { callback() } } + +fun BaseSimpleActivity.getStatusBarHeight(): Int { + var statusBarHeight = 0 + val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android") + if (resourceId > 0) { + statusBarHeight = resources.getDimensionPixelSize(resourceId) + } + return statusBarHeight +} + +fun BaseSimpleActivity.getActionBarHeight(): Int { + val styledAttributes = theme.obtainStyledAttributes(intArrayOf(android.R.attr.actionBarSize)) + val actionBarHeight = styledAttributes.getDimension(0, 0f) + styledAttributes.recycle() + return actionBarHeight.toInt() +} diff --git a/app/src/main/res/drawable/actionbar_gradient_background.xml b/app/src/main/res/drawable/gradient_background_flipped.xml similarity index 100% rename from app/src/main/res/drawable/actionbar_gradient_background.xml rename to app/src/main/res/drawable/gradient_background_flipped.xml diff --git a/app/src/main/res/drawable/gradient_background_lighter.xml b/app/src/main/res/drawable/gradient_background_lighter.xml deleted file mode 100644 index ba3477dc5..000000000 --- a/app/src/main/res/drawable/gradient_background_lighter.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/app/src/main/res/layout/activity_edit.xml b/app/src/main/res/layout/activity_edit.xml index 7e0465221..b6db534a7 100644 --- a/app/src/main/res/layout/activity_edit.xml +++ b/app/src/main/res/layout/activity_edit.xml @@ -28,7 +28,7 @@ android:layout_width="match_parent" android:layout_height="@dimen/bottom_editor_actions_shadow_height" android:layout_alignParentBottom="true" - android:background="@drawable/gradient_background_lighter"/> + android:background="@drawable/gradient_background"/> + + diff --git a/app/src/main/res/layout/bottom_actions.xml b/app/src/main/res/layout/bottom_actions.xml index c3329af25..0944d58ae 100644 --- a/app/src/main/res/layout/bottom_actions.xml +++ b/app/src/main/res/layout/bottom_actions.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="@dimen/bottom_actions_height" android:layout_alignParentBottom="true" - android:background="@drawable/gradient_background_lighter" + android:background="@drawable/gradient_background" android:paddingTop="@dimen/medium_margin"> + android:background="@drawable/gradient_background"> 76dp 90dp 180dp + 86dp