mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
directly remove notification, on error reload
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
d09df705bb
commit
4c9d98cfce
3 changed files with 23 additions and 13 deletions
|
@ -374,8 +374,15 @@ public class NotificationsActivity extends FileActivity implements Notifications
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemovedNotification(boolean isSuccess, NotificationListAdapter.NotificationViewHolder holder) {
|
public void onRemovedNotification(boolean isSuccess) {
|
||||||
if (isSuccess) {
|
if (!isSuccess) {
|
||||||
|
DisplayUtils.showSnackMessage(this, getString(R.string.remove_notification_failed));
|
||||||
|
fetchAndSetData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeNotification(NotificationListAdapter.NotificationViewHolder holder) {
|
||||||
adapter.removeNotification(holder);
|
adapter.removeNotification(holder);
|
||||||
|
|
||||||
if (adapter.getItemCount() == 0) {
|
if (adapter.getItemCount() == 0) {
|
||||||
|
@ -383,9 +390,6 @@ public class NotificationsActivity extends FileActivity implements Notifications
|
||||||
swipeListRefreshLayout.setVisibility(View.GONE);
|
swipeListRefreshLayout.setVisibility(View.GONE);
|
||||||
swipeEmptyListRefreshLayout.setVisibility(View.VISIBLE);
|
swipeEmptyListRefreshLayout.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
DisplayUtils.showSnackMessage(this, getString(R.string.remove_notification_failed));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -48,8 +48,12 @@ public class DeleteNotificationTask extends AsyncTask<Action, Void, Boolean> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean doInBackground(Action... actions) {
|
protected void onPreExecute() {
|
||||||
|
notificationsActivity.removeNotification(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Boolean doInBackground(Action... actions) {
|
||||||
RemoteOperationResult result = new DeleteNotificationRemoteOperation(notification.notificationId)
|
RemoteOperationResult result = new DeleteNotificationRemoteOperation(notification.notificationId)
|
||||||
.execute(client);
|
.execute(client);
|
||||||
|
|
||||||
|
@ -58,6 +62,6 @@ public class DeleteNotificationTask extends AsyncTask<Action, Void, Boolean> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Boolean success) {
|
protected void onPostExecute(Boolean success) {
|
||||||
notificationsActivity.onRemovedNotification(success, holder);
|
notificationsActivity.onRemovedNotification(success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,9 @@ import com.owncloud.android.ui.adapter.NotificationListAdapter;
|
||||||
public interface NotificationsContract {
|
public interface NotificationsContract {
|
||||||
|
|
||||||
interface View {
|
interface View {
|
||||||
void onRemovedNotification(boolean isSuccess, NotificationListAdapter.NotificationViewHolder holder);
|
void onRemovedNotification(boolean isSuccess);
|
||||||
|
|
||||||
|
void removeNotification(NotificationListAdapter.NotificationViewHolder holder);
|
||||||
|
|
||||||
void onRemovedAllNotifications(boolean isSuccess);
|
void onRemovedAllNotifications(boolean isSuccess);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue