removing the redundant widget_date_time.xml

This commit is contained in:
tibbi 2022-05-20 00:09:13 +02:00
parent 347260dfee
commit 271442514a
3 changed files with 4 additions and 100 deletions

View File

@ -27,7 +27,7 @@ class MyDigitalTimeWidgetProvider : AppWidgetProvider() {
private fun performUpdate(context: Context) { private fun performUpdate(context: Context) {
val appWidgetManager = AppWidgetManager.getInstance(context) ?: return val appWidgetManager = AppWidgetManager.getInstance(context) ?: return
appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach { appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach {
RemoteViews(context.packageName, R.layout.widget_date_time).apply { RemoteViews(context.packageName, R.layout.widget_digital).apply {
updateTexts(context, this) updateTexts(context, this)
updateColors(context, this) updateColors(context, this)
setupAppOpenIntent(context, this) setupAppOpenIntent(context, this)

View File

@ -1,98 +0,0 @@
<?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:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/widget_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:src="@drawable/widget_round_background" />
<LinearLayout
android:id="@+id/widget_date_time_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/small_margin"
android:paddingRight="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin"
tools:ignore="UnusedAttribute">
<TextClock
android:id="@+id/widget_text_clock"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:autoSizeMaxTextSize="300sp"
android:autoSizeMinTextSize="2sp"
android:autoSizeStepGranularity="1sp"
android:autoSizeTextType="uniform"
android:format12Hour="h:mm"
android:format24Hour="k:mm"
android:gravity="center"
android:includeFontPadding="false"
android:maxLines="1"
android:shadowColor="@android:color/black"
android:shadowDy="1"
android:shadowRadius="1"
android:textSize="@dimen/normal_text_size"
tools:text="00:00" />
<TextClock
android:id="@+id/widget_date"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:autoSizeMinTextSize="2sp"
android:autoSizeStepGranularity="1sp"
android:autoSizeTextType="uniform"
android:format12Hour="EEE, d MMM"
android:format24Hour="EEE, d MMM"
android:gravity="center"
android:includeFontPadding="false"
android:maxLines="1"
android:shadowColor="@android:color/black"
android:shadowDy="1"
android:shadowRadius="1"
android:textSize="@dimen/normal_text_size"
tools:text="Mon, 1 January" />
<RelativeLayout
android:id="@+id/widget_alarm_holder"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center_horizontal">
<ImageView
android:id="@+id/widget_next_alarm_image"
android:layout_width="@dimen/widget_alarm_icon_size"
android:layout_height="@dimen/widget_alarm_icon_size"
android:layout_alignTop="@+id/widget_next_alarm"
android:layout_alignBottom="@+id/widget_next_alarm"
android:src="@drawable/ic_alarm_vector" />
<TextView
android:id="@+id/widget_next_alarm"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toEndOf="@+id/widget_next_alarm_image"
android:gravity="center"
android:includeFontPadding="false"
android:maxLines="1"
android:paddingStart="@dimen/small_margin"
android:shadowColor="@android:color/black"
android:shadowDy="1"
android:shadowRadius="1"
android:textSize="@dimen/normal_text_size"
tools:text="Tue, 18:30" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -45,7 +45,7 @@
android:textSize="@dimen/normal_text_size" android:textSize="@dimen/normal_text_size"
tools:text="00:00" /> tools:text="00:00" />
<TextView <TextClock
android:id="@+id/widget_date" android:id="@+id/widget_date"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
@ -53,6 +53,8 @@
android:autoSizeMinTextSize="2sp" android:autoSizeMinTextSize="2sp"
android:autoSizeStepGranularity="1sp" android:autoSizeStepGranularity="1sp"
android:autoSizeTextType="uniform" android:autoSizeTextType="uniform"
android:format12Hour="EEE, d MMM"
android:format24Hour="EEE, d MMM"
android:gravity="center" android:gravity="center"
android:includeFontPadding="false" android:includeFontPadding="false"
android:maxLines="1" android:maxLines="1"