move the UI toggle functions out of extensions, as they arent
This commit is contained in:
parent
35fb696d30
commit
733d8e58d9
4 changed files with 22 additions and 33 deletions
|
@ -42,7 +42,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentClic
|
|||
mFragment.arguments = bundle
|
||||
supportFragmentManager.beginTransaction().replace(R.id.fragment_holder, mFragment).commit()
|
||||
}
|
||||
hideUI()
|
||||
hideSystemUI()
|
||||
|
||||
if (mUri.scheme == "content") {
|
||||
val proj = arrayOf(MediaStore.Images.Media.TITLE)
|
||||
|
@ -91,9 +91,9 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentClic
|
|||
override fun fragmentClicked() {
|
||||
mIsFullScreen = !mIsFullScreen
|
||||
if (mIsFullScreen) {
|
||||
hideUI()
|
||||
hideSystemUI()
|
||||
} else {
|
||||
showUI()
|
||||
showSystemUI()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,12 +7,11 @@ import android.os.Build
|
|||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import com.simplemobiletools.filepicker.extensions.isShowingWritePermissions
|
||||
import com.simplemobiletools.gallery.Config
|
||||
import com.simplemobiletools.gallery.OPEN_DOCUMENT_TREE
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.extensions.hideSystemUI
|
||||
import com.simplemobiletools.gallery.extensions.showSystemUI
|
||||
import java.io.File
|
||||
|
||||
open class SimpleActivity : AppCompatActivity() {
|
||||
|
@ -56,7 +55,20 @@ open class SimpleActivity : AppCompatActivity() {
|
|||
|
||||
fun isShowingPermDialog(file: File) = isShowingWritePermissions(file, mConfig.treeUri, OPEN_DOCUMENT_TREE)
|
||||
|
||||
fun hideUI() = hideSystemUI(supportActionBar, window)
|
||||
fun showSystemUI() {
|
||||
supportActionBar?.show()
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
}
|
||||
|
||||
fun showUI() = showSystemUI(supportActionBar, window)
|
||||
fun hideSystemUI() {
|
||||
supportActionBar?.hide()
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
|
||||
View.SYSTEM_UI_FLAG_LOW_PROFILE or
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN or
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
mIsFullScreen = true
|
||||
mToBeDeleted = ""
|
||||
mBeingDeleted = ""
|
||||
hideUI()
|
||||
hideSystemUI()
|
||||
|
||||
scanPath(mPath) {}
|
||||
addUndoMargin()
|
||||
|
@ -401,9 +401,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
deleteFile()
|
||||
mIsFullScreen = !mIsFullScreen
|
||||
if (mIsFullScreen) {
|
||||
hideUI()
|
||||
hideSystemUI()
|
||||
} else {
|
||||
showUI()
|
||||
showSystemUI()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package com.simplemobiletools.gallery.extensions
|
||||
|
||||
import android.app.Activity
|
||||
import android.support.v7.app.ActionBar
|
||||
import android.view.View
|
||||
import android.view.Window
|
||||
|
||||
fun Activity.showSystemUI(actionbar: ActionBar?, window: Window) {
|
||||
actionbar?.show()
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
}
|
||||
|
||||
fun Activity.hideSystemUI(actionbar: ActionBar?, window: Window) {
|
||||
actionbar?.hide()
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
|
||||
View.SYSTEM_UI_FLAG_LOW_PROFILE or
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN or
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE
|
||||
}
|
Loading…
Reference in a new issue