adding Notch support + some actionbar/statusbar updates
This commit is contained in:
parent
b3f1475436
commit
9319633c85
10 changed files with 42 additions and 13 deletions
|
@ -52,7 +52,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background))
|
supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.gradient_background_flipped))
|
||||||
if (config.blackBackground) {
|
if (config.blackBackground) {
|
||||||
updateStatusbarColor(Color.BLACK)
|
updateStatusbarColor(Color.BLACK)
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_medium)
|
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<ThumbnailItem>).filter { it is Medium }.mapTo(mMediaFiles) { it as Medium }
|
(MediaActivity.mMedia.clone() as ArrayList<ThumbnailItem>).filter { it is Medium }.mapTo(mMediaFiles) { it as Medium }
|
||||||
|
|
||||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||||
|
@ -113,7 +120,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
}
|
}
|
||||||
|
|
||||||
initBottomActions()
|
initBottomActions()
|
||||||
supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background))
|
|
||||||
|
|
||||||
if (config.maxBrightness) {
|
if (config.maxBrightness) {
|
||||||
val attributes = window.attributes
|
val attributes = window.attributes
|
||||||
|
@ -127,6 +133,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
if (config.blackBackground) {
|
if (config.blackBackground) {
|
||||||
updateStatusbarColor(Color.BLACK)
|
updateStatusbarColor(Color.BLACK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
supportActionBar?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
|
if (isLollipopPlus()) {
|
||||||
|
window.statusBarColor = Color.TRANSPARENT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
@ -247,7 +258,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
(it as MyPagerAdapter).toggleFullscreen(mIsFullScreen)
|
(it as MyPagerAdapter).toggleFullscreen(mIsFullScreen)
|
||||||
checkSystemUI()
|
checkSystemUI()
|
||||||
if (!bottom_actions.isGone()) {
|
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,
|
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 {
|
bottom_slideshow, bottom_show_on_map, bottom_toggle_file_visibility, bottom_rename).forEach {
|
||||||
it.isClickable = !mIsFullScreen
|
it.isClickable = !mIsFullScreen
|
||||||
|
|
|
@ -278,3 +278,19 @@ fun BaseSimpleActivity.showRecycleBinEmptyingDialog(callback: () -> Unit) {
|
||||||
callback()
|
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()
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<gradient
|
|
||||||
android:angle="90"
|
|
||||||
android:endColor="@android:color/transparent"
|
|
||||||
android:startColor="@color/circle_black_background"/>
|
|
||||||
</shape>
|
|
|
@ -28,7 +28,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/bottom_editor_actions_shadow_height"
|
android:layout_height="@dimen/bottom_editor_actions_shadow_height"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:background="@drawable/gradient_background_lighter"/>
|
android:background="@drawable/gradient_background"/>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/bottom_aspect_ratios"
|
android:id="@+id/bottom_aspect_ratios"
|
||||||
|
|
|
@ -14,4 +14,10 @@
|
||||||
android:id="@+id/bottom_actions"
|
android:id="@+id/bottom_actions"
|
||||||
layout="@layout/bottom_actions"/>
|
layout="@layout/bottom_actions"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/top_shadow"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/default_status_action_height"
|
||||||
|
android:background="@drawable/gradient_background_flipped"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/bottom_actions_height"
|
android:layout_height="@dimen/bottom_actions_height"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:background="@drawable/gradient_background_lighter"
|
android:background="@drawable/gradient_background"
|
||||||
android:paddingTop="@dimen/medium_margin">
|
android:paddingTop="@dimen/medium_margin">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/bottom_actions_height"
|
android:layout_height="@dimen/bottom_actions_height"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:background="@drawable/gradient_background_lighter">
|
android:background="@drawable/gradient_background">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/bottom_set_wallpaper_aspect_ratio"
|
android:id="@+id/bottom_set_wallpaper_aspect_ratio"
|
||||||
|
|
|
@ -14,4 +14,5 @@
|
||||||
<dimen name="bottom_filters_thumbnail_size">76dp</dimen>
|
<dimen name="bottom_filters_thumbnail_size">76dp</dimen>
|
||||||
<dimen name="bottom_filters_height">90dp</dimen>
|
<dimen name="bottom_filters_height">90dp</dimen>
|
||||||
<dimen name="bottom_editor_actions_shadow_height">180dp</dimen>
|
<dimen name="bottom_editor_actions_shadow_height">180dp</dimen>
|
||||||
|
<dimen name="default_status_action_height">86dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue