Skip to content

Commit

Permalink
Support mRecyclerView.setNestedScrollingEnabled(mNestedEnabled);
Browse files Browse the repository at this point in the history
  • Loading branch information
uncn committed Jun 10, 2019
1 parent fabcc8d commit 85ee638
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Library/src/main/java/com/sunzn/banner/library/Banner.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public interface OnItemBindListener<T> {

private Handler mHandler = new Handler();

private boolean isPlaying, mIsIndicatorShow;
private boolean isPlaying, mIsIndicatorShow, mNestedEnabled;

IntentFilter mFilter = new IntentFilter();

Expand Down Expand Up @@ -126,6 +126,7 @@ private void init(Context context, AttributeSet attrs) {
Drawable MissDrawable = attributes.getDrawable(R.styleable.Banner_indicator_miss);
mIndicatorGravity = attributes.getInt(R.styleable.Banner_indicator_gravity, 1);
mIsIndicatorShow = attributes.getBoolean(R.styleable.Banner_indicator_show, true);
mNestedEnabled = attributes.getBoolean(R.styleable.Banner_nested_enabled, true);
float mInch = attributes.getFloat(R.styleable.Banner_banner_inch, 100f);
mInterval = attributes.getInt(R.styleable.Banner_banner_interval, 3000);
mIndicatorSize = attributes.getDimensionPixelSize(R.styleable.Banner_indicator_size, 0);
Expand Down Expand Up @@ -177,6 +178,7 @@ private void init(Context context, AttributeSet attrs) {
mBannerAdapter = new BannerAdapter();
mRecyclerView.setAdapter(mBannerAdapter);
mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
mRecyclerView.setNestedScrollingEnabled(mNestedEnabled);
mRecyclerView.setLayoutManager(new BannerLayoutManager(context, LinearLayoutManager.HORIZONTAL, false, mInch));
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
Expand Down
1 change: 1 addition & 0 deletions Library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<attr name="banner_inch" format="float" />
<attr name="banner_interval" format="integer" />
<attr name="indicator_show" format="boolean" />
<attr name="nested_enabled" format="boolean" />
<attr name="indicator_gain" format="color|reference" />
<attr name="indicator_miss" format="color|reference" />
<attr name="indicator_size" format="dimension|reference" />
Expand Down

0 comments on commit 85ee638

Please sign in to comment.