fix #1576, properly handle fullscreen toggling on Chromebooks

This commit is contained in:
tibbi 2019-09-07 22:53:07 +02:00
parent 94d34904d5
commit 50e39315a5
2 changed files with 22 additions and 13 deletions

View file

@ -323,19 +323,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0 visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
} }
view_pager.adapter?.let { checkSystemUI()
(it as MyPagerAdapter).toggleFullscreen(mIsFullScreen) fullscreenToggled()
checkSystemUI()
val newAlpha = if (mIsFullScreen) 0f else 1f
top_shadow.animate().alpha(newAlpha).start()
if (bottom_actions.isVisible()) {
bottom_actions.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
}
}
}
} }
if (intent.action == "com.android.camera.action.REVIEW") { if (intent.action == "com.android.camera.action.REVIEW") {
@ -1082,6 +1071,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
override fun fragmentClicked() { override fun fragmentClicked() {
mIsFullScreen = !mIsFullScreen mIsFullScreen = !mIsFullScreen
checkSystemUI() checkSystemUI()
if (isChromebook()) {
fullscreenToggled()
}
} }
override fun videoEnded(): Boolean { override fun videoEnded(): Boolean {
@ -1138,6 +1130,21 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
} }
private fun fullscreenToggled() {
view_pager.adapter?.let {
(it as MyPagerAdapter).toggleFullscreen(mIsFullScreen)
val newAlpha = if (mIsFullScreen) 0f else 1f
top_shadow.animate().alpha(newAlpha).start()
if (bottom_actions.isVisible()) {
bottom_actions.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
}
}
}
}
private fun updateActionbarTitle() { private fun updateActionbarTitle() {
runOnUiThread { runOnUiThread {
if (mPos < getCurrentMedia().size) { if (mPos < getCurrentMedia().size) {

View file

@ -876,3 +876,5 @@ fun Context.getFileDateTaken(path: String): Long {
return 0L return 0L
} }
fun Context.isChromebook() = packageManager.hasSystemFeature("org.chromium.arc.device_management")