Skip to content

Commit

Permalink
修改拦截器命名,更新README
Browse files Browse the repository at this point in the history
  • Loading branch information
chay committed Jul 17, 2024
1 parent d5d9423 commit 7b597a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void initListener() {
mBottomBarLayout.showNotify(2);//设置第三个页签显示提示的小红点
mBottomBarLayout.setMsg(3, "NEW");//设置第四个页签显示NEW提示文字

mBottomBarLayout.setOnPageChangedInterceptor(position -> {
mBottomBarLayout.setOnPageChangeInterceptor(position -> {
boolean isLogin = false;
if (position == 3 && !isLogin){
//no login intercept to other tab or to LoginActivity
Expand Down
18 changes: 9 additions & 9 deletions library/src/main/java/com/chaychan/library/BottomBarLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public void removeItem(int position) {
}

private void handlePageSelected(int position){
if (onPageChangedInterceptor != null
&& onPageChangedInterceptor.onPageChangedIntercepted(position)){
if (mOnPageChangeInterceptor != null
&& mOnPageChangeInterceptor.onIntercepted(position)){
setCurrentItem(mCurrentItem);
return;
}
Expand Down Expand Up @@ -175,8 +175,8 @@ public MyOnClickListener(int i) {
@Override
public void onClick(View v) {
//点击时判断是否需要拦截跳转
if (onPageChangedInterceptor != null
&& onPageChangedInterceptor.onPageChangedIntercepted(currentIndex)){
if (mOnPageChangeInterceptor != null
&& mOnPageChangeInterceptor.onIntercepted(currentIndex)){
return;
}
if (currentIndex == mCurrentItem) {
Expand Down Expand Up @@ -302,13 +302,13 @@ public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListe
this.onItemSelectedListener = onItemSelectedListener;
}

private OnPageChangedInterceptor onPageChangedInterceptor;
private OnPageChangeInterceptor mOnPageChangeInterceptor;

public void setOnPageChangedInterceptor(OnPageChangedInterceptor onPageChangedInterceptor) {
this.onPageChangedInterceptor = onPageChangedInterceptor;
public void setOnPageChangeInterceptor(OnPageChangeInterceptor onPageChangeInterceptor) {
mOnPageChangeInterceptor = onPageChangeInterceptor;
}

public interface OnPageChangedInterceptor {
boolean onPageChangedIntercepted(int position);
public interface OnPageChangeInterceptor {
boolean onIntercepted(int position);
}
}

0 comments on commit 7b597a3

Please sign in to comment.