mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-25 00:56:35 +00:00
parent
aaa7fb2ad1
commit
f65864a935
2 changed files with 10 additions and 2 deletions
|
@ -57,6 +57,9 @@ import java.io.FileInputStream
|
|||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
import java.io.OutputStream
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
|
@ -273,12 +276,13 @@ class AdvancedSettingsFragment : SubScreenFragment() {
|
|||
.setTitle(R.string.backup_restore_title)
|
||||
.setMessage(R.string.backup_restore_message)
|
||||
.setNegativeButton(R.string.button_backup) { _, _ ->
|
||||
val currentDate = SimpleDateFormat("yyyyMMdd", Locale.getDefault()).format(Calendar.getInstance().time)
|
||||
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT)
|
||||
.addCategory(Intent.CATEGORY_OPENABLE)
|
||||
.putExtra(
|
||||
Intent.EXTRA_TITLE,
|
||||
requireContext().getString(R.string.english_ime_name)
|
||||
.replace(" ", "_") + "_backup.zip"
|
||||
.replace(" ", "_") + "_backup_$currentDate.zip"
|
||||
)
|
||||
.setType("application/zip")
|
||||
backupFilePicker.launch(intent)
|
||||
|
|
|
@ -44,6 +44,9 @@ import kotlinx.serialization.json.Json
|
|||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.OutputStream
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
|
@ -192,12 +195,13 @@ fun BackupRestorePreference(setting: Setting) {
|
|||
restoreLauncher.launch(intent)
|
||||
},
|
||||
onConfirmed = {
|
||||
val currentDate = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(Calendar.getInstance().time)
|
||||
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT)
|
||||
.addCategory(Intent.CATEGORY_OPENABLE)
|
||||
.putExtra(
|
||||
Intent.EXTRA_TITLE,
|
||||
ctx.getString(R.string.english_ime_name)
|
||||
.replace(" ", "_") + "_backup.zip"
|
||||
.replace(" ", "_") + "_backup_$currentDate.zip"
|
||||
)
|
||||
.setType("application/zip")
|
||||
backupLauncher.launch(intent)
|
||||
|
|
Loading…
Add table
Reference in a new issue