fixing some glitches related to transparent event type color

This commit is contained in:
tibbi 2018-10-24 16:40:46 +02:00
parent 97bc9ec85b
commit ee506ecc4e
3 changed files with 9 additions and 9 deletions

View File

@ -42,7 +42,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.2.1'
implementation 'com.simplemobiletools:commons:5.2.2'
implementation 'joda-time:joda-time:2.9.9'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'androidx.multidex:multidex:2.0.0'

View File

@ -56,8 +56,9 @@ class SelectEventCalendarDialog(val activity: Activity, val calendars: List<CalD
id = typeId
}
if (color != Color.TRANSPARENT)
if (typeId != STORED_LOCALLY_ONLY) {
view.dialog_radio_color.setFillWithStroke(color, activity.config.backgroundColor)
}
view.setOnClickListener { viewClicked(typeId) }
radioGroup.addView(view, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))

View File

@ -1,11 +1,10 @@
package com.simplemobiletools.calendar.dialogs
import android.app.Activity
import android.graphics.Color
import androidx.appcompat.app.AlertDialog
import android.view.ViewGroup
import android.widget.RadioButton
import android.widget.RadioGroup
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.extensions.config
import com.simplemobiletools.calendar.helpers.CalDAVHandler
@ -39,15 +38,15 @@ class SelectEventTypeColorDialog(val activity: Activity, val eventType: EventTyp
private fun addRadioButton(colorKey: Int, color: Int) {
val view = activity.layoutInflater.inflate(R.layout.radio_button_with_color, null)
(view.dialog_radio_button as RadioButton).apply {
text = String.format("#%06X", 0xFFFFFF and color)
text = if (color == 0) activity.getString(R.string.transparent) else String.format("#%06X", 0xFFFFFF and color)
isChecked = color == eventType.color
id = colorKey
}
if (color != Color.TRANSPARENT)
view.dialog_radio_color.setFillWithStroke(color, activity.config.backgroundColor)
view.setOnClickListener { viewClicked(colorKey) }
view.dialog_radio_color.setFillWithStroke(color, activity.config.backgroundColor)
view.setOnClickListener {
viewClicked(colorKey)
}
radioGroup.addView(view, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
}