|
|
@@ -13,6 +13,7 @@ import java.util.List;
|
|
|
import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.bean.SeriesListBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.ContentsDetailBean;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.LifeplusImageBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.SeriesItemBean;
|
|
|
import kr.co.zumo.app.lifeplus.view.IEventListener;
|
|
|
|
|
|
@@ -44,6 +45,7 @@ public class ContentsAdapter extends RecyclerView.Adapter<ContentsHolder> {
|
|
|
private static final int SERIES = 6;
|
|
|
private static final int WITH_SHOWN_CONTENTS = 7;
|
|
|
private static final int HTML = 8;
|
|
|
+ private static final int MOVIE = 9;
|
|
|
|
|
|
|
|
|
public ContentsAdapter(Context context, String listType, List<ContentsDetailBean> contentsDetailBeans, List<SeriesItemBean> seriesItemBeans, SeriesItemBean seriesInfo, IEventListener listener) {
|
|
|
@@ -98,18 +100,18 @@ public class ContentsAdapter extends RecyclerView.Adapter<ContentsHolder> {
|
|
|
listener.onEvent(event);
|
|
|
};
|
|
|
|
|
|
- if (holder instanceof ContentsSeriesHolder) {
|
|
|
- SeriesListBean seriesListBean = new SeriesListBean();
|
|
|
- seriesListBean.setSeriesInfo(seriesInfo);
|
|
|
- seriesListBean.setSeriesItemList(seriesItemBeans);
|
|
|
- holder.bind(position, seriesListBean, eventListener);
|
|
|
- }
|
|
|
- else if (holder instanceof ContentsCardHolder) {
|
|
|
+ if (holder instanceof ContentsCardHolder) {
|
|
|
((ContentsCardHolder) holder).setItemCount(getItemCount());
|
|
|
ContentsDetailBean bean = contentsDetailBeans.get(position);
|
|
|
holder.bind(position, bean, eventListener);
|
|
|
|
|
|
}
|
|
|
+ else if (holder instanceof ContentsSeriesHolder) {
|
|
|
+ SeriesListBean seriesListBean = new SeriesListBean();
|
|
|
+ seriesListBean.setSeriesInfo(seriesInfo);
|
|
|
+ seriesListBean.setSeriesItemList(seriesItemBeans);
|
|
|
+ holder.bind(position, seriesListBean, eventListener);
|
|
|
+ }
|
|
|
else {
|
|
|
Log.e("APP# ContentsAdapter | onBindViewHolder", "| position: " + position + " - " + this.hashCode());
|
|
|
ContentsDetailBean bean = contentsDetailBeans.get(position);
|
|
|
@@ -167,9 +169,6 @@ public class ContentsAdapter extends RecyclerView.Adapter<ContentsHolder> {
|
|
|
case ContentsDetailBean.TYPE_CARD:
|
|
|
type = CARD_LISTICLE_COVER;
|
|
|
break;
|
|
|
- case ContentsDetailBean.TYPE_HTML:
|
|
|
- type = HTML;
|
|
|
- break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
@@ -181,10 +180,10 @@ public class ContentsAdapter extends RecyclerView.Adapter<ContentsHolder> {
|
|
|
type = LISTICLE_DETAIL;
|
|
|
break;
|
|
|
case ContentsDetailBean.TYPE_CARD_LISTICLE:
|
|
|
- type = CARD_LISTICLE_DETAIL;
|
|
|
+ type = getCardType(position, CARD_LISTICLE_DETAIL);
|
|
|
break;
|
|
|
case ContentsDetailBean.TYPE_CARD:
|
|
|
- type = CARD_DETAIL;
|
|
|
+ type = getCardType(position, CARD_DETAIL);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
@@ -193,6 +192,27 @@ public class ContentsAdapter extends RecyclerView.Adapter<ContentsHolder> {
|
|
|
return type;
|
|
|
}
|
|
|
|
|
|
+ private int getCardType(int position, int defaultType) {
|
|
|
+ int type = defaultType;
|
|
|
+
|
|
|
+ ContentsDetailBean bean = contentsDetailBeans.get(position);
|
|
|
+ String itemType = bean.getImageType();
|
|
|
+ if (LifeplusImageBean.TYPE_COVER.equals(itemType)) {
|
|
|
+ type = CARD_DETAIL;
|
|
|
+ }
|
|
|
+ else if (LifeplusImageBean.TYPE_DETAIL.equals(itemType)) {
|
|
|
+ type = CARD_DETAIL;
|
|
|
+ }
|
|
|
+ else if (LifeplusImageBean.TYPE_MOVIE.equals(itemType)) {
|
|
|
+ type = MOVIE;
|
|
|
+ }
|
|
|
+ else if (LifeplusImageBean.TYPE_HTML.equals(itemType)) {
|
|
|
+ type = HTML;
|
|
|
+ }
|
|
|
+
|
|
|
+ return type;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
|
|
|
super.onAttachedToRecyclerView(recyclerView);
|