Fix: Fixed alignment for other languages (#169)

Signed-off-by: HᴇCᴏᴅᴇs2ᴍᴜᴄʜ <wayne6324@gmail.com>
This commit is contained in:
HᴇCᴏᴅᴇs2ᴍᴜᴄʜ
2024-11-25 08:04:45 +00:00
committed by GitHub
parent fdc46eed4a
commit 2412585920
2 changed files with 8 additions and 8 deletions

View File

@@ -137,11 +137,11 @@ class AppHelper @Inject constructor() {
}
}
fun getGravityFromSelectedItem(selectedItem: String): Int {
fun getGravityFromSelectedItem(selectedItem: Int): Int {
return when (selectedItem) {
"Left" -> Gravity.START
"Center" -> Gravity.CENTER
"Right" -> Gravity.END
0 -> Gravity.START
1 -> Gravity.CENTER
2 -> Gravity.END
else -> Gravity.START
}
}
@@ -387,4 +387,4 @@ class AppHelper @Inject constructor() {
// Data class to hold cached weather data along with timestamp
data class CachedWeatherData(val timestamp: Long, val weatherResponse: WeatherResponse)
}
}

View File

@@ -117,8 +117,8 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() {
val dialog = MaterialAlertDialogBuilder(requireContext())
dialog.setTitle(DIALOG_TITLE)
dialog.setItems(items) { _, which ->
val selectedItem = items[which]
dialog.setItems(items) { _, index ->
val selectedItem = index
val gravity = appHelper.getGravityFromSelectedItem(selectedItem)
when (selectedAlignment) {
@@ -215,4 +215,4 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() {
private const val REQUEST_KEY_ALARM_CLOCK_ALIGNMENT = "REQUEST_KEY_ALARM_CLOCK_ALIGNMENT"
private const val REQUEST_KEY_WORD_ALIGNMENT = "REQUEST_KEY_WORD_ALIGNMENT"
}
}
}