fix the theme at date and timepicker dialogs on android 7
This commit is contained in:
parent
ff1f7162db
commit
1ba39edc37
|
@ -22,6 +22,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
private var mWasReminderInit = false
|
private var mWasReminderInit = false
|
||||||
private var mWasEndDateSet = false
|
private var mWasEndDateSet = false
|
||||||
private var mWasEndTimeSet = false
|
private var mWasEndTimeSet = false
|
||||||
|
private var mDialogTheme = 0
|
||||||
|
|
||||||
lateinit var mEventStartDateTime: DateTime
|
lateinit var mEventStartDateTime: DateTime
|
||||||
lateinit var mEventEndDateTime: DateTime
|
lateinit var mEventEndDateTime: DateTime
|
||||||
|
@ -32,6 +33,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
setContentView(R.layout.activity_event)
|
setContentView(R.layout.activity_event)
|
||||||
|
|
||||||
val intent = intent ?: return
|
val intent = intent ?: return
|
||||||
|
mDialogTheme = if (mConfig.isDarkTheme) R.style.DialogTheme_Dark else R.style.DialogTheme
|
||||||
|
|
||||||
mWasReminderInit = false
|
mWasReminderInit = false
|
||||||
val eventId = intent.getIntExtra(EVENT_ID, 0)
|
val eventId = intent.getIntExtra(EVENT_ID, 0)
|
||||||
|
@ -303,21 +305,21 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setupStartDate() {
|
fun setupStartDate() {
|
||||||
DatePickerDialog(this, startDateSetListener, mEventStartDateTime.year, mEventStartDateTime.monthOfYear - 1,
|
DatePickerDialog(this, mDialogTheme, startDateSetListener, mEventStartDateTime.year, mEventStartDateTime.monthOfYear - 1,
|
||||||
mEventStartDateTime.dayOfMonth).show()
|
mEventStartDateTime.dayOfMonth).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setupStartTime() {
|
fun setupStartTime() {
|
||||||
TimePickerDialog(this, startTimeSetListener, mEventStartDateTime.hourOfDay, mEventStartDateTime.minuteOfHour, true).show()
|
TimePickerDialog(this, mDialogTheme, startTimeSetListener, mEventStartDateTime.hourOfDay, mEventStartDateTime.minuteOfHour, true).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setupEndDate() {
|
fun setupEndDate() {
|
||||||
DatePickerDialog(this, endDateSetListener, mEventEndDateTime.year, mEventEndDateTime.monthOfYear - 1,
|
DatePickerDialog(this, mDialogTheme, endDateSetListener, mEventEndDateTime.year, mEventEndDateTime.monthOfYear - 1,
|
||||||
mEventEndDateTime.dayOfMonth).show()
|
mEventEndDateTime.dayOfMonth).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setupEndTime() {
|
fun setupEndTime() {
|
||||||
TimePickerDialog(this, endTimeSetListener, mEventEndDateTime.hourOfDay, mEventEndDateTime.minuteOfHour, true).show()
|
TimePickerDialog(this, mDialogTheme, endTimeSetListener, mEventEndDateTime.hourOfDay, mEventEndDateTime.minuteOfHour, true).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val startDateSetListener = DatePickerDialog.OnDateSetListener { view, year, monthOfYear, dayOfMonth ->
|
private val startDateSetListener = DatePickerDialog.OnDateSetListener { view, year, monthOfYear, dayOfMonth ->
|
||||||
|
|
|
@ -8,4 +8,5 @@
|
||||||
<color name="activated_item_foreground">#44888888</color>
|
<color name="activated_item_foreground">#44888888</color>
|
||||||
<color name="mediumGrey">#18000000</color>
|
<color name="mediumGrey">#18000000</color>
|
||||||
<color name="divider_grey">#44cccccc</color>
|
<color name="divider_grey">#44cccccc</color>
|
||||||
|
<color name="dark_theme_dialog_background">#ff333333</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -56,6 +56,15 @@
|
||||||
|
|
||||||
<style name="MyAlertDialog.Dark" parent="Base.Theme.AppCompat.Dialog.Alert"/>
|
<style name="MyAlertDialog.Dark" parent="Base.Theme.AppCompat.Dialog.Alert"/>
|
||||||
|
|
||||||
|
<style name="DialogTheme" parent="Theme.AppCompat.Light.Dialog">
|
||||||
|
<item name="colorAccent">@color/colorPrimary</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="DialogTheme.Dark" parent="Theme.AppCompat.Dialog">
|
||||||
|
<item name="android:windowBackground">@color/dark_theme_dialog_background</item>
|
||||||
|
<item name="colorAccent">@color/colorPrimary</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.ActionBarStyle" parent="@style/Base.Widget.AppCompat.ActionBar">
|
<style name="AppTheme.ActionBarStyle" parent="@style/Base.Widget.AppCompat.ActionBar">
|
||||||
<item name="background">@color/colorPrimary</item>
|
<item name="background">@color/colorPrimary</item>
|
||||||
<item name="titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item>
|
<item name="titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item>
|
||||||
|
|
Loading…
Reference in New Issue