Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit e3645a4

Browse files
keianhzobluemarvin
authored andcommitted
Fixed the bookmarks item delete button state (#2470)
* Fixed the bookmarks item delete button state * Un-hover when touch action is cancelled
1 parent 777a0ae commit e3645a4

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

app/src/common/shared/org/mozilla/vrbrowser/ui/adapters/BookmarkAdapter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
215215
return true;
216216

217217
case MotionEvent.ACTION_CANCEL:
218+
binding.setIsHovered(false);
218219
binding.more.setImageState(new int[]{android.R.attr.state_active},true);
219220
return false;
220221
}
@@ -237,6 +238,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
237238
return true;
238239

239240
case MotionEvent.ACTION_CANCEL:
241+
binding.setIsHovered(false);
240242
binding.trash.setImageState(new int[]{android.R.attr.state_active},true);
241243
return false;
242244
}

app/src/common/shared/org/mozilla/vrbrowser/ui/adapters/HistoryAdapter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,18 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
186186
return true;
187187

188188
case MotionEvent.ACTION_CANCEL:
189+
binding.setIsHovered(false);
189190
binding.more.setImageState(new int[]{android.R.attr.state_active},true);
190191
return false;
191192
}
192193
return false;
193194
});
194195
binding.trash.setOnHoverListener(mIconHoverListener);
195196
binding.trash.setOnTouchListener((view, motionEvent) -> {
197+
binding.setIsHovered(true);
196198
int ev = motionEvent.getActionMasked();
197199
switch (ev) {
198200
case MotionEvent.ACTION_UP:
199-
binding.setIsHovered(true);
200201
if (mHistoryItemCallback != null) {
201202
mHistoryItemCallback.onDelete(view, binding.getItem());
202203
}
@@ -208,6 +209,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
208209
return true;
209210

210211
case MotionEvent.ACTION_CANCEL:
212+
binding.setIsHovered(false);
211213
binding.trash.setImageState(new int[]{android.R.attr.state_active},true);
212214
return false;
213215
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
android:layout_alignParentStart="true"
5252
android:layout_centerVertical="true"
5353
android:gravity="center_vertical"
54+
android:layout_toStartOf="@id/buttons_container"
5455
android:orientation="@{isNarrow ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL}">
5556

5657
<TextView

0 commit comments

Comments
 (0)