mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Fix inbox count not updating after reading a message.
This commit is contained in:
parent
4f7d8321fc
commit
67d30b90e4
@ -17,6 +17,8 @@ import androidx.paging.PagedListAdapter;
|
|||||||
import androidx.recyclerview.widget.DiffUtil;
|
import androidx.recyclerview.widget.DiffUtil;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
@ -40,6 +42,7 @@ import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity;
|
|||||||
import ml.docilealligator.infinityforreddit.activities.ViewPrivateMessagesActivity;
|
import ml.docilealligator.infinityforreddit.activities.ViewPrivateMessagesActivity;
|
||||||
import ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity;
|
import ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity;
|
||||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||||
|
import ml.docilealligator.infinityforreddit.events.ChangeInboxCountEvent;
|
||||||
import ml.docilealligator.infinityforreddit.markdown.SpoilerParserPlugin;
|
import ml.docilealligator.infinityforreddit.markdown.SpoilerParserPlugin;
|
||||||
import ml.docilealligator.infinityforreddit.markdown.SuperscriptInlineProcessor;
|
import ml.docilealligator.infinityforreddit.markdown.SuperscriptInlineProcessor;
|
||||||
import ml.docilealligator.infinityforreddit.message.FetchMessage;
|
import ml.docilealligator.infinityforreddit.message.FetchMessage;
|
||||||
@ -171,7 +174,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
|||||||
if (markAllMessagesAsRead) {
|
if (markAllMessagesAsRead) {
|
||||||
message.setNew(false);
|
message.setNew(false);
|
||||||
} else {
|
} else {
|
||||||
((DataViewHolder) holder).itemView.setBackgroundColor(
|
holder.itemView.setBackgroundColor(
|
||||||
mUnreadMessageBackgroundColor);
|
mUnreadMessageBackgroundColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,6 +212,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
|||||||
new ReadMessage.ReadMessageListener() {
|
new ReadMessage.ReadMessageListener() {
|
||||||
@Override
|
@Override
|
||||||
public void readSuccess() {
|
public void readSuccess() {
|
||||||
|
EventBus.getDefault().post(new ChangeInboxCountEvent(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -147,7 +147,11 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setInboxCount(int inboxCount) {
|
public void setInboxCount(int inboxCount) {
|
||||||
this.inboxCount = inboxCount;
|
if (inboxCount < 0) {
|
||||||
|
this.inboxCount = Math.max(0, this.inboxCount + inboxCount);
|
||||||
|
} else {
|
||||||
|
this.inboxCount = inboxCount;
|
||||||
|
}
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user