[Widget] Fixed colors of MD3 widget

This commit is contained in:
Prathamesh More 2022-01-13 18:21:30 +05:30
parent 7d3e1f4e28
commit 0efbefb6bd
7 changed files with 26 additions and 9 deletions

View file

@ -208,7 +208,13 @@ class AppWidgetMD3 : BaseAppWidget() {
val image = getAlbumArtDrawable(service.resources, bitmap) val image = getAlbumArtDrawable(service.resources, bitmap)
val roundedBitmap = createRoundedBitmap( val roundedBitmap = createRoundedBitmap(
image, imageSize, imageSize, cardRadius, cardRadius, cardRadius, cardRadius image,
imageSize,
imageSize,
cardRadius,
cardRadius,
cardRadius,
cardRadius
) )
appWidgetView.setImageViewBitmap(R.id.image, roundedBitmap) appWidgetView.setImageViewBitmap(R.id.image, roundedBitmap)

View file

@ -5,18 +5,20 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/app_widget_md3_height" android:layout_height="@dimen/app_widget_md3_height"
android:background="@drawable/app_widget_background" android:background="@drawable/app_widget_background"
android:backgroundTint="?android:attr/colorBackground" android:backgroundTint="@color/widget_md3_bg_color"
android:orientation="horizontal" android:orientation="horizontal"
tools:ignore="ContentDescription"> tools:ignore="ContentDescription"
android:theme="@style/Theme.Material3.DynamicColors.DayNight">
<ImageView <ImageView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="@dimen/app_widget_md3_image_size" android:layout_width="@dimen/app_widget_md3_image_size"
android:layout_height="@dimen/app_widget_md3_image_size" android:layout_height="@dimen/app_widget_md3_image_size"
android:background="@drawable/app_widget_background"
android:layout_margin="8dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:scaleType="centerCrop" /> android:layout_margin="10dp"
android:background="@drawable/app_widget_background"
android:scaleType="centerCrop"
tools:src="@tools:sample/backgrounds/scenic[6]" />
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -94,7 +96,6 @@
android:textAppearance="@style/TextViewNormal" android:textAppearance="@style/TextViewNormal"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
tools:text="Text" /> tools:text="Text" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="widget_md3_bg_color">@android:color/system_accent1_800</color>
</resources>

View file

@ -4,4 +4,5 @@
<color name="window_color">@android:color/black</color> <color name="window_color">@android:color/black</color>
<color name="bottomSheetColor">#202020</color> <color name="bottomSheetColor">#202020</color>
<color name="widget_md3_bg_color">@color/darkerColorSurface</color>
</resources> </resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="widget_md3_bg_color">@android:color/system_accent1_50</color>
</resources>

View file

@ -35,4 +35,5 @@
<color name="bottomSheetColorBlack">#000000</color> <color name="bottomSheetColorBlack">#000000</color>
<color name="bottomSheetColor">#FFFFFF</color> <color name="bottomSheetColor">#FFFFFF</color>
<color name="widget_md3_bg_color">@color/lighterColorSurface</color>
</resources> </resources>

View file

@ -39,8 +39,8 @@
<dimen name="app_widget_card_radius">2dp</dimen> <dimen name="app_widget_card_radius">2dp</dimen>
<dimen name="now_playing_top_margin">12dp</dimen> <dimen name="now_playing_top_margin">12dp</dimen>
<dimen name="app_widget_md3_height">96dp</dimen> <dimen name="app_widget_md3_height">90dp</dimen>
<dimen name="app_widget_md3_image_size">80dp</dimen> <dimen name="app_widget_md3_image_size">70dp</dimen>
<dimen name="icon_notification_dimen">32dp</dimen> <dimen name="icon_notification_dimen">32dp</dimen>
<dimen name="toolbar_margin_horizontal">8dp</dimen> <dimen name="toolbar_margin_horizontal">8dp</dimen>