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;
} else if (emojiKeyboard.getVisibility() == View.VISIBLE) {
emojiKeyboard.setVisibility(View.GONE);
if (viewModel.isEditingPost())
topicAdapter.notifyItemChanged(viewModel.getPostBeingEditedPosition());
if (viewModel.isWritingReply())
topicAdapter.notifyItemChanged(viewModel.postCount());
if (viewModel.isEditingPost()) {
TopicAdapter.EditMessageViewHolder vh = (TopicAdapter.EditMessageViewHolder)
recyclerView.findViewHolderForAdapterPosition(viewModel.getPostBeingEditedPosition());
vh.editEditor.updateEmojiKeyboardVisibility();
}
if (viewModel.isWritingReply()) {
TopicAdapter.QuickReplyViewHolder vh = (TopicAdapter.QuickReplyViewHolder)
recyclerView.findViewHolderForAdapterPosition(viewModel.postCount());
vh.replyEditor.updateEmojiKeyboardVisibility();
}
return;
} else if (viewModel.isWritingReply()) {
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));
if (backPressHidden) {
holder.replyEditor.requestFocus();
backPressHidden = false;
@ -601,7 +600,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
/**
* Custom {@link RecyclerView.ViewHolder} implementation
*/
private static class QuickReplyViewHolder extends RecyclerView.ViewHolder {
static class QuickReplyViewHolder extends RecyclerView.ViewHolder {
final ImageView thumbnail;
final TextView username;
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 TextView username;
final EditText editSubject;

Loading…
Cancel
Save