|
@ -696,43 +696,13 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
|
|
} |
|
|
} |
|
|
holder.replyEditor.setText(replyText); |
|
|
holder.replyEditor.setText(replyText); |
|
|
holder.replyEditor.getEditText().setSelection(holder.replyEditor.getText().length()); |
|
|
holder.replyEditor.getEditText().setSelection(holder.replyEditor.getText().length()); |
|
|
holder.replyEditor.getEditText().addTextChangedListener(new TextWatcher() { |
|
|
holder.replyEditor.getEditText().addTextChangedListener(createTextWatcher(holder)); |
|
|
@Override |
|
|
|
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
|
|
|
|
|
((Post) topicItems.get(holder.getAdapterPosition())).setBbContent(charSequence.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void afterTextChanged(Editable editable) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (backPressHidden) { |
|
|
if (backPressHidden) { |
|
|
holder.replyEditor.requestEditTextFocus(); |
|
|
holder.replyEditor.requestEditTextFocus(); |
|
|
backPressHidden = false; |
|
|
backPressHidden = false; |
|
|
} |
|
|
} |
|
|
holder.quickReplySubject.addTextChangedListener(new TextWatcher() { |
|
|
holder.quickReplySubject.addTextChangedListener(createTextWatcher(holder)); |
|
|
@Override |
|
|
|
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
|
|
|
|
|
((Post) topicItems.get(holder.getAdapterPosition())).setSubject(charSequence.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void afterTextChanged(Editable editable) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} else if (currentHolder instanceof EditMessageViewHolder) { |
|
|
} else if (currentHolder instanceof EditMessageViewHolder) { |
|
|
final EditMessageViewHolder holder = (EditMessageViewHolder) currentHolder; |
|
|
final EditMessageViewHolder holder = (EditMessageViewHolder) currentHolder; |
|
|
|
|
|
|
|
@ -767,44 +737,32 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
|
|
viewModel.editPost(position, holder.editSubject.getText().toString(), holder.editEditor.getText().toString()); |
|
|
viewModel.editPost(position, holder.editSubject.getText().toString(), holder.editEditor.getText().toString()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
holder.editSubject.addTextChangedListener(new TextWatcher() { |
|
|
holder.editSubject.addTextChangedListener(createTextWatcher(holder)); |
|
|
@Override |
|
|
holder.editEditor.getEditText().addTextChangedListener(createTextWatcher(holder)); |
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (backPressHidden) { |
|
|
|
|
|
holder.editEditor.requestEditTextFocus(); |
|
|
|
|
|
backPressHidden = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
|
|
|
|
|
((Post) topicItems.get(holder.getAdapterPosition())).setSubject(charSequence.toString()); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void afterTextChanged(Editable editable) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
holder.editEditor.getEditText().addTextChangedListener(new TextWatcher() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private TextWatcher createTextWatcher(@NonNull final RecyclerView.ViewHolder holder){ |
|
|
|
|
|
return new TextWatcher() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
|
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
|
|
((Post) topicItems.get(holder.getAdapterPosition())).setBbContent(charSequence.toString()); |
|
|
int position = holder.getAdapterPosition(); |
|
|
|
|
|
if (position >= 0 && position < topicItems.size()) |
|
|
|
|
|
((Post) topicItems.get(position)).setBbContent(charSequence.toString()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void afterTextChanged(Editable editable) { |
|
|
public void afterTextChanged(Editable editable) { } |
|
|
|
|
|
}; |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
if (backPressHidden) { |
|
|
|
|
|
holder.editEditor.requestEditTextFocus(); |
|
|
|
|
|
backPressHidden = false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void loadAvatar(String imageUrl, ImageView imageView, Context context) { |
|
|
private void loadAvatar(String imageUrl, ImageView imageView, Context context) { |
|
|