Merge pull request #1607 from Andries-Smit/fix/style-date-time-dialog

Fix style date time dialog
This commit is contained in:
Milos Kozak 2022-04-12 09:38:34 +02:00 committed by GitHub
commit 814b59bd43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 72 deletions

View file

@ -169,7 +169,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
cal.timeInMillis = overviewData.fromTime cal.timeInMillis = overviewData.fromTime
DatePickerDialog( DatePickerDialog(
this, R.style.MaterialPickerTheme, this,
dateSetListener, dateSetListener,
cal.get(Calendar.YEAR), cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH), cal.get(Calendar.MONTH),

View file

@ -105,7 +105,7 @@ class EditQuickWizardDialog : DaggerDialogFragment(), View.OnClickListener {
binding.from.setOnClickListener { binding.from.setOnClickListener {
context?.let { context?.let {
TimePickerDialog( TimePickerDialog(
it, R.style.MaterialPickerTheme, it,
fromTimeSetListener, fromTimeSetListener,
T.secs(fromSeconds.toLong()).hours().toInt(), T.secs(fromSeconds.toLong()).hours().toInt(),
T.secs((fromSeconds % 3600).toLong()).mins().toInt(), T.secs((fromSeconds % 3600).toLong()).mins().toInt(),
@ -124,7 +124,7 @@ class EditQuickWizardDialog : DaggerDialogFragment(), View.OnClickListener {
binding.to.setOnClickListener { binding.to.setOnClickListener {
context?.let { context?.let {
TimePickerDialog( TimePickerDialog(
it, R.style.MaterialPickerTheme, it,
toTimeSetListener, toTimeSetListener,
T.secs(toSeconds.toLong()).hours().toInt(), T.secs(toSeconds.toLong()).hours().toInt(),
T.secs((toSeconds % 3600).toLong()).mins().toInt(), T.secs((toSeconds % 3600).toLong()).mins().toInt(),

View file

@ -36,7 +36,7 @@ class InputDateTime(private val rh: ResourceHelper, private val dateUtil: DateUt
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
cal.timeInMillis = value cal.timeInMillis = value
DatePickerDialog( DatePickerDialog(
it, R.style.MaterialPickerTheme, it,
{ _, year, monthOfYear, dayOfMonth -> { _, year, monthOfYear, dayOfMonth ->
value = Calendar.getInstance().apply { value = Calendar.getInstance().apply {
timeInMillis = value timeInMillis = value
@ -62,7 +62,7 @@ class InputDateTime(private val rh: ResourceHelper, private val dateUtil: DateUt
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
cal.timeInMillis = value cal.timeInMillis = value
TimePickerDialog( TimePickerDialog(
it, R.style.MaterialPickerTheme, it,
{ _, hour, minute -> { _, hour, minute ->
value = Calendar.getInstance().apply { value = Calendar.getInstance().apply {
timeInMillis = value timeInMillis = value

View file

@ -38,7 +38,7 @@ class InputTime(private val rh: ResourceHelper, private val dateUtil: DateUtil)
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
cal.timeInMillis = toMills(value) cal.timeInMillis = toMills(value)
TimePickerDialog( TimePickerDialog(
it, R.style.MaterialPickerTheme, it,
{ _, hour, minute -> { _, hour, minute ->
value = 60 * hour + minute value = 60 * hour + minute
text = dateUtil.timeString(toMills(value)) text = dateUtil.timeString(toMills(value))

View file

@ -42,7 +42,7 @@ class InputTimeRange(private val rh: ResourceHelper, private val dateUtil: DateU
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
cal.timeInMillis = toMills(start) cal.timeInMillis = toMills(start)
TimePickerDialog( TimePickerDialog(
it, R.style.MaterialPickerTheme, it,
{ _, hour, minute -> { _, hour, minute ->
start = 60 * hour + minute start = 60 * hour + minute
text = dateUtil.timeString(toMills(start)) text = dateUtil.timeString(toMills(start))
@ -63,7 +63,7 @@ class InputTimeRange(private val rh: ResourceHelper, private val dateUtil: DateU
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
cal.timeInMillis = toMills(end) cal.timeInMillis = toMills(end)
TimePickerDialog( TimePickerDialog(
it, R.style.MaterialPickerTheme, it,
{ _, hour, minute -> { _, hour, minute ->
end = 60 * hour + minute end = 60 * hour + minute
text = dateUtil.timeString(toMills(end)) text = dateUtil.timeString(toMills(end))

View file

@ -105,7 +105,7 @@ abstract class DialogFragmentWithDate : DaggerDialogFragment() {
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
cal.timeInMillis = eventTime cal.timeInMillis = eventTime
DatePickerDialog( DatePickerDialog(
it, R.style.MaterialPickerTheme, it,
dateSetListener, dateSetListener,
cal.get(Calendar.YEAR), cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH), cal.get(Calendar.MONTH),
@ -134,7 +134,7 @@ abstract class DialogFragmentWithDate : DaggerDialogFragment() {
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
cal.timeInMillis = eventTime cal.timeInMillis = eventTime
TimePickerDialog( TimePickerDialog(
it, R.style.MaterialPickerTheme, it,
timeSetListener, timeSetListener,
cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.HOUR_OF_DAY),
cal.get(Calendar.MINUTE), cal.get(Calendar.MINUTE),

View file

@ -279,39 +279,6 @@
<item name="android:textAllCaps">true</item> <item name="android:textAllCaps">true</item>
</style> </style>
<style name="MaterialPickerTheme" parent="android:Theme.Material.Dialog.Alert">
<item name="android:datePickerStyle">@style/MaterialDatePickerStyle</item>
<item name="android:timePickerStyle">@style/MaterialTimePickerStyle</item>
<item name="android:buttonBarPositiveButtonStyle">@style/PickerTextButton</item>
<item name="android:buttonBarNegativeButtonStyle">@style/PickerTextButton</item>
<item name="colorAccent">@color/dialog_title_background</item>
<item name="colorSecondary">@color/dialog_title_background</item>
<item name="android:textColorSecondary">@color/defaulttextcolor</item>
<item name="android:textColorPrimary">@color/defaulttextcolor</item>
<item name="android:textColor">@color/defaulttextcolor</item>
<item name="backgroundColor">@color/dateTimePickerBackground</item>
<item name="android:dialogCornerRadius">12dp</item>
</style>
<style name="MaterialDatePickerStyle" parent="Widget.MaterialComponents.MaterialCalendar">
<item name="android:calendarTextColor">@color/defaulttextcolor</item>
<item name="android:datePickerMode">calendar</item>
<item name="colorSecondary">@color/dialog_title_background</item>
<item name="android:background">@color/dateTimePickerBackground</item>
<item name="android:headerBackground">@color/dialog_title_background</item>
</style>
<style name="MaterialTimePickerStyle" parent="Widget.MaterialComponents.TimePicker">
<item name="android:numbersTextColor">@color/defaulttextcolor</item>
<item name="android:numbersSelectorColor">@color/white_alpha_40</item>
<item name="android:numbersBackgroundColor">@color/dialog_title_background</item>
<item name="android:background">@color/dateTimePickerBackground</item>
<item name="android:headerBackground">@color/dialog_title_background</item>
<item name="android:headerTimeTextAppearance">@color/defaulttextcolor</item>
<item name="android:timePickerMode">clock</item>
</style>
<style name="PickerTextButton" parent="Widget.MaterialComponents.Button.TextButton.Dialog"> <style name="PickerTextButton" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="android:textColor">@color/okButtonText</item> <item name="android:textColor">@color/okButtonText</item>
</style> </style>

View file

@ -295,35 +295,6 @@
<item name="android:textAllCaps">true</item> <item name="android:textAllCaps">true</item>
</style> </style>
<style name="MaterialPickerTheme" parent="Theme.MaterialComponents.Light.Dialog.Alert">
<item name="android:datePickerStyle">@style/MaterialDatePickerStyle</item>
<item name="android:timePickerStyle">@style/MaterialTimePickerStyle</item>
<item name="android:buttonBarPositiveButtonStyle">@style/PickerTextButton</item>
<item name="android:buttonBarNegativeButtonStyle">@style/PickerTextButton</item>
<item name="colorAccent">@color/dialog_title_background</item>
<item name="android:textColorSecondary">@color/defaulttextcolor</item>
<item name="android:textColorPrimary">@color/defaulttextcolor</item>
<item name="android:textColor">@color/defaulttextcolor</item>
<item name="android:dialogCornerRadius">12dp</item>
</style>
<style name="MaterialDatePickerStyle" parent="Widget.MaterialComponents.MaterialCalendar">
<item name="android:calendarTextColor">@color/defaulttextcolor</item>
<item name="android:datePickerMode">calendar</item>
<item name="android:background">@color/dateTimePickerBackground</item>
<item name="android:headerBackground">@color/dialog_title_background</item>
</style>
<style name="MaterialTimePickerStyle" parent="Widget.MaterialComponents.TimePicker">
<item name="android:numbersTextColor">@color/defaulttextcolor</item>
<item name="android:numbersSelectorColor">@color/white_alpha_40</item>
<item name="android:numbersBackgroundColor">@color/dialog_title_background</item>
<item name="android:background">@color/dateTimePickerBackground</item>
<item name="android:headerBackground">@color/dialog_title_background</item>
<item name="android:headerTimeTextAppearance">@color/defaulttextcolor</item>
<item name="android:timePickerMode">clock</item>
</style>
<style name="PickerTextButton" parent="Widget.MaterialComponents.Button.TextButton.Dialog"> <style name="PickerTextButton" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="android:textColor">@color/okButtonText</item> <item name="android:textColor">@color/okButtonText</item>
</style> </style>