Browse Source

allow only one post to be edited at a time

pull/30/head
Thodoris1999 7 years ago
parent
commit
acf6258796
  1. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  2. 11
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

2
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java

@ -1049,6 +1049,7 @@ public class TopicActivity extends BaseActivity {
replyFAB.setEnabled(false);
replyFAB.hide();
bottomNavBar.setVisibility(View.GONE);
topicAdapter.disablePostEditing();
}
@Override
@ -1157,6 +1158,7 @@ public class TopicActivity extends BaseActivity {
Toast.makeText(TopicActivity.this, "Edit failed!", Toast.LENGTH_SHORT).show();
paginationEnabled(true);
replyFAB.setEnabled(true);
topicAdapter.enablePostEditing();
if (result) {
topicTask = new TopicTask();

11
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

@ -98,6 +98,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final int replySubject = 0, replyText = 1;
private String commitEditURL, numReplies, seqnum, sc, topic, buildedQuotes, postText;
private boolean canReply = false;
private boolean postEditingDisabled = false;
/**
* @param context the context of the {@link RecyclerView}
@ -493,7 +494,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
final TextView editPostButton = popUpContent.findViewById(R.id.edit_post);
if (currentPost.getPostEditURL() == null || currentPost.getPostEditURL().equals("")) {
if (postEditingDisabled || currentPost.getPostEditURL() == null || currentPost.getPostEditURL().equals("")) {
editPostButton.setVisibility(View.GONE);
} else {
editPostButton.setOnClickListener(new View.OnClickListener() {
@ -865,4 +866,12 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
return context.getResources().getString(R.string.fa_file);
}
public void disablePostEditing() {
postEditingDisabled = true;
}
public void enablePostEditing() {
postEditingDisabled = false;
}
}
Loading…
Cancel
Save