Bläddra i källkod

[카테고리메인][Bug] 트랜드이슈 뭐있지 페이지 구현

Hasemi 7 år sedan
förälder
incheckning
5d86c58b39

+ 80 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/fragment/main/category/FourthCategoryMainAdapter.java

@@ -0,0 +1,80 @@
+package kr.co.zumo.app.lifeplus.view.fragment.main.category;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import kr.co.zumo.app.R;
+
+/**
+ * FourthCategoryMainAdapter
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2018-10-24]   [최초 작성]
+ * @since 2018-10-24
+ */
+public class FourthCategoryMainAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+
+  private Context context;
+  private LayoutInflater inflater;
+  public static final int LINEAR_VIEW_TYPE = 0;
+  public static final int BANNER_VIEW_TYPE = 1;
+
+  public FourthCategoryMainAdapter(Context context) {
+    this.context = context;
+    this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+  }
+
+  @NonNull
+  @Override
+  public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+    View view;
+    switch (viewType) {
+      case LINEAR_VIEW_TYPE:
+        view = inflater.inflate(R.layout.main_fourth_category_linear_view, parent, false);
+        return new FourthCategoryMainLinearViewHolder(view);
+      case BANNER_VIEW_TYPE:
+        view = inflater.inflate(R.layout.main_fourth_category_banner_view, parent, false);
+        return new FourthCategoryMainBannerViewHolder(view);
+      default:
+        break;
+    }
+    return null;
+
+  }
+
+  @Override
+  public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
+    switch (getItemViewType(position)) {
+      case LINEAR_VIEW_TYPE:
+        ((FourthCategoryMainLinearViewHolder) holder).doDataSetting();
+        break;
+      case BANNER_VIEW_TYPE:
+        ((FourthCategoryMainBannerViewHolder) holder).doDataSetting();
+        break;
+      default:
+        break;
+    }
+  }
+
+  @Override
+  public int getItemCount() {
+    return 7;
+  }
+
+  @Override
+  public int getItemViewType(int position) {
+    if (position == 4) {
+      return BANNER_VIEW_TYPE;
+    }
+    else {
+      return LINEAR_VIEW_TYPE;
+    }
+  }
+}

+ 39 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/fragment/main/category/FourthCategoryMainBannerViewHolder.java

@@ -0,0 +1,39 @@
+package kr.co.zumo.app.lifeplus.view.fragment.main.category;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import kr.co.zumo.app.R;
+import kr.co.zumo.app.lifeplus.bean.TextImageBean;
+import kr.co.zumo.app.lifeplus.view.custom.main.banner.MainBannerView;
+
+/**
+ * FourthCategoryMainBannerViewHolder
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2018-10-24]   [최초 작성]
+ * @since 2018-10-24
+ */
+public class FourthCategoryMainBannerViewHolder extends RecyclerView.ViewHolder {
+
+  private MainBannerView mainBannerViewFirstCategory;
+
+  public FourthCategoryMainBannerViewHolder(View itemView) {
+    super(itemView);
+    mainBannerViewFirstCategory = itemView.findViewById(R.id.main_banner_view_first_category);
+  }
+
+  public void doDataSetting() {
+
+    List<TextImageBean> imageBeanList = new ArrayList<>();
+    imageBeanList.add(new TextImageBean(R.drawable.img_bestbucket_banner_1));
+    imageBeanList.add(new TextImageBean(R.drawable.img_bestbucket_banner_2));
+    mainBannerViewFirstCategory.init(itemView.getContext(), imageBeanList, 2);
+
+  }}

+ 43 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/fragment/main/category/FourthCategoryMainFragment.java

@@ -1,15 +1,24 @@
 package kr.co.zumo.app.lifeplus.view.fragment.main.category;
 
+import android.graphics.Rect;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
 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;
+import kr.co.zumo.app.lifeplus.bean.TextImageBean;
 import kr.co.zumo.app.lifeplus.manager.ActionBarManager;
 import kr.co.zumo.app.lifeplus.model.BlankModel;
+import kr.co.zumo.app.lifeplus.util.ResourceUtil;
+import kr.co.zumo.app.lifeplus.view.custom.main.series.MainSeriesView;
 import kr.co.zumo.app.lifeplus.view.fragment.FragmentBase;
 import kr.co.zumo.app.lifeplus.view.presenter.main.category.FourthCategoryMainPresenter;
 
