From 3c51e933f987acb06b8fdf48a19cbdb75f800ec2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 3 Jan 2017 23:27:50 +0100 Subject: [PATCH] use the new way of marking events and today at widget config too --- .../WidgetMonthlyConfigureActivity.kt | 19 +++++++++++-------- .../calendar/fragments/MonthFragment.kt | 6 +++--- .../main/res/layout/widget_config_list.xml | 1 + .../main/res/layout/widget_config_monthly.xml | 1 + 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt index 4e27c9f3f..93b756673 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt @@ -5,9 +5,9 @@ import android.appwidget.AppWidgetManager import android.content.Intent import android.content.res.Resources import android.graphics.Color +import android.graphics.Paint import android.graphics.PorterDuff import android.os.Bundle -import android.support.v7.app.AppCompatActivity import android.view.View import android.widget.SeekBar import android.widget.TextView @@ -26,7 +26,7 @@ import kotlinx.android.synthetic.main.widget_config_monthly.* import org.joda.time.DateTime import yuku.ambilwarna.AmbilWarnaDialog -class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { +class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar { lateinit var mRes: Resources private var mDays: List? = null private var mPackageName = "" @@ -177,23 +177,26 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { } } + val todayCircle = resources.getDrawable(R.drawable.circle_empty) + todayCircle.setColorFilter(mTextColor.adjustAlpha(HIGH_ALPHA), PorterDuff.Mode.SRC_IN) + for (i in 0..len - 1) { val day = mDays!![i] var curTextColor = mWeakTextColor - var curTextSize = mDayTextSize if (day.isThisMonth) { curTextColor = mTextColor } - if (day.isToday) { - curTextSize = mTodayTextSize - } - (findViewById(mRes.getIdentifier("day_$i", "id", mPackageName)) as TextView).apply { text = day.value.toString() setTextColor(curTextColor) - textSize = curTextSize + + if (day.hasEvent) + paintFlags = paintFlags or Paint.UNDERLINE_TEXT_FLAG + + if (day.isToday) + background = todayCircle } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt index 1c079e134..3310fd881 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt @@ -180,8 +180,8 @@ class MonthFragment : Fragment(), MonthlyCalendar { } } - val eventBackground = resources.getDrawable(R.drawable.circle_empty) - eventBackground.setColorFilter(mTextColor.adjustAlpha(HIGH_ALPHA), PorterDuff.Mode.SRC_IN) + val todayCircle = resources.getDrawable(R.drawable.circle_empty) + todayCircle.setColorFilter(mTextColor.adjustAlpha(HIGH_ALPHA), PorterDuff.Mode.SRC_IN) for (i in 0..len - 1) { val day = days[i] @@ -200,7 +200,7 @@ class MonthFragment : Fragment(), MonthlyCalendar { paintFlags = paintFlags or Paint.UNDERLINE_TEXT_FLAG if (day.isToday) - background = eventBackground + background = todayCircle } } } diff --git a/app/src/main/res/layout/widget_config_list.xml b/app/src/main/res/layout/widget_config_list.xml index 29ee8a276..c1b4faecd 100644 --- a/app/src/main/res/layout/widget_config_list.xml +++ b/app/src/main/res/layout/widget_config_list.xml @@ -1,6 +1,7 @@