use adjusted primary color instead of primary at the only event type color
This commit is contained in:
parent
5ce9971fb0
commit
eaf440751a
|
@ -28,12 +28,12 @@ class SettingsActivity : SimpleActivity() {
|
||||||
private val GET_RINGTONE_URI = 1
|
private val GET_RINGTONE_URI = 1
|
||||||
private val PICK_IMPORT_SOURCE_INTENT = 2
|
private val PICK_IMPORT_SOURCE_INTENT = 2
|
||||||
|
|
||||||
private var mStoredPrimaryColor = 0
|
private var mStoredAdjustedPrimaryColor = 0
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_settings)
|
setContentView(R.layout.activity_settings)
|
||||||
mStoredPrimaryColor = config.primaryColor
|
mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
@ -85,7 +85,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
mStoredPrimaryColor = config.primaryColor
|
mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
|
@ -113,12 +113,12 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkPrimaryColor() {
|
private fun checkPrimaryColor() {
|
||||||
if (config.primaryColor != mStoredPrimaryColor) {
|
if (getAdjustedPrimaryColor() != mStoredAdjustedPrimaryColor) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val eventTypes = eventsHelper.getEventTypesSync()
|
val eventTypes = eventsHelper.getEventTypesSync()
|
||||||
if (eventTypes.filter { it.caldavCalendarId == 0 }.size == 1) {
|
if (eventTypes.filter { it.caldavCalendarId == 0 }.size == 1) {
|
||||||
val eventType = eventTypes.first { it.caldavCalendarId == 0 }
|
val eventType = eventTypes.first { it.caldavCalendarId == 0 }
|
||||||
eventType.color = config.primaryColor
|
eventType.color = getAdjustedPrimaryColor()
|
||||||
eventsHelper.insertOrUpdateEventTypeSync(eventType)
|
eventsHelper.insertOrUpdateEventTypeSync(eventType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue