A ViewPager Android library
written in kotlin
that supports right to left for RTL locales with a natively ViewPager
that can be used with both :
The library is published on jCenter
you need to add the following dependency to your build.gradle
file.
repositories {
maven {
url "https://dl.bintray.com/abdallah-mohamed/maven"
}
}
dependencies {
implementation 'com.code95.bidirectionalviewpager:bidirectionalviewpager:0.0.1'
}
Send isRtlOriented
= true or false
to the RTLPagerAdapter
as a parameter.
Tab
is Helper class that contains the Tab with (Title And Fragment) OR
the Tab with (Menu Item resource ID And Fragment).
tabs
is our BiDirectionalTabLayout
view_pager
is our BiDirectionalViewPager
var adapter = BiDirectionalPagerAdapter(supportFragmentManager, isRtlOriented, view_pager)
view_pager.adapter = adapter
tabs.setupWithViewPager(view_pager)
bottom_navigation
is our BiDirectionalBottomNavigation
view_pager
is our BiDirectionalViewPager
var adapter = BiDirectionalPagerAdapter(supportFragmentManager, isRtlOriented, view_pager)
view_pager.adapter = adapter
adapter.setupWithBottomNavView(bottom_navigation)
Then we can add tab, tabs or remove tab using helper methods:
addTab(tab : Tab())
addTabs(tabs : MutableList<Tab>)
removeTab(position : Int)