Skip to content

Commit 57c7eeb

Browse files
committed
Use TextClock for today's date in event widget
1 parent f32aeb8 commit 57c7eeb

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetListProvider.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import com.simplemobiletools.calendar.pro.extensions.launchNewEventIntent
1616
import com.simplemobiletools.calendar.pro.extensions.widgetsDB
1717
import com.simplemobiletools.calendar.pro.services.WidgetService
1818
import com.simplemobiletools.calendar.pro.services.WidgetServiceEmpty
19-
import com.simplemobiletools.commons.extensions.*
19+
import com.simplemobiletools.commons.extensions.applyColorFilter
20+
import com.simplemobiletools.commons.extensions.getColoredBitmap
21+
import com.simplemobiletools.commons.extensions.getLaunchIntent
22+
import com.simplemobiletools.commons.extensions.setTextSize
2023
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
2124
import org.joda.time.DateTime
2225

@@ -46,9 +49,6 @@ class MyWidgetListProvider : AppWidgetProvider() {
4649
setTextSize(R.id.widget_event_list_today, fontSize)
4750
}
4851

49-
val todayText = Formatter.getLongestDate(getNowSeconds())
50-
views.setText(R.id.widget_event_list_today, todayText)
51-
5252
views.setImageViewBitmap(R.id.widget_event_new_event, context.resources.getColoredBitmap(R.drawable.ic_plus_vector, textColor))
5353
setupIntent(context, views, NEW_EVENT, R.id.widget_event_new_event)
5454
setupIntent(context, views, LAUNCH_CAL, R.id.widget_event_list_today)

app/src/main/res/layout/widget_event_list.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,24 @@
1515
android:layout_alignParentBottom="true"
1616
android:src="@drawable/widget_round_background" />
1717

18-
<TextView
18+
<TextClock
1919
android:id="@+id/widget_event_list_today"
2020
android:layout_width="match_parent"
2121
android:layout_height="wrap_content"
2222
android:layout_alignTop="@+id/widget_event_go_to_today"
2323
android:layout_alignBottom="@+id/widget_event_go_to_today"
2424
android:layout_toStartOf="@+id/widget_event_go_to_today"
2525
android:ellipsize="end"
26+
android:format12Hour="MMM d yyyy (EEEE)"
27+
android:format24Hour="MMM d yyyy (EEEE)"
2628
android:gravity="center_vertical"
29+
android:includeFontPadding="false"
2730
android:maxLines="1"
2831
android:paddingStart="@dimen/medium_margin"
32+
android:paddingTop="@dimen/medium_margin"
2933
android:paddingEnd="@dimen/medium_margin"
3034
android:textSize="@dimen/normal_text_size"
31-
tools:text="July 18" />
35+
tools:text="May 25 2022 (Wednesday)" />
3236

3337
<ImageView
3438
android:id="@+id/widget_event_go_to_today"

0 commit comments

Comments
 (0)