@@ -24,6 +33,11 @@ import kr.co.zumo.app.lifeplus.view.presenter.main.category.FourthCategoryMainPr
  * @since 2018-10-24
  */
 public class FourthCategoryMainFragment extends FragmentBase<FourthCategoryMainPresenter> {
+
+  private List<TextImageBean> textImageBeanList;
+  private MainSeriesView mainSeriesView;
+  private RecyclerView recyclerViewFourthCategoryMain;
+
   @Override
   protected View onAfterCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
     return inflater.inflate(R.layout.fragment_fourth_category_main, container, false);
@@ -31,7 +45,21 @@ public class FourthCategoryMainFragment extends FragmentBase<FourthCategoryMainP
 
   @Override
   protected void onAfterActivityCreated(Bundle savedInstanceState) {
-
+    mainSeriesView = findViewById(R.id.series_image_text_view);
+    recyclerViewFourthCategoryMain = findViewById(R.id.recycler_view_fourth_category_main);
+    doDataSetting();
+    mainSeriesView.init(getActivity(), textImageBeanList, 10);
+    FourthCategoryMainAdapter fourthCategoryMainAdapter = new FourthCategoryMainAdapter(getActivity());
+    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
+    recyclerViewFourthCategoryMain.setLayoutManager(linearLayoutManager );
+    recyclerViewFourthCategoryMain.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(21);
+      }
+    });
+    recyclerViewFourthCategoryMain.setAdapter(fourthCategoryMainAdapter);
   }
 
   @Override
@@ -47,4 +75,18 @@ public class FourthCategoryMainFragment extends FragmentBase<FourthCategoryMainP
   protected FourthCategoryMainPresenter definePresenter() {
     return new FourthCategoryMainPresenter(getModel(BlankModel.class), this);
   }
+
+  public void doDataSetting() {
+    textImageBeanList = new ArrayList<>();
+    textImageBeanList.add(new TextImageBean(R.drawable.img_select_bg_1, R.string.my_coin));
+    textImageBeanList.add(new TextImageBean(R.drawable.img_select_bg_2, R.string.my_coin));
+    textImageBeanList.add(new TextImageBean(R.drawable.img_select_bg_3, R.string.my_coin));
+    textImageBeanList.add(new TextImageBean(R.drawable.img_select_bg_4, R.string.my_coin));
+    textImageBeanList.add(new TextImageBean(R.drawable.img_select_bg_5, R.string.my_coin));
+    textImageBeanList.add(new TextImageBean(R.drawable.img_select_bg_6, R.string.my_coin));
+    textImageBeanList.add(new TextImageBean(R.drawable.img_select_bg_7, R.string.my_coin));
+    textImageBeanList.add(new TextImageBean(R.drawable.img_select_bg_8, R.string.my_coin));
+    textImageBeanList.add(new TextImageBean(R.drawable.img_select_bg_9, R.string.my_coin));
+    textImageBeanList.add(new TextImageBean(R.drawable.img_select_bg_10, R.string.my_coin));
+  }
 }

+ 41 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/fragment/main/category/FourthCategoryMainLinearViewHolder.java

@@ -0,0 +1,41 @@
+package kr.co.zumo.app.lifeplus.view.fragment.main.category;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import kr.co.zumo.app.R;
+
+/**
+ * FourthCategoryMainLinearViewHolder
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2018-10-24]   [최초 작성]
+ * @since 2018-10-24
+ */
+public class FourthCategoryMainLinearViewHolder extends RecyclerView.ViewHolder {
+
+  private TextView textViewMainFourthCategoryTitle1;
+  private TextView textViewMainFourthCategoryTitle2;
+  private TextView textViewMainFourthCategoryTitle3;
+  private ImageView imageViewMainFourthCategory;
+
+  public FourthCategoryMainLinearViewHolder(View itemView) {
+    super(itemView);
+    textViewMainFourthCategoryTitle1 = itemView.findViewById(R.id.text_view_main_fourth_category_title1);
+    textViewMainFourthCategoryTitle2 = itemView.findViewById(R.id.text_view_main_fourth_category_title2);
+    textViewMainFourthCategoryTitle3 = itemView.findViewById(R.id.text_view_main_fourth_category_title3);
+    imageViewMainFourthCategory = itemView.findViewById(R.id.image_view_main_fourth_category);
+  }
+
+  public void doDataSetting(){
+    textViewMainFourthCategoryTitle1.setText(R.string.main_fourth_category_example1);
+    textViewMainFourthCategoryTitle2.setText(R.string.main_fourth_category_example2);
+    textViewMainFourthCategoryTitle3.setText(R.string.main_fourth_category_example3);
+    imageViewMainFourthCategory.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_banner_1));
+  }
+}

+ 44 - 3
app/src/main/res/layout/fragment_fourth_category_main.xml

@@ -1,6 +1,47 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                                             android:layout_width="match_parent"
-                                             android:layout_height="match_parent">
+<android.support.constraint.ConstraintLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="match_parent">
 
