From 7704b8f40b24b3c7f6c4923bc01c44844a8152ce Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 5 Nov 2022 14:48:18 +0100 Subject: [PATCH] better backup title --- .../github/libretube/ui/preferences/AdvancedSettings.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt index 3480a7f25..6835dd7f5 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt @@ -17,6 +17,8 @@ import com.github.libretube.util.BackupHelper import com.github.libretube.util.ImageHelper import com.github.libretube.util.PreferenceHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder +import java.time.LocalDate +import java.time.LocalTime class AdvancedSettings : BasePreferenceFragment() { @@ -64,7 +66,7 @@ class AdvancedSettings : BasePreferenceFragment() { advancesBackup?.setOnPreferenceClickListener { BackupDialog { backupFile = it - createBackupFile.launch("backup.json") + createBackupFile.launch(getBackupFileName()) } .show(childFragmentManager, null) true @@ -93,4 +95,9 @@ class AdvancedSettings : BasePreferenceFragment() { } .show() } + + private fun getBackupFileName(): String { + val time = LocalTime.now().toString().split(".").firstOrNull() + return "libretube-backup-${LocalDate.now()}-$time.json" + } }