Use TextClock for today's date in event widget

This commit is contained in:
Naveen 2022-05-25 15:40:28 +05:30
parent f32aeb80d5
commit 57c7eebc6c
2 changed files with 10 additions and 6 deletions

View file

@ -16,7 +16,10 @@ import com.simplemobiletools.calendar.pro.extensions.launchNewEventIntent
import com.simplemobiletools.calendar.pro.extensions.widgetsDB
import com.simplemobiletools.calendar.pro.services.WidgetService
import com.simplemobiletools.calendar.pro.services.WidgetServiceEmpty
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.getColoredBitmap
import com.simplemobiletools.commons.extensions.getLaunchIntent
import com.simplemobiletools.commons.extensions.setTextSize
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import org.joda.time.DateTime
@ -46,9 +49,6 @@ class MyWidgetListProvider : AppWidgetProvider() {
setTextSize(R.id.widget_event_list_today, fontSize)
}
val todayText = Formatter.getLongestDate(getNowSeconds())
views.setText(R.id.widget_event_list_today, todayText)
views.setImageViewBitmap(R.id.widget_event_new_event, context.resources.getColoredBitmap(R.drawable.ic_plus_vector, textColor))
setupIntent(context, views, NEW_EVENT, R.id.widget_event_new_event)
setupIntent(context, views, LAUNCH_CAL, R.id.widget_event_list_today)

View file

@ -15,7 +15,7 @@
android:layout_alignParentBottom="true"
android:src="@drawable/widget_round_background" />
<TextView
<TextClock
android:id="@+id/widget_event_list_today"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -23,12 +23,16 @@
android:layout_alignBottom="@+id/widget_event_go_to_today"
android:layout_toStartOf="@+id/widget_event_go_to_today"
android:ellipsize="end"
android:format12Hour="MMM d yyyy (EEEE)"
android:format24Hour="MMM d yyyy (EEEE)"
android:gravity="center_vertical"
android:includeFontPadding="false"
android:maxLines="1"
android:paddingStart="@dimen/medium_margin"
android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin"
android:textSize="@dimen/normal_text_size"
tools:text="July 18" />
tools:text="May 25 2022 (Wednesday)" />
<ImageView
android:id="@+id/widget_event_go_to_today"