mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 06:17:59 +01:00
Merge pull request #1945 from roland-kister/master
Added default folder option
This commit is contained in:
commit
78f40ebc9f
43 changed files with 135 additions and 0 deletions
|
@ -92,6 +92,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
appLaunched(BuildConfig.APPLICATION_ID)
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
openDefaultFolder()
|
||||
|
||||
config.temporarilyShowHidden = false
|
||||
config.tempSkipDeleteConfirmation = false
|
||||
removeTempFolder()
|
||||
|
@ -284,6 +286,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
findItem(R.id.reduce_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt > 1
|
||||
findItem(R.id.hide_the_recycle_bin).isVisible = useBin && config.showRecycleBinAtFolders
|
||||
findItem(R.id.show_the_recycle_bin).isVisible = useBin && !config.showRecycleBinAtFolders
|
||||
findItem(R.id.set_as_default_folder).isVisible = !config.defaultFolder.isEmpty()
|
||||
setupSearch(this)
|
||||
}
|
||||
}
|
||||
|
@ -309,6 +312,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
R.id.hide_the_recycle_bin -> toggleRecycleBin(false)
|
||||
R.id.increase_column_count -> increaseColumnCount()
|
||||
R.id.reduce_column_count -> reduceColumnCount()
|
||||
R.id.set_as_default_folder -> setAsDefaultFolder()
|
||||
R.id.settings -> launchSettings()
|
||||
R.id.about -> launchAbout()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
|
@ -1408,4 +1412,27 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
checkWhatsNew(this, BuildConfig.VERSION_CODE)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setAsDefaultFolder() {
|
||||
config.defaultFolder = ""
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
private fun openDefaultFolder() {
|
||||
if (config.defaultFolder.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
val defaultDir = File(config.defaultFolder!!)
|
||||
|
||||
if (!defaultDir.exists() || !defaultDir.isDirectory) {
|
||||
config.defaultFolder = ""
|
||||
return;
|
||||
}
|
||||
|
||||
Intent(this, MediaActivity::class.java).apply {
|
||||
putExtra(DIRECTORY, defaultDir.path)
|
||||
handleMediaIntent(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,6 +219,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_media, menu)
|
||||
|
||||
val isDefaultFolder = !config.defaultFolder.isEmpty() && File(config.defaultFolder).compareTo(File(mPath)) == 0
|
||||
|
||||
menu.apply {
|
||||
findItem(R.id.group).isVisible = !config.scrollHorizontally
|
||||
|
||||
|
@ -234,6 +236,9 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
|
||||
findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden
|
||||
|
||||
findItem(R.id.set_as_default_folder).isVisible = !isDefaultFolder
|
||||
findItem(R.id.unset_as_default_folder).isVisible = isDefaultFolder
|
||||
|
||||
val viewType = config.getFolderViewType(if (mShowAll) SHOW_ALL else mPath)
|
||||
findItem(R.id.increase_column_count).isVisible = viewType == VIEW_TYPE_GRID && config.mediaColumnCnt < MAX_COLUMN_COUNT
|
||||
findItem(R.id.reduce_column_count).isVisible = viewType == VIEW_TYPE_GRID && config.mediaColumnCnt > 1
|
||||
|
@ -262,6 +267,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
|
||||
R.id.increase_column_count -> increaseColumnCount()
|
||||
R.id.reduce_column_count -> reduceColumnCount()
|
||||
R.id.set_as_default_folder -> setAsDefaultFolder()
|
||||
R.id.unset_as_default_folder -> unsetAsDefaultFolder()
|
||||
R.id.slideshow -> startSlideshow()
|
||||
R.id.settings -> launchSettings()
|
||||
R.id.about -> launchAbout()
|
||||
|
@ -937,4 +944,14 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
}
|
||||
finish()
|
||||
}
|
||||
|
||||
private fun setAsDefaultFolder() {
|
||||
config.defaultFolder = mPath
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
private fun unsetAsDefaultFolder() {
|
||||
config.defaultFolder = ""
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,6 +199,10 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
get() = prefs.getInt(getDirectoryColumnsField(), getDefaultDirectoryColumnCount())
|
||||
set(dirColumnCnt) = prefs.edit().putInt(getDirectoryColumnsField(), dirColumnCnt).apply()
|
||||
|
||||
var defaultFolder: String
|
||||
get() = prefs.getString(DEFAULT_FOLDER, "")!!
|
||||
set(defaultFolder) = prefs.edit().putString(DEFAULT_FOLDER, defaultFolder).apply()
|
||||
|
||||
var allowInstantChange: Boolean
|
||||
get() = prefs.getBoolean(ALLOW_INSTANT_CHANGE, false)
|
||||
set(allowInstantChange) = prefs.edit().putBoolean(ALLOW_INSTANT_CHANGE, allowInstantChange).apply()
|
||||
|
|
|
@ -23,6 +23,7 @@ const val DISPLAY_FILE_NAMES = "display_file_names"
|
|||
const val BLACK_BACKGROUND = "dark_background"
|
||||
const val PINNED_FOLDERS = "pinned_folders"
|
||||
const val FILTER_MEDIA = "filter_media"
|
||||
const val DEFAULT_FOLDER = "default_folder"
|
||||
const val DIR_COLUMN_CNT = "dir_column_cnt"
|
||||
const val DIR_LANDSCAPE_COLUMN_CNT = "dir_landscape_column_cnt"
|
||||
const val DIR_HORIZONTAL_COLUMN_CNT = "dir_horizontal_column_cnt"
|
||||
|
|
|
@ -58,6 +58,10 @@
|
|||
android:id="@+id/reduce_column_count"
|
||||
android:title="@string/reduce_column_count"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/set_as_default_folder"
|
||||
android:title="@string/set_as_default_folder"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:title="@string/settings"
|
||||
|
|
|
@ -71,6 +71,14 @@
|
|||
android:id="@+id/reduce_column_count"
|
||||
android:title="@string/reduce_column_count"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/set_as_default_folder"
|
||||
android:title="@string/set_as_default_folder"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/unset_as_default_folder"
|
||||
android:title="@string/unset_as_default_folder"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/slideshow"
|
||||
android:title="@string/slideshow"
|
||||
|
|
|
@ -375,6 +375,8 @@
|
|||
<b>موقع رديت:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -375,6 +375,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -377,6 +377,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -374,6 +374,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -375,6 +375,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@ Ezzel csak a kiválasztott mappák láthatók, mivel a kizárás és a befoglal
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -374,6 +374,8 @@
|
|||
<b>... i/lub naszego subreddita:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -375,6 +375,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Não encontrou todas as cadeias a traduzir? Existem mais algumas em:
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -393,6 +393,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -374,6 +374,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -383,6 +383,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -376,6 +376,8 @@
|
|||
<b>Reddit:</b>
|
||||
https://www.reddit.com/r/SimpleMobileTools
|
||||
</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
<string name="share_resized">Share a resized version</string>
|
||||
<string name="upgraded_from_free">Hey,\n\nseems like you upgraded from the old free app. You can now uninstall the old version, which has an \'Upgrade to Pro\' button at the top of the app settings.\n\nYou will only have the Recycle bin items deleted, favorite items unmarked and you will also have to reset your app settings.\n\nThanks!</string>
|
||||
<string name="switch_to_file_search">Switch to file search across all visible folders</string>
|
||||
<string name="set_as_default_folder">Set as default folder</string>
|
||||
<string name="unset_as_default_folder">Unset as default folder</string>
|
||||
|
||||
<!-- Filter -->
|
||||
<string name="filter_media">Filter media</string>
|
||||
|
|
Loading…
Reference in a new issue