Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.raival.compose.file.explorer.App.Companion.globalClass
import com.raival.compose.file.explorer.R
import com.raival.compose.file.explorer.common.ui.CheckableText
import com.raival.compose.file.explorer.common.ui.Space
Expand All @@ -22,8 +23,15 @@ import com.raival.compose.file.explorer.screen.main.tab.files.FilesTab
@Composable
fun DeleteConfirmationDialog(tab: FilesTab) {
if (tab.showConfirmDeleteDialog) {
val preferencesManager = globalClass.preferencesManager
var moveToRecycleBin by remember {
mutableStateOf(true)
mutableStateOf(preferencesManager.generalPrefs.moveToRecycleBin)
}
var showRememberChoice by remember {
mutableStateOf(false)
}
var rememberChoice by remember {
mutableStateOf(false)
}

val targetFiles by remember(tab.id, tab.activeFolder.path) {
Expand All @@ -41,6 +49,9 @@ fun DeleteConfirmationDialog(tab: FilesTab) {
onClick = {
onDismissRequest()
tab.unselectAllFiles()
if (showRememberChoice && rememberChoice) {
preferencesManager.generalPrefs.moveToRecycleBin = moveToRecycleBin
}
tab.deleteFiles(targetFiles, tab.taskCallback, moveToRecycleBin)
}
) { Text(stringResource(R.string.confirm)) }
Expand All @@ -65,14 +76,32 @@ fun DeleteConfirmationDialog(tab: FilesTab) {
CheckableText(
modifier = Modifier.fillMaxWidth(),
checked = moveToRecycleBin,
onCheckedChange = { moveToRecycleBin = it },
onCheckedChange = {
moveToRecycleBin = it
showRememberChoice = true
},
text = {
Text(
modifier = Modifier.alpha(0.7f),
text = stringResource(R.string.move_to_recycle_bin)
)
}
)

if (showRememberChoice) {
Space(size = 4.dp)
CheckableText(
modifier = Modifier.fillMaxWidth(),
checked = rememberChoice,
onCheckedChange = { rememberChoice = it },
text = {
Text(
modifier = Modifier.alpha(0.6f),
text = stringResource(R.string.remember_this_choice)
)
}
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ class PreferencesManager {
defaultValue = true,
getPreferencesKey = { booleanPreferencesKey(it) }
)

var moveToRecycleBin by prefMutableState(
keyName = "moveToRecycleBin",
defaultValue = true,
getPreferencesKey = { booleanPreferencesKey(it) }
)

var signApk by prefMutableState(
keyName = "signApk",
defaultValue = false,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,5 @@
<string name="github">لوب</string>
<string name="apply">درخواست کردن</string>
<string name="no_recent_files">هیچ پرونده اخیر وجود ندارد</string>
<string name="remember_this_choice">این انتخاب را به خاطر بسپار</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,5 @@
<string name="github">Github</string>
<string name="apply">Aplicar</string>
<string name="no_recent_files">Nenhum Arquivo Recente</string>
<string name="remember_this_choice">Lembre-se desta escolha</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,5 @@
<string name="github">Github</string>
<string name="apply">Применить</string>
<string name="no_recent_files">Нет недавних файлов</string>
<string name="remember_this_choice">Запомни этот выбор</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,5 @@
<string name="github">Github</string>
<string name="apply">应用</string>
<string name="no_recent_files">没有最近文件</string>
<string name="remember_this_choice">记住这个选择</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,5 @@
<string name="github">Github</string>
<string name="apply">套用</string>
<string name="no_recent_files">沒有最近使用的檔案</string>
<string name="remember_this_choice">記住這個選擇</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,5 @@
<string name="github">Github</string>
<string name="apply">Apply</string>
<string name="no_recent_files">No Recent Files</string>
<string name="remember_this_choice">Remember this choice</string>
</resources>
Loading