widgets: make widget responsive
The plans for widgets have changed somewhat. Instead of 4 or so variants, there will instead be one unified widget that chooses different layouts depending on its size. The first one added is the full widget, which shows more controls as long as theres enough space.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorPrimary"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorPrimary"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4zm-4-2V9h-1l-2 1v1h1.5v4H13z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorPrimary"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm0.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@android:id/background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/Theme.Widget">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/widget_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/colorSurface"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="contentDescription"
|
||||
android:src="@drawable/ic_song" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/colorSurface"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/spacing_medium">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_song"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/inter"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/placeholder_widget_song" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_artist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/inter"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:text="@string/placeholder_widget_artist" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_medium"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_loop"
|
||||
style="@style/Widget.Button.Unbounded.Widget.V31"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_change_loop"
|
||||
android:src="@drawable/ic_loop" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_skip_prev"
|
||||
style="@style/Widget.Button.Unbounded.Widget.V31"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_skip_prev"
|
||||
android:src="@drawable/ic_skip_prev" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_play_pause"
|
||||
style="@style/Widget.Button.Unbounded.Widget.V31"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_play_pause"
|
||||
android:src="@drawable/ic_play" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_skip_next"
|
||||
style="@style/Widget.Button.Unbounded.Widget.V31"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_skip_next"
|
||||
android:src="@drawable/ic_skip_next" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_shuffle"
|
||||
style="@style/Widget.Button.Unbounded.Widget.V31"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_shuffle_off"
|
||||
android:src="@drawable/ic_shuffle" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
+12
-9
@@ -7,7 +7,7 @@
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/Theme.Widget">
|
||||
|
||||
<android.widget.ImageView
|
||||
<ImageView
|
||||
android:id="@+id/widget_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
@@ -17,7 +17,7 @@
|
||||
tools:ignore="contentDescription"
|
||||
android:src="@drawable/ic_song" />
|
||||
|
||||
<android.widget.LinearLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
@@ -25,7 +25,7 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/spacing_medium">
|
||||
|
||||
<android.widget.TextView
|
||||
<TextView
|
||||
android:id="@+id/widget_song"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -37,7 +37,7 @@
|
||||
android:textStyle="bold"
|
||||
android:text="@string/placeholder_widget_song" />
|
||||
|
||||
<android.widget.TextView
|
||||
<TextView
|
||||
android:id="@+id/widget_artist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -51,32 +51,35 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_small"
|
||||
android:layout_marginTop="@dimen/spacing_medium"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_skip_prev"
|
||||
style="@style/Widget.Button.Unbounded"
|
||||
style="@style/Widget.Button.Unbounded.Widget.V31"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_skip_prev"
|
||||
android:src="@drawable/ic_skip_prev" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_play_pause"
|
||||
style="@style/Widget.Button.Unbounded"
|
||||
style="@style/Widget.Button.Unbounded.Widget.V31"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_play_pause"
|
||||
android:src="@drawable/ic_play" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_skip_next"
|
||||
style="@style/Widget.Button.Unbounded"
|
||||
style="@style/Widget.Button.Unbounded.Widget.V31"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_skip_next"
|
||||
android:src="@drawable/ic_skip_next" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.widget.LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -6,7 +6,7 @@
|
||||
android:background="?attr/colorSurface"
|
||||
android:theme="@style/Theme.Widget">
|
||||
|
||||
<android.widget.ImageView
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0.3"
|
||||
@@ -14,7 +14,7 @@
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_song" />
|
||||
|
||||
<android.widget.TextView
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@android:id/background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/Theme.Widget">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/widget_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/colorSurface"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="contentDescription"
|
||||
android:src="@drawable/ic_song" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/colorSurface"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/spacing_medium">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_song"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/inter"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/placeholder_widget_song" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_artist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/inter"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:text="@string/placeholder_widget_artist" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_medium"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_loop"
|
||||
style="@style/Widget.Button.Unbounded.Widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_change_loop"
|
||||
android:src="@drawable/ic_loop" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_skip_prev"
|
||||
style="@style/Widget.Button.Unbounded.Widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_skip_prev"
|
||||
android:src="@drawable/ic_skip_prev" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_play_pause"
|
||||
style="@style/Widget.Button.Unbounded.Widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_play_pause"
|
||||
android:src="@drawable/ic_play" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_skip_next"
|
||||
style="@style/Widget.Button.Unbounded.Widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_skip_next"
|
||||
android:src="@drawable/ic_skip_next" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_shuffle"
|
||||
style="@style/Widget.Button.Unbounded.Widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/description_shuffle_off"
|
||||
android:src="@drawable/ic_shuffle" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
+13
-13
@@ -7,7 +7,7 @@
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/Theme.Widget">
|
||||
|
||||
<android.widget.ImageView
|
||||
<ImageView
|
||||
android:id="@+id/widget_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
@@ -17,16 +17,16 @@
|
||||
tools:ignore="contentDescription"
|
||||
tools:src="@drawable/ic_song" />
|
||||
|
||||
<android.widget.LinearLayout
|
||||
<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:elevation="@dimen/elevation_normal"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/spacing_medium">
|
||||
|
||||
<android.widget.TextView
|
||||
<TextView
|
||||
android:id="@+id/widget_song"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -38,7 +38,7 @@
|
||||
android:textStyle="bold"
|
||||
tools:text="Song Name" />
|
||||
|
||||
<android.widget.TextView
|
||||
<TextView
|
||||
android:id="@+id/widget_artist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -52,7 +52,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_small">
|
||||
android:layout_marginTop="@dimen/spacing_medium">
|
||||
|
||||
<!--
|
||||
Can't use a normal unbounded ripple here since it causes a weird bug
|
||||
@@ -62,30 +62,30 @@
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_skip_prev"
|
||||
style="@style/Widget.Button.Unbounded"
|
||||
style="@style/Widget.Button.Unbounded.Widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/description_skip_prev"
|
||||
android:src="@drawable/ic_skip_prev" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_play_pause"
|
||||
style="@style/Widget.Button.Unbounded"
|
||||
style="@style/Widget.Button.Unbounded.Widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/description_play_pause"
|
||||
android:src="@drawable/ic_play" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widget_skip_next"
|
||||
style="@style/Widget.Button.Unbounded"
|
||||
style="@style/Widget.Button.Unbounded.Widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/description_skip_next"
|
||||
android:src="@drawable/ic_skip_next" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.widget.LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -5,7 +5,7 @@
|
||||
<!-- 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>
|
||||
<string name="info_widget_minimal">Minimal</string>
|
||||
<string name="info_widget_desc">See and control playing music</string>
|
||||
|
||||
<!-- Label Namespace | Static Labels -->
|
||||
<string name="label_retry">Retry</string>
|
||||
|
||||
@@ -87,4 +87,15 @@
|
||||
<item name="android:fontFamily">@font/inter_semibold</item>
|
||||
<item name="android:textColor">?attr/colorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Button.Unbounded.Widget" parent="Widget.AppCompat.Button.Borderless">
|
||||
<item name="android:layout_height">32dp</item>
|
||||
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
|
||||
<item name="android:scaleType">fitCenter</item>
|
||||
<item name="android:padding">@dimen/spacing_micro</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Button.Unbounded.Widget.V31" parent="Widget.Button.Unbounded.Widget">
|
||||
<item name="android:background">@drawable/ui_unbounded_ripple</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -1,13 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:initialLayout="@layout/widget_minimal"
|
||||
android:initialLayout="@layout/widget_small"
|
||||
android:targetCellWidth="2"
|
||||
android:targetCellHeight="2"
|
||||
android:minResizeWidth="110dp"
|
||||
android:minResizeHeight="110dp"
|
||||
android:previewLayout="@layout/widget_minimal"
|
||||
android:previewLayout="@layout/widget_small"
|
||||
android:description="@string/info_widget_desc"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="0"
|
||||
android:widgetCategory="home_screen">
|
||||
|
||||
</appwidget-provider>
|
||||
android:widgetCategory="home_screen" />
|
||||
@@ -1,12 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:initialLayout="@layout/widget_minimal"
|
||||
android:initialLayout="@layout/widget_small"
|
||||
android:minWidth="110dp"
|
||||
android:minHeight="110dp"
|
||||
android:minResizeWidth="110dp"
|
||||
android:minResizeHeight="110dp"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="0"
|
||||
android:widgetCategory="home_screen">
|
||||
|
||||
</appwidget-provider>
|
||||
android:widgetCategory="home_screen" />
|
||||
Reference in New Issue
Block a user