Selaa lähdekoodia

[FAQ][Bug] FAQ 리싸이클러뷰 변경 후 BUG 수정

Hasemi 7 vuotta sitten
vanhempi
commit
9474c2fb38

+ 0 - 9
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/FAQBean.java

@@ -44,8 +44,6 @@ public class FAQBean extends JsonBeanBase {
   @SerializedName("reg_dt")
   private String date;  // "yyyy-mm-dd"
 
-  private boolean isExpanded;
-
   public FAQBean(int id, String category, String title, String contents, String date) {
     this.id = id;
     this.category = category;
@@ -94,11 +92,4 @@ public class FAQBean extends JsonBeanBase {
     this.date = date;
   }
 
-  public boolean isExpanded() {
-    return isExpanded;
-  }
-
-  public void setExpanded(boolean expanded) {
-    isExpanded = expanded;
-  }
 }

+ 16 - 16
app/src/main/java/kr/co/zumo/app/lifeplus/view/fragment/faq/FAQExpandableListViewAdapter.java

@@ -2,7 +2,6 @@ package kr.co.zumo.app.lifeplus.view.fragment.faq;
 
 import android.support.annotation.NonNull;
 import android.support.v7.widget.RecyclerView;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -28,11 +27,7 @@ import kr.co.zumo.app.lifeplus.bean.api.FAQBean;
 public class FAQExpandableListViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
 
   private List<FAQBean> data;
-  private TextView textViewCategory;
-  private TextView textViewQuestion;
-  private ImageView buttonArrow;
-  private LinearLayout layoutAnswer;
-  private TextView textViewAnswer;
+
 
   public FAQExpandableListViewAdapter(List<FAQBean> data) {
     this.data = data;
@@ -55,11 +50,8 @@ public class FAQExpandableListViewAdapter extends RecyclerView.Adapter<RecyclerV
     ((FAQExpandableViewHolder) holder).itemView.setOnClickListener(new View.OnClickListener() {
       @Override
       public void onClick(View view) {
-        boolean isExpand = bean.isExpanded();
-        bean.setExpanded(!isExpand);
-        Log.e("APP#  FAQExpandableListViewAdapter | onBindViewHolder", "|" + position);
-        Log.e("APP#  FAQExpandableListViewAdapter | onClick", "|" + "expand 유무" + bean.isExpanded());
-        notifyItemChanged(position);
+
+        ((FAQExpandableViewHolder) holder).changed();
       }
     });
 
@@ -73,6 +65,11 @@ public class FAQExpandableListViewAdapter extends RecyclerView.Adapter<RecyclerV
 
   private class FAQExpandableViewHolder extends RecyclerView.ViewHolder {
 
+    private TextView textViewCategory;
+    private TextView textViewQuestion;
+    private ImageView buttonArrow;
+    private LinearLayout layoutAnswer;
+    private TextView textViewAnswer;
 
     public FAQExpandableViewHolder(View itemView) {
       super(itemView);
@@ -85,12 +82,15 @@ public class FAQExpandableListViewAdapter extends RecyclerView.Adapter<RecyclerV
     }
 
     private void bind(FAQBean faqBean) {
-      boolean expanded = faqBean.isExpanded();
-      Log.e("APP#  FAQExpandableViewHolder | bind", "|" + this + "," + faqBean.getId());
-      Log.e("APP#  FAQExpandableViewHolder | bind", "|" + expanded);
-      layoutAnswer.setVisibility(expanded ? View.VISIBLE : View.GONE);
-      buttonArrow.setImageResource(expanded ? R.drawable.icon_closearrow : R.drawable.icon_openarrow);
       textViewAnswer.setText(faqBean.getContents());
+      textViewQuestion.setText(faqBean.getTitle());
+      textViewCategory.setText(faqBean.getCategory());
+
+    }
+
+    private void changed() {
+      layoutAnswer.setVisibility(layoutAnswer.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
+      buttonArrow.setImageResource(layoutAnswer.getVisibility() == View.GONE ? R.drawable.icon_closearrow : R.drawable.icon_openarrow);
     }
   }
 }

+ 0 - 35
app/src/main/res/layout/faq_answer_list.xml

@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
-  xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="match_parent"
-  android:layout_height="match_parent"
-  android:background="@drawable/faq_answer_border"
-  android:orientation="vertical">
-
-  <LinearLayout
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    android:paddingLeft="23dp"
-    android:paddingRight="23dp"
-    android:paddingBottom="23dp"
-    >
-    <View
-      android:layout_width="match_parent"
-      android:layout_height="1dp"
-      android:background="#e5e5e5"
-      android:layout_marginBottom="23dp"
-      />
-  <TextView
-    android:id="@+id/faq_answer"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:textSize="12sp"
-    android:textColor="#999999"
-    android:lineSpacingExtra="9sp"
-    android:text="개인인증을 위한 정보(이름, 휴대폰 번호)를 입력 받고, 당첨 시 입력하신 번호로 경품 당첨 내용을 전송하오니 정확한 본인의 이름과 전화번호를 입력해 주시기 바랍니다. 당첨자는 추첨을 통해 선정되며 9월 28일자 발표일에 경품이 주어집니다."
-    />
-
-  </LinearLayout>
-
-</LinearLayout>

+ 1 - 2
app/src/main/res/layout/faq_question_list.xml

@@ -35,7 +35,6 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:lineSpacingExtra="5sp"
-        android:text="비밀번호는 어떻게 변경하나요?"
         android:textColor="#333333"
         android:textSize="14sp"
         />
@@ -69,6 +68,7 @@
 
   <LinearLayout
     android:id="@+id/layout_answer"
+    android:visibility="gone"
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -95,7 +95,6 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:lineSpacingExtra="9sp"
-        android:text="개인인증을 위한 정보(이름, 휴대폰 번호)를 입력 받고, 당첨 시 입력하신 번호로 경품 당첨 내용을 전송하오니 정확한 본인의 이름과 전화번호를 입력해 주시기 바랍니다. 당첨자는 추첨을 통해 선정되며 9월 28일자 발표일에 경품이 주어집니다."
         android:textColor="#999999"
         android:textSize="12sp"
         />