Skip to content

Commit

Permalink
Fixed the bookmarks item delete button state (#2470)
Browse files Browse the repository at this point in the history
* Fixed the bookmarks item delete button state

* Un-hover when touch action is cancelled
  • Loading branch information
keianhzo authored and bluemarvin committed Dec 24, 2019
1 parent 777a0ae commit e3645a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Expand Up @@ -215,6 +215,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
return true;

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

case MotionEvent.ACTION_CANCEL:
binding.setIsHovered(false);
binding.trash.setImageState(new int[]{android.R.attr.state_active},true);
return false;
}
Expand Down
Expand Up @@ -186,17 +186,18 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
return true;

case MotionEvent.ACTION_CANCEL:
binding.setIsHovered(false);
binding.more.setImageState(new int[]{android.R.attr.state_active},true);
return false;
}
return false;
});
binding.trash.setOnHoverListener(mIconHoverListener);
binding.trash.setOnTouchListener((view, motionEvent) -> {
binding.setIsHovered(true);
int ev = motionEvent.getActionMasked();
switch (ev) {
case MotionEvent.ACTION_UP:
binding.setIsHovered(true);
if (mHistoryItemCallback != null) {
mHistoryItemCallback.onDelete(view, binding.getItem());
}
Expand All @@ -208,6 +209,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
return true;

case MotionEvent.ACTION_CANCEL:
binding.setIsHovered(false);
binding.trash.setImageState(new int[]{android.R.attr.state_active},true);
return false;
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/bookmark_item.xml
Expand Up @@ -51,6 +51,7 @@
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:layout_toStartOf="@id/buttons_container"
android:orientation="@{isNarrow ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL}">

<TextView
Expand Down

0 comments on commit e3645a4

Please sign in to comment.