Skip to content

Commit

Permalink
refactor(notification-headers): make only avatar and icon be clickabl…
Browse files Browse the repository at this point in the history
…e. Also fixes the ripple not being drawn correctly
  • Loading branch information
LucasGGamerM committed Sep 27, 2023
1 parent 3b36434 commit 7b4be83
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ public ImageLoaderRequest getImageRequest(int index){
public static class Holder extends StatusDisplayItem.Holder<NotificationHeaderStatusDisplayItem> implements ImageLoaderViewHolder{
private final ImageView icon, avatar;
private final TextView text;
private final int selectableItemBackground;

public Holder(Activity activity, ViewGroup parent){
super(activity, R.layout.display_item_notification_header, parent);
Expand All @@ -124,10 +123,8 @@ public Holder(Activity activity, ViewGroup parent){
avatar.setOutlineProvider(OutlineProviders.roundedRect(8));
avatar.setClipToOutline(true);

itemView.setOnClickListener(this::onItemClick);
TypedValue outValue = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
selectableItemBackground = outValue.resourceId;
icon.setOnClickListener(this::onItemClick);
avatar.setOnClickListener(this::onItemClick);
}

@Override
Expand Down Expand Up @@ -170,10 +167,7 @@ public void onBind(NotificationHeaderStatusDisplayItem item){
case POLL -> R.attr.colorPoll;
default -> android.R.attr.colorAccent;
})));
itemView.setBackgroundResource(item.notification.type != Notification.Type.POLL
&& item.notification.type != Notification.Type.REPORT ?
selectableItemBackground : 0);
itemView.setClickable(item.notification.type != Notification.Type.POLL);
itemView.setBackgroundResource(0);
}

public void onItemClick(View v) {
Expand Down

0 comments on commit 7b4be83

Please sign in to comment.