Profile Stats Widget (#292)

* feat: create a statistics widget

* feat: mirror app color option

* fix: the minimum size cut off

* feat: make the stat widget decent

* fix: prevent bleeding edges

* fix: PREVENT BLEEDING EDGES!

* fix: we didn't really need an overlay
This commit is contained in:
TwistedUmbrellaX 2024-03-27 18:45:26 -04:00 committed by GitHub
parent 7bcc01b94e
commit f83d1d8d84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 652 additions and 2 deletions

View file

@ -0,0 +1,184 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:theme="@style/Theme.Dantotsu.AppWidgetContainer"
android:orientation="vertical">
<ImageView
android:id="@+id/backgroundView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/widget_stats_rounded"
tools:ignore="ContentDescription"/>
<LinearLayout
android:id="@+id/headerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_margin="4dp"
android:orientation="horizontal"
android:baselineAligned="false">
<ImageView
android:id="@+id/userAvatar"
android:layout_width="32dp"
android:layout_height="32dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_dantotsu_round"
tools:ignore="ContentDescription"/>
<TextView
android:id="@+id/userLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="8dp"
android:fontFamily="@font/poppins_bold"
android:textSize="18sp"
android:text="@string/loading"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:padding="4dp"
android:orientation="vertical"
android:background="@drawable/widget_stats_rounded"
android:layout_below="@id/headerLayout">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:id="@+id/topLeft"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:orientation="vertical"
tools:ignore="NestedWeights">
<TextView
android:id="@+id/topLeftItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/poppins_bold"
android:text="@string/loading"/>
<TextView
android:id="@+id/topLeftLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/poppins_semi_bold"
android:text="@string/anime_watched" />
</LinearLayout>
<RelativeLayout
android:id="@+id/dividerTop"
android:layout_width="4dp"
android:layout_height="match_parent"
android:layout_marginTop="4dp"
android:background="?android:attr/listDivider" />
<LinearLayout
android:id="@+id/topRight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/topRightItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/poppins_bold"
android:text="@string/loading"/>
<TextView
android:id="@+id/topRightLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/poppins_semi_bold"
android:text="@string/episodes_watched"/>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/dividerMiddle"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_margin="4dp"
android:background="?android:attr/listDivider" />
<LinearLayout
android:id="@+id/bottomLeft"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:orientation="vertical"
tools:ignore="NestedWeights">
<TextView
android:id="@+id/bottomLeftItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/poppins_bold"
android:text="@string/loading"/>
<TextView
android:id="@+id/bottomLeftLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_semi_bold"
android:text="@string/manga_read"
android:layout_gravity="center"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/dividerBottom"
android:layout_width="4dp"
android:layout_height="match_parent"
android:layout_marginBottom="4dp"
android:background="?android:attr/listDivider" />
<LinearLayout
android:id="@+id/bottomRight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/bottomRightItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/poppins_bold"
android:text="@string/loading"/>
<TextView
android:id="@+id/bottomRightLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/poppins_semi_bold"
android:text="@string/chapters_read"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:gravity="center"
android:fontFamily="@font/poppins_bold"
android:text="@string/profile_stats_widget" />
<com.google.android.material.button.MaterialButton
android:id="@+id/add_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/add_widget" />
</LinearLayout>