Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnk25 committed Jan 14, 2022
1 parent 17f1cb6 commit 6bcda4f
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion xbanner/src/main/java/com/stx/xhb/androidx/XBanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,11 @@ public void handleAutoPlayActionUpOrCancel(float xVelocity) {
}

private int getRealPosition(int position) {
return position % getRealCount();
int realCount = getRealCount();
if (realCount != 0) {
return position % realCount;
}
return position;
}

/**
Expand Down Expand Up @@ -1128,6 +1132,22 @@ public void setClipChildrenLeftRightMargin(@Dimension int mClipChildrenLeftMargi
this.mClipChildrenRightMargin = mClipChildrenRightMargin;
}

/**
* 是否显示提示文案
* @param mIsShowTips
*/
public void setIsShowTips(boolean mIsShowTips) {
this.mIsShowTips = mIsShowTips;
}

/**
* 低于三张图片是否展示一屏多显模式
* @param mIsClipChildrenModeLessThree
*/
public void setIsClipChildrenModeLessThree(boolean mIsClipChildrenModeLessThree) {
this.mIsClipChildrenModeLessThree = mIsClipChildrenModeLessThree;
}

@Override
protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
Expand Down Expand Up @@ -1206,6 +1226,9 @@ public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
if (getRealCount() == 0) {
return null;
}
final int realPosition = getRealPosition(position);
View itemView;
if (holderCreator == null) {
Expand Down

0 comments on commit 6bcda4f

Please sign in to comment.