Bläddra i källkod

Merge pull request #5133 from nextcloud/notificationTask

task needs to be a new object for every button
Andy Scherzinger 5 år sedan
förälder
incheckning
8a343be9c6

+ 5 - 5
src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java

@@ -152,10 +152,6 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
         MaterialButton button;
 
         Resources resources = notificationsActivity.getResources();
-        NotificationExecuteActionTask task = new NotificationExecuteActionTask(client,
-                                                                               holder,
-                                                                               notification,
-                                                                               notificationsActivity);
         LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                                                                          ViewGroup.LayoutParams.WRAP_CONTENT);
         params.setMargins(20, 0, 20, 0);
@@ -188,7 +184,11 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
 
             button.setOnClickListener(v -> {
                 setButtonEnabled(holder, false);
-                task.execute(action);
+                new NotificationExecuteActionTask(client,
+                                                  holder,
+                                                  notification,
+                                                  notificationsActivity)
+                    .execute(action);
             });
 
             holder.buttons.addView(button);