mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-23 09:10:04 +02:00
parent
f4bfe12abe
commit
bd43af4ab8
1 changed files with 56 additions and 34 deletions
|
@ -224,9 +224,31 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
Status statusReturned,
|
||||
boolean remote) {
|
||||
if (statusReturned == null) {
|
||||
Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
|
||||
return;
|
||||
switch (typeOfAction) {
|
||||
case BOOKMARK_ACTION:
|
||||
statusToDeal.bookmarked = true;
|
||||
break;
|
||||
case REBLOG_ACTION:
|
||||
statusToDeal.reblogged = true;
|
||||
statusToDeal.reblogs_count++;
|
||||
break;
|
||||
case FAVOURITE_ACTION:
|
||||
statusToDeal.favourited = true;
|
||||
statusToDeal.favourites_count++;
|
||||
break;
|
||||
case UNBOOKMARK_ACTION:
|
||||
statusToDeal.bookmarked = false;
|
||||
break;
|
||||
case UNREBLOG_ACTION:
|
||||
statusToDeal.reblogged = false;
|
||||
statusToDeal.reblogs_count--;
|
||||
break;
|
||||
case UNFAVOURITE_ACTION:
|
||||
statusToDeal.favourited = false;
|
||||
statusToDeal.favourites_count--;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
boolean isOK = true;
|
||||
switch (typeOfAction) {
|
||||
case BOOKMARK_ACTION:
|
||||
|
@ -248,7 +270,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
isOK = !statusReturned.favourited;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isOK) {
|
||||
Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
@ -260,6 +281,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
statusToDeal.reblogs_count = statusReturned.reblogs_count;
|
||||
statusToDeal.favourites_count = statusReturned.favourites_count;
|
||||
|
||||
}
|
||||
//Update status in cache if not a remote instance
|
||||
if (!remote) {
|
||||
new Thread(() -> {
|
||||
|
|
Loading…
Reference in a new issue