add a menu button for disabling Temporarily show hidden

This commit is contained in:
tibbi 2017-07-01 10:04:47 +02:00
parent 0b7a5a30f3
commit 61fb25332d
6 changed files with 27 additions and 9 deletions

View file

@ -32,7 +32,7 @@ android {
} }
dependencies { dependencies {
compile 'com.simplemobiletools:commons:2.22.0' compile 'com.simplemobiletools:commons:2.22.1'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'

View file

@ -87,7 +87,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
menu.findItem(R.id.increase_column_count).isVisible = config.dirColumnCnt < 10 menu.findItem(R.id.increase_column_count).isVisible = config.dirColumnCnt < 10
menu.findItem(R.id.reduce_column_count).isVisible = config.dirColumnCnt > 1 menu.findItem(R.id.reduce_column_count).isVisible = config.dirColumnCnt > 1
} }
menu.findItem(R.id.temporarily_show_hidden).isVisible = !config.showHiddenMedia menu.findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
menu.findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden
return true return true
} }
@ -96,7 +97,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
R.id.sort -> showSortingDialog() R.id.sort -> showSortingDialog()
R.id.open_camera -> launchCamera() R.id.open_camera -> launchCamera()
R.id.show_all -> showAllMedia() R.id.show_all -> showAllMedia()
R.id.temporarily_show_hidden -> temporarilyShowHidden() R.id.temporarily_show_hidden -> toggleTemporarilyShowHidden(true)
R.id.stop_showing_hidden -> toggleTemporarilyShowHidden(false)
R.id.increase_column_count -> increaseColumnCount() R.id.increase_column_count -> increaseColumnCount()
R.id.reduce_column_count -> reduceColumnCount() R.id.reduce_column_count -> reduceColumnCount()
R.id.settings -> launchSettings() R.id.settings -> launchSettings()
@ -208,9 +210,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
finish() finish()
} }
private fun temporarilyShowHidden() { private fun toggleTemporarilyShowHidden(show: Boolean) {
config.temporarilyShowHidden = true config.temporarilyShowHidden = show
getDirectories() getDirectories()
invalidateOptionsMenu()
} }
private fun checkIfColorChanged() { private fun checkIfColorChanged() {

View file

@ -197,7 +197,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
findItem(R.id.open_camera).isVisible = mShowAll findItem(R.id.open_camera).isVisible = mShowAll
findItem(R.id.about).isVisible = mShowAll findItem(R.id.about).isVisible = mShowAll
findItem(R.id.temporarily_show_hidden).isVisible = !config.showHiddenMedia findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden
findItem(R.id.increase_column_count).isVisible = config.mediaColumnCnt < 10 findItem(R.id.increase_column_count).isVisible = config.mediaColumnCnt < 10
findItem(R.id.reduce_column_count).isVisible = config.mediaColumnCnt > 1 findItem(R.id.reduce_column_count).isVisible = config.mediaColumnCnt > 1
@ -215,7 +216,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
R.id.hide_folder -> tryHideFolder() R.id.hide_folder -> tryHideFolder()
R.id.unhide_folder -> unhideFolder() R.id.unhide_folder -> unhideFolder()
R.id.exclude_folder -> tryExcludeFolder() R.id.exclude_folder -> tryExcludeFolder()
R.id.temporarily_show_hidden -> temporarilyShowHidden() R.id.temporarily_show_hidden -> toggleTemporarilyShowHidden(true)
R.id.stop_showing_hidden -> toggleTemporarilyShowHidden(false)
R.id.increase_column_count -> increaseColumnCount() R.id.increase_column_count -> increaseColumnCount()
R.id.reduce_column_count -> reduceColumnCount() R.id.reduce_column_count -> reduceColumnCount()
R.id.settings -> launchSettings() R.id.settings -> launchSettings()
@ -314,9 +316,10 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
false false
} }
private fun temporarilyShowHidden() { private fun toggleTemporarilyShowHidden(show: Boolean) {
config.temporarilyShowHidden = true config.temporarilyShowHidden = show
getMedia() getMedia()
invalidateOptionsMenu()
} }
private fun getRecyclerAdapter() = (media_grid.adapter as MediaAdapter) private fun getRecyclerAdapter() = (media_grid.adapter as MediaAdapter)

View file

@ -19,6 +19,10 @@
android:id="@+id/temporarily_show_hidden" android:id="@+id/temporarily_show_hidden"
android:title="@string/temporarily_show_hidden" android:title="@string/temporarily_show_hidden"
app:showAsAction="never"/> app:showAsAction="never"/>
<item
android:id="@+id/stop_showing_hidden"
android:title="@string/stop_showing_hidden"
app:showAsAction="never"/>
<item <item
android:id="@+id/increase_column_count" android:id="@+id/increase_column_count"
android:title="@string/increase_column_count" android:title="@string/increase_column_count"

View file

@ -5,4 +5,8 @@
android:id="@+id/temporarily_show_hidden" android:id="@+id/temporarily_show_hidden"
android:title="@string/temporarily_show_hidden" android:title="@string/temporarily_show_hidden"
app:showAsAction="never"/> app:showAsAction="never"/>
<item
android:id="@+id/stop_showing_hidden"
android:title="@string/stop_showing_hidden"
app:showAsAction="never"/>
</menu> </menu>

View file

@ -36,6 +36,10 @@
android:id="@+id/temporarily_show_hidden" android:id="@+id/temporarily_show_hidden"
android:title="@string/temporarily_show_hidden" android:title="@string/temporarily_show_hidden"
app:showAsAction="never"/> app:showAsAction="never"/>
<item
android:id="@+id/stop_showing_hidden"
android:title="@string/stop_showing_hidden"
app:showAsAction="never"/>
<item <item
android:id="@+id/increase_column_count" android:id="@+id/increase_column_count"
android:title="@string/increase_column_count" android:title="@string/increase_column_count"