Skip to content

Commit 0de40dc

Browse files
committed
Changed UI for clear all button
1 parent d815361 commit 0de40dc

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

app/src/main/java/phone/vishnu/quotes/fragment/FavoriteFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import android.view.WindowManager;
3636
import android.view.inputmethod.InputMethodManager;
3737
import android.widget.Filter;
38+
import android.widget.ImageButton;
3839
import android.widget.ImageView;
3940
import android.widget.TextView;
4041
import android.widget.Toast;
@@ -75,7 +76,7 @@ public class FavoriteFragment extends BaseBottomSheetDialogFragment {
7576
private FavoritesRVAdapter adapter;
7677
private RecyclerView recyclerView;
7778

78-
private TextView clearAllButton;
79+
private ImageButton clearAllButton;
7980

8081
private ImageView emptyHintIV;
8182
private TextView emptyHintTV, addTV, countTV;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
2+
3+
<path android:fillColor="@android:color/white" android:pathData="M6,13h12c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L6,11c-0.55,0 -1,0.45 -1,1s0.45,1 1,1zM4,17h12c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L4,15c-0.55,0 -1,0.45 -1,1s0.45,1 1,1zM7,8c0,0.55 0.45,1 1,1h12c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L8,7c-0.55,0 -1,0.45 -1,1z"/>
4+
5+
</vector>

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

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
android:layout_width="wrap_content"
6060
android:layout_height="wrap_content"
6161
android:orientation="horizontal"
62-
app:layout_constraintGuide_begin="100dp" />
62+
app:layout_constraintGuide_begin="55dp" />
6363

6464
<com.google.android.material.textfield.TextInputLayout
6565
android:id="@+id/favSearchTIL"
@@ -108,15 +108,29 @@
108108
android:layout_width="wrap_content"
109109
android:layout_height="wrap_content"
110110
android:layout_margin="8dp"
111+
android:layout_marginEnd="7dp"
111112
android:fontFamily="serif"
112113
android:padding="2dp"
113114
android:textColor="@color/textColor"
114115
android:textSize="16sp"
115116
android:textStyle="bold"
116117
app:layout_constraintBottom_toBottomOf="@id/favChipGroup"
117-
app:layout_constraintEnd_toEndOf="parent"
118+
app:layout_constraintEnd_toStartOf="@+id/clearAllButton"
118119
app:layout_constraintTop_toTopOf="@id/favChipGroup" />
119120

121+
<ImageButton
122+
android:id="@+id/clearAllButton"
123+
android:layout_width="40dp"
124+
android:layout_height="40dp"
125+
android:layout_margin="8dp"
126+
android:background="?attr/selectableItemBackgroundBorderless"
127+
android:contentDescription="@string/clear_all"
128+
android:src="@drawable/ic_round_clear_all_24"
129+
android:tint="@color/textColor"
130+
app:layout_constraintBottom_toBottomOf="@id/favCountTV"
131+
app:layout_constraintEnd_toEndOf="parent"
132+
app:layout_constraintTop_toTopOf="@id/favCountTV" />
133+
120134
<com.google.android.material.progressindicator.LinearProgressIndicator
121135
android:id="@+id/favProgressBar"
122136
android:layout_width="0dp"
@@ -174,25 +188,6 @@
174188
app:layout_constraintTop_toBottomOf="@id/favProgressBar"
175189
tools:listitem="@layout/favorite_single_item" />
176190

177-
<TextView
178-
android:id="@+id/clearAllButton"
179-
android:layout_width="175dp"
180-
android:layout_height="40dp"
181-
android:layout_marginTop="4dp"
182-
android:layout_marginBottom="16dp"
183-
android:background="#FFFFFF"
184-
android:gravity="center"
185-
android:text="Clear All"
186-
android:textColor="@android:color/black"
187-
android:textSize="16sp"
188-
android:visibility="visible"
189-
app:layout_constraintBottom_toTopOf="@+id/favSearchTIL"
190-
app:layout_constraintEnd_toEndOf="parent"
191-
app:layout_constraintHorizontal_bias="0.937"
192-
app:layout_constraintStart_toEndOf="@+id/favTitleTV"
193-
app:layout_constraintTop_toBottomOf="@+id/favAddTV"
194-
app:layout_constraintVertical_bias="1.0" />
195-
196191

197192
</androidx.constraintlayout.widget.ConstraintLayout>
198193

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
<string name="all">All</string>
128128
<string name="default_string">Default</string>
129129
<string name="custom">Custom</string>
130+
<string name="clear_all">Clear All</string>
130131

131132
<string name="font_file_not_found">Font file not found</string>
132133

0 commit comments

Comments
 (0)