add a settings toggle for toggling recycle bin usage
This commit is contained in:
parent
efc4e241ca
commit
d8a33f81d7
4 changed files with 56 additions and 1 deletions
|
@ -70,12 +70,13 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupSkipDeleteConfirmation()
|
||||
updateTextColors(settings_holder)
|
||||
setupSectionColors()
|
||||
setupUseRecycleBin()
|
||||
}
|
||||
|
||||
private fun setupSectionColors() {
|
||||
val adjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||
arrayListOf(visibility_label, videos_label, thumbnails_label, scrolling_label, fullscreen_media_label, security_label,
|
||||
file_operations_label, extended_details_label).forEach {
|
||||
file_operations_label, extended_details_label, recycle_bin_label).forEach {
|
||||
it.setTextColor(adjustedPrimaryColor)
|
||||
}
|
||||
}
|
||||
|
@ -409,4 +410,12 @@ class SettingsActivity : SimpleActivity() {
|
|||
ROTATE_BY_DEVICE_ROTATION -> R.string.screen_rotation_device_rotation
|
||||
else -> R.string.screen_rotation_aspect_ratio
|
||||
})
|
||||
|
||||
private fun setupUseRecycleBin() {
|
||||
settings_use_recycle_bin.isChecked = config.useRecycleBin
|
||||
settings_use_recycle_bin_holder.setOnClickListener {
|
||||
settings_use_recycle_bin.toggle()
|
||||
config.useRecycleBin = settings_use_recycle_bin.isChecked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -356,4 +356,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
var groupBy: Int
|
||||
get() = prefs.getInt(GROUP_BY, GROUP_BY_NONE)
|
||||
set(groupBy) = prefs.edit().putInt(GROUP_BY, groupBy).apply()
|
||||
|
||||
var useRecycleBin: Boolean
|
||||
get() = prefs.getBoolean(USE_RECYCLE_BIN, true)
|
||||
set(useRecycleBin) = prefs.edit().putBoolean(USE_RECYCLE_BIN, useRecycleBin).apply()
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ const val TEMP_SKIP_DELETE_CONFIRMATION = "temp_skip_delete_confirmation"
|
|||
const val BOTTOM_ACTIONS = "bottom_actions"
|
||||
const val WERE_FAVORITES_PINNED = "were_favorites_pinned"
|
||||
const val WAS_RECYCLE_BIN_PINNED = "was_recycle_bin_pinned"
|
||||
const val USE_RECYCLE_BIN = "use_recycle_bin"
|
||||
const val GROUP_BY = "group_by"
|
||||
|
||||
// slideshow
|
||||
|
|
|
@ -941,5 +941,46 @@
|
|||
android:text="@string/skip_delete_confirmation"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/recycle_bin_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="@color/divider_grey"
|
||||
android:importantForAccessibility="no"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/recycle_bin_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/bigger_margin"
|
||||
android:layout_marginStart="@dimen/bigger_margin"
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:text="@string/recycle_bin"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="@dimen/smaller_text_size"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_use_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_use_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/move_items_to_trash_bin"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
Loading…
Reference in a new issue