use the new way of fetching colors
This commit is contained in:
parent
267a469bc3
commit
76a578077d
33 changed files with 96 additions and 108 deletions
|
@ -46,7 +46,6 @@ import org.joda.time.DateTime
|
|||
import org.joda.time.DateTimeZone
|
||||
import java.util.*
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class EventActivity : SimpleActivity() {
|
||||
private val LAT_LON_PATTERN = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)([,;])\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)\$"
|
||||
|
@ -875,13 +874,13 @@ class EventActivity : SimpleActivity() {
|
|||
private fun updateReminderTypeImage(view: ImageView, reminder: Reminder) {
|
||||
view.beVisibleIf(reminder.minutes != REMINDER_OFF && mEventCalendarId != STORED_LOCALLY_ONLY)
|
||||
val drawable = if (reminder.type == REMINDER_NOTIFICATION) R.drawable.ic_bell_vector else R.drawable.ic_mail_vector
|
||||
val icon = resources.getColoredDrawableWithColor(drawable, config.textColor)
|
||||
val icon = resources.getColoredDrawableWithColor(drawable, getProperTextColor())
|
||||
view.setImageDrawable(icon)
|
||||
}
|
||||
|
||||
private fun updateAvailabilityImage() {
|
||||
val drawable = if (mAvailability == Attendees.AVAILABILITY_FREE) R.drawable.ic_event_available_vector else R.drawable.ic_event_busy_vector
|
||||
val icon = resources.getColoredDrawableWithColor(drawable, config.textColor)
|
||||
val icon = resources.getColoredDrawableWithColor(drawable, getProperTextColor())
|
||||
event_availability_image.setImageDrawable(icon)
|
||||
}
|
||||
|
||||
|
@ -899,7 +898,7 @@ class EventActivity : SimpleActivity() {
|
|||
if (eventType != null) {
|
||||
runOnUiThread {
|
||||
event_type.text = eventType.title
|
||||
event_type_color.setFillWithStroke(eventType.color, config.backgroundColor)
|
||||
event_type_color.setFillWithStroke(eventType.color, getProperBackgroundColor())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -967,7 +966,7 @@ class EventActivity : SimpleActivity() {
|
|||
val calendarColor = eventsHelper.getEventTypeWithCalDAVCalendarId(currentCalendar.id)?.color ?: currentCalendar.color
|
||||
|
||||
runOnUiThread {
|
||||
event_caldav_calendar_color.setFillWithStroke(calendarColor, config.backgroundColor)
|
||||
event_caldav_calendar_color.setFillWithStroke(calendarColor, getProperBackgroundColor())
|
||||
event_caldav_calendar_name.apply {
|
||||
text = currentCalendar.displayName
|
||||
setPadding(paddingLeft, paddingTop, paddingRight, resources.getDimension(R.dimen.tiny_margin).toInt())
|
||||
|
@ -1276,7 +1275,7 @@ class EventActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun checkStartEndValidity() {
|
||||
val textColor = if (mEventStartDateTime.isAfter(mEventEndDateTime)) resources.getColor(R.color.red_text) else config.textColor
|
||||
val textColor = if (mEventStartDateTime.isAfter(mEventEndDateTime)) resources.getColor(R.color.red_text) else getProperTextColor()
|
||||
event_end_date.setTextColor(textColor)
|
||||
event_end_time.setTextColor(textColor)
|
||||
}
|
||||
|
@ -1523,7 +1522,8 @@ class EventActivity : SimpleActivity() {
|
|||
beVisible()
|
||||
|
||||
val attendeeStatusBackground = resources.getDrawable(R.drawable.attendee_status_circular_background)
|
||||
(attendeeStatusBackground as LayerDrawable).findDrawableByLayerId(R.id.attendee_status_circular_background).applyColorFilter(config.backgroundColor)
|
||||
(attendeeStatusBackground as LayerDrawable).findDrawableByLayerId(R.id.attendee_status_circular_background)
|
||||
.applyColorFilter(getProperBackgroundColor())
|
||||
event_contact_status_image.apply {
|
||||
background = attendeeStatusBackground
|
||||
setImageDrawable(getAttendeeStatusImage(attendee))
|
||||
|
@ -1687,7 +1687,7 @@ class EventActivity : SimpleActivity() {
|
|||
|
||||
private fun updateIconColors() {
|
||||
event_show_on_map.applyColorFilter(getProperPrimaryColor())
|
||||
val textColor = config.textColor
|
||||
val textColor = getProperTextColor()
|
||||
arrayOf(
|
||||
event_time_image, event_time_zone_image, event_repetition_image, event_reminder_image, event_type_image, event_caldav_calendar_image,
|
||||
event_reminder_1_type, event_reminder_2_type, event_reminder_3_type, event_attendees_image, event_availability_image
|
||||
|
|
|
@ -154,7 +154,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredPrimaryColor != getProperPrimaryColor()
|
||||
if (mStoredTextColor != getProperTextColor() || mStoredBackgroundColor != getProperBackgroundColor() || mStoredPrimaryColor != getProperPrimaryColor()
|
||||
|| mStoredDayCode != Formatter.getTodayCode() || mStoredDimPastEvents != config.dimPastEvents || mStoredHighlightWeekends != config.highlightWeekends
|
||||
|| mStoredHighlightWeekendsColor != config.highlightWeekendsColor
|
||||
) {
|
||||
|
@ -179,14 +179,14 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
storeStateVariables()
|
||||
updateWidgets()
|
||||
updateTextColors(calendar_coordinator)
|
||||
fab_extended_overlay.background = ColorDrawable(config.backgroundColor.adjustAlpha(0.8f))
|
||||
fab_event_label.setTextColor(config.textColor)
|
||||
fab_task_label.setTextColor(config.textColor)
|
||||
fab_extended_overlay.background = ColorDrawable(getProperBackgroundColor().adjustAlpha(0.8f))
|
||||
fab_event_label.setTextColor(getProperTextColor())
|
||||
fab_task_label.setTextColor(getProperTextColor())
|
||||
|
||||
fab_task_icon.drawable.applyColorFilter(mStoredPrimaryColor.getContrastColor())
|
||||
fab_task_icon.background.applyColorFilter(mStoredPrimaryColor)
|
||||
|
||||
search_holder.background = ColorDrawable(config.backgroundColor)
|
||||
search_holder.background = ColorDrawable(getProperBackgroundColor())
|
||||
checkSwipeRefreshAvailability()
|
||||
checkShortcuts()
|
||||
|
||||
|
@ -292,10 +292,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
}
|
||||
|
||||
private fun storeStateVariables() {
|
||||
mStoredTextColor = getProperTextColor()
|
||||
mStoredPrimaryColor = getProperPrimaryColor()
|
||||
mStoredBackgroundColor = getProperBackgroundColor()
|
||||
config.apply {
|
||||
mStoredIsSundayFirst = isSundayFirst
|
||||
mStoredTextColor = textColor
|
||||
mStoredBackgroundColor = backgroundColor
|
||||
mStoredUse24HourFormat = use24HourFormat
|
||||
mStoredDimPastEvents = dimPastEvents
|
||||
mStoredHighlightWeekends = highlightWeekends
|
||||
|
@ -303,7 +304,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
mStoredMidnightSpan = showMidnightSpanningEventsAtTop
|
||||
mStoredStartWeekWithCurrentDay = startWeekWithCurrentDay
|
||||
}
|
||||
mStoredPrimaryColor = getProperPrimaryColor()
|
||||
mStoredDayCode = Formatter.getTodayCode()
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
settings_events_holder,
|
||||
settings_migrating_holder
|
||||
).forEach {
|
||||
it.background.applyColorFilter(baseConfig.backgroundColor.getContrastColor())
|
||||
it.background.applyColorFilter(getProperBackgroundColor().getContrastColor())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,12 +373,12 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun setupHighlightWeekendsColor() {
|
||||
settings_highlight_weekends_color.setFillWithStroke(config.highlightWeekendsColor, config.backgroundColor)
|
||||
settings_highlight_weekends_color.setFillWithStroke(config.highlightWeekendsColor, getProperBackgroundColor())
|
||||
settings_highlight_weekends_color_holder.setOnClickListener {
|
||||
ColorPickerDialog(this, config.highlightWeekendsColor) { wasPositivePressed, color ->
|
||||
if (wasPositivePressed) {
|
||||
config.highlightWeekendsColor = color
|
||||
settings_highlight_weekends_color.setFillWithStroke(color, config.backgroundColor)
|
||||
settings_highlight_weekends_color.setFillWithStroke(color, getProperBackgroundColor())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,12 +18,7 @@ import com.simplemobiletools.calendar.pro.models.Event
|
|||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import kotlinx.android.synthetic.main.activity_event.*
|
||||
import kotlinx.android.synthetic.main.activity_task.*
|
||||
import kotlinx.android.synthetic.main.activity_task.event_type
|
||||
import kotlinx.android.synthetic.main.activity_task.event_type_color
|
||||
import kotlinx.android.synthetic.main.activity_task.event_type_holder
|
||||
import kotlinx.android.synthetic.main.activity_task.event_type_image
|
||||
import org.joda.time.DateTime
|
||||
import java.util.*
|
||||
|
||||
|
@ -282,7 +277,7 @@ class TaskActivity : SimpleActivity() {
|
|||
if (mTask.isTaskCompleted()) {
|
||||
toggle_mark_complete.background = ContextCompat.getDrawable(this, R.drawable.button_background_stroke)
|
||||
toggle_mark_complete.setText(R.string.mark_incomplete)
|
||||
toggle_mark_complete.setTextColor(config.textColor)
|
||||
toggle_mark_complete.setTextColor(getProperTextColor())
|
||||
} else {
|
||||
val markCompleteBgColor = if (isWhiteTheme()) {
|
||||
Color.WHITE
|
||||
|
@ -321,7 +316,7 @@ class TaskActivity : SimpleActivity() {
|
|||
if (eventType != null) {
|
||||
runOnUiThread {
|
||||
event_type.text = eventType.title
|
||||
event_type_color.setFillWithStroke(eventType.color, config.backgroundColor)
|
||||
event_type_color.setFillWithStroke(eventType.color, getProperBackgroundColor())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +324,7 @@ class TaskActivity : SimpleActivity() {
|
|||
|
||||
private fun updateColors() {
|
||||
updateTextColors(task_scrollview)
|
||||
task_time_image.applyColorFilter(config.textColor)
|
||||
event_type_image.applyColorFilter(config.textColor)
|
||||
task_time_image.applyColorFilter(getProperTextColor())
|
||||
event_type_image.applyColorFilter(getProperTextColor())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.simplemobiletools.calendar.pro.helpers.MyWidgetDateProvider
|
|||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
||||
import com.simplemobiletools.commons.helpers.LOWER_ALPHA
|
||||
import kotlinx.android.synthetic.main.widget_config_date.*
|
||||
|
@ -113,7 +114,7 @@ class WidgetDateConfigureActivity : SimpleActivity() {
|
|||
private fun updateColors() {
|
||||
mTextColor = mTextColorWithoutTransparency
|
||||
mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOWER_ALPHA)
|
||||
mPrimaryColor = config.primaryColor
|
||||
mPrimaryColor = getProperPrimaryColor()
|
||||
|
||||
config_text_color.setFillWithStroke(mTextColor, Color.BLACK)
|
||||
config_save.setTextColor(mTextColor)
|
||||
|
|
|
@ -13,8 +13,10 @@ import com.simplemobiletools.calendar.pro.dialogs.CustomPeriodPickerDialog
|
|||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.seconds
|
||||
import com.simplemobiletools.calendar.pro.extensions.widgetsDB
|
||||
import com.simplemobiletools.calendar.pro.helpers.*
|
||||
import com.simplemobiletools.calendar.pro.helpers.EVENT_PERIOD_CUSTOM
|
||||
import com.simplemobiletools.calendar.pro.helpers.EVENT_PERIOD_TODAY
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.helpers.MyWidgetListProvider
|
||||
import com.simplemobiletools.calendar.pro.models.ListEvent
|
||||
import com.simplemobiletools.calendar.pro.models.ListItem
|
||||
import com.simplemobiletools.calendar.pro.models.ListSectionDay
|
||||
|
@ -56,7 +58,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
config_events_list.adapter = this
|
||||
}
|
||||
|
||||
period_picker_holder.background = ColorDrawable(config.backgroundColor)
|
||||
period_picker_holder.background = ColorDrawable(getProperBackgroundColor())
|
||||
period_picker_value.setOnClickListener { showPeriodSelector() }
|
||||
|
||||
config_save.setOnClickListener { saveConfig() }
|
||||
|
@ -65,7 +67,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
|
||||
period_picker_holder.beGoneIf(isCustomizingColors)
|
||||
|
||||
val primaryColor = config.primaryColor
|
||||
val primaryColor = getProperPrimaryColor()
|
||||
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
|
||||
|
||||
updateSelectedPeriod(config.lastUsedEventSpan)
|
||||
|
@ -230,7 +232,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
getString(R.string.sample_title_1),
|
||||
getString(R.string.sample_description_1),
|
||||
false,
|
||||
config.primaryColor,
|
||||
getProperPrimaryColor(),
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
|
@ -247,7 +249,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
getString(R.string.sample_title_2),
|
||||
getString(R.string.sample_description_2),
|
||||
false,
|
||||
config.primaryColor,
|
||||
getProperPrimaryColor(),
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
|
@ -270,7 +272,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
getString(R.string.sample_title_3),
|
||||
"",
|
||||
false,
|
||||
config.primaryColor,
|
||||
getProperPrimaryColor(),
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
|
@ -287,7 +289,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
getString(R.string.sample_title_4),
|
||||
getString(R.string.sample_description_4),
|
||||
false,
|
||||
config.primaryColor,
|
||||
getProperPrimaryColor(),
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
|
@ -304,7 +306,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
|||
getString(R.string.sample_title_5),
|
||||
"",
|
||||
false,
|
||||
config.primaryColor,
|
||||
getProperPrimaryColor(),
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
|
|
|
@ -19,10 +19,7 @@ import com.simplemobiletools.calendar.pro.helpers.isWeekend
|
|||
import com.simplemobiletools.calendar.pro.interfaces.MonthlyCalendar
|
||||
import com.simplemobiletools.calendar.pro.models.DayMonthly
|
||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.beVisible
|
||||
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.LOWER_ALPHA
|
||||
import kotlinx.android.synthetic.main.first_row.*
|
||||
import kotlinx.android.synthetic.main.top_navigation.*
|
||||
|
@ -131,7 +128,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
private fun updateColors() {
|
||||
mTextColor = mTextColorWithoutTransparency
|
||||
mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOWER_ALPHA)
|
||||
mPrimaryColor = config.primaryColor
|
||||
mPrimaryColor = getProperPrimaryColor()
|
||||
mWeekendsTextColor = config.highlightWeekendsColor
|
||||
mHighlightWeekends = config.highlightWeekends
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
|||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
|
@ -73,7 +74,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
|
|||
textColor = if (isPrintVersion) {
|
||||
resources.getColor(R.color.theme_light_text_color)
|
||||
} else {
|
||||
baseConfig.textColor
|
||||
activity.getProperTextColor()
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.simplemobiletools.calendar.pro.activities.SimpleActivity
|
|||
import com.simplemobiletools.calendar.pro.dialogs.DeleteEventDialog
|
||||
import com.simplemobiletools.calendar.pro.extensions.*
|
||||
import com.simplemobiletools.calendar.pro.helpers.*
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.models.ListEvent
|
||||
import com.simplemobiletools.calendar.pro.models.ListItem
|
||||
import com.simplemobiletools.calendar.pro.models.ListSectionDay
|
||||
|
@ -18,13 +17,13 @@ import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
|||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import kotlinx.android.synthetic.main.event_list_item.view.*
|
||||
import kotlinx.android.synthetic.main.event_list_section_day.view.*
|
||||
import java.util.*
|
||||
|
||||
class EventListAdapter(
|
||||
activity: SimpleActivity, var listItems: ArrayList<ListItem>, val allowLongClick: Boolean, val listener: RefreshRecyclerViewListener?,
|
||||
|
@ -123,7 +122,7 @@ class EventListAdapter(
|
|||
textColor = if (isPrintVersion) {
|
||||
resources.getColor(R.color.theme_light_text_color)
|
||||
} else {
|
||||
baseConfig.textColor
|
||||
activity.getProperTextColor()
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.simplemobiletools.calendar.pro.models.EventType
|
|||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
|
@ -70,7 +71,7 @@ class ManageEventTypesAdapter(
|
|||
view.apply {
|
||||
event_item_frame.isSelected = selectedKeys.contains(eventType.id?.toInt())
|
||||
event_type_title.text = eventType.getDisplayTitle()
|
||||
event_type_color.setFillWithStroke(eventType.color, activity.config.backgroundColor)
|
||||
event_type_color.setFillWithStroke(eventType.color, activity.getProperBackgroundColor())
|
||||
event_type_title.setTextColor(textColor)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.simplemobiletools.calendar.pro.activities.SimpleActivity
|
|||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.models.EventType
|
||||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.helpers.LOWER_ALPHA
|
||||
import kotlinx.android.synthetic.main.quick_filter_event_type_view.view.*
|
||||
import java.util.*
|
||||
|
@ -23,7 +24,7 @@ class QuickFilterEventTypeAdapter(
|
|||
private val quickFilterEventTypes = ArrayList<EventType>()
|
||||
private val displayEventTypes = activity.config.displayEventTypes
|
||||
|
||||
private val textColorActive = activity.config.textColor
|
||||
private val textColorActive = activity.getProperTextColor()
|
||||
private val textColorInactive = textColorActive.adjustAlpha(LOWER_ALPHA)
|
||||
|
||||
private val minItemWidth = activity.resources.getDimensionPixelSize(R.dimen.quick_filter_min_width)
|
||||
|
|
|
@ -5,14 +5,13 @@ import android.view.ViewGroup
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.models.MyTimeZone
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import kotlinx.android.synthetic.main.item_select_time_zone.view.*
|
||||
import java.util.*
|
||||
|
||||
class SelectTimeZoneAdapter(val activity: SimpleActivity, var timeZones: ArrayList<MyTimeZone>, val itemClick: (Any) -> Unit) :
|
||||
RecyclerView.Adapter<SelectTimeZoneAdapter.ViewHolder>() {
|
||||
val textColor = activity.config.textColor
|
||||
RecyclerView.Adapter<SelectTimeZoneAdapter.ViewHolder>() {
|
||||
val textColor = activity.getProperTextColor()
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = activity.layoutInflater.inflate(R.layout.item_select_time_zone, parent, false)
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.simplemobiletools.calendar.pro.interfaces.WidgetsDao
|
|||
import com.simplemobiletools.calendar.pro.models.Event
|
||||
import com.simplemobiletools.calendar.pro.models.EventType
|
||||
import com.simplemobiletools.calendar.pro.models.Widget
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
@Database(entities = [Event::class, EventType::class, Widget::class], version = 6)
|
||||
|
@ -63,7 +64,7 @@ abstract class EventsDatabase : RoomDatabase() {
|
|||
private fun insertRegularEventType(context: Context) {
|
||||
Executors.newSingleThreadScheduledExecutor().execute {
|
||||
val regularEvent = context.resources.getString(R.string.regular_event)
|
||||
val eventType = EventType(REGULAR_EVENT_TYPE_ID, regularEvent, context.config.primaryColor)
|
||||
val eventType = EventType(REGULAR_EVENT_TYPE_ID, regularEvent, context.getProperPrimaryColor())
|
||||
db!!.EventTypesDao().insertOrUpdate(eventType)
|
||||
context.config.addDisplayEventType(REGULAR_EVENT_TYPE_ID.toString())
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class EditEventTypeDialog(val activity: Activity, var eventType: EventType? = nu
|
|||
|
||||
init {
|
||||
if (eventType == null) {
|
||||
eventType = EventType(null, "", activity.config.primaryColor)
|
||||
eventType = EventType(null, "", activity.getProperPrimaryColor())
|
||||
}
|
||||
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_event_type, null).apply {
|
||||
|
@ -56,7 +56,7 @@ class EditEventTypeDialog(val activity: Activity, var eventType: EventType? = nu
|
|||
}
|
||||
|
||||
private fun setupColor(view: ImageView) {
|
||||
view.setFillWithStroke(eventType!!.color, activity.config.backgroundColor)
|
||||
view.setFillWithStroke(eventType!!.color, activity.getProperBackgroundColor())
|
||||
}
|
||||
|
||||
private fun eventTypeConfirmed(title: String, dialog: AlertDialog) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.simplemobiletools.calendar.pro.helpers.IcsImporter.ImportResult.IMPOR
|
|||
import com.simplemobiletools.calendar.pro.helpers.IcsImporter.ImportResult.IMPORT_OK
|
||||
import com.simplemobiletools.calendar.pro.helpers.IcsImporter.ImportResult.IMPORT_PARTIAL
|
||||
import com.simplemobiletools.calendar.pro.helpers.REGULAR_EVENT_TYPE_ID
|
||||
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
|
@ -93,7 +94,7 @@ class ImportEventsDialog(val activity: SimpleActivity, val path: String, val cal
|
|||
val eventType = activity.eventTypesDB.getEventTypeWithId(currEventTypeId)
|
||||
activity.runOnUiThread {
|
||||
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.getProperBackgroundColor())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.simplemobiletools.calendar.pro.extensions.config
|
|||
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
|
||||
import com.simplemobiletools.calendar.pro.helpers.STORED_LOCALLY_ONLY
|
||||
import com.simplemobiletools.calendar.pro.models.CalDAVCalendar
|
||||
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
|
@ -60,7 +61,7 @@ class SelectEventCalendarDialog(val activity: Activity, val calendars: List<CalD
|
|||
}
|
||||
|
||||
if (typeId != STORED_LOCALLY_ONLY) {
|
||||
view.dialog_radio_color.setFillWithStroke(color, activity.config.backgroundColor)
|
||||
view.dialog_radio_color.setFillWithStroke(color, activity.getProperBackgroundColor())
|
||||
}
|
||||
|
||||
view.setOnClickListener { viewClicked(typeId) }
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.simplemobiletools.calendar.pro.extensions.calDAVHelper
|
|||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.models.EventType
|
||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
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
|
||||
}
|
||||
|
||||
view.dialog_radio_color.setFillWithStroke(color, activity.config.backgroundColor)
|
||||
view.dialog_radio_color.setFillWithStroke(color, activity.getProperBackgroundColor())
|
||||
view.setOnClickListener {
|
||||
viewClicked(colorKey)
|
||||
}
|
||||
|
|
|
@ -9,10 +9,7 @@ import com.simplemobiletools.calendar.pro.R
|
|||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
|
||||
import com.simplemobiletools.calendar.pro.models.EventType
|
||||
import com.simplemobiletools.commons.extensions.hideKeyboard
|
||||
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
import kotlinx.android.synthetic.main.dialog_select_radio_group.view.*
|
||||
import kotlinx.android.synthetic.main.radio_button_with_color.view.*
|
||||
|
@ -68,7 +65,7 @@ class SelectEventTypeDialog(
|
|||
}
|
||||
|
||||
if (eventType.color != Color.TRANSPARENT) {
|
||||
view.dialog_radio_color.setFillWithStroke(eventType.color, activity.config.backgroundColor)
|
||||
view.dialog_radio_color.setFillWithStroke(eventType.color, activity.getProperBackgroundColor())
|
||||
}
|
||||
|
||||
view.setOnClickListener { viewClicked(eventType) }
|
||||
|
|
|
@ -20,7 +20,7 @@ class SetRemindersDialog(val activity: Activity, val eventType: Int, val callbac
|
|||
|
||||
init {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_set_reminders, null).apply {
|
||||
set_reminders_image.applyColorFilter(context.config.textColor)
|
||||
set_reminders_image.applyColorFilter(context.getProperTextColor())
|
||||
set_reminders_1.text = activity.getFormattedMinutes(mReminder1Minutes)
|
||||
set_reminders_2.text = activity.getFormattedMinutes(mReminder1Minutes)
|
||||
set_reminders_3.text = activity.getFormattedMinutes(mReminder1Minutes)
|
||||
|
|
|
@ -20,10 +20,7 @@ import com.simplemobiletools.calendar.pro.helpers.*
|
|||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.interfaces.NavigationListener
|
||||
import com.simplemobiletools.calendar.pro.models.Event
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.areSystemAnimationsEnabled
|
||||
import com.simplemobiletools.commons.extensions.beGone
|
||||
import com.simplemobiletools.commons.extensions.beVisible
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import kotlinx.android.synthetic.main.fragment_day.view.*
|
||||
import kotlinx.android.synthetic.main.top_navigation.view.*
|
||||
import java.util.*
|
||||
|
@ -51,7 +48,7 @@ class DayFragment : Fragment() {
|
|||
}
|
||||
|
||||
private fun setupButtons() {
|
||||
mTextColor = requireContext().config.textColor
|
||||
mTextColor = requireContext().getProperTextColor()
|
||||
|
||||
mHolder.top_left_arrow.apply {
|
||||
applyColorFilter(mTextColor)
|
||||
|
@ -84,7 +81,7 @@ class DayFragment : Fragment() {
|
|||
setOnClickListener {
|
||||
(activity as MainActivity).showGoToDateDialog()
|
||||
}
|
||||
setTextColor(context.config.textColor)
|
||||
setTextColor(context.getProperTextColor())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +146,7 @@ class DayFragment : Fragment() {
|
|||
Handler().postDelayed({
|
||||
top_left_arrow.beVisible()
|
||||
top_right_arrow.beVisible()
|
||||
top_value.setTextColor(requireContext().config.textColor)
|
||||
top_value.setTextColor(requireContext().getProperTextColor())
|
||||
(day_events.adapter as? DayEventsAdapter)?.togglePrintMode()
|
||||
}, 1000)
|
||||
}, 1000)
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.simplemobiletools.calendar.pro.helpers.DAY_CODE
|
|||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.interfaces.NavigationListener
|
||||
import com.simplemobiletools.commons.extensions.getDialogTheme
|
||||
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.updateActionBarTitle
|
||||
import com.simplemobiletools.commons.views.MyViewPager
|
||||
|
@ -43,7 +44,7 @@ class DayFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
val view = inflater.inflate(R.layout.fragment_days_holder, container, false)
|
||||
view.background = ColorDrawable(requireContext().config.backgroundColor)
|
||||
view.background = ColorDrawable(requireContext().getProperBackgroundColor())
|
||||
viewPager = view.fragment_days_viewpager
|
||||
viewPager!!.id = (System.currentTimeMillis() % 100000).toInt()
|
||||
setupFragment()
|
||||
|
|
|
@ -26,7 +26,6 @@ import com.simplemobiletools.commons.views.MyLinearLayoutManager
|
|||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import kotlinx.android.synthetic.main.fragment_event_list.view.*
|
||||
import org.joda.time.DateTime
|
||||
import java.util.*
|
||||
|
||||
class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener {
|
||||
private val NOT_UPDATING = 0
|
||||
|
@ -51,7 +50,7 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener {
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
mView = inflater.inflate(R.layout.fragment_event_list, container, false)
|
||||
mView.background = ColorDrawable(requireContext().config.backgroundColor)
|
||||
mView.background = ColorDrawable(requireContext().getProperBackgroundColor())
|
||||
mView.calendar_events_list_holder?.id = (System.currentTimeMillis() % 100000).toInt()
|
||||
mView.calendar_empty_list_placeholder_2.apply {
|
||||
setTextColor(context.getProperPrimaryColor())
|
||||
|
@ -171,7 +170,7 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener {
|
|||
mView.calendar_empty_list_placeholder_2.beVisibleIf(mEvents.isEmpty())
|
||||
mView.calendar_events_list.beGoneIf(mEvents.isEmpty())
|
||||
if (activity != null)
|
||||
mView.calendar_empty_list_placeholder.setTextColor(requireActivity().config.textColor)
|
||||
mView.calendar_empty_list_placeholder.setTextColor(requireActivity().getProperTextColor())
|
||||
}
|
||||
|
||||
private fun fetchPreviousPeriod() {
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.simplemobiletools.calendar.pro.models.Event
|
|||
import com.simplemobiletools.calendar.pro.models.ListEvent
|
||||
import com.simplemobiletools.commons.extensions.areSystemAnimationsEnabled
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
|
||||
import kotlinx.android.synthetic.main.fragment_month_day.*
|
||||
import kotlinx.android.synthetic.main.fragment_month_day.view.*
|
||||
|
@ -166,7 +167,7 @@ class MonthDayFragment : Fragment(), MonthlyCalendar, RefreshRecyclerViewListene
|
|||
}
|
||||
|
||||
private fun setupButtons() {
|
||||
val textColor = mConfig.textColor
|
||||
val textColor = requireContext().getProperTextColor()
|
||||
mHolder.apply {
|
||||
month_day_selected_day_label.setTextColor(textColor)
|
||||
month_day_no_events_placeholder.setTextColor(textColor)
|
||||
|
|
|
@ -12,16 +12,12 @@ import androidx.viewpager.widget.ViewPager
|
|||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||
import com.simplemobiletools.calendar.pro.adapters.MyMonthDayPagerAdapter
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.getMonthCode
|
||||
import com.simplemobiletools.calendar.pro.helpers.DAY_CODE
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.helpers.MONTHLY_DAILY_VIEW
|
||||
import com.simplemobiletools.calendar.pro.interfaces.NavigationListener
|
||||
import com.simplemobiletools.commons.extensions.beGone
|
||||
import com.simplemobiletools.commons.extensions.getDialogTheme
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.updateActionBarTitle
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.views.MyViewPager
|
||||
import kotlinx.android.synthetic.main.fragment_months_days_holder.view.*
|
||||
import org.joda.time.DateTime
|
||||
|
@ -45,7 +41,7 @@ class MonthDayFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
val view = inflater.inflate(R.layout.fragment_months_days_holder, container, false)
|
||||
view.background = ColorDrawable(requireContext().config.backgroundColor)
|
||||
view.background = ColorDrawable(requireContext().getProperBackgroundColor())
|
||||
viewPager = view.fragment_months_days_viewpager
|
||||
viewPager!!.id = (System.currentTimeMillis() % 100000).toInt()
|
||||
setupFragment()
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.simplemobiletools.calendar.pro.models.DayMonthly
|
|||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.beGone
|
||||
import com.simplemobiletools.commons.extensions.beVisible
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import kotlinx.android.synthetic.main.fragment_month.view.*
|
||||
import kotlinx.android.synthetic.main.top_navigation.view.*
|
||||
import org.joda.time.DateTime
|
||||
|
@ -100,14 +101,14 @@ class MonthFragment : Fragment(), MonthlyCalendar {
|
|||
mHolder.top_value.apply {
|
||||
text = month
|
||||
contentDescription = text
|
||||
setTextColor(mConfig.textColor)
|
||||
setTextColor(requireContext().getProperTextColor())
|
||||
}
|
||||
updateDays(days)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupButtons() {
|
||||
mTextColor = mConfig.textColor
|
||||
mTextColor = requireContext().getProperTextColor()
|
||||
|
||||
mHolder.top_left_arrow.apply {
|
||||
applyColorFilter(mTextColor)
|
||||
|
@ -134,7 +135,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
|
|||
}
|
||||
|
||||
mHolder.top_value.apply {
|
||||
setTextColor(mConfig.textColor)
|
||||
setTextColor(requireContext().getProperTextColor())
|
||||
setOnClickListener {
|
||||
(activity as MainActivity).showGoToDateDialog()
|
||||
}
|
||||
|
@ -158,7 +159,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
|
|||
|
||||
top_left_arrow.beVisible()
|
||||
top_right_arrow.beVisible()
|
||||
top_value.setTextColor(mConfig.textColor)
|
||||
top_value.setTextColor(requireContext().getProperTextColor())
|
||||
month_view_wrapper.togglePrintMode()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,7 @@ import com.simplemobiletools.calendar.pro.helpers.DAY_CODE
|
|||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.helpers.MONTHLY_VIEW
|
||||
import com.simplemobiletools.calendar.pro.interfaces.NavigationListener
|
||||
import com.simplemobiletools.commons.extensions.beGone
|
||||
import com.simplemobiletools.commons.extensions.getDialogTheme
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.updateActionBarTitle
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.views.MyViewPager
|
||||
import kotlinx.android.synthetic.main.fragment_months_holder.view.*
|
||||
import org.joda.time.DateTime
|
||||
|
@ -45,7 +42,7 @@ class MonthFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
val view = inflater.inflate(R.layout.fragment_months_holder, container, false)
|
||||
view.background = ColorDrawable(requireContext().config.backgroundColor)
|
||||
view.background = ColorDrawable(requireContext().getProperBackgroundColor())
|
||||
viewPager = view.fragment_months_viewpager
|
||||
viewPager!!.id = (System.currentTimeMillis() % 100000).toInt()
|
||||
setupFragment()
|
||||
|
|
|
@ -224,7 +224,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
} else if (highlightWeekends && isWeekend(curDay.dayOfWeek, true)) {
|
||||
config.highlightWeekendsColor
|
||||
} else {
|
||||
config.textColor
|
||||
requireContext().getProperTextColor()
|
||||
}
|
||||
|
||||
val label = inflater.inflate(R.layout.weekly_view_day_letter, mView.week_letters_holder, false) as MyTextView
|
||||
|
|
|
@ -51,7 +51,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
weekHolder = inflater.inflate(R.layout.fragment_week_holder, container, false) as ViewGroup
|
||||
weekHolder!!.background = ColorDrawable(requireContext().config.backgroundColor)
|
||||
weekHolder!!.background = ColorDrawable(requireContext().getProperBackgroundColor())
|
||||
|
||||
val itemHeight = requireContext().getWeeklyViewItemHeight().toInt()
|
||||
weekHolder!!.week_view_hours_holder.setPadding(0, 0, 0, itemHeight)
|
||||
|
@ -128,7 +128,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
})
|
||||
}
|
||||
|
||||
private fun addHours(textColor: Int = requireContext().config.textColor) {
|
||||
private fun addHours(textColor: Int = requireContext().getProperTextColor()) {
|
||||
val itemHeight = requireContext().getWeeklyViewItemHeight().toInt()
|
||||
weekHolder!!.week_view_hours_holder.removeAllViews()
|
||||
val hourDateTime = DateTime().withDate(2000, 1, 1).withTime(0, 0, 0, 0)
|
||||
|
@ -306,7 +306,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
week_view_seekbar.beVisible()
|
||||
week_view_days_count.beVisible()
|
||||
addHours()
|
||||
background = ColorDrawable(requireContext().config.backgroundColor)
|
||||
background = ColorDrawable(requireContext().getProperBackgroundColor())
|
||||
(viewPager?.adapter as? MyWeekPagerAdapter)?.togglePrintMode(viewPager?.currentItem ?: 0)
|
||||
}, 1000)
|
||||
}, 1000)
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.simplemobiletools.calendar.pro.interfaces.YearlyCalendar
|
|||
import com.simplemobiletools.calendar.pro.models.DayYearly
|
||||
import com.simplemobiletools.calendar.pro.views.SmallMonthView
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
import kotlinx.android.synthetic.main.fragment_year.view.*
|
||||
import org.joda.time.DateTime
|
||||
|
@ -77,7 +78,7 @@ class YearFragment : Fragment(), YearlyCalendar {
|
|||
val monthLabel = mView.findViewById<TextView>(resources.getIdentifier("month_${i}_label", "id", requireContext().packageName))
|
||||
val curTextColor = when {
|
||||
isPrintVersion -> resources.getColor(R.color.theme_light_text_color)
|
||||
else -> requireContext().config.textColor
|
||||
else -> requireContext().getProperTextColor()
|
||||
}
|
||||
|
||||
monthLabel.setTextColor(curTextColor)
|
||||
|
|
|
@ -12,17 +12,14 @@ import androidx.viewpager.widget.ViewPager
|
|||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.activities.MainActivity
|
||||
import com.simplemobiletools.calendar.pro.adapters.MyYearPagerAdapter
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.helpers.YEARLY_VIEW
|
||||
import com.simplemobiletools.calendar.pro.helpers.YEAR_TO_OPEN
|
||||
import com.simplemobiletools.commons.extensions.beGone
|
||||
import com.simplemobiletools.commons.extensions.getDialogTheme
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.updateActionBarTitle
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.views.MyViewPager
|
||||
import kotlinx.android.synthetic.main.fragment_years_holder.view.*
|
||||
import org.joda.time.DateTime
|
||||
import kotlin.text.toInt
|
||||
|
||||
class YearFragmentsHolder : MyFragmentHolder() {
|
||||
private val PREFILLED_YEARS = 61
|
||||
|
@ -44,7 +41,7 @@ class YearFragmentsHolder : MyFragmentHolder() {
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
val view = inflater.inflate(R.layout.fragment_years_holder, container, false)
|
||||
view.background = ColorDrawable(requireContext().config.backgroundColor)
|
||||
view.background = ColorDrawable(requireContext().getProperBackgroundColor())
|
||||
viewPager = view.fragment_years_viewpager
|
||||
viewPager!!.id = (System.currentTimeMillis() % 100000).toInt()
|
||||
setupFragment()
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.simplemobiletools.calendar.pro.R
|
|||
import com.simplemobiletools.calendar.pro.extensions.*
|
||||
import com.simplemobiletools.calendar.pro.models.Event
|
||||
import com.simplemobiletools.calendar.pro.models.EventType
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.helpers.CHOPPED_LIST_DEFAULT_SIZE
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
|
@ -239,7 +240,7 @@ class EventsHelper(val context: Context) {
|
|||
|
||||
filteredEvents.forEach {
|
||||
it.updateIsPastEvent()
|
||||
it.color = eventTypeColors.get(it.eventType) ?: config.primaryColor
|
||||
it.color = eventTypeColors.get(it.eventType) ?: context.getProperPrimaryColor()
|
||||
}
|
||||
|
||||
activity.runOnUiThread {
|
||||
|
@ -330,7 +331,7 @@ class EventsHelper(val context: Context) {
|
|||
}
|
||||
}
|
||||
}
|
||||
it.color = eventTypeColors.get(it.eventType) ?: config.primaryColor
|
||||
it.color = eventTypeColors.get(it.eventType) ?: context.getProperPrimaryColor()
|
||||
}
|
||||
|
||||
callback(events)
|
||||
|
|
|
@ -419,7 +419,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
|||
textColor = if (isPrintVersion) {
|
||||
resources.getColor(R.color.theme_light_text_color)
|
||||
} else {
|
||||
config.textColor
|
||||
context.getProperTextColor()
|
||||
}
|
||||
|
||||
textPaint.color = textColor
|
||||
|
|
|
@ -12,8 +12,8 @@ import com.simplemobiletools.calendar.pro.helpers.isWeekend
|
|||
import com.simplemobiletools.calendar.pro.models.DayYearly
|
||||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA
|
||||
import java.util.*
|
||||
|
||||
// used for displaying months at Yearly view
|
||||
class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(context, attrs, defStyle) {
|
||||
|
@ -57,7 +57,7 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
|
|||
attributes.recycle()
|
||||
}
|
||||
|
||||
val baseColor = context.config.textColor
|
||||
val baseColor = context.getProperTextColor()
|
||||
textColor = baseColor.adjustAlpha(MEDIUM_ALPHA)
|
||||
weekendsTextColor = context.config.highlightWeekendsColor.adjustAlpha(MEDIUM_ALPHA)
|
||||
highlightWeekends = context.config.highlightWeekends
|
||||
|
@ -121,7 +121,7 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
|
|||
textColor = if (isPrintVersion) {
|
||||
resources.getColor(R.color.theme_light_text_color)
|
||||
} else {
|
||||
context.config.textColor.adjustAlpha(MEDIUM_ALPHA)
|
||||
context.getProperTextColor().adjustAlpha(MEDIUM_ALPHA)
|
||||
}
|
||||
|
||||
paint.color = textColor
|
||||
|
|
Loading…
Reference in a new issue