1
0
mirror of https://github.com/etesync/android synced 2025-07-04 13:52:40 +00:00

Fix loading tasklist color in edit collection activity.

This commit is contained in:
Tom Hacohen 2019-01-29 23:05:36 +00:00
parent 18a00716f8
commit 96fc87cad4
2 changed files with 13 additions and 4 deletions

View File

@ -28,7 +28,7 @@ class LocalTaskList private constructor(
id: Long id: Long
): AndroidTaskList<LocalTask>(account, provider, LocalTask.Factory, id), LocalCollection<LocalTask> { ): AndroidTaskList<LocalTask>(account, provider, LocalTask.Factory, id), LocalCollection<LocalTask> {
companion object { companion object {
val defaultColor = -0x3c1592 // "DAVdroid green" val defaultColor = -0x743cb6 // light green 500
fun tasksProviderAvailable(context: Context): Boolean { fun tasksProviderAvailable(context: Context): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)

View File

@ -22,6 +22,7 @@ import com.etesync.syncadapter.R
import com.etesync.syncadapter.model.CollectionInfo import com.etesync.syncadapter.model.CollectionInfo
import com.etesync.syncadapter.model.JournalEntity import com.etesync.syncadapter.model.JournalEntity
import com.etesync.syncadapter.resource.LocalCalendar import com.etesync.syncadapter.resource.LocalCalendar
import com.etesync.syncadapter.resource.LocalTaskList
class EditCollectionActivity : CreateCollectionActivity() { class EditCollectionActivity : CreateCollectionActivity() {
@ -30,10 +31,18 @@ class EditCollectionActivity : CreateCollectionActivity() {
setTitle(R.string.edit_collection) setTitle(R.string.edit_collection)
if (info.type == CollectionInfo.Type.CALENDAR) { when (info.type) {
CollectionInfo.Type.CALENDAR -> {
val colorSquare = findViewById<View>(R.id.color) val colorSquare = findViewById<View>(R.id.color)
colorSquare.setBackgroundColor(info.color ?: LocalCalendar.defaultColor) colorSquare.setBackgroundColor(info.color ?: LocalCalendar.defaultColor)
} }
CollectionInfo.Type.TASKS -> {
val colorSquare = findViewById<View>(R.id.color)
colorSquare.setBackgroundColor(info.color ?: LocalTaskList.defaultColor)
}
CollectionInfo.Type.ADDRESS_BOOK -> {
}
}
val edit = findViewById<View>(R.id.display_name) as EditText val edit = findViewById<View>(R.id.display_name) as EditText
edit.setText(info.displayName) edit.setText(info.displayName)