Added larger notification icon
Added date localization for strings Added additional machine translation
This commit is contained in:
1 parent
a635595ade
commit
dab5e4fe97
51 files changed
+50
-4774
No files matched your search
+1
-2
@@ -132,8 +132,7 @@ fun NotificationScreen(
|
||||
.fillMaxHeight(0.5f)
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.semantics {
|
||||
contentDescription =
|
||||
context.getString(R.string.notification_bell_animation)
|
||||
contentDescription = context.getString(R.string.notification_bell_animation)
|
||||
},
|
||||
safeMode = true,
|
||||
enableMergePaths = true
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@ import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.format.FormatStyle
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
@@ -158,7 +159,7 @@ class SettingsViewModel @Inject constructor (
|
||||
|
||||
is SettingsEvent.SetWallpaperInterval -> {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val formatter = DateTimeFormatter.ofPattern("MM/dd/yy hh:mm\na")
|
||||
val formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT)
|
||||
val time = LocalDateTime.now()
|
||||
val formattedLastSetTime = time.format(formatter)
|
||||
val formattedNextSetTime = time.plusMinutes(event.interval.toLong()).format(formatter)
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ fun PaperizeListItem(onGitHubClick: () -> Unit, onPlaystoreClick: () -> Unit, on
|
||||
fontSize = MaterialTheme.typography.titleLarge.fontSize
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.version) + " " + version,
|
||||
text = stringResource(R.string.version, version),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
fontSize = MaterialTheme.typography.bodyMedium.fontSize
|
||||
)
|
||||
|
||||
+8
-6
@@ -55,10 +55,11 @@ fun CurrentAndNextChange(
|
||||
)
|
||||
Column {
|
||||
lastSetTime?.split(" ", "\n")?.let { parts ->
|
||||
if (parts.size == 3) {
|
||||
if (parts.size == 2) {
|
||||
Text(stringResource(R.string.last_change), style = textFirst, modifier = Modifier.align(Alignment.CenterHorizontally))
|
||||
Text(parts[0], style = textSecond, modifier = Modifier.align(Alignment.CenterHorizontally))
|
||||
Text("${parts[1]} ${parts[2]}", style = textSecond, modifier = Modifier.align(Alignment.CenterHorizontally)) }
|
||||
Text(parts[0].replace(',', ' '), style = textSecond, modifier = Modifier.align(Alignment.CenterHorizontally))
|
||||
Text(parts[1], style = textSecond, modifier = Modifier.align(Alignment.CenterHorizontally))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,10 +85,11 @@ fun CurrentAndNextChange(
|
||||
)
|
||||
Column {
|
||||
nextSetTime?.split(" ", "\n")?.let { parts ->
|
||||
if (parts.size == 3) {
|
||||
if (parts.size == 2) {
|
||||
Text(stringResource(R.string.next_change), style = textFirst, modifier = Modifier.align(Alignment.CenterHorizontally))
|
||||
Text(parts[0], style = textSecond, modifier = Modifier.align(Alignment.CenterHorizontally))
|
||||
Text("${parts[1]} ${parts[2]}", style = textSecond, modifier = Modifier.align(Alignment.CenterHorizontally)) }
|
||||
Text(parts[0].replace(',', ' '), style = textSecond, modifier = Modifier.align(Alignment.CenterHorizontally))
|
||||
Text(parts[1], style = textSecond, modifier = Modifier.align(Alignment.CenterHorizontally))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-17
@@ -37,6 +37,7 @@ fun TimeSliders(
|
||||
var hours by rememberSaveable { mutableFloatStateOf(((timeInMinutes % (24 * 60)) / 60).toFloat()) }
|
||||
var minutes by rememberSaveable { mutableFloatStateOf((timeInMinutes % 60).toFloat()) }
|
||||
val scope = rememberCoroutineScope()
|
||||
val context = LocalView.current
|
||||
var job by remember { mutableStateOf<Job?>(null) }
|
||||
|
||||
Surface(
|
||||
@@ -51,25 +52,21 @@ fun TimeSliders(
|
||||
val displayDays = totalMinutes / (24 * 60)
|
||||
val displayHours = (totalMinutes % (24 * 60)) / 60
|
||||
val displayMinutes = totalMinutes % 60
|
||||
val formattedDays = when {
|
||||
displayDays > 1 -> stringResource(R.string.days, displayDays)
|
||||
displayDays == 1 -> stringResource(R.string.day, displayDays)
|
||||
else -> ""
|
||||
}
|
||||
val formattedHours = when {
|
||||
displayHours > 1 -> stringResource(R.string.hours, displayHours)
|
||||
displayHours == 1 -> stringResource(R.string.hour, displayHours)
|
||||
else -> ""
|
||||
}
|
||||
val formattedMinutes = when {
|
||||
displayMinutes > 1 -> stringResource(R.string.minutes, displayMinutes)
|
||||
displayMinutes == 1 -> stringResource(R.string.minute, displayMinutes)
|
||||
else -> ""
|
||||
}
|
||||
val formattedDays = if (displayDays > 0) {
|
||||
context.resources.getQuantityString(R.plurals.days, displayDays, displayDays)
|
||||
} else {""}
|
||||
|
||||
val formattedHours = if (displayHours > 0) {
|
||||
context.resources.getQuantityString(R.plurals.hours, displayHours, displayHours)
|
||||
} else {""}
|
||||
|
||||
val formattedMinutes = if (displayMinutes > 0) {
|
||||
context.resources.getQuantityString(R.plurals.minutes, displayMinutes, displayMinutes)
|
||||
} else {""}
|
||||
|
||||
val formattedTime = stringResource(
|
||||
R.string.interval,
|
||||
listOf(formattedDays, formattedHours, formattedMinutes).filter { it.isNotEmpty() }
|
||||
.joinToString(", ")
|
||||
listOf(formattedDays, formattedHours, formattedMinutes).filter { it.isNotEmpty() }.joinToString(", ")
|
||||
)
|
||||
|
||||
Text(
|
||||
|
||||
+7
-18
@@ -31,6 +31,7 @@ import kotlinx.coroutines.launch
|
||||
import java.io.IOException
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.format.FormatStyle
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@@ -129,8 +130,8 @@ class WallpaperService: Service() {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
val pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
return NotificationCompat.Builder(this, "wallpaper_service_channel")
|
||||
.setContentTitle("Paperize")
|
||||
.setContentText("Rotation: $current/$total wallpapers\nInterval: ${formatTime(timeInMinutes)}")
|
||||
.setContentTitle(getString(R.string.app_name))
|
||||
.setContentText(resources.getQuantityString(R.plurals.notification_content_text, total, current, total, formatTime(timeInMinutes)))
|
||||
.setSmallIcon(R.drawable.notification_icon)
|
||||
.setContentIntent(pendingIntent)
|
||||
.build()
|
||||
@@ -141,7 +142,7 @@ class WallpaperService: Service() {
|
||||
* If none left, reshuffle the wallpapers and pick the first one
|
||||
*/
|
||||
private suspend fun changeWallpaper(context: Context) {
|
||||
val formatter = DateTimeFormatter.ofPattern("MM/dd/yy hh:mm\na")
|
||||
val formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT)
|
||||
val time = LocalDateTime.now()
|
||||
settingsDataStoreImpl.putString(SettingsConstants.LAST_SET_TIME, time.format(formatter))
|
||||
settingsDataStoreImpl.putString(SettingsConstants.NEXT_SET_TIME, time.plusMinutes(timeInMinutes.toLong()).format(formatter))
|
||||
@@ -261,21 +262,9 @@ class WallpaperService: Service() {
|
||||
val hours = (timeInMinutes % (24 * 60)) / 60
|
||||
val minutes = timeInMinutes % 60
|
||||
|
||||
val formattedDays = when {
|
||||
days > 1 -> "$days days"
|
||||
days == 1 -> "$days day"
|
||||
else -> ""
|
||||
}
|
||||
val formattedHours = when {
|
||||
hours > 1 -> "$hours hours"
|
||||
hours == 1 -> "$hours hour"
|
||||
else -> ""
|
||||
}
|
||||
val formattedMinutes = when {
|
||||
minutes > 1 -> "$minutes minutes"
|
||||
minutes == 1 -> "$minutes minute"
|
||||
else -> ""
|
||||
}
|
||||
val formattedDays = if (days > 0) resources.getQuantityString(R.plurals.days, days, days) else ""
|
||||
val formattedHours = if (hours > 0) resources.getQuantityString(R.plurals.hours, hours, hours) else ""
|
||||
val formattedMinutes = if (minutes > 0) resources.getQuantityString(R.plurals.minutes, minutes, minutes) else ""
|
||||
|
||||
return listOf(formattedDays, formattedHours, formattedMinutes).filter { it.isNotEmpty() }.joinToString(", ")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user