disable "Temporarily show hidden" after 10 minutes of app backgrounding
This commit is contained in:
parent
c3a7068806
commit
7c7b7d254d
3 changed files with 49 additions and 12 deletions
|
@ -52,6 +52,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
private var mAllowPickingMultiple = false
|
||||
private var mIsThirdPartyIntent = false
|
||||
private var mIsGettingDirs = false
|
||||
private var mLoadedInitialPhotos = false
|
||||
private var mIsPasswordProtectionPending = false
|
||||
private var mLatestMediaId = 0L
|
||||
private var mLastMediaHandler = Handler()
|
||||
private var mTempShowHiddenHandler = Handler()
|
||||
private var mCurrAsyncTask: GetDirectoriesAsynctask? = null
|
||||
private var mZoomListener: MyRecyclerView.MyZoomListener? = null
|
||||
|
||||
private var mStoredUseEnglish = false
|
||||
private var mStoredAnimateGifs = true
|
||||
private var mStoredCropThumbnails = true
|
||||
|
@ -59,12 +67,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
private var mStoredShowMediaCount = true
|
||||
private var mStoredShowInfoBubble = true
|
||||
private var mStoredTextColor = 0
|
||||
private var mLoadedInitialPhotos = false
|
||||
private var mIsPasswordProtectionPending = false
|
||||
private var mLatestMediaId = 0L
|
||||
private var mLastMediaHandler = Handler()
|
||||
private var mCurrAsyncTask: GetDirectoriesAsynctask? = null
|
||||
private var mZoomListener: MyRecyclerView.MyZoomListener? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -94,6 +96,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
mIsPasswordProtectionPending = config.appPasswordProtectionOn
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
mTempShowHiddenHandler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
config.isThirdPartyIntent = false
|
||||
|
@ -156,9 +163,21 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
if (config.temporarilyShowHidden) {
|
||||
mTempShowHiddenHandler.postDelayed({
|
||||
config.temporarilyShowHidden = false
|
||||
}, SHOW_TEMP_HIDDEN_DURATION)
|
||||
} else {
|
||||
mTempShowHiddenHandler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
config.temporarilyShowHidden = false
|
||||
mTempShowHiddenHandler.removeCallbacksAndMessages(null)
|
||||
removeTempFolder()
|
||||
}
|
||||
|
||||
|
|
|
@ -53,17 +53,19 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
private var mAllowPickingMultiple = false
|
||||
private var mShowAll = false
|
||||
private var mLoadedInitialPhotos = false
|
||||
private var mLatestMediaId = 0L
|
||||
private var mLastMediaHandler = Handler()
|
||||
private var mTempShowHiddenHandler = Handler()
|
||||
private var mCurrAsyncTask: GetMediaAsynctask? = null
|
||||
private var mZoomListener: MyRecyclerView.MyZoomListener? = null
|
||||
private var mSearchMenuItem: MenuItem? = null
|
||||
|
||||
private var mStoredUseEnglish = false
|
||||
private var mStoredAnimateGifs = true
|
||||
private var mStoredCropThumbnails = true
|
||||
private var mStoredScrollHorizontally = true
|
||||
private var mStoredShowInfoBubble = true
|
||||
private var mStoredTextColor = 0
|
||||
private var mLatestMediaId = 0L
|
||||
private var mLastMediaHandler = Handler()
|
||||
private var mCurrAsyncTask: GetMediaAsynctask? = null
|
||||
private var mZoomListener: MyRecyclerView.MyZoomListener? = null
|
||||
private var mSearchMenuItem: MenuItem? = null
|
||||
|
||||
companion object {
|
||||
var mMedia = ArrayList<Medium>()
|
||||
|
@ -90,6 +92,11 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
mTempShowHiddenHandler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (mStoredUseEnglish != config.useEnglish) {
|
||||
|
@ -139,13 +146,23 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
if (mSearchMenuItem != null) {
|
||||
MenuItemCompat.collapseActionView(mSearchMenuItem)
|
||||
}
|
||||
|
||||
if (config.temporarilyShowHidden) {
|
||||
mTempShowHiddenHandler.postDelayed({
|
||||
config.temporarilyShowHidden = false
|
||||
}, SHOW_TEMP_HIDDEN_DURATION)
|
||||
} else {
|
||||
mTempShowHiddenHandler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (config.showAll)
|
||||
if (config.showAll) {
|
||||
config.temporarilyShowHidden = false
|
||||
}
|
||||
|
||||
mTempShowHiddenHandler.removeCallbacksAndMessages(null)
|
||||
mMedia.clear()
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ const val SLIDESHOW_SCROLL_DURATION = 500L
|
|||
|
||||
const val NOMEDIA = ".nomedia"
|
||||
const val MAX_COLUMN_COUNT = 20
|
||||
const val SHOW_TEMP_HIDDEN_DURATION = 600000L
|
||||
|
||||
const val DIRECTORY = "directory"
|
||||
const val MEDIUM = "medium"
|
||||
|
|
Loading…
Reference in a new issue