From f32aeb80d5aa6fdf40f13d6f2588cb82c9dac0b4 Mon Sep 17 00:00:00 2001 From: Naveen Date: Wed, 25 May 2022 15:26:22 +0530 Subject: [PATCH] Use TextClock for date widget --- .../pro/helpers/MyWidgetDateProvider.kt | 8 ++--- app/src/main/res/layout/widget_date.xml | 31 ++++++++++++------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetDateProvider.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetDateProvider.kt index 143a28a1e..aeb18637f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetDateProvider.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetDateProvider.kt @@ -12,7 +12,6 @@ import com.simplemobiletools.calendar.pro.activities.SplashActivity import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.commons.extensions.applyColorFilter import com.simplemobiletools.commons.extensions.getLaunchIntent -import com.simplemobiletools.commons.extensions.setText class MyWidgetDateProvider : AppWidgetProvider() { private val OPEN_APP_INTENT_ID = 1 @@ -21,11 +20,8 @@ class MyWidgetDateProvider : AppWidgetProvider() { appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach { RemoteViews(context.packageName, R.layout.widget_date).apply { applyColorFilter(R.id.widget_date_background, context.config.widgetBgColor) - setText(R.id.widget_date_label, Formatter.getTodayDayNumber()) - setText(R.id.widget_month_label, Formatter.getCurrentMonthShort()) - - setTextColor(R.id.widget_date_label, context.config.widgetTextColor) - setTextColor(R.id.widget_month_label, context.config.widgetTextColor) + setTextColor(R.id.widget_date, context.config.widgetTextColor) + setTextColor(R.id.widget_month, context.config.widgetTextColor) setupAppOpenIntent(context, this) appWidgetManager.updateAppWidget(it, this) diff --git a/app/src/main/res/layout/widget_date.xml b/app/src/main/res/layout/widget_date.xml index 4c3f4f665..89f4f8bee 100644 --- a/app/src/main/res/layout/widget_date.xml +++ b/app/src/main/res/layout/widget_date.xml @@ -9,30 +9,37 @@ android:id="@+id/widget_date_background" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignStart="@+id/widget_date_label" - android:layout_alignTop="@+id/widget_date_label" - android:layout_alignEnd="@+id/widget_date_label" - android:layout_alignBottom="@+id/widget_month_label" - android:src="@drawable/widget_round_background" /> + android:layout_alignStart="@+id/widget_date" + android:layout_alignTop="@+id/widget_date" + android:layout_alignEnd="@+id/widget_date" + android:layout_alignBottom="@+id/widget_month" + android:src="@drawable/widget_round_background" + tools:ignore="ContentDescription" /> - -