widgets: rework tiny widget
Rework the tiny widget to cram even more information into it. The tiny widget is nominally meant for edge cases like exceptionally small screens or landscape mode, but apparently it's triggered on some devices in normal use because of platform fragmentation and OEM insanity. Update the tiny widget layout with some new buttons in order to make it more usable in mnormal use. This is still nowehre near ideal. For example, when triggering the layout on my device, it ends up squishing the buttons. But it should probably work better outside of those edge cases.
This commit is contained in:
@@ -7,5 +7,5 @@
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6 -1.41,-1.41z" />
|
||||
android:pathData="M 18.119999,7.0600006 12,13.166666 5.8800004,7.0600006 4.0000006,8.9400004 12,16.939999 19.999999,8.9400004 Z" />
|
||||
</vector>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
a terrible API.
|
||||
-->
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:fillColor="?attr/colorPrimary"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,16.5c-2.49,0 -4.5,-2.01 -4.5,-4.5S9.51,7.5 12,7.5s4.5,2.01 4.5,4.5 -2.01,4.5 -4.5,4.5zM12,11c-0.55,0 -1,0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1z" />
|
||||
<path
|
||||
android:fillColor="?attr/colorSurface"
|
||||
|
||||
@@ -8,14 +8,7 @@
|
||||
android:theme="@style/Theme.Widget">
|
||||
|
||||
<!--
|
||||
For this widget form to work, we need to scale the ImageView across a 1:1 aspect ratio.
|
||||
However, since we are working with a RemoteViews instance, we can't just use ConstraintLayout
|
||||
to achieve this. We can use RelativeLayout, but there's no way to force an aspect ratio with
|
||||
that layout. However, if we create an invisible ImageView that contains a massive fixed-size
|
||||
drawable and then clamp our main ImageView to it, we can make the view scale on a 1:1 aspect
|
||||
ratio.
|
||||
|
||||
This is easily one of the worst layout hacks I've done, but it seems to work.
|
||||
See widget_small.xml for an explanation for the ImageView setup
|
||||
-->
|
||||
|
||||
<android.widget.ImageView
|
||||
|
||||
@@ -8,14 +8,7 @@
|
||||
android:theme="@style/Theme.Widget">
|
||||
|
||||
<!--
|
||||
For this widget form to work, we need to scale the ImageView across a 1:1 aspect ratio.
|
||||
However, since we are working with a RemoteViews instance, we can't just use ConstraintLayout
|
||||
to achieve this. We can use RelativeLayout, but there's no way to force an aspect ratio with
|
||||
that layout. However, if we create an invisible ImageView that contains a massive fixed-size
|
||||
drawable and then clamp our main ImageView to it, we can make the view scale on a 1:1 aspect
|
||||
ratio.
|
||||
|
||||
This is easily one of the worst layout hacks I've done, but it seems to work.
|
||||
See widget_small.xml for an explanation for the ImageView setup
|
||||
-->
|
||||
|
||||
<android.widget.ImageView
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/Theme.Widget">
|
||||
|
||||
<!--
|
||||
This is a throwaway layout designed for the rare edge-case where a 2xN widget is shown
|
||||
in landscape mode.
|
||||
-->
|
||||
|
||||
<android.widget.LinearLayout
|
||||
style="@style/Widget.Auxio.AppWidget.Panel"
|
||||
android:layout_width="match_parent"
|
||||
@@ -22,7 +17,8 @@
|
||||
|
||||
<android.widget.ImageView
|
||||
android:id="@+id/widget_cover"
|
||||
style="@style/Widget.Auxio.Image.Medium"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_marginEnd="@dimen/spacing_medium"
|
||||
android:contentDescription="@string/desc_no_cover"
|
||||
android:scaleType="centerCrop"
|
||||
@@ -37,28 +33,51 @@
|
||||
<android.widget.TextView
|
||||
android:id="@+id/widget_song"
|
||||
style="@style/Widget.Auxio.TextView.Primary.AppWidget"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/def_widget_song" />
|
||||
|
||||
<android.widget.TextView
|
||||
android:id="@+id/widget_artist"
|
||||
style="@style/Widget.Auxio.TextView.Secondary.AppWidget"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/def_widget_artist" />
|
||||
|
||||
<android.widget.LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_small"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.widget.ImageButton
|
||||
android:id="@+id/widget_skip_prev"
|
||||
style="@style/Widget.Auxio.PlaybackButton.AppWidget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/desc_skip_prev"
|
||||
android:src="@drawable/ic_skip_prev" />
|
||||
|
||||
<android.widget.ImageButton
|
||||
android:id="@+id/widget_play_pause"
|
||||
style="@style/Widget.Auxio.PlaybackButton.AppWidget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/desc_play_pause"
|
||||
android:src="@drawable/ic_play" />
|
||||
|
||||
<android.widget.ImageButton
|
||||
android:id="@+id/widget_skip_next"
|
||||
style="@style/Widget.Auxio.PlaybackButton.AppWidget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/desc_skip_next"
|
||||
android:src="@drawable/ic_skip_next" />
|
||||
|
||||
</android.widget.LinearLayout>
|
||||
</android.widget.LinearLayout>
|
||||
|
||||
<android.widget.ImageButton
|
||||
android:id="@+id/widget_play_pause"
|
||||
style="@style/Widget.Auxio.PlaybackButton.AppWidget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_play_pause"
|
||||
android:minWidth="@dimen/size_btn_small"
|
||||
android:minHeight="@dimen/size_btn_small"
|
||||
android:src="@drawable/sel_playing_state" />
|
||||
|
||||
</android.widget.LinearLayout>
|
||||
</android.widget.LinearLayout>
|
||||
|
||||
@@ -8,14 +8,7 @@
|
||||
android:theme="@style/Theme.Widget">
|
||||
|
||||
<!--
|
||||
For this widget form to work, we need to scale the ImageView across a 1:1 aspect ratio.
|
||||
However, since we are working with a RemoteViews instance, we can't just use ConstraintLayout
|
||||
to achieve this. We can use RelativeLayout, but there's no way to force an aspect ratio with
|
||||
that layout. However, if we create an invisible ImageView that contains a massive fixed-size
|
||||
drawable and then clamp our main ImageView to it, we can make the view scale on a 1:1 aspect
|
||||
ratio.
|
||||
|
||||
This is easily one of the worst layout hacks I've done, but it seems to work.
|
||||
See widget_small.xml for an explanation for the ImageView setup
|
||||
-->
|
||||
|
||||
<android.widget.ImageView
|
||||
|
||||
@@ -178,6 +178,7 @@
|
||||
<string name="clr_orange">Orange</string>
|
||||
<string name="clr_brown">Brown</string>
|
||||
<string name="clr_grey">Grey</string>
|
||||
<string name="clr_dynamic">Dynamic</string>
|
||||
|
||||
<!-- Format Namespace | Value formatting/plurals -->
|
||||
<string name="fmt_disc_no">Disc %d</string>
|
||||
|
||||
Reference in New Issue
Block a user