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()
|
val foldersToScan = mediaFetcher.getFoldersToScan()
|
||||||
foldersToScan.add(FAVORITES)
|
foldersToScan.add(FAVORITES)
|
||||||
foldersToScan.add(RECYCLE_BIN)
|
if (config.showRecycleBinAtFolders) {
|
||||||
|
foldersToScan.add(RECYCLE_BIN)
|
||||||
|
} else {
|
||||||
|
foldersToScan.remove(RECYCLE_BIN)
|
||||||
|
}
|
||||||
|
|
||||||
dirs.forEach {
|
dirs.forEach {
|
||||||
foldersToScan.remove(it.path)
|
foldersToScan.remove(it.path)
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
setupSkipDeleteConfirmation()
|
setupSkipDeleteConfirmation()
|
||||||
setupManageBottomActions()
|
setupManageBottomActions()
|
||||||
setupUseRecycleBin()
|
setupUseRecycleBin()
|
||||||
|
setupShowRecycleBin()
|
||||||
setupEmptyRecycleBin()
|
setupEmptyRecycleBin()
|
||||||
updateTextColors(settings_holder)
|
updateTextColors(settings_holder)
|
||||||
setupSectionColors()
|
setupSectionColors()
|
||||||
|
@ -441,6 +442,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun setupUseRecycleBin() {
|
private fun setupUseRecycleBin() {
|
||||||
settings_empty_recycle_bin_holder.beVisibleIf(config.useRecycleBin)
|
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.isChecked = config.useRecycleBin
|
||||||
settings_use_recycle_bin_holder.setOnClickListener {
|
settings_use_recycle_bin_holder.setOnClickListener {
|
||||||
settings_use_recycle_bin.toggle()
|
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() {
|
private fun setupEmptyRecycleBin() {
|
||||||
Thread {
|
Thread {
|
||||||
mRecycleBinContentSize = galleryDB.MediumDao().getDeletedMedia().sumByLong { it.size }
|
mRecycleBinContentSize = galleryDB.MediumDao().getDeletedMedia().sumByLong { it.size }
|
||||||
|
|
|
@ -288,6 +288,11 @@ fun Context.getCachedDirectories(getVideosOnly: Boolean = false, getImagesOnly:
|
||||||
} catch (e: SQLiteException) {
|
} catch (e: SQLiteException) {
|
||||||
ArrayList<Directory>()
|
ArrayList<Directory>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config.showRecycleBinAtFolders) {
|
||||||
|
directories.removeAll { it.isRecycleBin() }
|
||||||
|
}
|
||||||
|
|
||||||
val shouldShowHidden = config.shouldShowHidden
|
val shouldShowHidden = config.shouldShowHidden
|
||||||
val excludedPaths = config.excludedFolders
|
val excludedPaths = config.excludedFolders
|
||||||
val includedPaths = config.includedFolders
|
val includedPaths = config.includedFolders
|
||||||
|
|
|
@ -376,4 +376,8 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
Environment.DIRECTORY_DCIM,
|
Environment.DIRECTORY_DCIM,
|
||||||
Environment.DIRECTORY_PICTURES
|
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 USE_RECYCLE_BIN = "use_recycle_bin"
|
||||||
const val GROUP_BY = "group_by"
|
const val GROUP_BY = "group_by"
|
||||||
const val EVER_SHOWN_FOLDERS = "ever_shown_folders"
|
const val EVER_SHOWN_FOLDERS = "ever_shown_folders"
|
||||||
|
const val SHOW_RECYCLE_BIN_AT_FOLDERS = "show_recycle_bin_at_folders"
|
||||||
|
|
||||||
// slideshow
|
// slideshow
|
||||||
const val SLIDESHOW_INTERVAL = "slideshow_interval"
|
const val SLIDESHOW_INTERVAL = "slideshow_interval"
|
||||||
|
|
|
@ -1045,6 +1045,29 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</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
|
<RelativeLayout
|
||||||
android:id="@+id/settings_empty_recycle_bin_holder"
|
android:id="@+id/settings_empty_recycle_bin_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in New Issue