zhpanvip 4 лет назад
Родитель
Сommit
e05fdd5618

+ 6 - 0
app/src/main/java/com/example/zhpan/banner/App.java

@@ -1,14 +1,19 @@
 package com.example.zhpan.banner;
 
 import android.app.Application;
+import android.os.Debug;
+import android.os.Environment;
 
 import com.tencent.bugly.crashreport.CrashReport;
 import com.zhpan.bannerview.utils.BannerUtils;
 
+import java.io.File;
+
 /**
  * <pre>
  *   Created by zhangpan on 2019-08-14.
  *   Description:
+ *
  * </pre>
  */
 public class App extends Application {
@@ -18,5 +23,6 @@ public class App extends Application {
         super.onCreate();
         BannerUtils.setDebugMode(true);
         CrashReport.initCrashReport(getApplicationContext(), "69b176a2b6", true);
+//        Debug.startMethodTracing(new File(Environment.getExternalStorageDirectory(), "test").getAbsolutePath());
     }
 }

+ 7 - 2
app/src/main/java/com/example/zhpan/banner/activity/MainActivity.kt

@@ -3,6 +3,7 @@ package com.example.zhpan.banner.activity
 import android.content.Context
 import android.content.Intent
 import android.os.Bundle
+import android.os.Debug
 import androidx.appcompat.app.ActionBarDrawerToggle
 import androidx.appcompat.app.AppCompatActivity
 import androidx.viewpager2.widget.ViewPager2
@@ -22,6 +23,11 @@ class MainActivity : AppCompatActivity() {
         setListener()
     }
 
