From 002687d2b1e4d45277b2378f0dd5ce0f3bc46e3b Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Mon, 12 Dec 2022 17:12:55 -0300 Subject: [PATCH] And it still doesnt work --- .../api/requests/lists/DeleteList.java | 8 +++-- .../fragments/ListTimelinesFragment.java | 30 +++++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/requests/lists/DeleteList.java b/mastodon/src/main/java/org/joinmastodon/android/api/requests/lists/DeleteList.java index 57b6b826c..5a19e4c7f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/requests/lists/DeleteList.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/requests/lists/DeleteList.java @@ -1,9 +1,11 @@ package org.joinmastodon.android.api.requests.lists; +import android.app.ListFragment; + import org.joinmastodon.android.api.MastodonAPIRequest; -public class DeleteList extends MastodonAPIRequest { - public DeleteList(String listId){ - super(HttpMethod.DELETE, "/lists/"+listId, Object.class); +public class DeleteList extends MastodonAPIRequest { + public DeleteList(String id){ + super(HttpMethod.DELETE, "/lists/"+id, ListFragment.class); } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelinesFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelinesFragment.java index bd1d32d3d..eb6a2d443 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelinesFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ListTimelinesFragment.java @@ -1,5 +1,6 @@ package org.joinmastodon.android.fragments; +import android.app.ListFragment; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; @@ -15,13 +16,17 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import org.joinmastodon.android.E; import org.joinmastodon.android.R; import org.joinmastodon.android.api.MastodonAPIRequest; import org.joinmastodon.android.api.requests.lists.AddAccountsToList; import org.joinmastodon.android.api.requests.lists.DeleteList; import org.joinmastodon.android.api.requests.lists.GetLists; import org.joinmastodon.android.api.requests.lists.RemoveAccountsFromList; +import org.joinmastodon.android.api.session.AccountSessionManager; +import org.joinmastodon.android.events.StatusDeletedEvent; import org.joinmastodon.android.model.ListTimeline; +import org.joinmastodon.android.model.Status; import org.joinmastodon.android.ui.M3AlertDialogBuilder; import org.joinmastodon.android.ui.utils.UiUtils; @@ -206,24 +211,25 @@ public class ListTimelinesFragment extends BaseRecyclerFragment im private void deleteList(String listId){ new M3AlertDialogBuilder(getActivity()) .setTitle(R.string.sk_delete_list_dialog_title) - .setPositiveButton(R.string.delete, (dialog, which)-> new DeleteList(listId)) + .setPositiveButton(R.string.delete, (dialog, which)-> actuallyDeleteList(listId)) .setNegativeButton(R.string.cancel, null) .show(); } private void actuallyDeleteList(String listId){ - new DeleteList(listId).setCallback(new Callback() { + new DeleteList(listId) + .setCallback(new Callback<>(){ + @Override + public void onSuccess(ListFragment result){ + System.out.println("All okay"); + } - @Override - public void onSuccess(Object result) { - loadData(); - } - - @Override - public void onError(ErrorResponse error) { - error.showToast(getActivity()); - } - }); + @Override + public void onError(ErrorResponse error){ + error.showToast(getActivity()); + } + }) + .wrapProgress(getActivity(), R.string.deleting, false); } } }