Define weekends highlight color in config
This commit is contained in:
parent
1c1c9e5701
commit
2683ebf6ed
|
@ -82,6 +82,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
private var mStoredDimPastEvents = true
|
||||
private var mStoredHighlightWeekends = false
|
||||
private var mStoredStartWeekWithCurrentDay = false
|
||||
private var mStoredHighlightWeekendsColor = 0
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -134,7 +135,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
super.onResume()
|
||||
if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredAdjustedPrimaryColor != getAdjustedPrimaryColor()
|
||||
|| mStoredDayCode != Formatter.getTodayCode() || mStoredDimPastEvents != config.dimPastEvents || mStoredHighlightWeekends != config.highlightWeekends
|
||||
) {
|
||||
|| mStoredHighlightWeekendsColor != config.highlightWeekendsColor) {
|
||||
updateViewPager()
|
||||
}
|
||||
|
||||
|
@ -262,6 +263,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
mStoredUse24HourFormat = use24HourFormat
|
||||
mStoredDimPastEvents = dimPastEvents
|
||||
mStoredHighlightWeekends = highlightWeekends
|
||||
mStoredHighlightWeekendsColor = highlightWeekendsColor
|
||||
mStoredMidnightSpan = showMidnightSpanningEventsAtTop
|
||||
mStoredStartWeekWithCurrentDay = startWeekWithCurrentDay
|
||||
}
|
||||
|
|
|
@ -41,7 +41,8 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
private var mTextColor = 0
|
||||
private var mWeakTextColor = 0
|
||||
private var mPrimaryColor = 0
|
||||
private var mRedTextColor = 0
|
||||
private var mWeekendsTextColor = 0
|
||||
private var mHighlightWeekends = false
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
|
@ -131,7 +132,8 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
mTextColor = mTextColorWithoutTransparency
|
||||
mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOWER_ALPHA)
|
||||
mPrimaryColor = config.primaryColor
|
||||
mRedTextColor = resources.getColor(R.color.red_text)
|
||||
mWeekendsTextColor = config.highlightWeekendsColor
|
||||
mHighlightWeekends = config.highlightWeekends
|
||||
|
||||
top_left_arrow.applyColorFilter(mTextColor)
|
||||
top_right_arrow.applyColorFilter(mTextColor)
|
||||
|
@ -171,7 +173,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
removeAllViews()
|
||||
|
||||
val dayTextColor = if (config.highlightWeekends && day.isWeekend) {
|
||||
mRedTextColor
|
||||
config.highlightWeekendsColor
|
||||
} else {
|
||||
mTextColor
|
||||
}
|
||||
|
@ -205,7 +207,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar {
|
|||
for (i in 0..6) {
|
||||
findViewById<TextView>(resources.getIdentifier("label_$i", "id", packageName)).apply {
|
||||
val textColor = if (config.highlightWeekends && isWeekend(i, config.isSundayFirst)) {
|
||||
mRedTextColor
|
||||
mWeekendsTextColor
|
||||
} else {
|
||||
mTextColor
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
} else if (todayCode == dayCode) {
|
||||
primaryColor
|
||||
} else if (highlightWeekends && isWeekend(i, config.isSundayFirst)) {
|
||||
resources.getColor(R.color.red_text)
|
||||
config.highlightWeekendsColor
|
||||
} else {
|
||||
config.textColor
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simplemobiletools.calendar.pro.helpers
|
|||
import android.content.Context
|
||||
import android.media.AudioManager
|
||||
import android.media.RingtoneManager
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.extensions.scheduleCalDAVSync
|
||||
import com.simplemobiletools.commons.extensions.getDefaultAlarmTitle
|
||||
|
@ -228,4 +229,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
var highlightWeekends: Boolean
|
||||
get() = prefs.getBoolean(HIGHLIGHT_WEEKENDS, false)
|
||||
set(highlightWeekends) = prefs.edit().putBoolean(HIGHLIGHT_WEEKENDS, highlightWeekends).apply()
|
||||
|
||||
var highlightWeekendsColor: Int
|
||||
get() = prefs.getInt(HIGHLIGHT_WEEKENDS_COLOR, context.resources.getColor(R.color.red_text))
|
||||
set(highlightWeekendsColor) = prefs.edit().putInt(HIGHLIGHT_WEEKENDS_COLOR, highlightWeekendsColor).apply()
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ const val EXPORT_PAST_EVENTS = "export_past_events"
|
|||
const val WEEKLY_VIEW_ITEM_HEIGHT_MULTIPLIER = "weekly_view_item_height_multiplier"
|
||||
const val WEEKLY_VIEW_DAYS = "weekly_view_days"
|
||||
const val HIGHLIGHT_WEEKENDS = "highlight_weekends"
|
||||
const val HIGHLIGHT_WEEKENDS_COLOR = "highlight_weekends_color"
|
||||
|
||||
// repeat_rule for monthly and yearly repetition
|
||||
const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition)
|
||||
|
|
|
@ -119,9 +119,8 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
|||
for (i in 0 until len) {
|
||||
val day = days[i]
|
||||
|
||||
val redTextColor = context.resources.getColor(R.color.red_text)
|
||||
val dayTextColor = if (context.config.highlightWeekends && day.isWeekend) {
|
||||
redTextColor
|
||||
context.config.highlightWeekendsColor
|
||||
} else {
|
||||
textColor
|
||||
}
|
||||
|
@ -227,12 +226,11 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
|||
val smallerFontSize = context.getWidgetFontSize()
|
||||
val packageName = context.packageName
|
||||
val letters = context.resources.getStringArray(R.array.week_day_letters)
|
||||
val redTextColor = resources.getColor(R.color.red_text)
|
||||
|
||||
for (i in 0..6) {
|
||||
val id = resources.getIdentifier("label_$i", "id", packageName)
|
||||
val dayTextColor = if (config.highlightWeekends && isWeekend(i, sundayFirst)) {
|
||||
redTextColor
|
||||
val dayTextColor = if (context.config.highlightWeekends && isWeekend(i, sundayFirst)) {
|
||||
context.config.highlightWeekendsColor
|
||||
} else {
|
||||
textColor
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
|||
private var dayHeight = 0f
|
||||
private var primaryColor = 0
|
||||
private var textColor = 0
|
||||
private var redTextColor = 0
|
||||
private var weekendsTextColor = 0
|
||||
private var weekDaysLetterHeight = 0
|
||||
private var eventTitleHeight = 0
|
||||
private var currDayOfWeek = 0
|
||||
|
@ -62,7 +62,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
|||
init {
|
||||
primaryColor = context.getAdjustedPrimaryColor()
|
||||
textColor = config.textColor
|
||||
redTextColor = context.resources.getColor(R.color.red_text)
|
||||
weekendsTextColor = config.highlightWeekendsColor
|
||||
showWeekNumbers = config.showWeekNumbers
|
||||
dimPastEvents = config.dimPastEvents
|
||||
highlightWeekends = config.highlightWeekends
|
||||
|
@ -214,7 +214,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
|||
if (i == currDayOfWeek && !isPrintVersion) {
|
||||
weekDayLetterPaint = getColoredPaint(primaryColor)
|
||||
} else if (highlightWeekends && isWeekend(i, config.isSundayFirst)) {
|
||||
weekDayLetterPaint = getColoredPaint(redTextColor)
|
||||
weekDayLetterPaint = getColoredPaint(weekendsTextColor)
|
||||
}
|
||||
canvas.drawText(dayLetters[i], xPos, weekDaysLetterHeight * 0.7f, weekDayLetterPaint)
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
|||
if (startDay.isToday) {
|
||||
paintColor = primaryColor.getContrastColor()
|
||||
} else if (highlightWeekends && startDay.isWeekend) {
|
||||
paintColor = redTextColor
|
||||
paintColor = weekendsTextColor
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
|
|||
private var todayCirclePaint: Paint
|
||||
private var dayWidth = 0f
|
||||
private var textColor = 0
|
||||
private var redTextColor = 0
|
||||
private var weekendsTextColor = 0
|
||||
private var days = 31
|
||||
private var isLandscape = false
|
||||
private var highlightWeekends = false
|
||||
|
@ -58,7 +58,7 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
|
|||
|
||||
val baseColor = context.config.textColor
|
||||
textColor = baseColor.adjustAlpha(MEDIUM_ALPHA)
|
||||
redTextColor = context.resources.getColor(R.color.red_text).adjustAlpha(MEDIUM_ALPHA)
|
||||
weekendsTextColor = context.config.highlightWeekendsColor.adjustAlpha(MEDIUM_ALPHA)
|
||||
highlightWeekends = context.config.highlightWeekends
|
||||
isSundayFirst = context.config.isSundayFirst
|
||||
|
||||
|
@ -108,7 +108,7 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
|
|||
return curPaint
|
||||
} else if (highlightWeekends && isWeekend(weekDay - 1, isSundayFirst)) {
|
||||
val curPaint = Paint(paint)
|
||||
curPaint.color = redTextColor
|
||||
curPaint.color = weekendsTextColor
|
||||
return curPaint
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue