Skip to content

Commit d3d30f1

Browse files
Refactor: Refactor rename UI in app drawer
This commit refactors the user interface for renaming items in the app drawer. The previous text-based "Rename" button has been replaced with more intuitive save (tick) and cancel (close) icons. Key changes include: - Replaced `FontAppCompatTextView` for saving with an `ImageView` using a new `ic_tick` drawable. - Added a new `ImageView` with an `ic_close` drawable to cancel the rename action. - Updated the `ic_close`, `ic_minus`, and `ic_plus` drawables to use the theme's primary color (`?attr/primaryColor`), ensuring a consistent look. - Set `windowSoftInputMode` to `adjustResize|stateHidden` in `AndroidManifest.xml` to prevent the keyboard from pushing the layout up unexpectedly during renaming.
1 parent 00c4785 commit d3d30f1

File tree

6 files changed

+37
-18
lines changed

6 files changed

+37
-18
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:dist="http://schemas.android.com/apk/distribution"
4-
xmlns:tools="http://schemas.android.com/tools">
3+
xmlns:dist="http://schemas.android.com/apk/distribution"
4+
xmlns:tools="http://schemas.android.com/tools">
55
<!-- Enable instant apps (optional) -->
66
<dist:module dist:instant="true" />
77
<!-- Permissions your launcher uses -->
@@ -33,6 +33,7 @@
3333
android:label="@string/app_name"
3434
android:supportsRtl="true"
3535
android:theme="@style/Theme.mLauncher"
36+
android:windowSoftInputMode="adjustResize|stateHidden"
3637
tools:targetApi="tiramisu">
3738
<activity
3839
android:name=".ui.widgets.WidgetActivity"

app/src/main/res/drawable/ic_close.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
android:height="24dp"
44
android:viewportWidth="24"
55
android:viewportHeight="24">
6-
<path
7-
android:fillColor="?attr/primaryColor"
8-
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
9-
</vector>
6+
<path
7+
android:pathData="m16.35,17.79l1.44,-1.44 -4.34,-4.35 4.34,-4.35 -1.44,-1.44 -4.35,4.34 -4.35,-4.34 -1.44,1.44 4.34,4.35 -4.34,4.35 1.44,1.44 4.35,-4.34z"
8+
android:fillColor="?attr/primaryColor"/>
9+
</vector>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
android:width="24dp"
3-
android:height="24dp"
4-
android:viewportWidth="24"
5-
android:viewportHeight="24">
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24">
66
<path
7-
android:fillColor="@android:color/white"
7+
android:fillColor="?attr/primaryColor"
88
android:pathData="M19,13H5V11H19V13Z" />
99
</vector>

app/src/main/res/drawable/ic_plus.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
android:viewportWidth="24"
55
android:viewportHeight="24">
66
<path
7-
android:fillColor="@android:color/white"
7+
android:fillColor="?attr/primaryColor"
88
android:pathData="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"/>
99
</vector>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24">
6+
<path
7+
android:pathData="m17.81,8.92l-1.44,-1.45 -6.17,6.17 -2.57,-2.57 -1.44,1.45 4.01,4.01z"
8+
android:fillColor="?attr/primaryColor"/>
9+
</vector>

app/src/main/res/layout/adapter_app_drawer.xml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,24 @@
195195
android:textColorHint="?attr/primaryColorTrans50"
196196
tools:ignore="LabelFor" />
197197

198-
<com.github.creativecodecat.components.views.FontAppCompatTextView
198+
<ImageView
199199
android:id="@+id/appSaveRename"
200-
style="@style/TextSmallBold"
201200
android:layout_width="wrap_content"
202201
android:layout_height="match_parent"
203-
android:gravity="center"
204-
android:paddingHorizontal="20dp"
205-
android:text="@string/rename"
206-
android:textAllCaps="true" />
202+
android:contentDescription="@string/rename"
203+
android:paddingHorizontal="2dp"
204+
android:scaleType="centerInside"
205+
android:src="@drawable/ic_tick" />
206+
207+
<ImageView
208+
android:id="@+id/appSaveCancel"
209+
android:layout_width="wrap_content"
210+
android:layout_height="match_parent"
211+
android:layout_marginEnd="18dp"
212+
android:contentDescription="@string/cancel"
213+
android:paddingHorizontal="2dp"
214+
android:scaleType="centerInside"
215+
android:src="@drawable/ic_close" />
207216

208217
</LinearLayout>
209218

0 commit comments

Comments
 (0)