mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 04:10:45 +01:00
update the event types color if theres just one and primary color changes
This commit is contained in:
parent
f5bec2fd8a
commit
5d690b8cc5
@ -12,6 +12,7 @@ import android.widget.ArrayAdapter
|
||||
import com.simplemobiletools.calendar.R
|
||||
import com.simplemobiletools.calendar.dialogs.EventReminderDialog
|
||||
import com.simplemobiletools.calendar.extensions.config
|
||||
import com.simplemobiletools.calendar.extensions.dbHelper
|
||||
import com.simplemobiletools.calendar.extensions.getReminderText
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
@ -23,6 +24,8 @@ class SettingsActivity : SimpleActivity() {
|
||||
private val REQUEST_ACCOUNT_NAME = 3
|
||||
private val REQUEST_GOOGLE_PLAY_SERVICES = 4
|
||||
|
||||
private var mStoredPrimaryColor = 0
|
||||
|
||||
companion object {
|
||||
val REQUEST_AUTHORIZATION = 5
|
||||
}
|
||||
@ -51,6 +54,24 @@ class SettingsActivity : SimpleActivity() {
|
||||
setupReminderSound()
|
||||
setupEventReminder()
|
||||
updateTextColors(settings_holder)
|
||||
checkPrimaryColor()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
mStoredPrimaryColor = config.primaryColor
|
||||
}
|
||||
|
||||
private fun checkPrimaryColor() {
|
||||
if (config.primaryColor != mStoredPrimaryColor) {
|
||||
dbHelper.getEventTypes {
|
||||
if (it.size == 1) {
|
||||
val eventType = it[0]
|
||||
eventType.color = config.primaryColor
|
||||
dbHelper.updateEventType(eventType)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupCustomizeColors() {
|
||||
|
@ -162,3 +162,5 @@ fun Context.launchNewEventIntent(startNewTask: Boolean = false, today: Boolean =
|
||||
fun Context.getNewEventTimestampFromCode(dayCode: String) = Formatter.getLocalDateTimeFromCode(dayCode).withTime(13, 0, 0, 0).seconds()
|
||||
|
||||
val Context.config: Config get() = Config.newInstance(this)
|
||||
|
||||
val Context.dbHelper: DBHelper get() = DBHelper.newInstance(this)
|
||||
|
Loading…
x
Reference in New Issue
Block a user