|
|
@@ -2,6 +2,7 @@ package kr.co.zumo.app.lifeplus.view.screen.faq;
|
|
|
|
|
|
import android.graphics.Typeface;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.RelativeLayout;
|
|
|
@@ -33,6 +34,8 @@ public class MyFAQExpandableViewHolder extends RecyclerView.ViewHolder {
|
|
|
private TextView textViewAnswer;
|
|
|
private TextView textViewAnswerDate;
|
|
|
|
|
|
+ private boolean hasAnswer = false;
|
|
|
+
|
|
|
public MyFAQExpandableViewHolder(View itemView) {
|
|
|
super(itemView);
|
|
|
textViewCategory = itemView.findViewById(R.id.text_view_my_faq_category);
|
|
|
@@ -47,12 +50,22 @@ public class MyFAQExpandableViewHolder extends RecyclerView.ViewHolder {
|
|
|
}
|
|
|
|
|
|
public void bind(QuestionBean bean, IEventListener listener) {
|
|
|
- textViewStatus.setText(bean.getStatus());
|
|
|
- textViewAnswerDate.setText(bean.getDate());
|
|
|
- textViewQuestionDate.setText(bean.getDate());
|
|
|
- textViewAnswer.setText(bean.getContents());
|
|
|
- textViewQuestion.setText(bean.getTitle());
|
|
|
textViewCategory.setText(bean.getCategory());
|
|
|
+ textViewQuestion.setText(bean.getTitle());
|
|
|
+ textViewQuestionDate.setText(bean.getQuestionDate());
|
|
|
+
|
|
|
+ // 답변 날짜/내용이 있으면 답변 완료
|
|
|
+ String answerDate = bean.getAnswerDate();
|
|
|
+ String answerContents = bean.getContents();
|
|
|
+ hasAnswer = bean.hasAnswer();
|
|
|
+ if (hasAnswer) {
|
|
|
+ textViewStatus.setVisibility(View.VISIBLE);
|
|
|
+ textViewAnswer.setText(answerContents);
|
|
|
+ textViewAnswerDate.setText(answerDate);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ textViewStatus.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
|
|
|
View.OnClickListener clickListener = view -> {
|
|
|
boolean isExpanded = bean.isExpanded();
|
|
|
@@ -60,23 +73,37 @@ public class MyFAQExpandableViewHolder extends RecyclerView.ViewHolder {
|
|
|
changed(bean.isExpanded());
|
|
|
|
|
|
listener.onEvent(new Event.Builder(Event.CLICK).integer(getAdapterPosition()).build());
|
|
|
-
|
|
|
};
|
|
|
|
|
|
textViewQuestion.setOnClickListener(clickListener);
|
|
|
-
|
|
|
buttonArrow.setOnClickListener(clickListener);
|
|
|
}
|
|
|
|
|
|
public void changed(boolean isExpanded) {
|
|
|
if (isExpanded) {
|
|
|
- layoutAnswer.setVisibility(View.VISIBLE);
|
|
|
+ // 문의 글 모두 보여주기
|
|
|
+ // maxLines , ellipsize
|
|
|
textViewQuestion.setTypeface(null, Typeface.BOLD);
|
|
|
+ textViewQuestion.setMaxLines(Integer.MAX_VALUE);
|
|
|
+ textViewQuestion.setEllipsize(null);
|
|
|
+ if (hasAnswer) {
|
|
|
+ // 답변 내용 보여주기
|
|
|
+ layoutAnswer.setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
- layoutAnswer.setVisibility(View.GONE);
|
|
|
+ // 문의 글 ... 처리
|
|
|
+ // maxLines , ellipsize
|
|
|
textViewQuestion.setTypeface(null, Typeface.NORMAL);
|
|
|
+ textViewQuestion.setMaxLines(2);
|
|
|
+ textViewQuestion.setEllipsize(TextUtils.TruncateAt.END);
|
|
|
+
|
|
|
+ if (hasAnswer) {
|
|
|
+ // 답변 내용 닫기
|
|
|
+ layoutAnswer.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
buttonArrow.setImageResource(isExpanded ? R.drawable.icon_closearrow : R.drawable.icon_openarrow);
|
|
|
}
|
|
|
|