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;
Notification notification = notifications.get(position);
//Follow Notification
boolean clickableNotification = true;
holder.peertube_notif_pp.setVisibility(View.VISIBLE);
AccountData.Account accountAction = 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) {
message = context.getString(R.string.peertube_video_abuse, notification.getVideoAbuse().getVideo().getName());
clickableNotification = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
else
holder.peertube_notif_message.setText(Html.fromHtml(message));
} else if (notification.getAbuse() != null) {
clickableNotification = false;
if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_REPPORT_SUCCESS) {
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()));
AccountData.Account finalAccountAction = accountAction;
ChannelData.Channel finalChannelAction = channelAction;
holder.peertube_notif_pp.setOnClickListener(v -> {
Bundle b = new Bundle();
Intent intent = null;
if (finalAccountAction != null) {
intent = new Intent(context, ShowAccountActivity.class);
b.putParcelable("account", finalAccountAction);
b.putString("accountAcct", finalAccountAction.getUsername() + "@" + finalAccountAction.getHost());
} else if (finalChannelAction != null) {
intent = new Intent(context, ShowChannelActivity.class);
b.putParcelable("channel", finalChannelAction);
}
if (intent != null) {
intent.putExtras(b);
context.startActivity(intent);
}
});
if (clickableNotification) {
holder.peertube_notif_pp.setOnClickListener(v -> {
Bundle b = new Bundle();
Intent intent = null;
if (finalAccountAction != null) {
intent = new Intent(context, ShowAccountActivity.class);
b.putParcelable("account", finalAccountAction);
b.putString("accountAcct", finalAccountAction.getUsername() + "@" + finalAccountAction.getHost());
} else if (finalChannelAction != null) {
intent = new Intent(context, ShowChannelActivity.class);
b.putParcelable("channel", finalChannelAction);
}
if (intent != null) {
intent.putExtras(b);
context.startActivity(intent);
}
});
}
}