diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListWidgetAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListWidgetAdapter.kt
index a0203ff18..2aea1111b 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListWidgetAdapter.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListWidgetAdapter.kt
@@ -31,7 +31,6 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
private val textColor = context.config.widgetTextColor
private val replaceDescription = context.config.replaceDescription
private var mediumFontSize = context.config.getFontSize()
- private var todayDate = ""
override fun getViewAt(position: Int): RemoteViews? {
val type = getItemViewType(position)
@@ -99,11 +98,7 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
override fun getViewTypeCount() = 2
- override fun onCreate() {
- val now = (System.currentTimeMillis() / 1000).toInt()
- val todayCode = Formatter.getDayCodeFromTS(now)
- todayDate = Formatter.getDayTitle(context, todayCode)
- }
+ override fun onCreate() {}
override fun getItemId(position: Int) = position.toLong()
@@ -121,8 +116,7 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
val code = Formatter.getDayCodeFromTS(it.startTS)
if (code != prevCode) {
val day = Formatter.getDayTitle(context, code)
- if (day != todayDate)
- listItems.add(ListSection(day))
+ listItems.add(ListSection(day))
prevCode = code
}
listItems.add(ListEvent(it.id, it.startTS, it.endTS, it.title, it.description, it.getIsAllDay(), it.color, it.location))
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Formatter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Formatter.kt
index 0e2651cf4..3614bdc08 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Formatter.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Formatter.kt
@@ -14,6 +14,7 @@ object Formatter {
val TIME_PATTERN = "HHmmss"
private val DAY_PATTERN = "d"
private val DAY_OF_WEEK_PATTERN = "EEE"
+ private val LONGEST_PATTERN = "MMMM dd YYYY (EEEE)"
private val PATTERN_TIME_12 = "hh:mm a"
private val PATTERN_TIME_24 = "HH:mm"
@@ -44,6 +45,8 @@ object Formatter {
date
}
+ fun getLongestDate(ts: Int) = getDateTimeFromTS(ts).toString(LONGEST_PATTERN)
+
fun getDate(context: Context, dateTime: DateTime, addDayOfWeek: Boolean = true) = getDayTitle(context, getDayCodeFromDateTime(dateTime), addDayOfWeek)
fun getFullDate(context: Context, dateTime: DateTime): String {
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetListProvider.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetListProvider.kt
index 9deb3f86b..076f6c824 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetListProvider.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetListProvider.kt
@@ -40,12 +40,11 @@ class MyWidgetListProvider : AppWidgetProvider() {
setTextSize(R.id.widget_event_list_empty, fontSize)
setTextColor(R.id.widget_event_list_today, textColor)
- setTextSize(R.id.widget_event_list_today, fontSize + 3)
+ setTextSize(R.id.widget_event_list_today, fontSize)
}
val now = (System.currentTimeMillis() / 1000).toInt()
- val todayCode = Formatter.getDayCodeFromTS(now)
- val todayText = Formatter.getDayTitle(context, todayCode)
+ val todayText = Formatter.getLongestDate(now)
views.setText(R.id.widget_event_list_today, todayText)
views.setImageViewBitmap(R.id.widget_event_new_event, context.resources.getColoredBitmap(R.drawable.ic_plus, textColor))
diff --git a/app/src/main/res/layout/widget_event_list.xml b/app/src/main/res/layout/widget_event_list.xml
index 9e01ec324..f789f19f0 100644
--- a/app/src/main/res/layout/widget_event_list.xml
+++ b/app/src/main/res/layout/widget_event_list.xml
@@ -7,22 +7,29 @@
+ android:layout_alignBottom="@+id/widget_event_new_event"
+ android:layout_alignTop="@+id/widget_event_new_event"
+ android:layout_toLeftOf="@+id/widget_event_new_event"
+ android:ellipsize="end"
+ android:gravity="center_vertical"
+ android:maxLines="1"
+ android:paddingLeft="@dimen/activity_margin"
+ android:paddingRight="@dimen/activity_margin"
+ android:textSize="@dimen/normal_text_size"/>
@@ -30,11 +37,11 @@
android:id="@+id/widget_event_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_below="@+id/widget_event_list_today"
+ android:layout_below="@+id/widget_event_new_event"
android:clipToPadding="false"
android:divider="@null"
android:dividerHeight="@dimen/medium_margin"
- android:paddingBottom="@dimen/activity_margin"
+ android:paddingBottom="@dimen/medium_margin"
android:paddingLeft="@dimen/activity_margin"/>