From 89ecc7404298b3d374aced8d3dc7da7044895fea Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 16:55:40 +0100 Subject: [PATCH] use a bit higher alpha for dimmed event titles --- .../pro/activities/WidgetDateConfigureActivity.kt | 4 ++-- .../pro/activities/WidgetMonthlyConfigureActivity.kt | 4 ++-- .../calendar/pro/adapters/DayEventsAdapter.kt | 4 ++-- .../calendar/pro/adapters/EventListAdapter.kt | 7 ++++--- .../calendar/pro/adapters/EventListWidgetAdapter.kt | 5 +++-- .../calendar/pro/extensions/Context.kt | 2 +- .../calendar/pro/fragments/WeekFragment.kt | 10 ++++++---- .../calendar/pro/helpers/Constants.kt | 2 -- .../calendar/pro/helpers/MyWidgetMonthlyProvider.kt | 1 + .../simplemobiletools/calendar/pro/views/MonthView.kt | 9 ++++++--- .../calendar/pro/views/SmallMonthView.kt | 2 +- 11 files changed, 28 insertions(+), 22 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetDateConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetDateConfigureActivity.kt index 8852bb13d..31fba1baa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetDateConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetDateConfigureActivity.kt @@ -9,12 +9,12 @@ import android.widget.SeekBar import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.helpers.Formatter -import com.simplemobiletools.calendar.pro.helpers.LOW_ALPHA 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.setFillWithStroke +import com.simplemobiletools.commons.helpers.LOWER_ALPHA import kotlinx.android.synthetic.main.widget_config_date.* class WidgetDateConfigureActivity : SimpleActivity() { @@ -112,7 +112,7 @@ class WidgetDateConfigureActivity : SimpleActivity() { private fun updateColors() { mTextColor = mTextColorWithoutTransparency - mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOW_ALPHA) + mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOWER_ALPHA) mPrimaryColor = config.primaryColor config_text_color.setFillWithStroke(mTextColor, Color.BLACK) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetMonthlyConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetMonthlyConfigureActivity.kt index 1b0302585..9171af04c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetMonthlyConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetMonthlyConfigureActivity.kt @@ -13,7 +13,6 @@ import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.extensions.addDayEvents import com.simplemobiletools.calendar.pro.extensions.addDayNumber import com.simplemobiletools.calendar.pro.extensions.config -import com.simplemobiletools.calendar.pro.helpers.LOW_ALPHA import com.simplemobiletools.calendar.pro.helpers.MonthlyCalendarImpl import com.simplemobiletools.calendar.pro.helpers.MyWidgetMonthlyProvider import com.simplemobiletools.calendar.pro.interfaces.MonthlyCalendar @@ -23,6 +22,7 @@ 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.helpers.LOWER_ALPHA import kotlinx.android.synthetic.main.first_row.* import kotlinx.android.synthetic.main.top_navigation.* import kotlinx.android.synthetic.main.widget_config_monthly.* @@ -127,7 +127,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar { private fun updateColors() { mTextColor = mTextColorWithoutTransparency - mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOW_ALPHA) + mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOWER_ALPHA) mPrimaryColor = config.primaryColor top_left_arrow.applyColorFilter(mTextColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt index 36cdfd449..225f3c7c5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt @@ -13,13 +13,13 @@ import com.simplemobiletools.calendar.pro.extensions.shareEvents import com.simplemobiletools.calendar.pro.helpers.Formatter import com.simplemobiletools.calendar.pro.helpers.ITEM_EVENT import com.simplemobiletools.calendar.pro.helpers.ITEM_EVENT_SIMPLE -import com.simplemobiletools.calendar.pro.helpers.LOW_ALPHA import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.applyColorFilter import com.simplemobiletools.commons.extensions.beInvisible import com.simplemobiletools.commons.extensions.beInvisibleIf +import com.simplemobiletools.commons.helpers.LOWER_ALPHA import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.views.MyRecyclerView import kotlinx.android.synthetic.main.event_item_day_view.view.* @@ -136,7 +136,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList, r var newTextColor = textColor if (dimPastEvents && event.isPastEvent && !isPrintVersion) { - newTextColor = newTextColor.adjustAlpha(LOW_ALPHA) + newTextColor = newTextColor.adjustAlpha(LOWER_ALPHA) } event_item_start.setTextColor(newTextColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt index 9f05f928e..e27d10b0b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt @@ -20,6 +20,7 @@ import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.applyColorFilter import com.simplemobiletools.commons.extensions.beInvisible import com.simplemobiletools.commons.extensions.beInvisibleIf +import com.simplemobiletools.commons.helpers.LOWER_ALPHA import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.commons.views.MyRecyclerView @@ -177,8 +178,8 @@ class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList= now && !isPrintVersion) { startTextColor = adjustedPrimaryColor @@ -197,7 +198,7 @@ class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList() private var textColor = context.config.widgetTextColor - private var weakTextColor = textColor.adjustAlpha(LOW_ALPHA) + private var weakTextColor = textColor.adjustAlpha(LOWER_ALPHA) private val replaceDescription = context.config.replaceDescription private val dimPastEvents = context.config.dimPastEvents private var mediumFontSize = context.getWidgetFontSize() @@ -157,7 +158,7 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi override fun onDataSetChanged() { textColor = context.config.widgetTextColor - weakTextColor = textColor.adjustAlpha(LOW_ALPHA) + weakTextColor = textColor.adjustAlpha(LOWER_ALPHA) mediumFontSize = context.getWidgetFontSize() val fromTS = DateTime().seconds() - context.config.displayPastEvents * 60 val toTS = DateTime().plusYears(1).seconds() diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt index d87c1c093..2438795fa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt @@ -389,7 +389,7 @@ fun Context.scheduleCalDAVSync(activate: Boolean) { fun Context.addDayNumber(rawTextColor: Int, day: DayMonthly, linearLayout: LinearLayout, dayLabelHeight: Int, callback: (Int) -> Unit) { var textColor = rawTextColor if (!day.isThisMonth) - textColor = textColor.adjustAlpha(LOW_ALPHA) + textColor = textColor.adjustAlpha(LOWER_ALPHA) (View.inflate(applicationContext, R.layout.day_monthly_number_view, null) as TextView).apply { setTextColor(textColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt index 9948b5759..adfc76663 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt @@ -25,6 +25,8 @@ import com.simplemobiletools.calendar.pro.models.EventWeeklyView import com.simplemobiletools.calendar.pro.views.MyScrollView import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.DAY_SECONDS +import com.simplemobiletools.commons.helpers.HIGHER_ALPHA +import com.simplemobiletools.commons.helpers.LOWER_ALPHA import com.simplemobiletools.commons.helpers.WEEK_SECONDS import com.simplemobiletools.commons.views.MyTextView import kotlinx.android.synthetic.main.fragment_week.* @@ -451,8 +453,8 @@ class WeekFragment : Fragment(), WeeklyCalendar { var backgroundColor = eventTypeColors.get(event.eventType, primaryColor) var textColor = backgroundColor.getContrastColor() if (dimPastEvents && event.isPastEvent && !isPrintVersion) { - backgroundColor = backgroundColor.adjustAlpha(LOW_ALPHA) - textColor = textColor.adjustAlpha(LOW_ALPHA) + backgroundColor = backgroundColor.adjustAlpha(LOWER_ALPHA) + textColor = textColor.adjustAlpha(HIGHER_ALPHA) } background = ColorDrawable(backgroundColor) @@ -558,8 +560,8 @@ class WeekFragment : Fragment(), WeeklyCalendar { var backgroundColor = eventTypeColors.get(event.eventType, primaryColor) var textColor = backgroundColor.getContrastColor() if (dimPastEvents && event.isPastEvent && !isPrintVersion) { - backgroundColor = backgroundColor.adjustAlpha(LOW_ALPHA) - textColor = textColor.adjustAlpha(LOW_ALPHA) + backgroundColor = backgroundColor.adjustAlpha(LOWER_ALPHA) + textColor = textColor.adjustAlpha(HIGHER_ALPHA) } background = ColorDrawable(backgroundColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index 5f6d96d57..020b69644 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -1,7 +1,5 @@ package com.simplemobiletools.calendar.pro.helpers -const val LOW_ALPHA = .3f -const val MEDIUM_ALPHA = .6f const val STORED_LOCALLY_ONLY = 0 const val ROW_COUNT = 6 const val COLUMN_COUNT = 7 diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetMonthlyProvider.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetMonthlyProvider.kt index ebda2b729..fc456a3f2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetMonthlyProvider.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetMonthlyProvider.kt @@ -18,6 +18,7 @@ import com.simplemobiletools.calendar.pro.interfaces.MonthlyCalendar import com.simplemobiletools.calendar.pro.models.DayMonthly import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA import org.joda.time.DateTime class MyWidgetMonthlyProvider : AppWidgetProvider() { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index b56479865..b63d83475 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -18,6 +18,9 @@ import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor import com.simplemobiletools.commons.extensions.getContrastColor import com.simplemobiletools.commons.extensions.moveLastItemToFront +import com.simplemobiletools.commons.helpers.HIGHER_ALPHA +import com.simplemobiletools.commons.helpers.LOWER_ALPHA +import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA import org.joda.time.DateTime import org.joda.time.Days @@ -75,7 +78,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con } gridPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { - color = textColor.adjustAlpha(LOW_ALPHA) + color = textColor.adjustAlpha(LOWER_ALPHA) } circleStrokePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { @@ -322,7 +325,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con private fun getEventTitlePaint(event: MonthViewEvent, startDay: DayMonthly, endDay: DayMonthly): Paint { var paintColor = event.color.getContrastColor() if ((!startDay.isThisMonth && !endDay.isThisMonth) || (dimPastEvents && event.isPastEvent && !isPrintVersion)) { - paintColor = paintColor.adjustAlpha(MEDIUM_ALPHA) + paintColor = paintColor.adjustAlpha(HIGHER_ALPHA) } val curPaint = Paint(eventTitlePaint) @@ -400,7 +403,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con } textPaint.color = textColor - gridPaint.color = textColor.adjustAlpha(LOW_ALPHA) + gridPaint.color = textColor.adjustAlpha(LOWER_ALPHA) invalidate() initWeekDayLetters() } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt index f17072f58..ee8e37d09 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt @@ -8,11 +8,11 @@ import android.util.AttributeSet import android.view.View import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.extensions.config -import com.simplemobiletools.calendar.pro.helpers.MEDIUM_ALPHA 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.getAdjustedPrimaryColor +import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA import java.util.* // used for displaying months at Yearly view