Skip to content

Commit 16d068e

Browse files
authored
Merge pull request #4290 from yashwanthgajji/issue/4277
2 parents ef790ae + 6607702 commit 16d068e

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

app/src/main/java/com/amaze/filemanager/ui/dialogs/GeneralDialogCreation.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,22 @@ public static void deleteFilesDialog(
209209
sharedPreferences.getBoolean(
210210
PreferencesConstants.PREFERENCE_DELETE_CONFIRMATION,
211211
PreferencesConstants.DEFAULT_PREFERENCE_DELETE_CONFIRMATION);
212+
boolean deletePermanently =
213+
sharedPreferences.getBoolean(
214+
PreferencesConstants.PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION,
215+
PreferencesConstants.DEFAULT_PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION);
212216
View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_delete, null);
213217
TextView deleteDisclaimerTextView = dialogView.findViewById(R.id.dialog_delete_disclaimer);
214218
final AppCompatCheckBox deletePermanentlyCheckbox =
215219
dialogView.findViewById(R.id.delete_permanently_checkbox);
216220
if (positions.get(0).generateBaseFile().isLocal()) {
217221
// FIXME: make sure dialog is not shown for zero items
218222
// allow trash bin delete only for local files for now
219-
deletePermanentlyCheckbox.setVisibility(View.VISIBLE);
223+
if (deletePermanently) {
224+
deletePermanentlyCheckbox.setVisibility(View.GONE);
225+
} else {
226+
deletePermanentlyCheckbox.setVisibility(View.VISIBLE);
227+
}
220228
} else {
221229
deleteDisclaimerTextView.setText(context.getString(R.string.dialog_delete_disclaimer));
222230
}

app/src/main/java/com/amaze/filemanager/ui/fragments/preferencefragments/PreferencesConstants.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ object PreferencesConstants {
7777
const val PREFERENCE_ZIP_EXTRACT_PATH = "extractpath"
7878
const val PREFERENCE_TEXTEDITOR_NEWSTACK = "texteditor_newstack"
7979
const val PREFERENCE_DELETE_CONFIRMATION = "delete_confirmation"
80+
const val PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION = "delete_permanently_without_confirmation"
8081
const val PREFERENCE_DISABLE_PLAYER_INTENT_FILTERS = "disable_player_intent_filters"
8182
const val PREFERENCE_TRASH_BIN_RETENTION_NUM_OF_FILES = "retention_num_of_files"
8283
const val PREFERENCE_TRASH_BIN_RETENTION_DAYS = "retention_days"
@@ -122,4 +123,5 @@ object PreferencesConstants {
122123
const val KEY_TRASH_BIN_CLEANUP_INTERVAL_HOURS = "trash_bin_cleanup_interval_hours"
123124

124125
const val DEFAULT_PREFERENCE_DELETE_CONFIRMATION = true
126+
const val DEFAULT_PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION = false
125127
}

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,8 @@ You only need to do this once, until the next time you select a new location for
801801
<string name="error_cannot_get_package_info">Unable to get package info from file \"%s\". Either the specified file is not an APK, or the package file is corrupt.</string>
802802
<string name="preference_delete_confirmation">Delete confirmation</string>
803803
<string name="preference_delete_confirmation_summary">Ask for confirmation before deleting files. Disabling this is highly discouraged!</string>
804+
<string name="preference_delete_permanently_without_confirmation">Delete permanently (Disable Trashbin)</string>
805+
<string name="preference_delete_permanently_without_confirmation_summary">Delete files permanently without moving to trashbin. Enabling this is highly discouraged!</string>
804806
<string name="protocol_ssh" translatable="false">SSH/SFTP</string>
805807
<string name="protocol_ftp" translatable="false">FTP</string>
806808
<string name="protocol_ftps">Secure FTP</string>

app/src/main/res/xml/behavior_prefs.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
app:key="delete_confirmation"
3131
app:summary="@string/preference_delete_confirmation_summary"
3232
app:title="@string/preference_delete_confirmation" />
33+
<com.amaze.filemanager.ui.views.preference.CheckBox
34+
android:layout_width="wrap_content"
35+
android:layout_height="wrap_content"
36+
app:defaultValue="false"
37+
app:key="delete_permanently_without_confirmation"
38+
app:summary="@string/preference_delete_permanently_without_confirmation_summary"
39+
app:title="@string/preference_delete_permanently_without_confirmation" />
3340
<Preference
3441
android:layout_width="wrap_content"
3542
android:layout_height="wrap_content"

0 commit comments

Comments
 (0)