mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
add a dialog for selecting folder thumbnail grouping
This commit is contained in:
parent
a374f40e92
commit
05d37cbfcc
4 changed files with 38 additions and 0 deletions
|
@ -217,6 +217,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
R.id.open_camera -> launchCamera()
|
R.id.open_camera -> launchCamera()
|
||||||
R.id.folder_view -> switchToFolderView()
|
R.id.folder_view -> switchToFolderView()
|
||||||
R.id.change_view_type -> changeViewType()
|
R.id.change_view_type -> changeViewType()
|
||||||
|
R.id.group -> showGroupByDialog()
|
||||||
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()
|
||||||
|
@ -416,6 +417,27 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showGroupByDialog() {
|
||||||
|
val items = arrayListOf(
|
||||||
|
RadioItem(GROUP_BY_NONE, getString(R.string.do_not_group_files)),
|
||||||
|
RadioItem(GROUP_BY_LAST_MODIFIED, getString(R.string.by_last_modified)),
|
||||||
|
RadioItem(GROUP_BY_DATE_TAKEN, getString(R.string.by_date_taken)),
|
||||||
|
RadioItem(GROUP_BY_FILE_TYPE, getString(R.string.by_file_type)),
|
||||||
|
RadioItem(GROUP_BY_EXTENSION, getString(R.string.by_extension))
|
||||||
|
)
|
||||||
|
|
||||||
|
if (mShowAll) {
|
||||||
|
items.add(RadioItem(GROUP_BY_FOLDER, getString(R.string.by_folder)))
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioGroupDialog(this, items, config.groupBy) {
|
||||||
|
config.groupBy = it as Int
|
||||||
|
invalidateOptionsMenu()
|
||||||
|
media_grid.adapter = null
|
||||||
|
setupAdapter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun tryHideFolder() {
|
private fun tryHideFolder() {
|
||||||
if (config.wasHideFolderTooltipShown) {
|
if (config.wasHideFolderTooltipShown) {
|
||||||
hideFolder()
|
hideFolder()
|
||||||
|
|
|
@ -326,4 +326,8 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
var wereFavoritesPinned: Boolean
|
var wereFavoritesPinned: Boolean
|
||||||
get() = prefs.getBoolean(WERE_FAVORITES_PINNED, false)
|
get() = prefs.getBoolean(WERE_FAVORITES_PINNED, false)
|
||||||
set(wereFavoritesPinned) = prefs.edit().putBoolean(WERE_FAVORITES_PINNED, wereFavoritesPinned).apply()
|
set(wereFavoritesPinned) = prefs.edit().putBoolean(WERE_FAVORITES_PINNED, wereFavoritesPinned).apply()
|
||||||
|
|
||||||
|
var groupBy: Int
|
||||||
|
get() = prefs.getInt(GROUP_BY, GROUP_BY_NONE)
|
||||||
|
set(groupBy) = prefs.edit().putInt(GROUP_BY, groupBy).apply()
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ const val WAS_OTG_HANDLED = "was_otg_handled"
|
||||||
const val TEMP_SKIP_DELETE_CONFIRMATION = "temp_skip_delete_confirmation"
|
const val TEMP_SKIP_DELETE_CONFIRMATION = "temp_skip_delete_confirmation"
|
||||||
const val BOTTOM_ACTIONS = "bottom_actions"
|
const val BOTTOM_ACTIONS = "bottom_actions"
|
||||||
const val WERE_FAVORITES_PINNED = "were_favorites_pinned"
|
const val WERE_FAVORITES_PINNED = "were_favorites_pinned"
|
||||||
|
const val GROUP_BY = "group_by"
|
||||||
|
|
||||||
// slideshow
|
// slideshow
|
||||||
const val SLIDESHOW_INTERVAL = "slideshow_interval"
|
const val SLIDESHOW_INTERVAL = "slideshow_interval"
|
||||||
|
@ -112,3 +113,10 @@ const val TYPE_RAWS = 8
|
||||||
const val LOCAITON_INTERNAL = 1
|
const val LOCAITON_INTERNAL = 1
|
||||||
const val LOCATION_SD = 2
|
const val LOCATION_SD = 2
|
||||||
const val LOCATION_OTG = 3
|
const val LOCATION_OTG = 3
|
||||||
|
|
||||||
|
const val GROUP_BY_NONE = 0
|
||||||
|
const val GROUP_BY_LAST_MODIFIED = 1
|
||||||
|
const val GROUP_BY_DATE_TAKEN = 2
|
||||||
|
const val GROUP_BY_FILE_TYPE = 3
|
||||||
|
const val GROUP_BY_EXTENSION = 4
|
||||||
|
const val GROUP_BY_FOLDER = 5
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
android:icon="@drawable/ic_camera"
|
android:icon="@drawable/ic_camera"
|
||||||
android:title="@string/open_camera"
|
android:title="@string/open_camera"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/group"
|
||||||
|
android:title="@string/group_by"
|
||||||
|
app:showAsAction="never"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/change_view_type"
|
android:id="@+id/change_view_type"
|
||||||
android:title="@string/change_view_type"
|
android:title="@string/change_view_type"
|
||||||
|
|
Loading…
Reference in a new issue