Skip to content

Commit

Permalink
RTL mode supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhpanvip committed Jan 25, 2021
1 parent d011259 commit 5fdbe1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ protected void initView(Bundle savedInstanceState, View view) {
.setIndicatorSlideMode(IndicatorSlideMode.SCALE)
.setIndicatorSliderColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color))
.setIndicatorSliderRadius(getResources().getDimensionPixelOffset(R.dimen.dp_4), getResources().getDimensionPixelOffset(R.dimen.dp_5))
.setRTLMode(true)
.setLifecycleRegistry(getLifecycle())
.setOnPageClickListener(this::pageClick)
.setAdapter(new ViewBindingSampleAdapter(getResources().getDimensionPixelOffset(R.dimen.dp_8)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.ArrayList;
import java.util.List;

import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static com.zhpan.bannerview.BaseBannerAdapter.MAX_VALUE;
import static com.zhpan.bannerview.constants.IndicatorGravity.CENTER;
import static com.zhpan.bannerview.constants.IndicatorGravity.END;
Expand Down Expand Up @@ -1036,6 +1037,14 @@ public BannerViewPager<T> disallowParentInterceptDownEvent(boolean disallowParen
return this;
}

public BannerViewPager<T> setRTLMode(boolean rtlMode) {
if (Build.VERSION.SDK_INT >= JELLY_BEAN_MR1) {
mViewPager.setLayoutDirection(rtlMode ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
// TODO set indicator RTL mode.
}
return this;
}

/**
* @deprecated Use {@link BannerViewPager#disallowParentInterceptDownEvent(boolean)} instead.
*/
Expand Down

0 comments on commit 5fdbe1f

Please sign in to comment.