Browse Source

fix bug when text would be deleted on emoji keyboard close

pull/45/head
Thodoris1999 6 years ago
parent
commit
90a989f00a
  1. 14
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  2. 5
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

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

@ -261,10 +261,16 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo
return; return;
} else if (emojiKeyboard.getVisibility() == View.VISIBLE) { } else if (emojiKeyboard.getVisibility() == View.VISIBLE) {
emojiKeyboard.setVisibility(View.GONE); emojiKeyboard.setVisibility(View.GONE);
if (viewModel.isEditingPost()) if (viewModel.isEditingPost()) {
topicAdapter.notifyItemChanged(viewModel.getPostBeingEditedPosition()); TopicAdapter.EditMessageViewHolder vh = (TopicAdapter.EditMessageViewHolder)
if (viewModel.isWritingReply()) recyclerView.findViewHolderForAdapterPosition(viewModel.getPostBeingEditedPosition());
topicAdapter.notifyItemChanged(viewModel.postCount()); vh.editEditor.updateEmojiKeyboardVisibility();
}
if (viewModel.isWritingReply()) {
TopicAdapter.QuickReplyViewHolder vh = (TopicAdapter.QuickReplyViewHolder)
recyclerView.findViewHolderForAdapterPosition(viewModel.postCount());
vh.replyEditor.updateEmojiKeyboardVisibility();
}
return; return;
} else if (viewModel.isWritingReply()) { } else if (viewModel.isWritingReply()) {
postsList.remove(postsList.size() - 1); postsList.remove(postsList.size() - 1);

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

@ -485,7 +485,6 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
}); });
holder.replyEditor.setOnClickListener(view -> holder.replyEditor.setError(null)); holder.replyEditor.setOnClickListener(view -> holder.replyEditor.setError(null));
if (backPressHidden) { if (backPressHidden) {
holder.replyEditor.requestFocus(); holder.replyEditor.requestFocus();
backPressHidden = false; backPressHidden = false;
@ -601,7 +600,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
/** /**
* Custom {@link RecyclerView.ViewHolder} implementation * Custom {@link RecyclerView.ViewHolder} implementation
*/ */
private static class QuickReplyViewHolder extends RecyclerView.ViewHolder { static class QuickReplyViewHolder extends RecyclerView.ViewHolder {
final ImageView thumbnail; final ImageView thumbnail;
final TextView username; final TextView username;
final EditText quickReplySubject; final EditText quickReplySubject;
@ -616,7 +615,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
} }
} }
private static class EditMessageViewHolder extends RecyclerView.ViewHolder { static class EditMessageViewHolder extends RecyclerView.ViewHolder {
final ImageView thumbnail; final ImageView thumbnail;
final TextView username; final TextView username;
final EditText editSubject; final EditText editSubject;

Loading…
Cancel
Save