This commit is contained in:
Thomas 2020-12-12 14:45:14 +01:00
parent ccb5cd20b1
commit efd6b0088f
1 changed files with 21 additions and 17 deletions

View File

@ -68,7 +68,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
ViewHolder holder = (ViewHolder) viewHolder; ViewHolder holder = (ViewHolder) viewHolder;
Notification notification = notifications.get(position); Notification notification = notifications.get(position);
//Follow Notification //Follow Notification
boolean clickableNotification = true;
holder.peertube_notif_pp.setVisibility(View.VISIBLE); holder.peertube_notif_pp.setVisibility(View.VISIBLE);
AccountData.Account accountAction = null; AccountData.Account accountAction = null;
ChannelData.Channel channelAction = null; ChannelData.Channel channelAction = null;
@ -158,11 +158,13 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
}); });
} else if (notification.getVideoAbuse() != null && notification.getVideoAbuse().getVideo() != null) { } else if (notification.getVideoAbuse() != null && notification.getVideoAbuse().getVideo() != null) {
message = context.getString(R.string.peertube_video_abuse, notification.getVideoAbuse().getVideo().getName()); message = context.getString(R.string.peertube_video_abuse, notification.getVideoAbuse().getVideo().getName());
clickableNotification = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY)); holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
else else
holder.peertube_notif_message.setText(Html.fromHtml(message)); holder.peertube_notif_message.setText(Html.fromHtml(message));
} else if (notification.getAbuse() != null) { } else if (notification.getAbuse() != null) {
clickableNotification = false;
if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_REPPORT_SUCCESS) { if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_REPPORT_SUCCESS) {
message = context.getString(R.string.peertube_video_report_success, notification.getAbuse().getId()); message = context.getString(R.string.peertube_video_report_success, notification.getAbuse().getId());
} }
@ -175,22 +177,24 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
holder.peertube_notif_date.setText(Helper.dateDiff(context, notification.getCreatedAt())); holder.peertube_notif_date.setText(Helper.dateDiff(context, notification.getCreatedAt()));
AccountData.Account finalAccountAction = accountAction; AccountData.Account finalAccountAction = accountAction;
ChannelData.Channel finalChannelAction = channelAction; ChannelData.Channel finalChannelAction = channelAction;
holder.peertube_notif_pp.setOnClickListener(v -> { if (clickableNotification) {
Bundle b = new Bundle(); holder.peertube_notif_pp.setOnClickListener(v -> {
Intent intent = null; Bundle b = new Bundle();
if (finalAccountAction != null) { Intent intent = null;
intent = new Intent(context, ShowAccountActivity.class); if (finalAccountAction != null) {
b.putParcelable("account", finalAccountAction); intent = new Intent(context, ShowAccountActivity.class);
b.putString("accountAcct", finalAccountAction.getUsername() + "@" + finalAccountAction.getHost()); b.putParcelable("account", finalAccountAction);
} else if (finalChannelAction != null) { b.putString("accountAcct", finalAccountAction.getUsername() + "@" + finalAccountAction.getHost());
intent = new Intent(context, ShowChannelActivity.class); } else if (finalChannelAction != null) {
b.putParcelable("channel", finalChannelAction); intent = new Intent(context, ShowChannelActivity.class);
} b.putParcelable("channel", finalChannelAction);
if (intent != null) { }
intent.putExtras(b); if (intent != null) {
context.startActivity(intent); intent.putExtras(b);
} context.startActivity(intent);
}); }
});
}
} }