show task icon at the event list too

This commit is contained in:
tibbi 2022-02-27 17:07:20 +01:00
parent 1bda60498c
commit 9862f958bf
3 changed files with 31 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package com.simplemobiletools.calendar.pro.adapters
import android.content.Context
import android.content.Intent
import android.graphics.Paint
import android.widget.RemoteViews
import android.widget.RemoteViewsService
import com.simplemobiletools.calendar.pro.R
@ -29,6 +30,8 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
private var replaceDescription = context.config.replaceDescription
private var dimPastEvents = context.config.dimPastEvents
private var mediumFontSize = context.getWidgetFontSize()
private var smallMargin = context.resources.getDimension(R.dimen.small_margin).toInt()
private var normalMargin = context.resources.getDimension(R.dimen.normal_margin).toInt()
init {
initConfigValues()
@ -107,6 +110,21 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
setTextSize(R.id.event_item_title, mediumFontSize)
setTextSize(R.id.event_item_time, mediumFontSize)
setVisibleIf(R.id.event_item_task_image, item.isTask)
applyColorFilter(R.id.event_item_task_image, curTextColor)
if (item.isTask) {
setViewPadding(R.id.event_item_title, 0, 0, smallMargin, 0)
} else {
setViewPadding(R.id.event_item_title, normalMargin, 0, smallMargin, 0)
}
if (item.isTaskCompleted) {
setInt(R.id.event_item_title, "setPaintFlags", Paint.ANTI_ALIAS_FLAG or Paint.STRIKE_THRU_TEXT_FLAG)
} else {
setInt(R.id.event_item_title, "setPaintFlags", Paint.ANTI_ALIAS_FLAG)
}
Intent().apply {
putExtra(EVENT_ID, item.id)
putExtra(EVENT_OCCURRENCE_TS, item.startTS)

View File

@ -151,6 +151,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
setTextSize(R.id.day_monthly_event_id, smallerFontSize - 3f)
setBackgroundColor(R.id.day_monthly_event_holder, backgroundColor)
setVisibleIf(R.id.day_monthly_task_image, it.isTask())
applyColorFilter(R.id.day_monthly_task_image, eventTextColor)
if (it.isTaskCompleted()) {
setInt(R.id.day_monthly_event_id, "setPaintFlags", Paint.ANTI_ALIAS_FLAG or Paint.STRIKE_THRU_TEXT_FLAG)

View File

@ -20,11 +20,21 @@
android:paddingTop="@dimen/tiny_margin"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/event_item_task_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/event_item_title"
android:layout_alignBottom="@+id/event_item_title"
android:layout_marginStart="@dimen/normal_margin"
android:contentDescription="@string/task"
android:src="@drawable/ic_task_vector" />
<TextView
android:id="@+id/event_item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/normal_margin"
android:layout_toEndOf="@+id/event_item_task_image"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxLines="1"
@ -37,7 +47,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/event_item_title"
android:layout_alignStart="@+id/event_item_title"
android:layout_marginStart="@dimen/normal_margin"
android:alpha="0.8"
android:ellipsize="end"
android:includeFontPadding="false"