mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
moving some Menu related functions, no code change
This commit is contained in:
parent
539d6ee16d
commit
6a94ac11bc
1 changed files with 32 additions and 32 deletions
|
@ -93,38 +93,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
mIsPasswordProtectionPending = config.appPasswordProtectionOn
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
if (mIsThirdPartyIntent) {
|
||||
menuInflater.inflate(R.menu.menu_main_intent, menu)
|
||||
} else {
|
||||
menuInflater.inflate(R.menu.menu_main, menu)
|
||||
menu.findItem(R.id.increase_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt < MAX_COLUMN_COUNT
|
||||
menu.findItem(R.id.reduce_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt > 1
|
||||
}
|
||||
menu.findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
|
||||
menu.findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.sort -> showSortingDialog()
|
||||
R.id.filter -> showFilterMediaDialog()
|
||||
R.id.open_camera -> launchCamera()
|
||||
R.id.show_all -> showAllMedia()
|
||||
R.id.change_view_type -> changeViewType()
|
||||
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
|
||||
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
|
||||
R.id.create_new_folder -> createNewFolder()
|
||||
R.id.increase_column_count -> increaseColumnCount()
|
||||
R.id.reduce_column_count -> reduceColumnCount()
|
||||
R.id.settings -> launchSettings()
|
||||
R.id.about -> launchAbout()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
config.isThirdPartyIntent = false
|
||||
|
@ -191,6 +159,38 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
removeTempFolder()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
if (mIsThirdPartyIntent) {
|
||||
menuInflater.inflate(R.menu.menu_main_intent, menu)
|
||||
} else {
|
||||
menuInflater.inflate(R.menu.menu_main, menu)
|
||||
menu.findItem(R.id.increase_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt < MAX_COLUMN_COUNT
|
||||
menu.findItem(R.id.reduce_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt > 1
|
||||
}
|
||||
menu.findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
|
||||
menu.findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.sort -> showSortingDialog()
|
||||
R.id.filter -> showFilterMediaDialog()
|
||||
R.id.open_camera -> launchCamera()
|
||||
R.id.show_all -> showAllMedia()
|
||||
R.id.change_view_type -> changeViewType()
|
||||
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
|
||||
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
|
||||
R.id.create_new_folder -> createNewFolder()
|
||||
R.id.increase_column_count -> increaseColumnCount()
|
||||
R.id.reduce_column_count -> reduceColumnCount()
|
||||
R.id.settings -> launchSettings()
|
||||
R.id.about -> launchAbout()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private fun getDirectoryAdapter() = directories_grid.adapter as? DirectoryAdapter
|
||||
|
||||
private fun storeStateVariables() {
|
||||
|
|
Loading…
Reference in a new issue