Explorar o código

[카테고리메인][Common] 여행 어디가지 페이지 구현(미완)

Hasemi %!s(int64=7) %!d(string=hai) anos
pai
achega
62d4cb30d0

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

@@ -0,0 +1,61 @@
+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;
+
+/**
+ * SecondCategoryMainAdapter
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2018-10-24]   [최초 작성]
+ * @since 2018-10-24
+ */
+public class SecondCategoryMainAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+
+  private Context context;
+  private LayoutInflater inflater;
+  private static final int FULL_IMAGE = 0;
+  private static final int DEFAULT_IMAGE = 1;
+
+
+  public SecondCategoryMainAdapter(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 = inflater.inflate(R.layout.main_second_category_image_view, parent, false);
+    return new SecondCategoryMainViewHolder(view);
+  }
+
+  @Override
+  public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
+    ((SecondCategoryMainViewHolder) holder).doDataSetting();
+  }
+
+  @Override
+  public int getItemCount() {
+    return 9;
+  }
+
+//  @Override
+//  public int getItemViewType(int position) {
+//    if (position == 0 || position == 5) {
+//      return FULL_IMAGE;
+//    }
+//    else {
+//      return DEFAULT_IMAGE;
+//    }
+//  }
+}

+ 46 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/fragment/main/category/SecondCategoryMainFragment.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.SecondCategoryMainPresenter;
 
@@ -25,6 +34,11 @@ import kr.co.zumo.app.lifeplus.view.presenter.main.category.SecondCategoryMainPr
  * @since 2018-10-24
  */
 public class SecondCategoryMainFragment extends FragmentBase<SecondCategoryMainPresenter> {
+
+  private List<TextImageBean> textImageBeanList;
+  private RecyclerView recyclerViewSecondCategoryMain;
+  private MainSeriesView mainSeriesView;
+
   @Override
   protected View onAfterCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
     return inflater.inflate(R.layout.fragment_second_category_main, container, false);
@@ -32,6 +46,22 @@ public class SecondCategoryMainFragment extends FragmentBase<SecondCategoryMainP
 
   @Override
   protected void onAfterActivityCreated(Bundle savedInstanceState) {
+    mainSeriesView = findViewById(R.id.series_image_text_view);
+    recyclerViewSecondCategoryMain = findViewById(R.id.recycler_view_second_category_main);
+    doDataSetting();
+    mainSeriesView.init(getActivity(), textImageBeanList, 10);
+    SecondCategoryMainAdapter secondCategoryMainAdapter = new SecondCategoryMainAdapter(getActivity());
+    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
+    recyclerViewSecondCategoryMain.setLayoutManager(linearLayoutManager);
+    recyclerViewSecondCategoryMain.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(7);
+      }
+    });
+    recyclerViewSecondCategoryMain.setLayoutManager(linearLayoutManager);
+    recyclerViewSecondCategoryMain.setAdapter(secondCategoryMainAdapter);
 
   }
 
@@ -42,10 +72,26 @@ public class SecondCategoryMainFragment extends FragmentBase<SecondCategoryMainP
       .search(actionBar -> presenter.onClickSearch(actionBar))
       .back(actionBar -> presenter.onClickBack(actionBar))
       .show();
+
   }
 
   @Override
   protected SecondCategoryMainPresenter definePresenter() {
     return new SecondCategoryMainPresenter(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));
+
+  }
 }

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

