Browse Source

[FAQ][Bug] decoration 수정

hyodong.min 6 years ago
parent
commit
4825d2232b

+ 16 - 19
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/faq/FAQListFragment.java

@@ -34,15 +34,14 @@ public class FAQListFragment extends Fragment {
   private RecyclerView expandableListViewFaq;
 
   private List<FAQBean> faqBeans;
-  private IFAQListFragmentListener listener;
+  private IFAQListFragmentDelegate delegate;
   private int index;
 
-  public void setListener(IFAQListFragmentListener listener) {
-    this.listener = listener;
+  public void setDelegate(IFAQListFragmentDelegate delegate) {
+    this.delegate = delegate;
   }
 
   public static FAQListFragment newInstance(int index) {
-
     FAQListFragment fragment = new FAQListFragment();
     Bundle args = new Bundle();
     args.putInt(PARAM_INDEX, index);
@@ -67,22 +66,30 @@ public class FAQListFragment extends Fragment {
   @Override
   public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
     super.onViewCreated(view, savedInstanceState);
+
+    expandableListViewFaq = view.findViewById(R.id.expandable_list_view_faq);
+    expandableListViewFaq.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
+    expandableListViewFaq.addItemDecoration(new RecyclerView.ItemDecoration() {
+      @Override
+      public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
+        super.getItemOffsets(outRect, view, parent, state);
+        outRect.bottom = ResourceUtil.dpToPx(12);
+      }
+    });
   }
 
   @Override
   public void onStart() {
     super.onStart();
 
-    listener.onInit(this, this.index);
+    delegate.onInit(this, this.index);
   }
 
   @Override
   public void setUserVisibleHint(boolean isVisibleToUser) {
     super.setUserVisibleHint(isVisibleToUser);
 
-    if (isVisibleToUser) {
-    }
-    else {
+    if (isVisibleToUser == false) {
       if (null != expandableListViewFaq) {
         expandableListViewFaq.scrollToPosition(0);
       }
@@ -95,23 +102,13 @@ public class FAQListFragment extends Fragment {
    * @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
-      public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
-        super.getItemOffsets(outRect, view, parent, state);
-        outRect.bottom = ResourceUtil.dpToPx(12);
-      }
-    });
   }
 
-  interface IFAQListFragmentListener {
+  interface IFAQListFragmentDelegate {
     void onInit(FAQListFragment faqListFragment, int category);
   }
 }

+ 2 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/faq/FAQPagerAdapter.java

@@ -20,7 +20,7 @@ import kr.co.zumo.app.lifeplus.bean.api.FAQBean;
  * @history 하세미   [2018-10-01]   [최초 작성]
  * @since 2018-10-01
  */
-public class FAQPagerAdapter extends FragmentStatePagerAdapter implements FAQListFragment.IFAQListFragmentListener {
+public class FAQPagerAdapter extends FragmentStatePagerAdapter implements FAQListFragment.IFAQListFragmentDelegate {
 
   private String[] tabs;
   private static final int PAGE_COUNT = 4;
@@ -39,7 +39,7 @@ public class FAQPagerAdapter extends FragmentStatePagerAdapter implements FAQLis
     // position 에 매칭되는 카테고리 인덱스
 
     FAQListFragment faqListFragment = FAQListFragment.newInstance(position);
-    faqListFragment.setListener(this);
+    faqListFragment.setDelegate(this);
     return faqListFragment;
   }