+    override fun onWindowFocusChanged(hasFocus: Boolean) {
+        super.onWindowFocusChanged(hasFocus)
+//        Debug.stopMethodTracing()
+    }
+
     private fun initView() {
         toolbar.apply {
             title = getString(R.string.app_name)
@@ -31,8 +37,7 @@ class MainActivity : AppCompatActivity() {
             val toggle = ActionBarDrawerToggle(
                     this@MainActivity,
                     this,
-                    toolbar
-                    , R.string.navigation_drawer_open,
+                    toolbar, R.string.navigation_drawer_open,
                     R.string.navigation_drawer_close)
             addDrawerListener(toggle)
             toggle.syncState()

+ 3 - 1
app/src/main/java/com/example/zhpan/banner/adapter/DataBindingSampleAdapter.java

@@ -20,7 +20,9 @@ public class DataBindingSampleAdapter extends BaseBannerAdapter<BannerData> {
     @Override
     protected void bindData(BaseViewHolder<BannerData> holder, BannerData data, int position, int pageSize) {
         ItemSlideModelDataBindingBinding dataBinding = DataBindingUtil.bind(holder.itemView);
-        dataBinding.setBannerData(data);
+        if (dataBinding != null) {
+            dataBinding.setBannerData(data);
+        }
     }
 
     @Override

+ 2 - 1
app/src/main/java/com/example/zhpan/banner/fragment/EmptyFragment.java

@@ -1,6 +1,7 @@
 package com.example.zhpan.banner.fragment;
 
 import android.os.Bundle;
+import android.os.Message;
 import android.view.View;
 
 import com.example.zhpan.banner.R;
@@ -13,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
  * @date 2020/12/9
  */
 public class EmptyFragment extends BaseFragment {
-
+    Message msg;
     @Override
     protected int getLayout() {
         return R.layout.fragment_empty;

+ 1 - 1
app/src/main/java/com/example/zhpan/banner/fragment/HomeFragment.java

@@ -99,7 +99,7 @@ public class HomeFragment extends BaseFragment {
         mIndicatorView = view.findViewById(R.id.indicator_view);
         recyclerView = view.findViewById(R.id.recycler_view);
         recyclerView.setLayoutManager(new LinearLayoutManager(getMContext()));
-        recyclerView.addHeadView(getHeaderView(), true);
+        recyclerView.addHeaderView(getHeaderView(), true);
         recyclerView.addItemDecoration(new DividerItemDecoration(getMContext(),
                 DividerItemDecoration.VERTICAL));
         articleAdapter = new ArticleAdapter(getActivity(), new ArrayList<>());

+ 35 - 77
app/src/main/java/com/example/zhpan/banner/recyclerview/ui/CustomAdapter.java

@@ -21,50 +21,33 @@ import com.example.zhpan.banner.recyclerview.module.ViewConfig;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
 
-public final class CustomAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
-    private List<ViewConfig> headConfig;
-    private List<ViewConfig> footConfig;
-    private ArrayList<ViewConfig> EMPTY_LIST = new ArrayList<>();
-    private LayoutInflater inflater;
-    private RecyclerView.Adapter mAdapter;
-    private int headcount = 0;
-    private int footcount = 0;
-    private Context mContext;
+final class CustomAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+    private final List<ViewConfig> headConfig;
+    private final List<ViewConfig> footConfig;
+    private final LayoutInflater inflater;
+    private final RecyclerView.Adapter mAdapter;
+    private int headCount = 0;
+    private int footerCount = 0;
     private ICustomClickListener customClickListener;
-    private ConcurrentHashMap<String, View> mCache = new ConcurrentHashMap<>();
-    private RecyclerView mRecyclerView;
-    private RecyclerView.RecycledViewPool mPool;
-    private RecyclerView.LayoutManager mLayoutManager;
 
     public CustomAdapter(List<ViewConfig> headConfig, List<ViewConfig> footConfig, RecyclerView.Adapter mAdapter, Context mContext, RecyclerView mRecyclerView) {
         this.mAdapter = mAdapter;
         this.inflater = LayoutInflater.from(mContext);
-        this.mContext = mContext;
         if (headConfig == null) {
-            this.headConfig = EMPTY_LIST;
+            this.headConfig = new ArrayList<>();
         } else {
             this.headConfig = headConfig;
         }
         if (footConfig == null) {
-            this.footConfig = EMPTY_LIST;
+            this.footConfig = new ArrayList<>();
         } else {
             this.footConfig = footConfig;
         }
-        init(mRecyclerView);
-    }
-
-    private void init(RecyclerView mRecyclerView) {
-        this.mRecyclerView = mRecyclerView;
-        this.mPool = mRecyclerView.getRecycledViewPool();
-        this.mLayoutManager = mRecyclerView.getLayoutManager();
     }
 
     /**
      * 设置监听事件
-     *
-     * @param customClickListener
      */
     public void setCustomClickListener(ICustomClickListener customClickListener) {
         this.customClickListener = customClickListener;
@@ -75,50 +58,37 @@ public final class CustomAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
     @Override
     public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int index) {
         if (index == ViewConfig.HEADVIEW_TYPE) {
-//            mLayoutManager.set
             FrameLayout contentView = (FrameLayout) inflater.inflate(R.layout.item_head_foot_parent, viewGroup, false);
-//            if (null == contentView.getTag()) {
-            contentView.setTag(contentView.getClass() + "_head_" + headcount);
-            View cView = headConfig.get(headcount).getContentView();
+            contentView.setTag(contentView.getClass() + "_head_" + headCount);
+            View cView = headConfig.get(headCount).getContentView();
             ViewGroup vg = (ViewGroup) cView.getParent();
             if (vg != null) {
                 vg.removeView(cView);
             }
             contentView.addView(cView);
-            mCache.put((String) contentView.getTag(), contentView);
             CustomViewHolder customViewHolder = new CustomViewHolder(contentView);
-            customViewHolder.setIsRecyclable(headConfig.get(headcount).isCache());
-            headcount += 1;
-            if (headcount > headConfig.size() - 1) {
-                headcount = 0;
+            customViewHolder.setIsRecyclable(headConfig.get(headCount).isCache());
+            headCount += 1;
+            if (headCount > headConfig.size() - 1) {
+                headCount = 0;
             }
-//                customViewHolder.setIsRecyclable(false);
-//            Log.log("CustomAdapter", "onCreateViewHolder#HEADVIEW_TYPE");
             return customViewHolder;
-//            }else{
-//                return new CustomViewHolder(mCache.get(contentView.getTag()));
-//            }
         } else if (index == ViewConfig.FOOTVIEW_TYPE) {
             FrameLayout contentView = (FrameLayout) inflater.inflate(R.layout.item_head_foot_parent, viewGroup, false);
-//            if (null == contentView.getTag()) {
-            contentView.setTag(contentView.getClass() + "_foot_" + footcount);
-            View cView = footConfig.get(footcount).getContentView();
+            contentView.setTag(contentView.getClass() + "_foot_" + footerCount);
+            View cView = footConfig.get(footerCount).getContentView();
             ViewGroup vg = (ViewGroup) cView.getParent();
             if (vg != null) {
                 vg.removeView(cView);
             }
             contentView.addView(cView);
-            mCache.put((String) contentView.getTag(), contentView);
             CustomViewHolder customViewHolder = new CustomViewHolder(contentView);
-            customViewHolder.setIsRecyclable(footConfig.get(footcount).isCache());
-            footcount += 1;
-            if (footcount > footConfig.size() - 1) {
-                footcount = 0;
+            customViewHolder.setIsRecyclable(footConfig.get(footerCount).isCache());
+            footerCount += 1;
+            if (footerCount > footConfig.size() - 1) {
+                footerCount = 0;
             }
             return customViewHolder;
-//            }else{
-//                return new CustomViewHolder(mCache.get(contentView.getTag()));
-//            }
         } else {
             return mAdapter.onCreateViewHolder(viewGroup, index);
         }
@@ -136,32 +106,24 @@ public final class CustomAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
                 ViewGroup parentGroup = (ViewGroup) mParent;
                 int childCount = parentGroup.getChildCount();
                 for (int i = 0; i < childCount; i++) {
-                    parentGroup.getChildAt(i).setOnClickListener(new View.OnClickListener() {
-                        @Override
-                        public void onClick(View v) {
-                            if (customClickListener != null) {
-                                if (position < getHeadSize()) {
-                                    customClickListener.onClick(v, position, 0);
-                                } else {
-                                    customClickListener.onClick(v, position - getHeadSize() - mAdapter.getItemCount(), 1);
-                                }
+                    parentGroup.getChildAt(i).setOnClickListener(v -> {
+                        if (customClickListener != null) {
+                            if (position < getHeadSize()) {
+                                customClickListener.onClick(v, position, 0);
+                            } else {
+                                customClickListener.onClick(v, position - getHeadSize() - mAdapter.getItemCount(), 1);
                             }
                         }
                     });
-
                 }
             }
-            mParent.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    if (position < getHeadSize()) {
-                        customClickListener.onClick(v, position, 0);
-                    } else {
-                        customClickListener.onClick(v, position - getHeadSize() - mAdapter.getItemCount(), 1);
-                    }
+            mParent.setOnClickListener(v -> {
+                if (position < getHeadSize()) {
+                    customClickListener.onClick(v, position, 0);
+                } else {
+                    customClickListener.onClick(v, position - getHeadSize() - mAdapter.getItemCount(), 1);
                 }
             });
-//            Log.log("CustomAdapter", "onBindViewHolder" + position + "------->" + customViewHolder);
         } else {
             mAdapter.onBindViewHolder(viewHolder, position - getHeadSize());
         }
@@ -174,7 +136,7 @@ public final class CustomAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
                 : headConfig.size() + footConfig.size();
     }
 
-    public class CustomViewHolder extends RecyclerView.ViewHolder {
+    public static class CustomViewHolder extends RecyclerView.ViewHolder {
         View mParent;
 
         public CustomViewHolder(@NonNull View itemView) {
@@ -192,7 +154,7 @@ public final class CustomAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
         } else if (position >= headSize + mAdapter.getItemCount() && position < adapterCount) {
             return ViewConfig.FOOTVIEW_TYPE;
         }
-        return mAdapter.getItemViewType(position-headSize);
+        return mAdapter.getItemViewType(position - headSize);
     }
 
     public int getHeadSize() {
@@ -213,8 +175,6 @@ public final class CustomAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
 
     /**
      * 适配GridLayoutManager
-     *
-     * @param recyclerView
      */
     @Override
     public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
@@ -242,8 +202,6 @@ public final class CustomAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
 
     /**
      * 适配StaggeredGridLayoutManager
-     *
-     * @param holder
      */
     @Override
     public void onViewAttachedToWindow(@NonNull RecyclerView.ViewHolder holder) {
@@ -251,7 +209,7 @@ public final class CustomAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
         int position = holder.getLayoutPosition();
         if (getHeadSize() > position || position >= getHeadSize() + mAdapter.getItemCount()) {
             ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
-            if (lp != null && lp instanceof StaggeredGridLayoutManager.LayoutParams) {
+            if (lp instanceof StaggeredGridLayoutManager.LayoutParams) {
                 StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
                 p.setFullSpan(true);
             }

+ 36 - 49
app/src/main/java/com/example/zhpan/banner/recyclerview/ui/CustomRecyclerView.java

@@ -1,14 +1,15 @@
 package com.example.zhpan.banner.recyclerview.ui;
 
 import android.content.Context;
+
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.recyclerview.widget.RecyclerView;
+
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.ViewGroup;
 
-
 import com.example.zhpan.banner.R;
 import com.example.zhpan.banner.recyclerview.listener.ICustomClickListener;
 import com.example.zhpan.banner.recyclerview.module.ViewConfig;
@@ -16,15 +17,19 @@ import com.example.zhpan.banner.recyclerview.module.ViewConfig;
 import java.util.ArrayList;
 
 /**
- * 2018.11.4
  * 自定义RecyclerView,主要用于添加不同类型的Head和Foot
  */
 public class CustomRecyclerView extends RecyclerView {
-    private ArrayList<ViewConfig> mHeadCouListInfo; //保存头部的view
-    private ArrayList<ViewConfig> mFootCouListInfo; //保存尾部的view
-    private int headCount;  //记录head的个数
-    private int footCount;  //记录foot的个数
-    private Adapter mAdapter; //adapter,可能是customadapter, 可能是自定义adapter
+    //保存头部的view
+    private ArrayList<ViewConfig> mHeaderCouListInfo;
+    //保存尾部的view
+    private ArrayList<ViewConfig> mFooterCouListInfo;
+    //记录head的个数
+    private int headerCount;
+    //记录foot的个数
+    private int footerCount;
+    //adapter,可能是CustomAdapter, 可能是自定义adapter
+    private Adapter mAdapter;
     private Context mContext;
     private ICustomClickListener customClickListener;
 
@@ -42,17 +47,17 @@ public class CustomRecyclerView extends RecyclerView {
     }
 
     private void init(Context context) {
-        mHeadCouListInfo = new ArrayList<>();
-        mFootCouListInfo = new ArrayList<>();
+        mHeaderCouListInfo = new ArrayList<>();
+        mFooterCouListInfo = new ArrayList<>();
         mContext = context;
     }
 
     public ArrayList<ViewConfig> getmHeadCouListInfo() {
-        return mHeadCouListInfo;
+        return mHeaderCouListInfo;
     }
 
     public ArrayList<ViewConfig> getmFootCouListInfo() {
-        return mFootCouListInfo;
+        return mFooterCouListInfo;
     }
 
     /**
@@ -61,13 +66,14 @@ public class CustomRecyclerView extends RecyclerView {
      * @param view
      */
 
-    public void addHeadView(View view) {
-        addHeadView(view, false);
+    public void addHeaderView(View view) {
+        addHeaderView(view, false);
     }
 
-    public void addHeadView(View view, boolean isCache) {
-        headCount++;
-        setHeadViewConfig(view, ViewConfig.HEADVIEW, headCount, 100000, isCache);
+    public void addHeaderView(View view, boolean isCache) {
+        setHeadViewConfig(view, ViewConfig.HEADVIEW, headerCount, 100000, isCache);
+        headerCount = mHeaderCouListInfo.size();
+
         if (mAdapter != null) {
             if (!(mAdapter instanceof CustomAdapter)) {
                 wrapHeadAdapter();
@@ -76,8 +82,8 @@ public class CustomRecyclerView extends RecyclerView {
     }
 
     public void addFootView(View view) {
-        footCount++;
-        setFootViewConfig(view, ViewConfig.FOOTVIEW, footCount, 100000);
+        setFootViewConfig(view, ViewConfig.FOOTVIEW, footerCount, 100000);
+        footerCount = mFooterCouListInfo.size();
         if (mAdapter != null) {
             if (!(mAdapter instanceof CustomAdapter)) {
                 wrapHeadAdapter();
@@ -89,41 +95,27 @@ public class CustomRecyclerView extends RecyclerView {
      * 将adapter构建为customadapter用来填充头部尾部布局
      */
     private void wrapHeadAdapter() {
-        mAdapter = new CustomAdapter(mHeadCouListInfo, mFootCouListInfo, mAdapter, mContext, this);
+        mAdapter = new CustomAdapter(mHeaderCouListInfo, mFooterCouListInfo, mAdapter, mContext, this);
     }
 
     @Override
     public void setAdapter(@Nullable Adapter adapter) {
-        if (mHeadCouListInfo.size() > 0 || mFootCouListInfo.size() > 0) {
-            mAdapter = new CustomAdapter(mHeadCouListInfo, mFootCouListInfo, adapter, mContext, this);
+        if (mHeaderCouListInfo.size() > 0 || mFooterCouListInfo.size() > 0) {
+            mAdapter = new CustomAdapter(mHeaderCouListInfo, mFooterCouListInfo, adapter, mContext, this);
         } else {
             mAdapter = adapter;
         }
         /**
          * 设置头尾的两个缓存为size  变相解决复用问题
          */
-        getRecycledViewPool().setMaxRecycledViews(ViewConfig.FOOTVIEW_TYPE, mFootCouListInfo.size() + 1);
-        getRecycledViewPool().setMaxRecycledViews(ViewConfig.HEADVIEW_TYPE, mHeadCouListInfo.size() + 1);
-        //现在交给scroolwrap处理
-//        /**
-//         * 计算高度
-//         */
-//        if (mRefreshView != null) {
-//            ViewGroup.MarginLayoutParams layoutParams = (MarginLayoutParams) getLayoutParams();
-//            layoutParams.topMargin = getRefreshHeight();
-//            setLayoutParams(layoutParams);
-//        }
+        getRecycledViewPool().setMaxRecycledViews(ViewConfig.FOOTVIEW_TYPE, mFooterCouListInfo.size() + 1);
+        getRecycledViewPool().setMaxRecycledViews(ViewConfig.HEADVIEW_TYPE, mHeaderCouListInfo.size() + 1);
+
         super.setAdapter(mAdapter);
     }
 
     /**
      * 配置头部view的信息
-     *
-     * @param view
-     * @param type
-     * @param count
-     * @param headCount
-     * @param isCache
      */
     private void setHeadViewConfig(View view, String type, int count, int headCount, boolean isCache) {
         ViewConfig viewConfig = new ViewConfig();
@@ -136,16 +128,11 @@ public class CustomRecyclerView extends RecyclerView {
             mHeadParent.removeView(view);
         }
         viewConfig.setContentView(view);
-        mHeadCouListInfo.add(viewConfig);
+        mHeaderCouListInfo.add(viewConfig);
     }
 
     /**
      * 配置尾部view的信息
-     *
-     * @param view
-     * @param type
-     * @param count
-     * @param headCount
      */
     private void setFootViewConfig(View view, String type, int count, int headCount) {
         ViewConfig viewConfig = new ViewConfig();
@@ -157,7 +144,7 @@ public class CustomRecyclerView extends RecyclerView {
             mFootParent.removeView(view);
         }
         viewConfig.setContentView(view);
-        mFootCouListInfo.add(viewConfig);
+        mFooterCouListInfo.add(viewConfig);
     }
 
     public CustomAdapter getHeadAndFootAdapter() {
@@ -174,12 +161,12 @@ public class CustomRecyclerView extends RecyclerView {
      * 移除最后一个View, 就是加载更多的哪一个
      */
     public void removeLastFootView(int foorIndex) {
-        this.mFootCouListInfo.remove(foorIndex);
-        footCount--;
+        this.mFooterCouListInfo.remove(foorIndex);
+        footerCount = mFooterCouListInfo.size();
     }
 
     public void removeFirstHeadView() {
-        this.mHeadCouListInfo.remove(0);
-        headCount--;
+        this.mHeaderCouListInfo.remove(0);
+        headerCount = mHeaderCouListInfo.size();
     }
 }

+ 0 - 771
app/src/main/java/com/example/zhpan/banner/recyclerview/ui/ScrollWrapRecycler.java

@@ -1,771 +0,0 @@
-package com.example.zhpan.banner.recyclerview.ui;
-
-import android.animation.PropertyValuesHolder;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import androidx.annotation.Nullable;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.example.zhpan.banner.R;
-import com.example.zhpan.banner.recyclerview.listener.ICustomClickListener;
-import com.example.zhpan.banner.recyclerview.listener.ICustomScrollListener;
-import com.example.zhpan.banner.recyclerview.listener.IScrollListener;
-
-
-public class ScrollWrapRecycler extends LinearLayout {
-    /**
-     * 没有滑动
-     */
-    public static final int SCROLL_RL_NOTSLIPPING = 0;
-    /**
-     * 正在滑动 但是还没有到可以刷新的指定距离
-     */
-    public static final int SCROLL_RL_NOTMET = 1;
-    /**
-     * 松开后刷新
-     */
-    public static final int SCROLL_RL_REFRESH = 2;
-    /**
-     * 正在刷新
-     */
-    public static final int SCROLL_RL_LOADING = 3;
-    /**
-     * 刷新成功
-     */
-    public static final int SCROLL_RL_SUCCESS = 4;
-    /**
-     * 刷新失败
-     */
-    public static final int SCROLL_RL_FAILD = 5;
-    /**
-     * 刷新状态
-     */
-    private int refreshScrollStatus;
-    private int loadMoreScrollStatus;
-
-    private float start_X, start_Y = 0;
-
-    private boolean isUseSelfRefresh = false;
-    private boolean isUseSelfLoadMore = false;
-    //是否正在刷新或者加载
-    private boolean isRefreshing = false;
-    private boolean isLoadMored = false;
-    //记录当前的刷新滑动状态  如果isRefreshStatus==true,那就是刷新, 如果isLoadMoreStatus==true,那就是加载
-    private boolean isRefreshStatus = false;
-    private boolean isLoadMoreStatus = false;
-    //刷新加载的标志  为true的时候才添加  默认都添加
-    private boolean isRefresh = true;
-    private boolean isLoadMore = true;
-
-    private View mRefreshView;
-    private View mLoadMoreView;
-    private TextView mRefreshHint;
-    private TextView mLoadMoreHint;
-    private CustomRecyclerView mRecyclerView;
-    private ICustomScrollListener mCustomScrollListener;
-    private IScrollListener mIScrollListener;
-
-    private ValueAnimator refreshAnimator;
-    private ValueAnimator loadmoreAnimator;
-
-    private Context mContext;
-
-
-    public ScrollWrapRecycler(Context context) {
-        this(context, null);
-    }
-
-    public ScrollWrapRecycler(Context context, @Nullable AttributeSet attrs) {
-        this(context, attrs, 0);
-    }
-
-    public ScrollWrapRecycler(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-        init(context);
-    }
-
-    /**
-     * 设置是否允许刷新
-     *
-     * @param refresh
-     */
-    public void setRefresh(boolean refresh) {
-        this.isRefresh = refresh;
-    }
-
-    /**
-     * 设置是否允许加载
-     *
-     * @param loadMore
-     */
-    public void setLoadMore(boolean loadMore) {
-        this.isLoadMore = loadMore;
-    }
-
-    /**
-     * 同时设置
-     *
-     * @param isRefALoad
-     */
-    public void setRefreshAndLoadMore(boolean isRefALoad) {
-        this.isRefresh = isRefALoad;
-        this.isLoadMore = isRefALoad;
-    }
-
-    /**
-     * 初始化一些信息,比如动画之类的
-     *
-     * @param context
-     */
-    private void init(Context context) {
-        setOrientation(VERTICAL);
-        this.mRecyclerView = new CustomRecyclerView(context);
-        this.mRecyclerView.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
-        this.mContext = context.getApplicationContext();
-        refreshAnimator = new ValueAnimator();
-        loadmoreAnimator = new ValueAnimator();
-        /**
-         * 刷新成功/失败后回调
-         */
-        refreshAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
-            @Override
-            public void onAnimationUpdate(ValueAnimator animation) {
-                float animatedValue = (float) animation.getAnimatedValue();
-                if (animatedValue < -mRefreshView.getMeasuredHeight()) {
-                    animatedValue = mRefreshView.getMeasuredHeight();
-                }
-                getMarginParams(mRefreshView).topMargin = (int) animatedValue;
-                mRefreshView.setLayoutParams(getMarginParams(mRefreshView));
-            }
-        });
-        /**
-         * 加载成功/失败后加载
-         */
-        loadmoreAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
-            @Override
-            public void onAnimationUpdate(ValueAnimator animation) {
-                float animatedValue = (float) animation.getAnimatedValue();
-                if (animatedValue < -mLoadMoreView.getMeasuredHeight()) {
-                    animatedValue = mLoadMoreView.getMeasuredHeight();
-                }
-                setPadding(0, 0, 0, (int) animatedValue);
-            }
-        });
-    }
-
-    /**
-     * 设置用户自定义接口
-     *
-     * @param mCustomScrollListener
-     */
-    public void setmCustomScrollListener(ICustomScrollListener mCustomScrollListener) {
-        if (mIScrollListener != null) {
-            mIScrollListener = null;
-        }
-        this.mCustomScrollListener = mCustomScrollListener;
-    }
-
-    /**
-     * 设置默认实现接口,如果采用了自定义的View做刷新加载,则不允许设置该接口,使用一下接口{@see}替代
-     *
-     * @param mIScrollListener
-     * @see #setmCustomScrollListener(ICustomScrollListener)
-     */
-    public void setmIScrollListener(IScrollListener mIScrollListener) {
-        if (isUseSelfRefresh || isUseSelfLoadMore) {
-            return;
-        }
-        if (mCustomScrollListener != null) {
-            mCustomScrollListener = null;
-        }
-        this.mIScrollListener = mIScrollListener;
-    }
-
-    /**
-     * 添加HeadView的方法
-     *
-     * @param view
-     */
-    public void addHeadView(View view) {
-        this.mRecyclerView.addHeadView(view);
-    }
-
-    /**
-     * 添加HeadView的方法 并添加是否添加缓存的标识
-     *
-     * @param view
-     * @param isCache
-     */
-    public void addHeadView(View view, boolean isCache) {
-        this.mRecyclerView.addHeadView(view, isCache);
-    }
-
-    /**
-     * 添加FootView的方法 并添加是否添加缓存的标识
-     *
-     * @param view
-     */
-    public void addFootView(View view) {
-        this.mRecyclerView.addFootView(view);
-    }
-
-    /**
-     * 设置Adapter
-     *
-     * @param adapter
-     */
-    public void setAdapter(RecyclerView.Adapter adapter) {
-        View refreshView;
-        View loadmoreView;
-        //初始化的时候根据是否需要刷新加载给一个默认
-        if (mRefreshView == null && isRefresh) {
-            refreshView = LayoutInflater.from(mContext).inflate(R.layout.item_defalut_refresh_view, null);
-            mRefreshHint = (TextView) refreshView.findViewById(R.id.m_refresh_hint);
-            addRefreshView(refreshView);
-            addView(mRefreshView);
-            isUseSelfRefresh = false;
-        } else if(mRefreshView != null){
-            addView(mRefreshView);
-        }
-        ViewGroup parent = (ViewGroup) mRecyclerView.getParent();
-        if (parent==null) {
-            addView(mRecyclerView, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1));
-        }
-        if (mLoadMoreView == null && isLoadMore) {
-            loadmoreView = LayoutInflater.from(mContext).inflate(R.layout.item_defalut_loadmore_view, null);
-            mLoadMoreHint = (TextView) loadmoreView.findViewById(R.id.m_loadmore_hint);
-            addLoadMoreView(loadmoreView);
-            addView(mLoadMoreView);
-            isUseSelfLoadMore = false;
-        } else if(mLoadMoreView != null){
-            addView(mLoadMoreView);
-        }
-        this.mRecyclerView.setAdapter(adapter);
-        viewLayout();
-    }
-
-    /**
-     * 改变View的位置
-     */
-    private void viewLayout() {
-        if (mRefreshView != null) {
-            mRefreshView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
-            getMarginParams(mRefreshView).topMargin = -mRefreshView.getMeasuredHeight();
-        }
-        if (mLoadMoreView != null) {
-            mLoadMoreView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
-            setPadding(0, 0, 0, -mLoadMoreView.getMeasuredHeight());
-        }
-    }
-
-    /**
-     * @return
-     */
-    public CustomAdapter getAdapter() {
-        return this.mRecyclerView.getHeadAndFootAdapter();
-    }
-
-    /**
-     * 返回指定的Head
-     *
-     * @param index
-     * @return
-     */
-    public View getIndexHeadView(int index) {
-        if (mRefreshView != null)
-            return getAdapter().getIndexHeadView(index + 1);
-        return getAdapter().getIndexHeadView(index);
-    }
-
-    /**
-     * 返回指定的Foot
-     *
-     * @param index
-     * @return
-     */
-    public View getIndexFootView(int index) {
-        if (mLoadMoreView != null && index >= getAdapter().getFootSize())
-            return getAdapter().getIndexFootView(index - 1);
-        return getAdapter().getIndexFootView(index);
-    }
-
-    /**
-     * 设置点击事件
-     *
-     * @param customClickListener
-     */
-    public void setCustomClickListener(ICustomClickListener customClickListener) {
-        this.mRecyclerView.setCustomClickListener(customClickListener);
-    }
-
-    /**
-     * 设置LayoutManager
-     *
-     * @param manager
-     */
-    public void setLayoutManager(RecyclerView.LayoutManager manager) {
-        this.mRecyclerView.setLayoutManager(manager);
-    }
-
-    /**
-     * 设置LayoutParmas
-     *
-     * @param pramas
-     */
-    public void setRLayoutPramas(ViewGroup.LayoutParams pramas) {
-        this.mRecyclerView.setLayoutParams(pramas);
-    }
-
-    /**
-     * 添加刷新的View
-     *
-     * @param mRefreshView
-     */
-    public void addRefreshView(View mRefreshView) {
-        this.isUseSelfRefresh = true;
-        this.mIScrollListener = null;
-        this.mRefreshView = mRefreshView;
-    }
-
-    /**
-     * 添加加载的View
-     *
-     * @param mLoadMoreView
-     */
-    public void addLoadMoreView(View mLoadMoreView) {
-        this.isUseSelfLoadMore = true;
-        this.mIScrollListener = null;
-        this.mLoadMoreView = mLoadMoreView;
-    }
-
-    /**
-     * 用来回调是否刷新成功
-     *
-     * @param status
-     */
-    public void setRefreshStatus(int status) {
-        this.refreshScrollStatus = status;
-        if (isUseSelfRefresh) {
-            mCustomScrollListener.scrollRefreshState(status);
-        } else {
-            scrollRefreshState(status);
-        }
-        postDelayed(new Runnable() {
-            @Override
-            public void run() {
-                setRefreshScrollAnimation(-mRefreshView.getMeasuredHeight());
-                isRefreshing = false;
-            }
-        }, 500);
-    }
-
-    /**
-     * 用来回调是否刷新成功
-     *
-     * @param status
-     */
-    public void setLoadMoreStatus(int status) {
-        this.loadMoreScrollStatus = status;
-        if (isUseSelfLoadMore) {
-            mCustomScrollListener.scrollLoadMoreState(status);
-        } else {
-            scrollLoadMoreState(status);
-        }
-        notifyDataSetChanged();
-        setLoadMoreScrollAnimation(-mLoadMoreView.getMeasuredHeight());
-        isLoadMored = false;
-    }
-
-    public void scrollToPosition(int position) {
-        mRecyclerView.scrollToPosition(position);
-    }
-
-    /**
-     * 重写手势监听事件
-     *
-     * @param ev
-     * @return
-     */
-    @Override
-    public boolean dispatchTouchEvent(MotionEvent ev) {
-        if (!isRefreshing && !isLoadMored && this.isRefresh && this.isLoadMore) {
-            switch (ev.getAction()) {
-                case MotionEvent.ACTION_DOWN:
-                    start_X = (int) ev.getX();
-                    start_Y = (int) ev.getY();
-                    break;
-                case MotionEvent.ACTION_MOVE:
-                    float move_X = ev.getX();
-                    float move_Y = ev.getY();
-                    /*
-                     * 如果没有刷新的View  或者刷新的View <= view的高度负值  证明刷新的view已经还原  这时候执行recycler的滑动
-                     */
-//                    View childAt = layoutManager.getChildAt(1);
-                    /*
-                     * 每次进来时先全部置为false  且isRefreshStatus与isLoadMoreStatus为互斥状态  isLoadMoreStatus为true,则且isRefreshStatus为false,反之一样
-                     */
-                    LinearLayoutManager layoutManager = (LinearLayoutManager) mRecyclerView.getLayoutManager();
-                    /*
-                     * 下拉刷新时候的判断
-                     */
-                    if ((mRefreshView != null && layoutManager.findFirstCompletelyVisibleItemPosition() == 0 && move_Y - start_Y > 0)
-                            || (getMarginParams(mRefreshView).topMargin > -mRefreshView.getMeasuredHeight()/* && move_Y - start_Y < 0*/)) {
-                        float phaseDiff = move_Y - start_Y;
-                        updateHead((float) (phaseDiff / 1.5));
-                        start_Y = move_Y;
-                        return true;
-                        /*
-                         * 上拉加载时候的判断
-                         */
-                    } else if ((mLoadMoreView != null && layoutManager.findLastCompletelyVisibleItemPosition() == getAdapter().getItemCount() - 1 && move_Y - start_Y < 0)
-                            || getBottomPadding(this) > -mLoadMoreView.getMeasuredHeight() /*&& move_Y - start_Y > 0*/) {
-                        float phaseDiff = move_Y - start_Y;
-                        updateFoot((float) (phaseDiff / 1.5));
-                        start_Y = move_Y;
-                        return true;
-                        /*
-                         * 正常滑动 直接分发该事件 不拦截
-                         */
-                    } else {
-                        isRefreshStatus = false;
-                        isLoadMoreStatus = false;
-                        start_Y = move_Y;
-                        return super.dispatchTouchEvent(ev);
-                    }
-                case MotionEvent.ACTION_CANCEL:
-                case MotionEvent.ACTION_UP:
-                    /*
-                     * 下拉刷新时候走这里
-                     */
-                    if (isRefreshStatus) {
-                        if (mRefreshView != null) {
-                            if (refreshScrollStatus == SCROLL_RL_REFRESH) {
-                                isRefreshing = true;
-                                refresh();
-                                if (mCustomScrollListener != null && isUseSelfRefresh) {
-                                    mCustomScrollListener.scrollRefreshState(SCROLL_RL_LOADING);
-                                } else {
-                                    scrollRefreshState(SCROLL_RL_LOADING);
-                                }
-                                setRefreshScrollAnimation((int) (mRefreshView.getMeasuredHeight() * 1.2));
-                            } else {
-                                setRefreshScrollAnimation(-mRefreshView.getMeasuredHeight());
-                            }
-                        }
-                        /*
-                         * 上拉加载走这里
-                         */
-                    } else if (isLoadMoreStatus) {
-                        if (mLoadMoreView != null) {
-                            if (loadMoreScrollStatus == SCROLL_RL_REFRESH) {
-                                isLoadMored = true;
-                                loadMore();
-                                if (mCustomScrollListener != null && isUseSelfLoadMore) {
-                                    mCustomScrollListener.scrollLoadMoreState(SCROLL_RL_LOADING);
-                                } else {
-                                    scrollLoadMoreState(SCROLL_RL_LOADING);
-                                }
-                                setLoadMoreScrollAnimation(0);
-                            } else {
-                                setLoadMoreScrollAnimation(-mLoadMoreView.getMeasuredHeight());
-                            }
-                        }
-                    }
-                    /**
-                     * 将刷新加载的状态重置
-                     */
-                    isLoadMoreStatus = false;
-                    isRefreshStatus = false;
-                    break;
-            }
-        } else if(!isRefresh || !isLoadMore){
-            return super.dispatchTouchEvent(ev);
-        }
-        return super.dispatchTouchEvent(ev);
-    }
-
-    /**
-     * 会回调刷新接口,需要设置{@link ICustomScrollListener}或{@link IScrollListener}
-     */
-    private void refresh() {
-        if (mCustomScrollListener != null) {
-            mCustomScrollListener.refresh();
-        } else if (mIScrollListener != null) {
-            mIScrollListener.refresh();
-        } else {
-            Log.w(getClass().getName(), "请设置回调监听器");
-        }
-    }
-
-    /**
-     * 会回调加载接口,需要设置{@link ICustomScrollListener}或{@link IScrollListener}
-     */
-    private void loadMore() {
-        if (mCustomScrollListener != null) {
-            mCustomScrollListener.loadMore();
-        } else if (mIScrollListener != null) {
-            mIScrollListener.loadMore();
-        } else {
-            Log.w(getClass().getName(), "请设置回调监听器");
-        }
-    }
-
-    /**
-     * 更新加载的View
-     *
-     * @param phaseDiff
-     */
-    private void updateFoot(float phaseDiff) {
-        isLoadMoreStatus = true;
-        isRefreshStatus = false;
-        int bottomPadding = getBottomPadding(this);
-        int scrollMax = bottomPadding;
-        if (phaseDiff < 0) {
-            if (scrollMax > mLoadMoreView.getMeasuredHeight() * 0.8) {
-                return;
-            }
-            scrollMax = scrollMax > mLoadMoreView.getMeasuredHeight() * 0.8 ? (int) (mLoadMoreView.getMeasuredHeight() * 0.8) : (int) (scrollMax - phaseDiff);
-        } else {
-            scrollMax = scrollMax < -mLoadMoreView.getMeasuredHeight() ? -mLoadMoreView.getMeasuredHeight() : (int) (scrollMax - phaseDiff);
-        }
-        mRecyclerView.scrollToPosition(getAdapter().getItemCount() - 1);
-        setPadding(0, 0, 0, scrollMax);
-        requestLayout();
-        if (isUseSelfLoadMore) {
-            if (mCustomScrollListener != null) {
-                if (scrollMax < mLoadMoreView.getMeasuredHeight() * 0.5) {
-                    this.loadMoreScrollStatus = SCROLL_RL_NOTMET;
-                    mCustomScrollListener.scrollLoadMoreState(SCROLL_RL_NOTMET);
-                } else if (scrollMax > mLoadMoreView.getMeasuredHeight() * 0.5) {
-                    this.loadMoreScrollStatus = SCROLL_RL_REFRESH;
-                    mCustomScrollListener.scrollLoadMoreState(SCROLL_RL_REFRESH);
-                }
-//                mCustomScrollListener.scrollRefreshState(scrollMax > mRefreshView.getMeasuredHeight());
-            }
-        } else {
-            if (scrollMax < mLoadMoreView.getMeasuredHeight() * 0.5) {
-                this.scrollLoadMoreState(SCROLL_RL_NOTMET);
-            } else if (scrollMax > mLoadMoreView.getMeasuredHeight() *0.5) {
-                this.scrollLoadMoreState(SCROLL_RL_REFRESH);
-            }
-        }
-    }
-
-    /**
-     * 刷新接口  调用后给动画  并且刷新
-     */
-    public void setRefresh() {
-        isRefreshing = true;
-        if (mCustomScrollListener != null && isUseSelfRefresh) {
-            mCustomScrollListener.scrollRefreshState(SCROLL_RL_LOADING);
-        } else {
-            scrollRefreshState(SCROLL_RL_LOADING);
-        }
-        postDelayed(new Runnable() {
-            @Override
-            public void run() {
-                refresh();
-            }
-        }, 300);
-        setRefreshScrollAnimation((int) (mRefreshView.getMeasuredHeight() * 1.2));
-    }
-
-    /**
-     * 更新头部的刷新
-     *
-     * @param phaseDiff
-     */
-    private void updateHead(float phaseDiff) {
-        isRefreshStatus = true;
-        isLoadMoreStatus = false;
-        MarginLayoutParams marginParams = getMarginParams(mRefreshView);
-        int scrollMax = marginParams.topMargin + (int) (phaseDiff);
-        if (phaseDiff > 0) {
-            scrollMax = scrollMax > mRefreshView.getMeasuredHeight() * 2 ? mRefreshView.getMeasuredHeight() * 2 : scrollMax;
-        } else {
-            scrollMax = scrollMax < -mRefreshView.getMeasuredHeight() ? -mRefreshView.getMeasuredHeight() : scrollMax;
-        }
-        marginParams.topMargin = scrollMax;
-        requestLayout();
-//        setRLayoutPramas(marginParams);
-        if (isUseSelfRefresh) {
-            if (mCustomScrollListener != null) {
-                if (scrollMax < mRefreshView.getMeasuredHeight() * 1.2) {
-                    this.refreshScrollStatus = SCROLL_RL_NOTMET;
-                    mCustomScrollListener.scrollRefreshState(SCROLL_RL_NOTMET);
-                } else if (scrollMax > mRefreshView.getMeasuredHeight() * 1.2) {
-                    this.refreshScrollStatus = SCROLL_RL_REFRESH;
-                    mCustomScrollListener.scrollRefreshState(SCROLL_RL_REFRESH);
-                }
-//                mCustomScrollListener.scrollRefreshState(scrollMax > mRefreshView.getMeasuredHeight());
-            }
-        } else {
-            if (scrollMax < mRefreshView.getMeasuredHeight() * 1.2) {
-                this.scrollRefreshState(SCROLL_RL_NOTMET);
-            } else if (scrollMax > mRefreshView.getMeasuredHeight() * 1.2) {
-                this.scrollRefreshState(SCROLL_RL_REFRESH);
-            }
-        }
-    }
-
-    /**
-     * 更改头部状态
-     *
-     * @param scrollReleash
-     */
-    public void scrollRefreshState(int scrollReleash) {
-        switch (scrollReleash) {
-            case SCROLL_RL_NOTSLIPPING:
-                mRefreshHint.setText("等待刷新");
-                break;
-            case SCROLL_RL_NOTMET:
-                mRefreshHint.setText("下拉刷新");
-                break;
-            case SCROLL_RL_REFRESH:
-                mRefreshHint.setText("松开刷新");
-                break;
-            case SCROLL_RL_LOADING:
-                mRefreshHint.setText("正在刷新...");
-                break;
-            case SCROLL_RL_SUCCESS:
-                mRefreshHint.setText("刷新成功");
-                break;
-            case SCROLL_RL_FAILD:
-                mRefreshHint.setText("刷新失败");
-                break;
-        }
-        this.refreshScrollStatus = scrollReleash;
-    }
-
-    /**
-     * 更改底部加载状态
-     *
-     * @param scrollReleash
-     */
-    public void scrollLoadMoreState(int scrollReleash) {
-        switch (scrollReleash) {
-            case SCROLL_RL_NOTSLIPPING:
-                mLoadMoreHint.setText("加载更多");
-                break;
-            case SCROLL_RL_NOTMET:
-                mLoadMoreHint.setText("上拉加载");
-                break;
-            case SCROLL_RL_REFRESH:
-                mLoadMoreHint.setText("松开立即加载");
-                break;
-            case SCROLL_RL_LOADING:
-                mLoadMoreHint.setText("正在加载...");
-                break;
-            case SCROLL_RL_SUCCESS:
-                mLoadMoreHint.setText("加载成功");
-                break;
-            case SCROLL_RL_FAILD:
-                mLoadMoreHint.setText("加载失败");
-                break;
-        }
-        this.loadMoreScrollStatus = scrollReleash;
-    }
-
-    /**
-     * 实际的内容size
-     *
-     * @return
-     */
-    public int getFullSize() {
-        return getAdapter().getItemCount() - (mRefreshView != null ? 1 : 0) - (mLoadMoreView != null ? 1 : 0);
-    }
-
-    /**
-     * 获取View的Params  用来更改Margin
-     *
-     * @param view
-     * @return
-     */
-    private MarginLayoutParams getMarginParams(View view) {
-        return (MarginLayoutParams) view.getLayoutParams();
-    }
-
-    /**
-     * 获取View的bottomPadding
-     *
-     * @param view
-     * @return
-     */
-    private int getBottomPadding(View view) {
-        return view.getPaddingBottom();
-    }
-
-    /**
-     * 设置刷新后隐藏View的动画
-     *
-     * @param height
-     */
-    public void setRefreshScrollAnimation(int height) {
-        PropertyValuesHolder valuesHolder = PropertyValuesHolder.ofFloat("", getMarginParams(mRefreshView).topMargin, height);
-        refreshAnimator.setValues(valuesHolder);
-        refreshAnimator.setDuration(300);
-        refreshAnimator.start();
-    }
-
-    /**
-     * 设置加载后隐藏View的动画
-     *
-     * @param height
-     */
-    public void setLoadMoreScrollAnimation(int height) {
-        PropertyValuesHolder valuesHolder = PropertyValuesHolder.ofFloat("", getBottomPadding(this), height);
-        loadmoreAnimator.setValues(valuesHolder);
-        loadmoreAnimator.setDuration(0);
-        loadmoreAnimator.start();
-    }
-
-    /**
-     * ====================================================================================
-     * 以下提供的方法均调用的是CustomAdapter的方法
-     * ====================================================================================
-     */
-    public void notifyDataSetChanged() {
-        this.getAdapter().notifyDataSetChanged();
-    }
-
-    public void notifyItemChanged(final int position) {
-        this.getAdapter().notifyItemChanged(position);
-    }
-
-    public void notifyItemChanged(int position, Object payload) {
-        this.getAdapter().notifyItemChanged(position, payload);
-    }
-
-    public void notifyItemInserted(int position) {
-        this.getAdapter().notifyItemInserted(position);
-    }
-
-    public void notifyItemMoved(int fromPosition, int toPosition) {
-        this.getAdapter().notifyItemMoved(fromPosition, toPosition);
-    }
-
-    public void notifyItemRangeChanged(int positionStart, int itemCount) {
-        this.getAdapter().notifyItemRangeChanged(positionStart, itemCount);
-    }
-
-    public void notifyItemRangeChanged(int positionStart, int itemCount, Object payload) {
-        this.getAdapter().notifyItemRangeChanged(positionStart, itemCount, payload);
-    }
-
-    public void notifyItemRangeInserted(int positionStart, int itemCount) {
-        this.getAdapter().notifyItemRangeInserted(positionStart, itemCount);
-    }
-
-    public void notifyItemRemoved(int positionStart) {
-        this.getAdapter().notifyItemRemoved(positionStart);
-    }
-}

+ 1 - 3
bannerview/src/main/java/com/zhpan/bannerview/manager/BannerOptions.java

@@ -278,9 +278,7 @@ public class BannerOptions {
 
     public void setRtl(boolean rtl) {
         this.rtl = rtl;
-        if (rtl) {
-            mIndicatorOptions.setOrientation(IndicatorOrientation.INDICATOR_RTL);
-        }
+        mIndicatorOptions.setOrientation(rtl ? IndicatorOrientation.INDICATOR_RTL : IndicatorOrientation.INDICATOR_HORIZONTAL);
     }
 
     public static class IndicatorMargin {

+ 1 - 1
build.gradle

@@ -23,7 +23,7 @@ allprojects {
     repositories {
         jcenter()
         google()
-        maven { url "https://jitpack.io" }
+        maven { url "https://www.jitpack.io" }
     }
 }