M66B 3 years ago
parent 80abcde95c
commit 05a90177d9

@ -111,7 +111,7 @@ public class Widget extends AppWidgetProvider {
RemoteViews views = new RemoteViews(context.getPackageName(), RemoteViews views = new RemoteViews(context.getPackageName(),
layout == 0 ? R.layout.widget : R.layout.widget_new); layout == 0 ? R.layout.widget : R.layout.widget_new);
views.setOnClickPendingIntent(R.id.widget, pi); views.setOnClickPendingIntent(android.R.id.background, pi);
if (layout == 1) if (layout == 1)
views.setImageViewResource(R.id.ivMessage, unseen == 0 views.setImageViewResource(R.id.ivMessage, unseen == 0
@ -131,9 +131,9 @@ public class Widget extends AppWidgetProvider {
if (background == Color.TRANSPARENT) { if (background == Color.TRANSPARENT) {
if (semi) if (semi)
views.setInt(R.id.widget, "setBackgroundResource", R.drawable.widget_background); views.setInt(android.R.id.background, "setBackgroundResource", R.drawable.widget_background);
else else
views.setInt(R.id.widget, "setBackgroundColor", background); views.setInt(android.R.id.background, "setBackgroundColor", background);
int colorWidgetForeground = context.getResources().getColor(R.color.colorWidgetForeground); int colorWidgetForeground = context.getResources().getColor(R.color.colorWidgetForeground);
views.setInt(R.id.ivMessage, "setColorFilter", colorWidgetForeground); views.setInt(R.id.ivMessage, "setColorFilter", colorWidgetForeground);
@ -145,7 +145,7 @@ public class Widget extends AppWidgetProvider {
if (semi) if (semi)
background = ColorUtils.setAlphaComponent(background, 127); background = ColorUtils.setAlphaComponent(background, 127);
views.setInt(R.id.widget, "setBackgroundColor", background); views.setInt(android.R.id.background, "setBackgroundColor", background);
if (lum > 0.7f) { if (lum > 0.7f) {
views.setInt(R.id.ivMessage, "setColorFilter", Color.BLACK); views.setInt(R.id.ivMessage, "setColorFilter", Color.BLACK);
@ -155,7 +155,7 @@ public class Widget extends AppWidgetProvider {
} }
int pad = Helper.dp2pixels(context, layout == 0 ? 3 : 6); int pad = Helper.dp2pixels(context, layout == 0 ? 3 : 6);
views.setViewPadding(R.id.widget, pad, pad, pad, pad); views.setViewPadding(R.id.content, pad, pad, pad, pad);
appWidgetManager.updateAppWidget(appWidgetId, views); appWidgetManager.updateAppWidget(appWidgetId, views);
} }

@ -59,9 +59,9 @@ public class WidgetSync extends AppWidgetProvider {
if (background == Color.TRANSPARENT) { if (background == Color.TRANSPARENT) {
if (semi) if (semi)
views.setInt(R.id.widget, "setBackgroundResource", R.drawable.widget_background); views.setInt(android.R.id.background, "setBackgroundResource", R.drawable.widget_background);
else else
views.setInt(R.id.widget, "setBackgroundColor", background); views.setInt(android.R.id.background, "setBackgroundColor", background);
views.setInt(R.id.ivSync, "setColorFilter", views.setInt(R.id.ivSync, "setColorFilter",
context.getResources().getColor(R.color.colorWidgetForeground)); context.getResources().getColor(R.color.colorWidgetForeground));
} else { } else {
@ -70,14 +70,14 @@ public class WidgetSync extends AppWidgetProvider {
if (semi) if (semi)
background = ColorUtils.setAlphaComponent(background, 127); background = ColorUtils.setAlphaComponent(background, 127);
views.setInt(R.id.widget, "setBackgroundColor", background); views.setInt(android.R.id.background, "setBackgroundColor", background);
if (lum > 0.7f) if (lum > 0.7f)
views.setInt(R.id.ivSync, "setColorFilter", Color.BLACK); views.setInt(R.id.ivSync, "setColorFilter", Color.BLACK);
} }
int dp6 = Helper.dp2pixels(context, 6); int dp6 = Helper.dp2pixels(context, 6);
views.setViewPadding(R.id.widget, dp6, dp6, dp6, dp6); views.setViewPadding(R.id.content, dp6, dp6, dp6, dp6);
appWidgetManager.updateAppWidget(appWidgetId, views); appWidgetManager.updateAppWidget(appWidgetId, views);
} }

@ -133,9 +133,9 @@ public class WidgetUnified extends AppWidgetProvider {
if (background == Color.TRANSPARENT) { if (background == Color.TRANSPARENT) {
if (semi) if (semi)
views.setInt(R.id.widget, "setBackgroundResource", R.drawable.widget_background); views.setInt(android.R.id.background, "setBackgroundResource", R.drawable.widget_background);
else else
views.setInt(R.id.widget, "setBackgroundColor", background); views.setInt(android.R.id.background, "setBackgroundColor", background);
int colorWidgetForeground = context.getResources().getColor(R.color.colorWidgetForeground); int colorWidgetForeground = context.getResources().getColor(R.color.colorWidgetForeground);
views.setTextColor(R.id.title, colorWidgetForeground); views.setTextColor(R.id.title, colorWidgetForeground);
@ -145,14 +145,14 @@ public class WidgetUnified extends AppWidgetProvider {
if (semi) if (semi)
background = ColorUtils.setAlphaComponent(background, 127); background = ColorUtils.setAlphaComponent(background, 127);
views.setInt(R.id.widget, "setBackgroundColor", background); views.setInt(android.R.id.background, "setBackgroundColor", background);
if (lum > 0.7f) if (lum > 0.7f)
views.setTextColor(R.id.title, Color.BLACK); views.setTextColor(R.id.title, Color.BLACK);
} }
int dp6 = Helper.dp2pixels(context, 6); int dp6 = Helper.dp2pixels(context, 6);
views.setViewPadding(R.id.widget, dp6, 0, dp6, 0); views.setViewPadding(R.id.content, dp6, 0, dp6, 0);
appWidgetManager.updateAppWidget(appWidgetId, views); appWidgetManager.updateAppWidget(appWidgetId, views);
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.lv); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.lv);

@ -1,10 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/widget" android:id="@android:id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/widget_background">
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/widget_background"
android:orientation="vertical" android:orientation="vertical"
android:padding="3dp"> android:padding="3dp">
@ -46,4 +51,5 @@
android:textColor="@color/colorWidgetForeground" android:textColor="@color/colorWidgetForeground"
android:textSize="12dp" android:textSize="12dp"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
</FrameLayout>

@ -1,10 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/widget" android:id="@android:id/background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/widget_background">
<RelativeLayout
android:id="@+id/content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/widget_background"
android:padding="6dp"> android:padding="6dp">
<ImageView <ImageView
@ -49,4 +54,5 @@
android:textColor="@color/colorWidgetForeground" android:textColor="@color/colorWidgetForeground"
android:textSize="12dp" android:textSize="12dp"
android:visibility="gone" /> android:visibility="gone" />
</RelativeLayout> </RelativeLayout>
</FrameLayout>

@ -1,10 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/widget" android:id="@android:id/background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/widget_background">
<RelativeLayout
android:id="@+id/content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/widget_background"
android:padding="6dp"> android:padding="6dp">
<ImageView <ImageView
@ -16,4 +21,5 @@
android:scaleType="fitXY" android:scaleType="fitXY"
android:src="@drawable/twotone_sync_disabled_24" android:src="@drawable/twotone_sync_disabled_24"
app:tint="@color/colorWidgetForeground" /> app:tint="@color/colorWidgetForeground" />
</RelativeLayout> </RelativeLayout>
</FrameLayout>

@ -1,10 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/widget" android:id="@android:id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/widget_background">
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/widget_background"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="6dp" android:paddingStart="6dp"
android:paddingEnd="6dp"> android:paddingEnd="6dp">
@ -62,4 +67,5 @@
android:layout_marginBottom="6dp" android:layout_marginBottom="6dp"
android:divider="@color/colorWidgetRead" android:divider="@color/colorWidgetRead"
android:dividerHeight="1dp" /> android:dividerHeight="1dp" />
</LinearLayout> </LinearLayout>
</FrameLayout>
Loading…
Cancel
Save