Skip to content

Commit

Permalink
Merge pull request #3334 from nextcloud/backport/3332/stable-17.1
Browse files Browse the repository at this point in the history
[stable-17.1] TimePicker format matches locale of device
  • Loading branch information
AndyScherzinger authored Sep 21, 2023
2 parents a9b0572 + 2c3235a commit bc97a1f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package com.nextcloud.talk.ui.dialog

import android.app.Dialog
import android.os.Bundle
import android.text.format.DateFormat
import android.text.format.DateUtils
import android.view.LayoutInflater
import android.view.View
Expand All @@ -32,6 +33,7 @@ import com.google.android.material.datepicker.DateValidatorPointForward
import com.google.android.material.datepicker.MaterialDatePicker
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.timepicker.MaterialTimePicker
import com.google.android.material.timepicker.TimeFormat
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.application.NextcloudTalkApplication
Expand Down Expand Up @@ -229,9 +231,10 @@ class DateTimePickerFragment(
}

private fun setUpTimePicker(year: Int, month: Int, day: Int, weekInYear: Int) {
val timePicker = MaterialTimePicker
.Builder()
val locale = if (DateFormat.is24HourFormat(requireContext())) TimeFormat.CLOCK_24H else TimeFormat.CLOCK_12H
val timePicker = MaterialTimePicker.Builder()
.setTitleText(R.string.nc_remind)
.setTimeFormat(locale)
.build()

timePicker.addOnPositiveButtonClickListener {
Expand Down

0 comments on commit bc97a1f

Please sign in to comment.