mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Improved layout of new message count widget
This commit is contained in:
parent
d876d0ddc2
commit
ba7b57afbb
4 changed files with 68 additions and 41 deletions
|
@ -101,9 +101,14 @@ public class Widget extends AppWidgetProvider {
|
|||
if (!semi)
|
||||
views.setInt(R.id.widget, "setBackgroundColor", Color.TRANSPARENT);
|
||||
|
||||
views.setImageViewResource(R.id.ivMessage, unseen == 0
|
||||
? R.drawable.baseline_mail_outline_24
|
||||
: R.drawable.baseline_mail_24);
|
||||
if (layout == 1)
|
||||
views.setImageViewResource(R.id.ivMessage, unseen == 0
|
||||
? R.drawable.baseline_mail_outline_widget_24
|
||||
: R.drawable.baseline_mail_widget_24);
|
||||
else
|
||||
views.setImageViewResource(R.id.ivMessage, unseen == 0
|
||||
? R.drawable.baseline_mail_outline_24
|
||||
: R.drawable.baseline_mail_24);
|
||||
views.setTextViewText(R.id.tvCount, unseen < 100 ? nf.format(unseen) : "99+");
|
||||
views.setViewVisibility(R.id.tvCount, layout == 1 && unseen == 0 ? View.GONE : View.VISIBLE);
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="16dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="20.0"
|
||||
android:viewportHeight="16.0">
|
||||
<group
|
||||
android:translateX="-2.0"
|
||||
android:translateY="-4.0">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,18L4,18L4,8l8,5 8,-5v10zM12,11L4,6h16l-8,5z" />
|
||||
</group>
|
||||
</vector>
|
15
app/src/main/res/drawable/baseline_mail_widget_24.xml
Normal file
15
app/src/main/res/drawable/baseline_mail_widget_24.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="16dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="20.0"
|
||||
android:viewportHeight="16.0">
|
||||
<group
|
||||
android:translateX="-2.0"
|
||||
android:translateY="-4.0">
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z" />
|
||||
</group>
|
||||
</vector>
|
|
@ -1,53 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/widget_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="3dp">
|
||||
|
||||
<RelativeLayout
|
||||
<ImageView
|
||||
android:id="@+id/ivMessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingBottom="3dp">
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/title_legend_count"
|
||||
android:padding="3dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/baseline_mail_widget_24"
|
||||
android:tint="@color/colorWidgetForeground" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivMessage"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:contentDescription="@string/title_legend_count"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/baseline_mail_24"
|
||||
android:tint="@color/colorWidgetForeground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@id/ivMessage"
|
||||
android:layout_alignBottom="@id/ivMessage"
|
||||
android:background="@drawable/widget_background_unread"
|
||||
android:includeFontPadding="false"
|
||||
android:lines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:text="\?"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/colorWidgetForeground"
|
||||
android:textSize="12dp"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/tvCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@id/ivMessage"
|
||||
android:layout_alignBottom="@id/ivMessage"
|
||||
android:background="@drawable/widget_background_unread"
|
||||
android:includeFontPadding="false"
|
||||
android:lines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:text="\?"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/colorWidgetForeground"
|
||||
android:textSize="12dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAccount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/ivMessage"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_horizontal"
|
||||
android:includeFontPadding="false"
|
||||
android:lines="1"
|
||||
android:text="account"
|
||||
|
@ -55,4 +48,4 @@
|
|||
android:textColor="@color/colorWidgetForeground"
|
||||
android:textSize="12dp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in a new issue