Pin can only be done by owner + fixes an issue when query fails
This commit is contained in:
parent
563bb53f40
commit
0f3c64978f
|
@ -718,6 +718,7 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
||||||
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
|
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
|
||||||
if( show_error_messages)
|
if( show_error_messages)
|
||||||
Toast.makeText(context, error.getError(),Toast.LENGTH_LONG).show();
|
Toast.makeText(context, error.getError(),Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
Helper.manageMessageStatusCode(context, statusCode, statusAction);
|
Helper.manageMessageStatusCode(context, statusCode, statusAction);
|
||||||
//When muting or blocking an account, its status are removed from the list
|
//When muting or blocking an account, its status are removed from the list
|
||||||
|
@ -730,42 +731,40 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
||||||
notifications.removeAll(notificationsToRemove);
|
notifications.removeAll(notificationsToRemove);
|
||||||
notificationsListAdapter.notifyDataSetChanged();
|
notificationsListAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
if( targetedId != null) {
|
if (statusAction == API.StatusAction.REBLOG) {
|
||||||
if (statusAction == API.StatusAction.REBLOG) {
|
for (Notification notification : notifications) {
|
||||||
for (Notification notification : notifications) {
|
if (notification.getStatus().getId().equals(targetedId)) {
|
||||||
if (notification.getStatus().getId().equals(targetedId)) {
|
notification.getStatus().setReblogs_count(notification.getStatus().getReblogs_count() + 1);
|
||||||
notification.getStatus().setReblogs_count(notification.getStatus().getReblogs_count() + 1);
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
notificationsListAdapter.notifyDataSetChanged();
|
|
||||||
} else if (statusAction == API.StatusAction.UNREBLOG) {
|
|
||||||
for (Notification notification : notifications) {
|
|
||||||
if (notification.getStatus().getId().equals(targetedId)) {
|
|
||||||
if (notification.getStatus().getReblogs_count() - 1 >= 0)
|
|
||||||
notification.getStatus().setReblogs_count(notification.getStatus().getReblogs_count() - 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notificationsListAdapter.notifyDataSetChanged();
|
|
||||||
} else if (statusAction == API.StatusAction.FAVOURITE) {
|
|
||||||
for (Notification notification : notifications) {
|
|
||||||
if (notification.getStatus().getId().equals(targetedId)) {
|
|
||||||
notification.getStatus().setFavourites_count(notification.getStatus().getFavourites_count() + 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notificationsListAdapter.notifyDataSetChanged();
|
|
||||||
} else if (statusAction == API.StatusAction.UNFAVOURITE) {
|
|
||||||
for (Notification notification : notifications) {
|
|
||||||
if (notification.getStatus().getId().equals(targetedId)) {
|
|
||||||
if (notification.getStatus().getFavourites_count() - 1 >= 0)
|
|
||||||
notification.getStatus().setFavourites_count(notification.getStatus().getFavourites_count() - 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notificationsListAdapter.notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
|
notificationsListAdapter.notifyDataSetChanged();
|
||||||
|
} else if (statusAction == API.StatusAction.UNREBLOG) {
|
||||||
|
for (Notification notification : notifications) {
|
||||||
|
if (notification.getStatus().getId().equals(targetedId)) {
|
||||||
|
if (notification.getStatus().getReblogs_count() - 1 >= 0)
|
||||||
|
notification.getStatus().setReblogs_count(notification.getStatus().getReblogs_count() - 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
notificationsListAdapter.notifyDataSetChanged();
|
||||||
|
} else if (statusAction == API.StatusAction.FAVOURITE) {
|
||||||
|
for (Notification notification : notifications) {
|
||||||
|
if (notification.getStatus().getId().equals(targetedId)) {
|
||||||
|
notification.getStatus().setFavourites_count(notification.getStatus().getFavourites_count() + 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
notificationsListAdapter.notifyDataSetChanged();
|
||||||
|
} else if (statusAction == API.StatusAction.UNFAVOURITE) {
|
||||||
|
for (Notification notification : notifications) {
|
||||||
|
if (notification.getStatus().getId().equals(targetedId)) {
|
||||||
|
if (notification.getStatus().getFavourites_count() - 1 >= 0)
|
||||||
|
notification.getStatus().setFavourites_count(notification.getStatus().getFavourites_count() - 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
notificationsListAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -825,7 +825,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.status_pin.setOnClickListener(new View.OnClickListener() {
|
holder.status_pin.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
CrossActions.doCrossAction(context, status, (status.isPinned()|| (status.getReblog() != null && status.getReblog().isPinned()))? API.StatusAction.UNPIN:API.StatusAction.PIN, statusListAdapter, StatusListAdapter.this, false);
|
CrossActions.doCrossAction(context, status, (status.isPinned()|| (status.getReblog() != null && status.getReblog().isPinned()))? API.StatusAction.UNPIN:API.StatusAction.PIN, statusListAdapter, StatusListAdapter.this, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue