Widget improvements

pull/146/head
M66B 6 years ago
parent 812401086e
commit 85432963c4

@ -53,7 +53,7 @@ public class Widget extends AppWidgetProvider {
for (int id : appWidgetIds) { for (int id : appWidgetIds) {
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
views.setOnClickPendingIntent(R.id.widget, pi); views.setOnClickPendingIntent(R.id.widget, pi);
views.setTextViewText(R.id.tvCount, count < 0 ? "?" : Integer.toString(count)); views.setTextViewText(R.id.tvCount, count < 0 ? "?" : (count > 99 ? "99+" : Integer.toString(count)));
appWidgetManager.updateAppWidget(id, views); appWidgetManager.updateAppWidget(id, views);
} }
} }

@ -8,19 +8,17 @@
android:padding="6dp"> android:padding="6dp">
<ImageView <ImageView
android:layout_width="24dp" android:layout_width="36dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_weight="1" android:layout_weight="2"
android:src="@drawable/baseline_mail_24" android:src="@mipmap/ic_launcher" />
android:tint="@color/colorWidgetForeground" />
<TextView <TextView
android:id="@+id/tvCount" android:id="@+id/tvCount"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="6dp"
android:layout_weight="1" android:layout_weight="1"
android:text="?" android:text="?"
android:textColor="@color/colorWidgetForeground" android:textColor="@color/colorWidgetForeground"

Loading…
Cancel
Save