|
@ -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,38 +737,9 @@ 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) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@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) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@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.editEditor.requestEditTextFocus(); |
|
|
holder.editEditor.requestEditTextFocus(); |
|
|
backPressHidden = false; |
|
|
backPressHidden = false; |
|
@ -807,6 +748,23 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private TextWatcher createTextWatcher(@NonNull final RecyclerView.ViewHolder holder){ |
|
|
|
|
|
return new TextWatcher() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
|
|
|
|
|
int position = holder.getAdapterPosition(); |
|
|
|
|
|
if (position >= 0 && position < topicItems.size()) |
|
|
|
|
|
((Post) topicItems.get(position)).setBbContent(charSequence.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void afterTextChanged(Editable editable) { } |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void loadAvatar(String imageUrl, ImageView imageView, Context context) { |
|
|
private void loadAvatar(String imageUrl, ImageView imageView, Context context) { |
|
|
if(imageUrl!=null) |
|
|
if(imageUrl!=null) |
|
|
imageUrl = imageUrl.trim(); |
|
|
imageUrl = imageUrl.trim(); |
|
|