widgets: add widget layout preview

Add a layout preview to the Android 12 widget metadata. I'm holding off
on implementing a drawable until the widgets are completely finalized.
This commit is contained in:
OxygenCobalt
2021-08-03 10:33:07 -06:00
parent 8551e90884
commit 49db7e0741
11 changed files with 54 additions and 29 deletions
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@android:dimen/system_app_widget_inner_radius" />
</shape>
@@ -15,13 +15,13 @@
android:background="?attr/colorSurface"
android:scaleType="centerCrop"
tools:ignore="contentDescription"
tools:src="@drawable/ic_song" />
android:src="@drawable/ic_song" />
<android.widget.LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?android:attr/colorBackground"
android:background="?attr/colorSurface"
android:orientation="vertical"
android:padding="@dimen/spacing_medium">
@@ -35,7 +35,7 @@
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
tools:text="Song Name" />
android:text="@string/placeholder_widget_song" />
<android.widget.TextView
android:id="@+id/widget_artist"
@@ -46,13 +46,12 @@
android:singleLine="true"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
android:textColor="?android:attr/textColorSecondary"
tools:text="Artist Name" />
android:text="@string/placeholder_widget_artist" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="@dimen/spacing_medium"
android:layout_marginTop="@dimen/spacing_small"
android:orientation="horizontal">
<ImageButton
@@ -3,6 +3,7 @@
android:id="@android:id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:theme="@style/Theme.Widget">
<android.widget.ImageView
+1 -3
View File
@@ -52,9 +52,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_medium"
android:gravity="center"
android:orientation="horizontal">
android:layout_marginTop="@dimen/spacing_small">
<!--
Can't use a normal unbounded ripple here since it causes a weird bug
+3
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<!-- Info namespace | App labels -->
<string name="info_app_desc">A simple, rational music player for android.</string>
<string name="info_channel_name">Music Playback</string>
@@ -137,6 +138,8 @@
<string name="placeholder_album">Unknown Album</string>
<string name="placeholder_no_date">No Date</string>
<string name="placeholder_playback">No music playing</string>
<string name="placeholder_widget_song">Song Name</string>
<string name="placeholder_widget_artist">Artist Name</string>
<!-- Color Label namespace | Accent names -->
<string name="color_label_red">Red</string>
@@ -5,6 +5,7 @@
android:targetCellHeight="2"
android:minResizeWidth="110dp"
android:minResizeHeight="110dp"
android:previewLayout="@layout/widget_minimal"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="0"
android:widgetCategory="home_screen">