Cherish: improve app list fragment

* properly constrained image view and max lines of both label and package views
* use lifecycle scope inherent to fragments instead of creating new coroutine scopes
* fetch package list from pm every time refreshList is called
* early release locks when refreshing list
* properly annotate setDisplayCategory method
* keep AppListAdapter as a regular nested class instead of an inner class for reusability

Signed-off-by: jhonboy121 <alfredmathew05@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
jhonboy121
2022-04-18 01:50:24 +05:30
committed by Hưng Phan
parent 5112b06122
commit 7c02f3bf4d
2 changed files with 143 additions and 115 deletions

View File

@@ -25,11 +25,11 @@
android:id="@+id/icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_marginVertical="4dp"
android:scaleType="centerInside"
settings:layout_constraintStart_toStartOf="parent"
settings:layout_constraintTop_toTopOf="parent" />
settings:layout_constraintTop_toTopOf="parent"
settings:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:id="@+id/label"
@@ -38,23 +38,26 @@
android:layout_marginStart="@dimen/default_margin"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorPrimary"
android:maxLines="1"
settings:layout_constraintStart_toEndOf="@id/icon"
settings:layout_constraintEnd_toStartOf="@id/checkBox"
settings:layout_constraintTop_toTopOf="@id/icon" />
settings:layout_constraintEnd_toStartOf="@id/check_box"
settings:layout_constraintTop_toTopOf="@id/icon"
settings:layout_constraintBottom_toTopOf="@id/package_name" />
<TextView
android:id="@+id/packageName"
android:id="@+id/package_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="2"
settings:layout_constraintStart_toStartOf="@id/label"
settings:layout_constraintEnd_toEndOf="@id/label"
settings:layout_constraintTop_toBottomOf="@id/label"
settings:layout_constraintBottom_toBottomOf="@id/icon" />
<CheckBox
android:id="@+id/checkBox"
android:id="@+id/check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"