Przeglądaj źródła

[콘텐츠][New] 모든 카트형에 적용하기 위해서 홀더에서 적용하지 않음.

hyodong.min 6 lat temu
rodzic
commit
551c2d4c64

+ 2 - 8
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsAdapter.java

@@ -41,8 +41,6 @@ public class ContentsAdapter extends RecyclerView.Adapter<ContentsHolder> {
   private SeriesItemBean seriesInfo;
   private final String listType;
   private final String contentsNo;  // 현재 컨텐츠 와 비교하기 위해서 필요
-  private int screenWidth;
-  private int screenHeight;
 
   private static final int LISTICLE_COVER = 0;
   private static final int LISTICLE_DETAIL = 1;
@@ -59,8 +57,6 @@ public class ContentsAdapter extends RecyclerView.Adapter<ContentsHolder> {
   public ContentsAdapter(Activity activity,
                          String contentsNo,
                          String listType,
-                         int screenWidth,
-                         int screenHeight,
                          List<ContentsItemBean> contentsItemBeans,
                          List<SeriesItemBean> seriesItemBeans,
                          SeriesItemBean seriesInfo,
@@ -75,8 +71,6 @@ public class ContentsAdapter extends RecyclerView.Adapter<ContentsHolder> {
     this.seriesInfo = seriesInfo;
     this.listType = listType;
     this.contentsNo = contentsNo;
-    this.screenWidth = screenWidth;
-    this.screenHeight = screenHeight;
   }
 
   @NonNull
@@ -86,7 +80,7 @@ public class ContentsAdapter extends RecyclerView.Adapter<ContentsHolder> {
     switch (viewType) {
       case LISTICLE_COVER:
         view = inflater.inflate(R.layout.contents_listicle_cover, parent, false);
-        return new ContentsListicleCoverHolder(view, hasSeries() ? contentsItemBeans.get(0).getSeriesTitle() : "", screenWidth, screenHeight);
+        return new ContentsListicleCoverHolder(view, hasSeries() ? contentsItemBeans.get(0).getSeriesTitle() : "");
       case LISTICLE_DETAIL:
         view = inflater.inflate(R.layout.contents_listicle_detail, parent, false);
         return new ContentsListicleHolder(view, activity);
@@ -100,7 +94,7 @@ public class ContentsAdapter extends RecyclerView.Adapter<ContentsHolder> {
         /* falls through */
       case CARD_LISTICLE_COVER:
         view = inflater.inflate(R.layout.contents_card_listicle_cover, parent, false);
-        return new ContentsCardCoverHolder(view, screenWidth, screenHeight);
+        return new ContentsCardCoverHolder(view);
       case CARD_DETAIL:
         view = inflater.inflate(R.layout.contents_card_listicle_detail, parent, false);
         return new ContentsCardHolder(view);

+ 4 - 5
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsCardCoverHolder.java

@@ -2,7 +2,6 @@ package kr.co.zumo.app.lifeplus.view.screen.contents;
 
 import android.graphics.drawable.Drawable;
 import android.support.annotation.Nullable;
-import android.support.constraint.ConstraintLayout;
 import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
@@ -33,15 +32,15 @@ import kr.co.zumo.app.lifeplus.view.Visibler;
  * @history 하세미   [2018-11-28]   [최초 작성]
  * @since 2018-11-28
  */
-public class ContentsCardCoverHolder extends ContentsCoverHolder<ContentsItemBean> {
+public class ContentsCardCoverHolder extends ContentsHolder<ContentsItemBean> {
 
   private ImageView imageViewCardListicleCover;
   private ImageView imageViewShopping;
   private View dimTop;
   private View dimBottom;
 
-  public ContentsCardCoverHolder(View itemView, int screenWidth, int screenHeight) {
-    super(itemView, screenWidth, screenHeight);
+  public ContentsCardCoverHolder(View itemView) {
+    super(itemView);
     imageViewCardListicleCover = itemView.findViewById(R.id.image_view_card_listicle_cover);
     dimTop = itemView.findViewById(R.id.view_dim_top);
     dimBottom = itemView.findViewById(R.id.view_dim_bottom);
@@ -52,7 +51,7 @@ public class ContentsCardCoverHolder extends ContentsCoverHolder<ContentsItemBea
   @Override
   protected void bindInternal() {
 
-    setPaddingByRatio((ConstraintLayout) itemView, imageViewCardListicleCover);
+//    setPaddingByRatio((ConstraintLayout) itemView, imageViewCardListicleCover);
 
     imageViewShopping.setVisibility(ContentsItemBean.TYPE_ATTRIBUTE_PURCHASE.equals(bean.getListAttributeType()) ? View.VISIBLE : View.GONE);
     Glide.with(imageViewCardListicleCover)

+ 1 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsCardHolder.java

@@ -56,6 +56,7 @@ public class ContentsCardHolder extends ContentsHolder<ContentsItemBean> {
   @CallSuper
   @Override
   protected void bindInternal() {
+//    setPaddingByRatio((ConstraintLayout) itemView, imageViewCardListicleCover);
 
     // 기본 이미지
     Glide.with(imageViewCardListicleCover)

+ 0 - 56
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsCoverHolder.java

@@ -1,56 +0,0 @@
-/*
- * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
- */
-package kr.co.zumo.app.lifeplus.view.screen.contents;
-
-import android.support.constraint.ConstraintLayout;
-import android.support.constraint.ConstraintSet;
-import android.view.View;
-import android.widget.ImageView;
-
-import kr.co.zumo.app.R;
-import kr.co.zumo.app.lifeplus.util.ResourceUtil;
-
-/**
- * ContentsCoverHolder
- * <pre>
- * </pre>
- *
- * @author 민효동
- * @version 1.0
- * @history 민효동   [2019-04-11]   [최초 작성]
- * @since 2019-04-11
- */
-public abstract class ContentsCoverHolder<T> extends ContentsHolder<T> {
-  private int screenWidth;
-  private int screenHeight;
-  public ContentsCoverHolder(View itemView, int screenWidth, int screenHeight) {
-    super(itemView);
-    this.screenWidth = screenWidth;
-    this.screenHeight = screenHeight;
-  }
-
-  /**
-   * 화면 비율이 1.8 을 초과한다면 상단에 액션바 높이만큼 패딩을 준다.
-   * - 하단 패딩은 이미지 비율을 1.8로 맞추고 남는 경우 넣어준다.
-   */
-  void setPaddingByRatio(ConstraintLayout itemView, ImageView coverImageView) {
-
-    final float baseRatio = 1.8f;
-    if ((float) screenHeight / screenWidth > baseRatio) {
-      int paddingTop = ResourceUtil.getDimension(R.dimen.action_bar_height) + ResourceUtil.getStatusBarHeightManual();
-      int modifiedHeight = screenHeight - paddingTop;
-      itemView.setPadding(0, paddingTop, 0, 0);
-
-      if ((float) modifiedHeight / screenWidth > baseRatio) {
-        // 상단 패딩 이후 여전히 비율이 안맞다면
-        // 이미지 비율을 9:16으로 조절해서 하단 여백을 남김
-        ConstraintSet set = new ConstraintSet();
-        set.clone(itemView);
-        set.setDimensionRatio(coverImageView.getId(), "9:16");
-        set.applyTo(itemView);
-      }
-    }
-
-  }
-}

+ 1 - 3
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsFragment.java

@@ -221,9 +221,7 @@ public class ContentsFragment extends FragmentBase<ContentsPresenter> implements
     List<SeriesItemBean> seriesItemBeans = contentsDetailListBean.getSeriesItemList();
     List<WithShownItemBean> withItemBeans = contentsDetailListBean.getWithItemList();
 
-    ScreenSizeHelper sizeHelper = getHelper(ScreenSizeHelper.class);
-
-    adapter = new ContentsAdapter(getActivity(), contentsNo, listType, sizeHelper.getScreenWidth(), sizeHelper.getScreenHeight(), contentsItemBeans, seriesItemBeans, contentsDetailListBean.getSeriesInfo(), withItemBeans, event -> {
+    adapter = new ContentsAdapter(getActivity(), contentsNo, listType, contentsItemBeans, seriesItemBeans, contentsDetailListBean.getSeriesInfo(), withItemBeans, event -> {
       presenter.onEvent(event);
     });
 

+ 3 - 6
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsListicleCoverHolder.java

@@ -32,7 +32,7 @@ import kr.co.zumo.app.lifeplus.view.Visibler;
  * @history 하세미   [2018-11-27]   [최초 작성]
  * @since 2018-11-27
  */
-public class ContentsListicleCoverHolder extends ContentsCoverHolder<ContentsItemBean> {
+public class ContentsListicleCoverHolder extends ContentsHolder<ContentsItemBean> {
 
   private ImageView imageViewBackground;
   private ImageView imageViewArrow;
@@ -49,8 +49,8 @@ public class ContentsListicleCoverHolder extends ContentsCoverHolder<ContentsIte
   private View dim;
   private String seriesTitle;
 
-  public ContentsListicleCoverHolder(View itemView, String seriesTitle, int screenWidth, int screenHeight) {
-    super(itemView, screenWidth, screenHeight);
+  public ContentsListicleCoverHolder(View itemView, String seriesTitle) {
+    super(itemView);
     imageViewBackground = itemView.findViewById(R.id.image_view_background);
     imageViewArrow = itemView.findViewById(R.id.image_view_arrow);
     imageViewShopping = itemView.findViewById(R.id.shopping_icon);
@@ -72,9 +72,6 @@ public class ContentsListicleCoverHolder extends ContentsCoverHolder<ContentsIte
   @Override
   protected void bindInternal() {
 
-    // 리스티클 커버는 상하 패딩없이 그냥 전체화면으로 표시하면 됨
-    // setPaddingByRatio((ConstraintLayout) itemView, imageViewBackground);
-
     imageViewShopping.setVisibility(ContentsItemBean.TYPE_ATTRIBUTE_PURCHASE.equals(bean.getListAttributeType()) ? View.VISIBLE : View.GONE);
     Glide.with(imageViewBackground)
       //.asBitmap()

+ 3 - 4
app/src/main/res/layout/contents_card_listicle_cover.xml

@@ -10,15 +10,14 @@
 
   <ImageView
     android:id="@+id/image_view_card_listicle_cover"
-    android:layout_width="0dp"
-    android:layout_height="0dp"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/CFFFFFF"
     android:scaleType="centerCrop"
-    app:layout_constraintVertical_bias="0"
     app:layout_constraintBottom_toBottomOf="parent"
     app:layout_constraintEnd_toEndOf="parent"
     app:layout_constraintStart_toStartOf="parent"
     app:layout_constraintTop_toTopOf="parent"
-    android:background="@color/CFFFFFF"
     />
 
   <View

+ 9 - 14
app/src/main/res/layout/contents_card_listicle_detail.xml

@@ -6,21 +6,16 @@
   android:layout_width="match_parent"
   android:layout_height="match_parent">
 
-  <android.support.constraint.ConstraintLayout
+  <ImageView
+    android:id="@+id/image_view"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-    <ImageView
-      android:id="@+id/image_view"
-      android:layout_width="match_parent"
-      android:layout_height="match_parent"
-      android:background="@color/CF6F6F6"
-      android:scaleType="center"
-      app:layout_constraintBottom_toBottomOf="parent"
-      app:layout_constraintEnd_toEndOf="parent"
-      app:layout_constraintStart_toStartOf="parent"
-      app:layout_constraintTop_toTopOf="parent"/>
-  </android.support.constraint.ConstraintLayout>
+    android:layout_height="match_parent"
+    android:background="@color/CFFFFFF"
+    android:scaleType="center"
+    app:layout_constraintBottom_toBottomOf="parent"
+    app:layout_constraintEnd_toEndOf="parent"
+    app:layout_constraintStart_toStartOf="parent"
+    app:layout_constraintTop_toTopOf="parent"/>
 
   <View
     android:id="@+id/view_dim_0"