|
|
@@ -11,7 +11,6 @@ import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
@@ -30,26 +29,59 @@ import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
*/
|
|
|
public class FAQFragment extends Fragment {
|
|
|
|
|
|
+ private static final String PARAM_INDEX = "index";
|
|
|
+
|
|
|
private RecyclerView expandableListViewFaq;
|
|
|
|
|
|
+ private List<FAQBean> faqBeans;
|
|
|
+ private IFAQFragmentListener listener;
|
|
|
+ private int index;
|
|
|
+
|
|
|
+ public void setListener(IFAQFragmentListener listener) {
|
|
|
+ this.listener = listener;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static FAQFragment newInstance(int index) {
|
|
|
+ FAQFragment fragment = new FAQFragment();
|
|
|
+ Bundle args = new Bundle();
|
|
|
+ args.putInt(PARAM_INDEX, index);
|
|
|
+ fragment.setArguments(args);
|
|
|
+ return fragment;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
|
|
|
+ this.index = getArguments().getInt(PARAM_INDEX);
|
|
|
+ }
|
|
|
|
|
|
@Nullable
|
|
|
@Override
|
|
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
|
View view = inflater.inflate(R.layout.fragment_faq, container, false);
|
|
|
- //settingList();
|
|
|
-
|
|
|
-
|
|
|
- expandableListViewFaq = (RecyclerView) view.findViewById(R.id.expandable_list_view_faq);
|
|
|
- expandableListViewFaq.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL ,false));
|
|
|
- List<FAQBean> data = new ArrayList<>();
|
|
|
- data.add(new FAQBean(0, "카테고리", "타이틀", "콘텐츠", "날짜"));
|
|
|
- data.add(new FAQBean(1, "카테고리", "타이틀", "콘텐츠", "날짜"));
|
|
|
- data.add(new FAQBean(2, "카테고리", "타이틀", "콘텐츠", "날짜"));
|
|
|
- data.add(new FAQBean(3, "카테고리", "타이틀", "콘텐츠", "날짜"));
|
|
|
- data.add(new FAQBean(4, "카테고리", "타이틀", "콘텐츠", "날짜"));
|
|
|
- FAQExpandableListViewAdapter adapter = new FAQExpandableListViewAdapter(data);
|
|
|
+ return view;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onActivityCreated(savedInstanceState);
|
|
|
+
|
|
|
+ listener.onInit(this, this.index);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 초기화
|
|
|
+ *
|
|
|
+ * @param beans
|
|
|
+ */
|
|
|
+ public void init(List<FAQBean> beans) {
|
|
|
+ View view = getView();
|
|
|
+ expandableListViewFaq = view.findViewById(R.id.expandable_list_view_faq);
|
|
|
+ expandableListViewFaq.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
|
|
+ faqBeans = beans;
|
|
|
+
|
|
|
+ FAQExpandableListViewAdapter adapter = new FAQExpandableListViewAdapter(faqBeans);
|
|
|
expandableListViewFaq.setAdapter(adapter);
|
|
|
expandableListViewFaq.addItemDecoration(new RecyclerView.ItemDecoration() {
|
|
|
@Override
|
|
|
@@ -58,20 +90,9 @@ public class FAQFragment extends Fragment {
|
|
|
outRect.top = ResourceUtil.dpToPx(12);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- return view;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
|
|
- super.onActivityCreated(savedInstanceState);
|
|
|
+ interface IFAQFragmentListener {
|
|
|
+ void onInit(FAQFragment faqFragment, int category);
|
|
|
}
|
|
|
-
|
|
|
-/* private void settingList() {
|
|
|
- faqList = new ArrayList<>();
|
|
|
- FAQBean bean1 = new FAQBean(0, "회원", "비밀번호는 어떻게 변경하나요?", "개인인증을 위한 정보(이름, 휴대폰 번호)를 입력 받고, 당첨 시 입력하신 번호로 경품 당첨 내용을 전송하오니 정확한 본인의 이름과 전화번호를 입력해 주시기 바랍니다. 당첨자는 추첨을 통해 선정되며 9월 28일자 발표일에 경품이 주어집니다.", "dummy");
|
|
|
- faqList.add(bean1);
|
|
|
- FAQBean bean2 = new FAQBean(0, "회원", "비밀번호는 어떻게 변경하나요?", "개인인증을 위한 정보(이름, 휴대폰 번호)를 입력 받고, 당첨 시 입력하신 번호로 경품 당첨 내용을 전송하오니 정확한 본인의 이름과 전화번호를 입력해 주시기 바랍니다. 당첨자는 추첨을 통해 선정되며 9월 28일자 발표일에 경품이 주어집니다.", "dummy");
|
|
|
- faqList.add(bean2);
|
|
|
- }*/
|
|
|
}
|