@@ -0,0 +1,62 @@
+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 kr.co.zumo.app.R;
+
+/**
+ * SecondCategoryMainViewHolder
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2018-10-24]   [최초 작성]
+ * @since 2018-10-24
+ */
+public class SecondCategoryMainViewHolder extends RecyclerView.ViewHolder {
+
+//  private ImageView imageViewMainSecondCategory;
+//  private TextView textViewMainSecondCategory;
+    private ImageView imageView1;
+    private ImageView imageView2;
+    private ImageView imageView3;
+//    private ImageView imageView4;
+//    private ImageView imageView5;
+//    private ImageView imageView6;
+//    private ImageView imageView7;
+//    private ImageView imageView8;
+//    private ImageView imageView9;
+
+  public SecondCategoryMainViewHolder(View itemView) {
+    super(itemView);
+//    imageViewMainSecondCategory = itemView.findViewById(R.id.image_view_main_second_category);
+//    textViewMainSecondCategory = itemView.findViewById(R.id.text_view_main_second_title);
+    imageView1 = itemView.findViewById(R.id.first_image_view);
+    imageView2 = itemView.findViewById(R.id.second_image_view);
+    imageView3 = itemView.findViewById(R.id.third_image_view);
+//    imageView4 = itemView.findViewById(R.id.fourth_image_view);
+//    imageView5 = itemView.findViewById(R.id.fifth_image_view);
+//    imageView6 = itemView.findViewById(R.id.sixth_image_view);
+//    imageView7 = itemView.findViewById(R.id.seventh_image_view);
+//    imageView8 = itemView.findViewById(R.id.eighth_image_view);
+//    imageView9 = itemView.findViewById(R.id.ninth_image_view);
+  }
+
+  public void doDataSetting() {
+//    imageViewMainSecondCategory.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_3));
+//    textViewMainSecondCategory.setText(R.string.main_second_category_title);
+    imageView1.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_3));
+    imageView2.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_3));
+    imageView3.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_3));
+//    imageView4.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_3));
+//    imageView5.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_3));
+//    imageView6.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_3));
+//    imageView7.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_3));
+//    imageView8.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_3));
+//    imageView9.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_3));
+
+  }
+}

+ 53 - 3
app/src/main/res/layout/fragment_second_category_main.xml

@@ -1,6 +1,56 @@
 <?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"/>
+
+    <ImageView
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_alignParentEnd="true"
+      android:layout_marginEnd="10dp"
+      android:padding="14dp"
+      app:srcCompat="@drawable/ic_filter_de"
+      />
+  </RelativeLayout>
+
+  <android.support.v7.widget.RecyclerView
+    android:id="@+id/recycler_view_second_category_main"
+    android:layout_width="match_parent"
+    android:layout_height="0dp"
+    android:clipToPadding="false"
+    android:layout_marginStart="16dp"
+    android:layout_marginEnd="16dp"
+    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>

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

@@ -0,0 +1,35 @@
+<?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"
+  >
+
+<ImageView
+  android:id="@+id/first_image_view"
+  android:layout_width="205dp"
+  android:layout_height="205dp"
+  android:scaleType="fitXY"
+  android:src="@drawable/img_bestbucket_banner_5"
+  />
+
+  <ImageView
+    android:id="@+id/second_image_view"
+    android:layout_width="99dp"
+    android:layout_height="99dp"
+    android:scaleType="fitXY"
+    android:src="@drawable/img_bestbucket_banner_4"
+    app:layout_constraintTop_toBottomOf="@+id/first_image_view"
+    />
+  <ImageView
+    android:id="@+id/third_image_view"
+    android:layout_width="99dp"
+    android:layout_height="99dp"
+    android:scaleType="fitXY"
+    android:src="@drawable/img_bestbucket_banner_3"
+    app:layout_constraintTop_toBottomOf="@+id/second_image_view"
+    />
+
+</android.support.constraint.ConstraintLayout>

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

@@ -394,7 +394,7 @@
   <string name="main_fifth_category_title">이번 주\n꼭 알아야 할 이야기</string>
   <string name="main_fifth_category_date">2018.09.17 ~ 2018.09.23</string>
   <string name="main_fifth_category_contents">9월 3주차\n뮤지컬 예매순위 TOP 10</string>
-
+  <string name="main_second_category_title">디즈니랜드 여행</string>
 
 
 </resources>