show recycle bin at the main folders screen only when appropriate
This commit is contained in:
parent
012007a239
commit
3358dfa201
|
@ -749,7 +749,12 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
|
||||
val foldersToScan = mediaFetcher.getFoldersToScan()
|
||||
foldersToScan.add(FAVORITES)
|
||||
if (config.showRecycleBinAtFolders) {
|
||||
foldersToScan.add(RECYCLE_BIN)
|
||||
} else {
|
||||
foldersToScan.remove(RECYCLE_BIN)
|
||||
}
|
||||
|
||||
dirs.forEach {
|
||||
foldersToScan.remove(it.path)
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupSkipDeleteConfirmation()
|
||||
setupManageBottomActions()
|
||||
setupUseRecycleBin()
|
||||
setupShowRecycleBin()
|
||||
setupEmptyRecycleBin()
|
||||
updateTextColors(settings_holder)
|
||||
setupSectionColors()
|
||||
|
@ -441,6 +442,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
|
||||
private fun setupUseRecycleBin() {
|
||||
settings_empty_recycle_bin_holder.beVisibleIf(config.useRecycleBin)
|
||||
settings_show_recycle_bin_holder.beVisibleIf(config.useRecycleBin)
|
||||
settings_use_recycle_bin.isChecked = config.useRecycleBin
|
||||
settings_use_recycle_bin_holder.setOnClickListener {
|
||||
settings_use_recycle_bin.toggle()
|
||||
|
@ -449,6 +451,14 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupShowRecycleBin() {
|
||||
settings_show_recycle_bin.isChecked = config.showRecycleBinAtFolders
|
||||
settings_show_recycle_bin_holder.setOnClickListener {
|
||||
settings_show_recycle_bin.toggle()
|
||||
config.showRecycleBinAtFolders = settings_show_recycle_bin.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupEmptyRecycleBin() {
|
||||
Thread {
|
||||
mRecycleBinContentSize = galleryDB.MediumDao().getDeletedMedia().sumByLong { it.size }
|
||||
|
|
|
@ -288,6 +288,11 @@ fun Context.getCachedDirectories(getVideosOnly: Boolean = false, getImagesOnly:
|
|||
} catch (e: SQLiteException) {
|
||||
ArrayList<Directory>()
|
||||
}
|
||||
|
||||
if (!config.showRecycleBinAtFolders) {
|
||||
directories.removeAll { it.isRecycleBin() }
|
||||
}
|
||||
|
||||
val shouldShowHidden = config.shouldShowHidden
|
||||
val excludedPaths = config.excludedFolders
|
||||
val includedPaths = config.includedFolders
|
||||
|
|
|
@ -376,4 +376,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
Environment.DIRECTORY_DCIM,
|
||||
Environment.DIRECTORY_PICTURES
|
||||
)
|
||||
|
||||
var showRecycleBinAtFolders: Boolean
|
||||
get() = prefs.getBoolean(SHOW_RECYCLE_BIN_AT_FOLDERS, true)
|
||||
set(showRecycleBinAtFolders) = prefs.edit().putBoolean(SHOW_RECYCLE_BIN_AT_FOLDERS, showRecycleBinAtFolders).apply()
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ const val WAS_RECYCLE_BIN_PINNED = "was_recycle_bin_pinned"
|
|||
const val USE_RECYCLE_BIN = "use_recycle_bin"
|
||||
const val GROUP_BY = "group_by"
|
||||
const val EVER_SHOWN_FOLDERS = "ever_shown_folders"
|
||||
const val SHOW_RECYCLE_BIN_AT_FOLDERS = "show_recycle_bin_at_folders"
|
||||
|
||||
// slideshow
|
||||
const val SLIDESHOW_INTERVAL = "slideshow_interval"
|
||||
|
|
|
@ -1045,6 +1045,29 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_show_recycle_bin_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingLeft="@dimen/normal_margin"
|
||||
android:paddingRight="@dimen/normal_margin"
|
||||
android:paddingTop="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||
android:id="@+id/settings_show_recycle_bin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingLeft="@dimen/medium_margin"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/show_recycle_bin"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_empty_recycle_bin_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue