Skip to content

Commit

Permalink
Revert "Recorder: Use medium localized datetime for filename"
Browse files Browse the repository at this point in the history
This reverts commit ff23879.

Reason for revert: In some locale (e.g. Japanese) the change produces invalid filename that contains "/" (e.g. "Sound record (2024/09/29 19:15:33).wav"), breaking the app.

Change-Id: I7216cc3fb2897c993b526e5b9ed7ac2553aabb86
  • Loading branch information
Outvi V authored and luca020400 committed Oct 18, 2024
1 parent fe36556 commit 19e2baa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/src/main/java/org/lineageos/recorder/RecorderActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import org.lineageos.recorder.utils.Utils
import org.lineageos.recorder.viewmodels.RecordingsViewModel
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
import java.time.format.DateTimeFormatterBuilder
import java.time.temporal.ChronoUnit
import java.util.Locale
import kotlin.reflect.safeCast
Expand Down Expand Up @@ -373,9 +373,11 @@ class RecorderActivity : AppCompatActivity(R.layout.activity_main) {
private val newRecordFileName: String
get() {
val tag = locationHelper.currentLocationName ?: FILE_NAME_FALLBACK
val formatter = DateTimeFormatter
.ofLocalizedDateTime(FormatStyle.MEDIUM)
.withLocale(Locale.getDefault())
val formatter = DateTimeFormatterBuilder()
.append(DateTimeFormatter.ISO_LOCAL_DATE)
.appendLiteral(' ')
.append(DateTimeFormatter.ISO_LOCAL_TIME)
.toFormatter(Locale.getDefault())
val now = LocalDateTime.now()
return String.format(
FILE_NAME_BASE, tag,
Expand Down

0 comments on commit 19e2baa

Please sign in to comment.