And it still doesnt work

This commit is contained in:
LucasGGamerM 2022-12-12 17:12:55 -03:00
parent a3267f6cd3
commit 002687d2b1
2 changed files with 23 additions and 15 deletions

View File

@ -1,9 +1,11 @@
package org.joinmastodon.android.api.requests.lists; package org.joinmastodon.android.api.requests.lists;
import android.app.ListFragment;
import org.joinmastodon.android.api.MastodonAPIRequest; import org.joinmastodon.android.api.MastodonAPIRequest;
public class DeleteList extends MastodonAPIRequest<Object> { public class DeleteList extends MastodonAPIRequest<ListFragment> {
public DeleteList(String listId){ public DeleteList(String id){
super(HttpMethod.DELETE, "/lists/"+listId, Object.class); super(HttpMethod.DELETE, "/lists/"+id, ListFragment.class);
} }
} }

View File

@ -1,5 +1,6 @@
package org.joinmastodon.android.fragments; package org.joinmastodon.android.fragments;
import android.app.ListFragment;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@ -15,13 +16,17 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.joinmastodon.android.E;
import org.joinmastodon.android.R; import org.joinmastodon.android.R;
import org.joinmastodon.android.api.MastodonAPIRequest; import org.joinmastodon.android.api.MastodonAPIRequest;
import org.joinmastodon.android.api.requests.lists.AddAccountsToList; import org.joinmastodon.android.api.requests.lists.AddAccountsToList;
import org.joinmastodon.android.api.requests.lists.DeleteList; import org.joinmastodon.android.api.requests.lists.DeleteList;
import org.joinmastodon.android.api.requests.lists.GetLists; import org.joinmastodon.android.api.requests.lists.GetLists;
import org.joinmastodon.android.api.requests.lists.RemoveAccountsFromList; 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.ListTimeline;
import org.joinmastodon.android.model.Status;
import org.joinmastodon.android.ui.M3AlertDialogBuilder; import org.joinmastodon.android.ui.M3AlertDialogBuilder;
import org.joinmastodon.android.ui.utils.UiUtils; import org.joinmastodon.android.ui.utils.UiUtils;
@ -206,24 +211,25 @@ public class ListTimelinesFragment extends BaseRecyclerFragment<ListTimeline> im
private void deleteList(String listId){ private void deleteList(String listId){
new M3AlertDialogBuilder(getActivity()) new M3AlertDialogBuilder(getActivity())
.setTitle(R.string.sk_delete_list_dialog_title) .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) .setNegativeButton(R.string.cancel, null)
.show(); .show();
} }
private void actuallyDeleteList(String listId){ private void actuallyDeleteList(String listId){
new DeleteList(listId).setCallback(new Callback<Object>() { new DeleteList(listId)
.setCallback(new Callback<>(){
@Override
public void onSuccess(ListFragment result){
System.out.println("All okay");
}
@Override @Override
public void onSuccess(Object result) { public void onError(ErrorResponse error){
loadData(); error.showToast(getActivity());
} }
})
@Override .wrapProgress(getActivity(), R.string.deleting, false);
public void onError(ErrorResponse error) {
error.showToast(getActivity());
}
});
} }
} }
} }