use rounded corners at event type pickers

This commit is contained in:
tibbi 2020-12-07 22:22:45 +01:00
parent 948a99a5d5
commit 4e7575eb76
9 changed files with 18 additions and 14 deletions

View file

@ -64,7 +64,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.32.6' implementation 'com.simplemobiletools:commons:5.32.7'
implementation 'joda-time:joda-time:2.10.1' implementation 'joda-time:joda-time:2.10.1'
implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

View file

@ -868,7 +868,7 @@ class EventActivity : SimpleActivity() {
if (eventType != null) { if (eventType != null) {
runOnUiThread { runOnUiThread {
event_type.text = eventType.title event_type.text = eventType.title
event_type_color.setFillWithStroke(eventType.color, config.backgroundColor) event_type_color.setFillWithStroke(eventType.color, config.backgroundColor, getCornerRadius())
} }
} }
} }
@ -933,7 +933,7 @@ class EventActivity : SimpleActivity() {
val calendarColor = eventsHelper.getEventTypeWithCalDAVCalendarId(currentCalendar.id)?.color ?: currentCalendar.color val calendarColor = eventsHelper.getEventTypeWithCalDAVCalendarId(currentCalendar.id)?.color ?: currentCalendar.color
runOnUiThread { runOnUiThread {
event_caldav_calendar_color.setFillWithStroke(calendarColor, config.backgroundColor) event_caldav_calendar_color.setFillWithStroke(calendarColor, config.backgroundColor, getCornerRadius())
event_caldav_calendar_name.apply { event_caldav_calendar_name.apply {
text = currentCalendar.displayName text = currentCalendar.displayName
setPadding(paddingLeft, paddingTop, paddingRight, resources.getDimension(R.dimen.tiny_margin).toInt()) setPadding(paddingLeft, paddingTop, paddingRight, resources.getDimension(R.dimen.tiny_margin).toInt())

View file

@ -8,12 +8,14 @@ import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.models.EventType import com.simplemobiletools.calendar.pro.models.EventType
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.getCornerRadius
import com.simplemobiletools.commons.extensions.setFillWithStroke import com.simplemobiletools.commons.extensions.setFillWithStroke
import kotlinx.android.synthetic.main.filter_event_type_view.view.* import kotlinx.android.synthetic.main.filter_event_type_view.view.*
import java.util.* import java.util.*
class FilterEventTypeAdapter(val activity: SimpleActivity, val eventTypes: List<EventType>, val displayEventTypes: Set<String>) : class FilterEventTypeAdapter(val activity: SimpleActivity, val eventTypes: List<EventType>, val displayEventTypes: Set<String>) :
RecyclerView.Adapter<FilterEventTypeAdapter.ViewHolder>() { RecyclerView.Adapter<FilterEventTypeAdapter.ViewHolder>() {
private val cornerRadius = activity.getCornerRadius()
private val selectedKeys = HashSet<Long>() private val selectedKeys = HashSet<Long>()
init { init {
@ -55,7 +57,7 @@ class FilterEventTypeAdapter(val activity: SimpleActivity, val eventTypes: List<
filter_event_type_checkbox.isChecked = isSelected filter_event_type_checkbox.isChecked = isSelected
filter_event_type_checkbox.setColors(activity.config.textColor, activity.getAdjustedPrimaryColor(), activity.config.backgroundColor) filter_event_type_checkbox.setColors(activity.config.textColor, activity.getAdjustedPrimaryColor(), activity.config.backgroundColor)
filter_event_type_checkbox.text = eventType.getDisplayTitle() filter_event_type_checkbox.text = eventType.getDisplayTitle()
filter_event_type_color.setFillWithStroke(eventType.color, activity.config.backgroundColor) filter_event_type_color.setFillWithStroke(eventType.color, activity.config.backgroundColor, cornerRadius)
filter_event_type_holder.setOnClickListener { viewClicked(!isSelected, eventType) } filter_event_type_holder.setOnClickListener { viewClicked(!isSelected, eventType) }
} }

View file

@ -13,6 +13,7 @@ import com.simplemobiletools.calendar.pro.models.EventType
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.getCornerRadius
import com.simplemobiletools.commons.extensions.setFillWithStroke import com.simplemobiletools.commons.extensions.setFillWithStroke
import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
@ -22,6 +23,7 @@ import java.util.*
class ManageEventTypesAdapter(activity: SimpleActivity, val eventTypes: ArrayList<EventType>, val listener: DeleteEventTypesListener?, recyclerView: MyRecyclerView, class ManageEventTypesAdapter(activity: SimpleActivity, val eventTypes: ArrayList<EventType>, val listener: DeleteEventTypesListener?, recyclerView: MyRecyclerView,
itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) { itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) {
private val cornerRadius = activity.getCornerRadius()
init { init {
setupDragListener(true) setupDragListener(true)
@ -69,7 +71,7 @@ class ManageEventTypesAdapter(activity: SimpleActivity, val eventTypes: ArrayLis
view.apply { view.apply {
event_item_frame.isSelected = selectedKeys.contains(eventType.id?.toInt()) event_item_frame.isSelected = selectedKeys.contains(eventType.id?.toInt())
event_type_title.text = eventType.getDisplayTitle() event_type_title.text = eventType.getDisplayTitle()
event_type_color.setFillWithStroke(eventType.color, activity.config.backgroundColor) event_type_color.setFillWithStroke(eventType.color, activity.config.backgroundColor, cornerRadius)
event_type_title.setTextColor(textColor) event_type_title.setTextColor(textColor)
} }
} }

View file

@ -55,7 +55,7 @@ class EditEventTypeDialog(val activity: Activity, var eventType: EventType? = nu
} }
private fun setupColor(view: ImageView) { private fun setupColor(view: ImageView) {
view.setFillWithStroke(eventType!!.color, activity.config.backgroundColor) view.setFillWithStroke(eventType!!.color, activity.config.backgroundColor, activity.getCornerRadius())
} }
private fun eventTypeConfirmed(title: String, dialog: AlertDialog) { private fun eventTypeConfirmed(title: String, dialog: AlertDialog) {

View file

@ -10,6 +10,7 @@ import com.simplemobiletools.calendar.pro.extensions.eventsHelper
import com.simplemobiletools.calendar.pro.helpers.IcsImporter import com.simplemobiletools.calendar.pro.helpers.IcsImporter
import com.simplemobiletools.calendar.pro.helpers.IcsImporter.ImportResult.* import com.simplemobiletools.calendar.pro.helpers.IcsImporter.ImportResult.*
import com.simplemobiletools.calendar.pro.helpers.REGULAR_EVENT_TYPE_ID import com.simplemobiletools.calendar.pro.helpers.REGULAR_EVENT_TYPE_ID
import com.simplemobiletools.commons.extensions.getCornerRadius
import com.simplemobiletools.commons.extensions.setFillWithStroke import com.simplemobiletools.commons.extensions.setFillWithStroke
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.toast
@ -86,7 +87,7 @@ class ImportEventsDialog(val activity: SimpleActivity, val path: String, val cal
val eventType = activity.eventTypesDB.getEventTypeWithId(currEventTypeId) val eventType = activity.eventTypesDB.getEventTypeWithId(currEventTypeId)
activity.runOnUiThread { activity.runOnUiThread {
view.import_event_type_title.text = eventType!!.getDisplayTitle() view.import_event_type_title.text = eventType!!.getDisplayTitle()
view.import_event_type_color.setFillWithStroke(eventType.color, activity.config.backgroundColor) view.import_event_type_color.setFillWithStroke(eventType.color, activity.config.backgroundColor, activity.getCornerRadius())
} }
} }
} }

View file

@ -11,6 +11,7 @@ import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.extensions.eventsHelper import com.simplemobiletools.calendar.pro.extensions.eventsHelper
import com.simplemobiletools.calendar.pro.helpers.STORED_LOCALLY_ONLY import com.simplemobiletools.calendar.pro.helpers.STORED_LOCALLY_ONLY
import com.simplemobiletools.calendar.pro.models.CalDAVCalendar import com.simplemobiletools.calendar.pro.models.CalDAVCalendar
import com.simplemobiletools.commons.extensions.getCornerRadius
import com.simplemobiletools.commons.extensions.setFillWithStroke import com.simplemobiletools.commons.extensions.setFillWithStroke
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.extensions.updateTextColors
@ -60,7 +61,7 @@ class SelectEventCalendarDialog(val activity: Activity, val calendars: List<CalD
} }
if (typeId != STORED_LOCALLY_ONLY) { if (typeId != STORED_LOCALLY_ONLY) {
view.dialog_radio_color.setFillWithStroke(color, activity.config.backgroundColor) view.dialog_radio_color.setFillWithStroke(color, activity.config.backgroundColor, activity.getCornerRadius())
} }
view.setOnClickListener { viewClicked(typeId) } view.setOnClickListener { viewClicked(typeId) }

View file

@ -10,6 +10,7 @@ import com.simplemobiletools.calendar.pro.extensions.calDAVHelper
import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.models.EventType import com.simplemobiletools.calendar.pro.models.EventType
import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.extensions.getCornerRadius
import com.simplemobiletools.commons.extensions.setFillWithStroke import com.simplemobiletools.commons.extensions.setFillWithStroke
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import kotlinx.android.synthetic.main.dialog_select_event_type_color.view.* import kotlinx.android.synthetic.main.dialog_select_event_type_color.view.*
@ -51,7 +52,7 @@ class SelectEventTypeColorDialog(val activity: Activity, val eventType: EventTyp
id = colorKey id = colorKey
} }
view.dialog_radio_color.setFillWithStroke(color, activity.config.backgroundColor) view.dialog_radio_color.setFillWithStroke(color, activity.config.backgroundColor, activity.getCornerRadius())
view.setOnClickListener { view.setOnClickListener {
viewClicked(colorKey) viewClicked(colorKey)
} }

View file

@ -9,10 +9,7 @@ import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.extensions.eventsHelper import com.simplemobiletools.calendar.pro.extensions.eventsHelper
import com.simplemobiletools.calendar.pro.models.EventType import com.simplemobiletools.calendar.pro.models.EventType
import com.simplemobiletools.commons.extensions.hideKeyboard import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.setFillWithStroke
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.views.MyCompatRadioButton import com.simplemobiletools.commons.views.MyCompatRadioButton
import kotlinx.android.synthetic.main.dialog_select_radio_group.view.* import kotlinx.android.synthetic.main.dialog_select_radio_group.view.*
import kotlinx.android.synthetic.main.radio_button_with_color.view.* import kotlinx.android.synthetic.main.radio_button_with_color.view.*
@ -66,7 +63,7 @@ class SelectEventTypeDialog(val activity: Activity, val currEventType: Long, val
} }
if (eventType.color != Color.TRANSPARENT) { if (eventType.color != Color.TRANSPARENT) {
view.dialog_radio_color.setFillWithStroke(eventType.color, activity.config.backgroundColor) view.dialog_radio_color.setFillWithStroke(eventType.color, activity.config.backgroundColor, activity.getCornerRadius())
} }
view.setOnClickListener { viewClicked(eventType) } view.setOnClickListener { viewClicked(eventType) }