forked from mirrors/Fedilab
Fix issue #496 - wrong label for new reports and user sign-up
This commit is contained in:
parent
b334a5b655
commit
3f8f15256d
4 changed files with 33 additions and 7 deletions
|
@ -67,6 +67,8 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
private final int TYPE_REACTION = 8;
|
private final int TYPE_REACTION = 8;
|
||||||
private final int TYPE_UPDATE = 9;
|
private final int TYPE_UPDATE = 9;
|
||||||
private final int TYPE_FILERED = 10;
|
private final int TYPE_FILERED = 10;
|
||||||
|
private final int TYPE_ADMIN_SIGNUP = 11;
|
||||||
|
private final int TYPE_ADMIN_REPORT = 12;
|
||||||
public FetchMoreCallBack fetchMoreCallBack;
|
public FetchMoreCallBack fetchMoreCallBack;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
|
@ -107,6 +109,10 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
return TYPE_POLL;
|
return TYPE_POLL;
|
||||||
case "status":
|
case "status":
|
||||||
return TYPE_STATUS;
|
return TYPE_STATUS;
|
||||||
|
case "admin.sign_up":
|
||||||
|
return TYPE_ADMIN_SIGNUP;
|
||||||
|
case "admin.report":
|
||||||
|
return TYPE_ADMIN_REPORT;
|
||||||
case "pleroma:emoji_reaction":
|
case "pleroma:emoji_reaction":
|
||||||
return TYPE_REACTION;
|
return TYPE_REACTION;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +124,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
@Override
|
@Override
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
context = parent.getContext();
|
context = parent.getContext();
|
||||||
if (viewType == TYPE_FOLLOW || viewType == TYPE_FOLLOW_REQUEST) {
|
if (viewType == TYPE_FOLLOW || viewType == TYPE_FOLLOW_REQUEST || viewType == TYPE_ADMIN_REPORT || viewType == TYPE_ADMIN_SIGNUP) {
|
||||||
DrawerFollowBinding itemBinding = DrawerFollowBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
DrawerFollowBinding itemBinding = DrawerFollowBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
return new ViewHolderFollow(itemBinding);
|
return new ViewHolderFollow(itemBinding);
|
||||||
} else if (viewType == TYPE_FILERED) {
|
} else if (viewType == TYPE_FILERED) {
|
||||||
|
@ -133,7 +139,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
Notification notification = notificationList.get(position);
|
Notification notification = notificationList.get(position);
|
||||||
if (getItemViewType(position) == TYPE_FOLLOW || getItemViewType(position) == TYPE_FOLLOW_REQUEST) {
|
if (getItemViewType(position) == TYPE_FOLLOW || getItemViewType(position) == TYPE_FOLLOW_REQUEST || getItemViewType(position) == TYPE_ADMIN_REPORT || getItemViewType(position) == TYPE_ADMIN_SIGNUP) {
|
||||||
ViewHolderFollow holderFollow = (ViewHolderFollow) viewHolder;
|
ViewHolderFollow holderFollow = (ViewHolderFollow) viewHolder;
|
||||||
MastodonHelper.loadPPMastodon(holderFollow.binding.avatar, notification.account);
|
MastodonHelper.loadPPMastodon(holderFollow.binding.avatar, notification.account);
|
||||||
holderFollow.binding.displayName.setText(
|
holderFollow.binding.displayName.setText(
|
||||||
|
@ -157,13 +163,17 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
holderFollow.binding.username.setTextColor(theme_text_color);
|
holderFollow.binding.username.setTextColor(theme_text_color);
|
||||||
holderFollow.binding.title.setTextColor(theme_text_color);
|
holderFollow.binding.title.setTextColor(theme_text_color);
|
||||||
}
|
}
|
||||||
|
holderFollow.binding.rejectButton.setVisibility(View.GONE);
|
||||||
|
holderFollow.binding.acceptButton.setVisibility(View.GONE);
|
||||||
if (getItemViewType(position) == TYPE_FOLLOW_REQUEST) {
|
if (getItemViewType(position) == TYPE_FOLLOW_REQUEST) {
|
||||||
holderFollow.binding.rejectButton.setVisibility(View.VISIBLE);
|
holderFollow.binding.rejectButton.setVisibility(View.VISIBLE);
|
||||||
holderFollow.binding.acceptButton.setVisibility(View.VISIBLE);
|
holderFollow.binding.acceptButton.setVisibility(View.VISIBLE);
|
||||||
holderFollow.binding.title.setText(R.string.follow_request);
|
holderFollow.binding.title.setText(R.string.follow_request);
|
||||||
|
} else if (getItemViewType(position) == TYPE_ADMIN_REPORT) {
|
||||||
|
holderFollow.binding.title.setText(String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_submitted_report)));
|
||||||
|
} else if (getItemViewType(position) == TYPE_ADMIN_SIGNUP) {
|
||||||
|
holderFollow.binding.title.setText(String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_signed_up)));
|
||||||
} else {
|
} else {
|
||||||
holderFollow.binding.rejectButton.setVisibility(View.GONE);
|
|
||||||
holderFollow.binding.acceptButton.setVisibility(View.GONE);
|
|
||||||
holderFollow.binding.title.setText(R.string.follow);
|
holderFollow.binding.title.setText(R.string.follow);
|
||||||
}
|
}
|
||||||
AccountsVM accountsVM = new ViewModelProvider((ViewModelStoreOwner) context).get(AccountsVM.class);
|
AccountsVM accountsVM = new ViewModelProvider((ViewModelStoreOwner) context).get(AccountsVM.class);
|
||||||
|
@ -317,6 +327,8 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
title = String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_update));
|
title = String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_update));
|
||||||
} else if (getItemViewType(position) == TYPE_POLL) {
|
} else if (getItemViewType(position) == TYPE_POLL) {
|
||||||
title = context.getString(R.string.notif_poll);
|
title = context.getString(R.string.notif_poll);
|
||||||
|
} else if (getItemViewType(position) == TYPE_POLL) {
|
||||||
|
title = context.getString(R.string.notif_poll);
|
||||||
}
|
}
|
||||||
if (notification.relatedNotifications != null && notification.relatedNotifications.size() > 0) {
|
if (notification.relatedNotifications != null && notification.relatedNotifications.size() > 0) {
|
||||||
if (notification.type.equals("favourite")) {
|
if (notification.type.equals("favourite")) {
|
||||||
|
|
|
@ -103,6 +103,8 @@ public class FragmentMastodonConversation extends Fragment implements Conversati
|
||||||
isViewInitialized = true;
|
isViewInitialized = true;
|
||||||
if (initialConversations != null) {
|
if (initialConversations != null) {
|
||||||
initializeConversationCommonView(initialConversations);
|
initializeConversationCommonView(initialConversations);
|
||||||
|
} else {
|
||||||
|
route(null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,7 +249,7 @@ public class FragmentMastodonConversation extends Fragment implements Conversati
|
||||||
binding.recyclerView.setVisibility(View.GONE);
|
binding.recyclerView.setVisibility(View.GONE);
|
||||||
timelinesVM = new ViewModelProvider(FragmentMastodonConversation.this).get(TimelinesVM.class);
|
timelinesVM = new ViewModelProvider(FragmentMastodonConversation.this).get(TimelinesVM.class);
|
||||||
max_id = null;
|
max_id = null;
|
||||||
route(null, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -176,7 +176,7 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
|
||||||
binding.recyclerView.setVisibility(View.GONE);
|
binding.recyclerView.setVisibility(View.GONE);
|
||||||
max_id = null;
|
max_id = null;
|
||||||
initialNotifications = null;
|
initialNotifications = null;
|
||||||
route(null, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,6 +213,8 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
|
||||||
excludeType.add("mention");
|
excludeType.add("mention");
|
||||||
excludeType.add("update");
|
excludeType.add("update");
|
||||||
excludeType.add("status");
|
excludeType.add("status");
|
||||||
|
excludeType.add("admin.sign_up");
|
||||||
|
excludeType.add("admin.report");
|
||||||
if (notificationType == NotificationTypeEnum.ALL) {
|
if (notificationType == NotificationTypeEnum.ALL) {
|
||||||
aggregateNotification = sharedpreferences.getBoolean(getString(R.string.SET_AGGREGATE_NOTIFICATION), true);
|
aggregateNotification = sharedpreferences.getBoolean(getString(R.string.SET_AGGREGATE_NOTIFICATION), true);
|
||||||
if (excludedCategories != null) {
|
if (excludedCategories != null) {
|
||||||
|
@ -234,6 +236,10 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
|
||||||
excludeType.remove("update");
|
excludeType.remove("update");
|
||||||
} else if (notificationType == NotificationTypeEnum.TOOTS) {
|
} else if (notificationType == NotificationTypeEnum.TOOTS) {
|
||||||
excludeType.remove("status");
|
excludeType.remove("status");
|
||||||
|
} else if (notificationType == NotificationTypeEnum.ADMIN_SIGNUP) {
|
||||||
|
excludeType.remove("admin.sign_up");
|
||||||
|
} else if (notificationType == NotificationTypeEnum.ADMIN_REPORT) {
|
||||||
|
excludeType.remove("admin.report");
|
||||||
} else if (notificationType == NotificationTypeEnum.FOLLOWS) {
|
} else if (notificationType == NotificationTypeEnum.FOLLOWS) {
|
||||||
excludeType.remove("follow");
|
excludeType.remove("follow");
|
||||||
excludeType.remove("follow_request");
|
excludeType.remove("follow_request");
|
||||||
|
@ -343,7 +349,7 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
|
||||||
if (initialNotifications != null) {
|
if (initialNotifications != null) {
|
||||||
initializeNotificationView(initialNotifications);
|
initializeNotificationView(initialNotifications);
|
||||||
} else {
|
} else {
|
||||||
recreate();
|
route(null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -684,6 +690,10 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
|
||||||
REBLOGS("REBLOGS"),
|
REBLOGS("REBLOGS"),
|
||||||
@SerializedName("POLLS")
|
@SerializedName("POLLS")
|
||||||
POLLS("POLLS"),
|
POLLS("POLLS"),
|
||||||
|
@SerializedName("ADMIN_SIGNUP")
|
||||||
|
ADMIN_SIGNUP("ADMIN_SIGNUP"),
|
||||||
|
@SerializedName("ADMIN_REPORT")
|
||||||
|
ADMIN_REPORT("ADMIN_REPORT"),
|
||||||
@SerializedName("TOOTS")
|
@SerializedName("TOOTS")
|
||||||
TOOTS("TOOTS"),
|
TOOTS("TOOTS"),
|
||||||
@SerializedName("FOLLOWS")
|
@SerializedName("FOLLOWS")
|
||||||
|
|
|
@ -1902,4 +1902,6 @@
|
||||||
<string name="display_remote_profile">Display remote profile</string>
|
<string name="display_remote_profile">Display remote profile</string>
|
||||||
<string name="toast_fetch_error">The app cannot find remote data!</string>
|
<string name="toast_fetch_error">The app cannot find remote data!</string>
|
||||||
<string name="delete_timeline">Delete timeline</string>
|
<string name="delete_timeline">Delete timeline</string>
|
||||||
|
<string name="notif_submitted_report">Submitted a report</string>
|
||||||
|
<string name="notif_signed_up">Signed up</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue