|
|
@@ -0,0 +1,56 @@
|
|
|
+package kr.co.zumo.app.lifeplus.view.custom.main.banner;
|
|
|
+
|
|
|
+import android.content.Context;
|
|
|
+import android.support.constraint.ConstraintLayout;
|
|
|
+import android.support.v7.widget.LinearLayoutManager;
|
|
|
+import android.support.v7.widget.LinearSnapHelper;
|
|
|
+import android.support.v7.widget.RecyclerView;
|
|
|
+import android.support.v7.widget.SnapHelper;
|
|
|
+import android.util.AttributeSet;
|
|
|
+import android.view.LayoutInflater;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import kr.co.zumo.app.R;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.ImageBean;
|
|
|
+import kr.co.zumo.app.lifeplus.view.fragment.main.category.banner.MainBannerAdapter;
|
|
|
+
|
|
|
+/**
|
|
|
+ * MainBannerView
|
|
|
+ * <pre>
|
|
|
+ * </pre>
|
|
|
+ *
|
|
|
+ * @author 하세미
|
|
|
+ * @version 1.0
|
|
|
+ * @history 하세미 [2018-10-23] [최초 작성]
|
|
|
+ * @since 2018-10-23
|
|
|
+ */
|
|
|
+public class MainBannerView extends ConstraintLayout {
|
|
|
+
|
|
|
+ private MainBannerAdapter mainBannerAdapter;
|
|
|
+ private RecyclerView recyclerView;
|
|
|
+
|
|
|
+ public MainBannerView(Context context) {
|
|
|
+ super(context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public MainBannerView(Context context, AttributeSet attrs) {
|
|
|
+ super(context, attrs);
|
|
|
+ }
|
|
|
+
|
|
|
+ public MainBannerView(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
|
+ super(context, attrs, defStyleAttr);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void init(Context context, List<ImageBean> textImageBeanList, int itemCount) {
|
|
|
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
|
+ inflater.inflate(R.layout.main_banner_view, this);
|
|
|
+ SnapHelper snapHelper = new LinearSnapHelper();
|
|
|
+ snapHelper.attachToRecyclerView(recyclerView );
|
|
|
+ recyclerView = (RecyclerView) findViewById(R.id.recycler_view_main_banner_view);
|
|
|
+ recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
|
|
|
+ mainBannerAdapter = new MainBannerAdapter(context, inflater, textImageBeanList, itemCount);
|
|
|
+ recyclerView.setAdapter(mainBannerAdapter);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|