+  <kr.co.zumo.app.lifeplus.view.custom.main.series.MainSeriesView
+    android:id="@+id/series_image_text_view"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginTop="23dp"
+    android:clipToPadding="false">
+  </kr.co.zumo.app.lifeplus.view.custom.main.series.MainSeriesView>
+
+  <RelativeLayout
+    android:id="@+id/relativeLayout"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    app:layout_constraintTop_toBottomOf="@id/series_image_text_view">
+
+    <Spinner
+      android:id="@+id/spinner_select_contents"
+      android:layout_width="wrap_content"
+      android:layout_height="45dp"
+      android:layout_marginStart="25dp"
+      android:background="@drawable/filter_drop_down"
+      android:entries="@array/main_filter"
+      android:focusable="true"
+      android:textColor="@color/C000000"
+      android:textSize="14sp"/>
+  </RelativeLayout>
+
+  <android.support.v7.widget.RecyclerView
+    android:id="@+id/recycler_view_fourth_category_main"
+    android:layout_width="match_parent"
+    android:layout_height="0dp"
+    android:clipToPadding="false"
+    android:layout_marginStart="25dp"
+    android:layout_marginEnd="25dp"
+    app:layout_constraintBottom_toBottomOf="parent"
+    app:layout_constraintTop_toBottomOf="@id/relativeLayout"
+    app:layout_constraintLeft_toLeftOf="parent"
+    app:layout_constraintRight_toRightOf="parent"
+    />
 </android.support.constraint.ConstraintLayout>

+ 12 - 0
app/src/main/res/layout/main_fourth_category_banner_view.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content">
+
+  <kr.co.zumo.app.lifeplus.view.custom.main.banner.MainBannerView
+    android:id="@+id/main_banner_view_first_category"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"/>
+
+</android.support.constraint.ConstraintLayout>

+ 56 - 0
app/src/main/res/layout/main_fourth_category_linear_view.xml

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content">
+
+  <TextView
+    android:id="@+id/text_view_main_fourth_category_title1"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginTop="7dp"
+    android:lineSpacingExtra="4sp"
+    android:textColor="@color/C666666"
+    android:textSize="11sp"
+    app:layout_constraintStart_toStartOf="parent"
+    app:layout_constraintTop_toTopOf="parent"
+    tools:text="알짜배기 투자전략"
+    />
+
+  <TextView
+    android:id="@+id/text_view_main_fourth_category_title2"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginTop="5dp"
+    android:lineSpacingExtra="6sp"
+    android:textColor="@color/C000000"
+    android:textSize="14sp"
+    app:layout_constraintStart_toStartOf="parent"
+    app:layout_constraintTop_toBottomOf="@+id/text_view_main_fourth_category_title1"
+    tools:text="개미 벗어나기
누구나 주주가 될 수 있다?"
+    />
+
+  <TextView
+    android:id="@+id/text_view_main_fourth_category_title3"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginTop="10dp"
+    android:lineSpacingExtra="4sp"
+    android:textColor="@color/C999999"
+    android:textSize="11sp"
+    app:layout_constraintStart_toStartOf="parent"
+    app:layout_constraintTop_toBottomOf="@+id/text_view_main_fourth_category_title2"
+    tools:text="경제/비즈니스"
+    />
+
+  <ImageView
+    android:id="@+id/image_view_main_fourth_category"
+    android:layout_width="124dp"
+    android:layout_height="93dp"
+    android:scaleType="fitXY"
+    android:src="@drawable/img_bestbucket_banner_5"
+    app:layout_constraintEnd_toEndOf="parent"
+    />
+</android.support.constraint.ConstraintLayout>

+ 5 - 1
app/src/main/res/values/strings.xml

@@ -326,7 +326,7 @@
 
   <string name="contents_category2"><b>여행</b> 어디가지</string>
   <string name="contents_category3"><b>취미로</b> 뭐하지</string>
-  <string name="contents_category4"><b>트드이슈</b> 뭐있지</string>
+  <string name="contents_category4"><b>트드이슈</b> 뭐있지</string>
   <string name="contents_category5"><b>THIS</b> WEEK</string>
 
   <string name="menu_category1">MY</string>
@@ -387,4 +387,8 @@
   <string name="bucket_select_text9">한 해동안 책 20권 읽기</string>
   <string name="bucket_select_text10">스쿠버 다이빙 자격증 따기</string>
 
+  <string name="main_fourth_category_example1">알짜배기 투자전략</string>
+  <string name="main_fourth_category_example2">개미 벗어나기\n
누구나 주주가 될 수 있다?</string>
+  <string name="main_fourth_category_example3">경제/비즈니스</string>
+
 </resources>