show tasks at the monthly widget
This commit is contained in:
parent
da126eead8
commit
1bda60498c
|
@ -7,6 +7,7 @@ import android.content.ComponentName
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Paint
|
||||
import android.view.View
|
||||
import android.widget.RemoteViews
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
|
@ -144,11 +145,18 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
|||
backgroundColor = backgroundColor.adjustAlpha(MEDIUM_ALPHA)
|
||||
}
|
||||
|
||||
val newRemoteView = RemoteViews(packageName, R.layout.day_monthly_event_view).apply {
|
||||
val newRemoteView = RemoteViews(packageName, R.layout.day_monthly_event_view_widget).apply {
|
||||
setText(R.id.day_monthly_event_id, it.title.replace(" ", "\u00A0"))
|
||||
setTextColor(R.id.day_monthly_event_id, eventTextColor)
|
||||
setTextSize(R.id.day_monthly_event_id, smallerFontSize - 3f)
|
||||
setBackgroundColor(R.id.day_monthly_event_id, backgroundColor)
|
||||
setBackgroundColor(R.id.day_monthly_event_holder, backgroundColor)
|
||||
setVisibleIf(R.id.day_monthly_task_image, it.isTask())
|
||||
|
||||
if (it.isTaskCompleted()) {
|
||||
setInt(R.id.day_monthly_event_id, "setPaintFlags", Paint.ANTI_ALIAS_FLAG or Paint.STRIKE_THRU_TEXT_FLAG)
|
||||
} else {
|
||||
setInt(R.id.day_monthly_event_id, "setPaintFlags", Paint.ANTI_ALIAS_FLAG)
|
||||
}
|
||||
}
|
||||
views.addView(id, newRemoteView)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/day_monthly_event_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- widgets cannot contain ConstraintLayout and image scaling doesn't work well, so set its size -->
|
||||
<ImageView
|
||||
android:id="@+id/day_monthly_task_image"
|
||||
android:layout_width="@dimen/activity_margin"
|
||||
android:layout_height="@dimen/activity_margin"
|
||||
android:layout_alignTop="@+id/day_monthly_event_id"
|
||||
android:layout_alignBottom="@+id/day_monthly_event_id"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/task"
|
||||
android:paddingStart="@dimen/one_dp"
|
||||
android:paddingTop="@dimen/one_dp"
|
||||
android:paddingBottom="@dimen/one_dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_task_vector" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_monthly_event_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@+id/day_monthly_task_image"
|
||||
android:ellipsize="none"
|
||||
android:gravity="start"
|
||||
android:hyphenationFrequency="none"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="@dimen/tiny_margin"
|
||||
android:paddingEnd="@dimen/tiny_margin"
|
||||
android:textSize="@dimen/day_monthly_text_size"
|
||||
tools:targetApi="m"
|
||||
tools:text="My event" />
|
||||
|
||||
</RelativeLayout>
|
Loading…
Reference in New Issue