|
|
@@ -20,7 +20,8 @@ import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.WithShownItemBean;
|
|
|
import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
import kr.co.zumo.app.lifeplus.view.IEventListener;
|
|
|
-import kr.co.zumo.app.lifeplus.view.custom.category.banner.MainBannerViewItemDotIndicator;
|
|
|
+import kr.co.zumo.app.lifeplus.view.IndexScrollListener;
|
|
|
+import kr.co.zumo.app.lifeplus.view.screen.event.CustomIndicator;
|
|
|
|
|
|
/**
|
|
|
* RecommendContentsView
|
|
|
@@ -37,7 +38,10 @@ public class RecommendContentsView extends ConstraintLayout {
|
|
|
private TextView textViewTitle;
|
|
|
private TextView textViewSubTitle;
|
|
|
private RecyclerView recyclerViewRecommendContents;
|
|
|
+ private CustomIndicator customIndicator;
|
|
|
private List<WithShownItemBean> withItemList;
|
|
|
+ private IndexScrollListener indexScrollListener;
|
|
|
+ private LinearLayoutManager layoutManager;
|
|
|
|
|
|
public RecommendContentsView(Context context) {
|
|
|
super(context);
|
|
|
@@ -59,6 +63,9 @@ public class RecommendContentsView extends ConstraintLayout {
|
|
|
inflater.inflate(R.layout.recommend_contents_view, this);
|
|
|
|
|
|
recyclerViewRecommendContents = findViewById(R.id.recycler_view_recommend_contents);
|
|
|
+ customIndicator = findViewById(R.id.custom_indicator);
|
|
|
+ layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
|
|
|
+
|
|
|
recyclerViewRecommendContents.addItemDecoration(new RecyclerView.ItemDecoration() {
|
|
|
@Override
|
|
|
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
|
|
@@ -99,18 +106,25 @@ public class RecommendContentsView extends ConstraintLayout {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ indexScrollListener = new IndexScrollListener(layoutManager, index -> {
|
|
|
+ customIndicator.onChangedIndex(index);
|
|
|
+ });
|
|
|
+
|
|
|
+ recyclerViewRecommendContents.addOnScrollListener(indexScrollListener);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public void draw(Context context, List<WithShownItemBean> withItemList, IEventListener listener) {
|
|
|
this.withItemList = withItemList;
|
|
|
-
|
|
|
+ customIndicator.setIndicatorSetting(recyclerViewRecommendContents, R.color.C19000000, R.color.C000000, ResourceUtil.dpToPx(0));
|
|
|
if (null == withItemList) {
|
|
|
Log.e("APP# RecommendContentsView | draw", "|" + "withItemList is null......");
|
|
|
return;
|
|
|
}
|
|
|
RecommendContentsViewAdapter recommendContentsViewAdapter = new RecommendContentsViewAdapter(context, withItemList, listener);
|
|
|
- recyclerViewRecommendContents.addItemDecoration(new MainBannerViewItemDotIndicator(context, R.color.C19000000, R.color.C000000, ResourceUtil.dpToPx(74)));
|
|
|
- recyclerViewRecommendContents.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
|
|
|
+ // recyclerViewRecommendContents.addItemDecoration(new MainBannerViewItemDotIndicator(context, R.color.C19000000, R.color.C000000, ResourceUtil.dpToPx(74)));
|
|
|
+ recyclerViewRecommendContents.setLayoutManager(layoutManager);
|
|
|
recyclerViewRecommendContents.setAdapter(recommendContentsViewAdapter);
|
|
|
|
|
|
}
|