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,
|
Status statusReturned,
|
||||||
boolean remote) {
|
boolean remote) {
|
||||||
if (statusReturned == null) {
|
if (statusReturned == null) {
|
||||||
Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
|
switch (typeOfAction) {
|
||||||
return;
|
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;
|
boolean isOK = true;
|
||||||
switch (typeOfAction) {
|
switch (typeOfAction) {
|
||||||
case BOOKMARK_ACTION:
|
case BOOKMARK_ACTION:
|
||||||
|
@ -248,7 +270,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
isOK = !statusReturned.favourited;
|
isOK = !statusReturned.favourited;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isOK) {
|
if (!isOK) {
|
||||||
Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
|
Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
|
@ -260,6 +281,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
statusToDeal.reblogs_count = statusReturned.reblogs_count;
|
statusToDeal.reblogs_count = statusReturned.reblogs_count;
|
||||||
statusToDeal.favourites_count = statusReturned.favourites_count;
|
statusToDeal.favourites_count = statusReturned.favourites_count;
|
||||||
|
|
||||||
|
}
|
||||||
//Update status in cache if not a remote instance
|
//Update status in cache if not a remote instance
|
||||||
if (!remote) {
|
if (!remote) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
|
Loading…
Reference in a new issue