fix #1576, properly handle fullscreen toggling on Chromebooks
This commit is contained in:
parent
94d34904d5
commit
50e39315a5
2 changed files with 22 additions and 13 deletions
|
@ -323,19 +323,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
|
||||
}
|
||||
|
||||
view_pager.adapter?.let {
|
||||
(it as MyPagerAdapter).toggleFullscreen(mIsFullScreen)
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
checkSystemUI()
|
||||
fullscreenToggled()
|
||||
}
|
||||
|
||||
if (intent.action == "com.android.camera.action.REVIEW") {
|
||||
|
@ -1082,6 +1071,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
override fun fragmentClicked() {
|
||||
mIsFullScreen = !mIsFullScreen
|
||||
checkSystemUI()
|
||||
if (isChromebook()) {
|
||||
fullscreenToggled()
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
runOnUiThread {
|
||||
if (mPos < getCurrentMedia().size) {
|
||||
|
|
|
@ -876,3 +876,5 @@ fun Context.getFileDateTaken(path: String): Long {
|
|||
|
||||
return 0L
|
||||
}
|
||||
|
||||
fun Context.isChromebook() = packageManager.hasSystemFeature("org.chromium.arc.device_management")
|
||||
|
|
Loading…
Reference in a new issue