Delete posts and comments

This comments makes the delete post and delete comment buttons functional.

Closes #29
This commit is contained in:
Balazs Toldi 2023-08-01 09:57:15 +02:00
parent 3a66a79f49
commit 065fcedd34
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
12 changed files with 121 additions and 133 deletions

View File

@ -5,7 +5,9 @@ import androidx.annotation.NonNull;
import java.util.HashMap;
import java.util.Map;
import eu.toldi.infinityforlemmy.apis.RedditAPI;
import eu.toldi.infinityforlemmy.apis.LemmyAPI;
import eu.toldi.infinityforlemmy.dto.DeleteCommentDTO;
import eu.toldi.infinityforlemmy.dto.DeletePostDTO;
import eu.toldi.infinityforlemmy.utils.APIUtils;
import retrofit2.Call;
import retrofit2.Callback;
@ -13,10 +15,11 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class DeleteThing {
public static void delete(Retrofit oauthRetrofit, String fullname, String accessToken, DeleteThingListener deleteThingListener) {
public static void deletePost(Retrofit retrofit, int post_id, String accessToken, DeleteThingListener deleteThingListener) {
Map<String, String> params = new HashMap<>();
params.put(APIUtils.ID_KEY, fullname);
oauthRetrofit.create(RedditAPI.class).delete(APIUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() {
params.put(APIUtils.ID_KEY, String.valueOf(post_id));
retrofit.create(LemmyAPI.class).postDelete(new DeletePostDTO(post_id, true, accessToken)).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
@ -33,6 +36,27 @@ public class DeleteThing {
});
}
public static void deleteComment(Retrofit retrofit, int comment_id, String accessToken, DeleteThingListener deleteThingListener) {
Map<String, String> params = new HashMap<>();
params.put(APIUtils.ID_KEY, String.valueOf(comment_id));
retrofit.create(LemmyAPI.class).commentDelete(new DeleteCommentDTO(comment_id, true, accessToken)).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
deleteThingListener.deleteSuccess();
} else {
deleteThingListener.deleteFailed();
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
deleteThingListener.deleteFailed();
}
});
}
public interface DeleteThingListener {
void deleteSuccess();

View File

@ -425,11 +425,11 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
}
public void deleteComment(String fullName, int position) {
public void deleteComment(int comment_id, int position) {
if (sectionsPagerAdapter != null) {
ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment();
if (fragment != null) {
fragment.deleteComment(fullName, position);
fragment.deleteComment(comment_id, position);
}
}
}

View File

@ -1098,12 +1098,12 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
}
}
public void deleteComment(String fullName) {
public void deleteComment(int commentId) {
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.delete_this_comment)
.setMessage(R.string.are_you_sure)
.setPositiveButton(R.string.delete, (dialogInterface, i)
-> DeleteThing.delete(mOauthRetrofit, fullName, mAccessToken, new DeleteThing.DeleteThingListener() {
-> DeleteThing.deleteComment(mRetrofit.getRetrofit(), commentId, mAccessToken, new DeleteThing.DeleteThingListener() {
@Override
public void deleteSuccess() {
Toast.makeText(ViewUserDetailActivity.this, R.string.delete_post_success, Toast.LENGTH_SHORT).show();

View File

@ -161,7 +161,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
public CommentsRecyclerViewAdapter(BaseActivity activity, ViewPostDetailFragment fragment,
CustomThemeWrapper customThemeWrapper,
Executor executor, Retrofit retrofit, Retrofit oauthRetrofit,
Executor executor, Retrofit retrofit,
String accessToken, String accountName,
Post post, Locale locale, Integer singleCommentId,
boolean isSingleCommentThreadMode,
@ -171,7 +171,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
mFragment = fragment;
mExecutor = executor;
mRetrofit = retrofit;
mOauthRetrofit = oauthRetrofit;
mGlide = Glide.with(activity);
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
mCommentTextColor = customThemeWrapper.getCommentColor();

View File

@ -214,7 +214,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
public PostDetailRecyclerViewAdapter(BaseActivity activity, ViewPostDetailFragment fragment,
Executor executor, CustomThemeWrapper customThemeWrapper,
Retrofit retrofit, Retrofit oauthRetrofit, Retrofit gfycatRetrofit,
Retrofit retrofit, Retrofit gfycatRetrofit,
Retrofit redgifsRetrofit, Provider<StreamableAPI> streamableApiProvider,
RedditDataRoomDatabase redditDataRoomDatabase, RequestManager glide,
boolean separatePostAndComments, String accessToken,
@ -229,7 +229,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mFragment = fragment;
mExecutor = executor;
mRetrofit = retrofit;
mOauthRetrofit = oauthRetrofit;
mGfycatRetrofit = gfycatRetrofit;
mRedgifsRetrofit = redgifsRetrofit;
mStreamableApiProvider = streamableApiProvider;

View File

@ -5,6 +5,8 @@ import com.google.common.util.concurrent.ListenableFuture;
import eu.toldi.infinityforlemmy.dto.AccountLoginDTO;
import eu.toldi.infinityforlemmy.dto.CommentDTO;
import eu.toldi.infinityforlemmy.dto.CommentVoteDTO;
import eu.toldi.infinityforlemmy.dto.DeleteCommentDTO;
import eu.toldi.infinityforlemmy.dto.DeletePostDTO;
import eu.toldi.infinityforlemmy.dto.EditCommentDTO;
import eu.toldi.infinityforlemmy.dto.EditPostDTO;
import eu.toldi.infinityforlemmy.dto.FollowCommunityDTO;
@ -48,6 +50,10 @@ public interface LemmyAPI {
@PUT("api/v3/post")
Call<String> postUpdate(@Body EditPostDTO params);
@Headers("Content-Type: application/json")
@POST("api/v3/post/delete")
Call<String> postDelete(@Body DeletePostDTO params);
@GET("api/v3/user")
ListenableFuture<Response<String>> getUserPosts(
@Query("username") String username,
@ -159,6 +165,10 @@ public interface LemmyAPI {
@POST("api/v3/comment")
Call<String> postComment(@Body CommentDTO params);
@Headers("Content-Type: application/json")
@POST("api/v3/comment/delete")
Call<String> commentDelete(@Body DeleteCommentDTO params);
@Headers("Content-Type: application/json")
@PUT("api/v3/comment")
Call<String> commentEdit(@Body EditCommentDTO params);

View File

@ -127,9 +127,9 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
deleteTextView.setOnClickListener(view -> {
dismiss();
if (activity instanceof ViewPostDetailActivity) {
((ViewPostDetailActivity) activity).deleteComment(comment.getFullName(), bundle.getInt(EXTRA_POSITION));
((ViewPostDetailActivity) activity).deleteComment(comment.getId(), bundle.getInt(EXTRA_POSITION));
} else if (activity instanceof ViewUserDetailActivity) {
((ViewUserDetailActivity) activity).deleteComment(comment.getFullName());
((ViewUserDetailActivity) activity).deleteComment(comment.getId());
}
});
}

View File

@ -49,6 +49,8 @@ public class Comment implements Parcelable {
private int depth;
private int childCount;
private boolean collapsed;
private boolean isDeleted;
private boolean hasReply;
private boolean saved;
private boolean isExpanded;
@ -67,7 +69,7 @@ public class Comment implements Parcelable {
long commentTimeMillis, String commentMarkdown, String commentRawText,
String linkId, String communityName, String communityQualifiedName, Integer parentId, int score,
int voteType, boolean isSubmitter, String distinguished, String permalink,
int depth, boolean collapsed, boolean hasReply, boolean saved, long edited, String[] path) {
int depth, boolean collapsed, boolean hasReply, boolean saved, boolean deleted, long edited, String[] path) {
this.id = id;
this.postId = postId;
this.fullName = fullName;
@ -90,6 +92,7 @@ public class Comment implements Parcelable {
this.collapsed = collapsed;
this.hasReply = hasReply;
this.saved = saved;
this.isDeleted = deleted;
this.isExpanded = false;
this.hasExpandedBefore = false;
this.editedTimeMillis = edited;

View File

@ -327,11 +327,12 @@ public class ParseComment {
boolean collapsed = false;
boolean hasReply = countsObj.getInt("child_count") > 0;
boolean saved = jsonObject.getBoolean("saved");
boolean deleted = commentObj.getBoolean("deleted");
long edited = 0;
Comment comment = new Comment(id, postID, fullName, author, authorQualifiedName, linkAuthor, commentTimeMillis,
commentMarkdown, commentRawText, linkId, communityName, communityQualifiedName, parentId,
score, voteType, isSubmitter, distinguished, permalink, depth, collapsed, hasReply, saved, edited, path);
score, voteType, isSubmitter, distinguished, permalink, depth, collapsed, hasReply, saved, deleted, edited, path);
int child_count = countsObj.getInt("child_count");
comment.setChildCount(child_count);
return comment;

View File

@ -0,0 +1,26 @@
package eu.toldi.infinityforlemmy.dto;
public class DeleteCommentDTO {
private int comment_id;
boolean deleted;
String auth;
public DeleteCommentDTO(int comment_id, boolean deleted, String auth) {
this.comment_id = comment_id;
this.deleted = deleted;
this.auth = auth;
}
public int getComment_id() {
return comment_id;
}
public boolean isDeleted() {
return deleted;
}
public String getAuth() {
return auth;
}
}

View File

@ -0,0 +1,26 @@
package eu.toldi.infinityforlemmy.dto;
public class DeletePostDTO {
int post_id;
boolean deleted;
String auth;
public DeletePostDTO(int post_id, boolean deleted, String auth) {
this.post_id = post_id;
this.deleted = deleted;
this.auth = auth;
}
public int getPost_id() {
return post_id;
}
public boolean isDeleted() {
return deleted;
}
public String getAuth() {
return auth;
}
}

View File

@ -85,7 +85,7 @@ import eu.toldi.infinityforlemmy.activities.SubmitCrosspostActivity;
import eu.toldi.infinityforlemmy.activities.ViewPostDetailActivity;
import eu.toldi.infinityforlemmy.adapters.CommentsRecyclerViewAdapter;
import eu.toldi.infinityforlemmy.adapters.PostDetailRecyclerViewAdapter;
import eu.toldi.infinityforlemmy.apis.RedditAPI;
import eu.toldi.infinityforlemmy.apis.LemmyAPI;
import eu.toldi.infinityforlemmy.apis.StreamableAPI;
import eu.toldi.infinityforlemmy.asynctasks.LoadUserData;
import eu.toldi.infinityforlemmy.bottomsheetfragments.FlairBottomSheetFragment;
@ -97,6 +97,7 @@ import eu.toldi.infinityforlemmy.comment.FetchRemovedCommentReveddit;
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
import eu.toldi.infinityforlemmy.customviews.CustomToroContainer;
import eu.toldi.infinityforlemmy.customviews.LinearLayoutManagerBugFixed;
import eu.toldi.infinityforlemmy.dto.EditPostDTO;
import eu.toldi.infinityforlemmy.events.ChangeNSFWBlurEvent;
import eu.toldi.infinityforlemmy.events.ChangeNetworkStatusEvent;
import eu.toldi.infinityforlemmy.events.ChangeSpoilerBlurEvent;
@ -155,9 +156,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
@Named("reveddit")
Retrofit revedditRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
@Named("gfycat")
Retrofit mGfycatRetrofit;
@Inject
@ -578,7 +576,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
private void bindView() {
if (mAccessToken != null && mMessageFullname != null) {
ReadMessage.readMessage(mOauthRetrofit, mAccessToken, mMessageFullname, new ReadMessage.ReadMessageListener() {
ReadMessage.readMessage(mRetrofit.getRetrofit(), mAccessToken, mMessageFullname, new ReadMessage.ReadMessageListener() {
@Override
public void readSuccess() {
mMessageFullname = null;
@ -601,13 +599,13 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
setupMenu();
mPostAdapter = new PostDetailRecyclerViewAdapter(activity,
this, mExecutor, mCustomThemeWrapper, mRetrofit.getRetrofit(), mOauthRetrofit, mGfycatRetrofit,
this, mExecutor, mCustomThemeWrapper, mRetrofit.getRetrofit(), mGfycatRetrofit,
mRedgifsRetrofit, mStreamableApiProvider, mRedditDataRoomDatabase, mGlide,
mSeparatePostAndComments, mAccessToken, mAccountName, mPost, mLocale,
mSharedPreferences, mCurrentAccountSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostDetailsSharedPreferences,
mExoCreator, post -> EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)));
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
this, mCustomThemeWrapper, mExecutor, mRetrofit.getRetrofit(), mOauthRetrofit,
this, mCustomThemeWrapper, mExecutor, mRetrofit.getRetrofit(),
mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId,
isSingleCommentThreadMode, mSharedPreferences,
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
@ -776,29 +774,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
}
public void changeFlair(Flair flair) {
Map<String, String> params = new HashMap<>();
params.put(APIUtils.API_TYPE_KEY, APIUtils.API_TYPE_JSON);
params.put(APIUtils.FLAIR_TEMPLATE_ID_KEY, flair.getId());
params.put(APIUtils.LINK_KEY, mPost.getFullName());
params.put(APIUtils.TEXT_KEY, flair.getText());
mOauthRetrofit.create(RedditAPI.class).selectFlair(mPost.getSubredditNamePrefixed(),
APIUtils.getOAuthHeader(mAccessToken), params).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
refresh(true, false);
showMessage(R.string.update_flair_success);
} else {
showMessage(R.string.update_flair_failed);
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
showMessage(R.string.update_flair_failed);
}
});
}
public void changeSortType(SortType sortType) {
@ -952,7 +928,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
SavePost savePost = new SavePost();
if (mPost.isSaved()) {
item.setIcon(mUnsavedIcon);
savePost.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getId(),
savePost.unsaveThing(mRetrofit.getRetrofit(), mAccessToken, mPost.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@ -976,7 +952,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
});
} else {
item.setIcon(mSavedIcon);
savePost.saveThing(mOauthRetrofit, mAccessToken, mPost.getId(),
savePost.saveThing(mRetrofit.getRetrofit(), mAccessToken, mPost.getId(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
@ -1017,7 +993,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
if (mPost.isHidden()) {
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, getString(R.string.action_hide_post));
HidePost.unhidePost(mOauthRetrofit, mAccessToken, mPost.getFullName(), new HidePost.HidePostListener() {
HidePost.unhidePost(mRetrofit.getRetrofit(), mAccessToken, mPost.getFullName(), new HidePost.HidePostListener() {
@Override
public void success() {
mPost.setHidden(false);
@ -1037,7 +1013,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
} else {
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, getString(R.string.action_unhide_post));
HidePost.hidePost(mOauthRetrofit, mAccessToken, mPost.getFullName(), new HidePost.HidePostListener() {
HidePost.hidePost(mRetrofit.getRetrofit(), mAccessToken, mPost.getFullName(), new HidePost.HidePostListener() {
@Override
public void success() {
mPost.setHidden(true);
@ -1067,7 +1043,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
.setTitle(R.string.delete_this_post)
.setMessage(R.string.are_you_sure)
.setPositiveButton(R.string.delete, (dialogInterface, i)
-> DeleteThing.delete(mOauthRetrofit, mPost.getFullName(), mAccessToken, new DeleteThing.DeleteThingListener() {
-> DeleteThing.deletePost(mRetrofit.getRetrofit(), mPost.getId(), mAccessToken, new DeleteThing.DeleteThingListener() {
@Override
public void deleteSuccess() {
Toast.makeText(activity, R.string.delete_post_success, Toast.LENGTH_SHORT).show();
@ -1262,7 +1238,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mPost = post;
mPostAdapter = new PostDetailRecyclerViewAdapter(activity,
ViewPostDetailFragment.this, mExecutor, mCustomThemeWrapper,
mRetrofit.getRetrofit(), mOauthRetrofit, mGfycatRetrofit, mRedgifsRetrofit,
mRetrofit.getRetrofit(), mGfycatRetrofit, mRedgifsRetrofit,
mStreamableApiProvider, mRedditDataRoomDatabase, mGlide, mSeparatePostAndComments,
mAccessToken, mAccountName, mPost, mLocale, mSharedPreferences,
mCurrentAccountSharedPreferences, mNsfwAndSpoilerSharedPreferences,
@ -1275,7 +1251,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
pages_loaded++;
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
ViewPostDetailFragment.this, mCustomThemeWrapper, mExecutor,
mRetrofit.getRetrofit(), mOauthRetrofit, mAccessToken, mAccountName, mPost, mLocale,
mRetrofit.getRetrofit(), mAccessToken, mAccountName, mPost, mLocale,
mSingleCommentId, isSingleCommentThreadMode, mSharedPreferences,
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
@Override
@ -1567,7 +1543,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
Map<String, String> params = new HashMap<>();
params.put(APIUtils.ID_KEY, mPost.getFullName());
mOauthRetrofit.create(RedditAPI.class).markNSFW(APIUtils.getOAuthHeader(mAccessToken), params)
mRetrofit.getRetrofit().create(LemmyAPI.class).postUpdate(new EditPostDTO(mPost.getId(), mPost.getTitle(), mPost.getUrl(), mPost.getSelfText(), true, null, mAccessToken))
.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
@ -1605,7 +1581,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
Map<String, String> params = new HashMap<>();
params.put(APIUtils.ID_KEY, mPost.getFullName());
mOauthRetrofit.create(RedditAPI.class).unmarkNSFW(APIUtils.getOAuthHeader(mAccessToken), params)
mRetrofit.getRetrofit().create(LemmyAPI.class).postUpdate(new EditPostDTO(mPost.getId(), mPost.getTitle(), mPost.getUrl(), mPost.getSelfText(), false, null, mAccessToken))
.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
@ -1636,88 +1612,12 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
});
}
private void markSpoiler() {
if (mMenu != null) {
mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment).setTitle(R.string.action_unmark_spoiler);
}
Map<String, String> params = new HashMap<>();
params.put(APIUtils.ID_KEY, mPost.getFullName());
mOauthRetrofit.create(RedditAPI.class).markSpoiler(APIUtils.getOAuthHeader(mAccessToken), params)
.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
if (mMenu != null) {
mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment).setTitle(R.string.action_unmark_spoiler);
}
refresh(true, false);
showMessage(R.string.mark_spoiler_success);
} else {
if (mMenu != null) {
mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment).setTitle(R.string.action_mark_spoiler);
}
showMessage(R.string.mark_spoiler_failed);
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
if (mMenu != null) {
mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment).setTitle(R.string.action_mark_spoiler);
}
showMessage(R.string.mark_spoiler_failed);
}
});
}
private void unmarkSpoiler() {
if (mMenu != null) {
mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment).setTitle(R.string.action_mark_spoiler);
}
Map<String, String> params = new HashMap<>();
params.put(APIUtils.ID_KEY, mPost.getFullName());
mOauthRetrofit.create(RedditAPI.class).unmarkSpoiler(APIUtils.getOAuthHeader(mAccessToken), params)
.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
if (mMenu != null) {
mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment).setTitle(R.string.action_mark_spoiler);
}
refresh(true, false);
showMessage(R.string.unmark_spoiler_success);
} else {
if (mMenu != null) {
mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment).setTitle(R.string.action_unmark_spoiler);
}
showMessage(R.string.unmark_spoiler_failed);
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
if (mMenu != null) {
mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment).setTitle(R.string.action_unmark_spoiler);
}
showMessage(R.string.unmark_spoiler_failed);
}
});
}
public void deleteComment(String fullName, int position) {
public void deleteComment(int commentId, int position) {
new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.delete_this_comment)
.setMessage(R.string.are_you_sure)
.setPositiveButton(R.string.delete, (dialogInterface, i)
-> DeleteThing.delete(mOauthRetrofit, fullName, mAccessToken, new DeleteThing.DeleteThingListener() {
-> DeleteThing.deleteComment(mRetrofit.getRetrofit(), commentId, mAccessToken, new DeleteThing.DeleteThingListener() {
@Override
public void deleteSuccess() {
Toast.makeText(activity, R.string.delete_post_success, Toast.LENGTH_SHORT).show();