Skip to content

Commit

Permalink
Timestamp are now used for backup
Browse files Browse the repository at this point in the history
  • Loading branch information
jamal2362 committed Sep 28, 2023
1 parent 1a9e49b commit 0257d92
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/jamal2367/urlradio/Keys.kt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ object Keys {
const val COLLECTION_FILE: String = "collection.json"
const val COLLECTION_M3U_FILE: String = "collection.m3u"
const val COLLECTION_PLS_FILE: String = "collection.pls"
const val COLLECTION_BACKUP_FILE: String = "URL_Radio-Backup.zip"
const val STATION_IMAGE_FILE: String = "station-image.jpg"

// server addresses
Expand Down
23 changes: 20 additions & 3 deletions app/src/main/java/com/jamal2367/urlradio/SettingsFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import com.jamal2367.urlradio.helpers.AppThemeHelper.getColor
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
import java.text.SimpleDateFormat
import java.util.*


/*
Expand Down Expand Up @@ -512,7 +514,12 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = Keys.MIME_TYPE_M3U
putExtra(Intent.EXTRA_TITLE, Keys.COLLECTION_M3U_FILE)

val timeStamp: String
val dateFormat = SimpleDateFormat("_yyyy-MM-dd'T'HH_mm", Locale.US)
timeStamp = dateFormat.format(Date())

putExtra(Intent.EXTRA_TITLE, "collection$timeStamp.m3u")
}
// file gets saved in the ActivityResult
try {
Expand All @@ -529,7 +536,12 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = Keys.MIME_TYPE_PLS
putExtra(Intent.EXTRA_TITLE, Keys.COLLECTION_PLS_FILE)

val timeStamp: String
val dateFormat = SimpleDateFormat("_yyyy-MM-dd'T'HH_mm", Locale.US)
timeStamp = dateFormat.format(Date())

putExtra(Intent.EXTRA_TITLE, "collection$timeStamp.pls")
}
// file gets saved in the ActivityResult
try {
Expand All @@ -546,7 +558,12 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = Keys.MIME_TYPE_ZIP
putExtra(Intent.EXTRA_TITLE, Keys.COLLECTION_BACKUP_FILE)

val timeStamp: String
val dateFormat = SimpleDateFormat("_yyyy-MM-dd'T'HH_mm", Locale.US)
timeStamp = dateFormat.format(Date())

putExtra(Intent.EXTRA_TITLE, "URL_Radio$timeStamp.zip")
}
// file gets saved in the ActivityResult
try {
Expand Down

0 comments on commit 0257d92

Please sign in to comment.