Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.ravindu1024:android-viewpager-indicator:1.0.5'
}
dependencies {
implementation("com.github.ravindu1024:android-viewpager-indicator:1.0.5")
}
<dependency>
<groupId>com.github.ravindu1024</groupId>
<artifactId>android-viewpager-indicator</artifactId>
<version>1.0.5</version>
</dependency>
libraryDependencies += "com.github.ravindu1024" % "android-viewpager-indicator" % "1.0.5"
:dependencies [[com.github.ravindu1024/android-viewpager-indicator "1.0.5"]]
A simple customizable indicator for ViewPagers
Installation:
1) Add the following to the main project gradle file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
2) Add this to the module gradle file:
dependencies {
compile 'com.github.ravindu1024:android-viewpager-indicator:1.0.1'
}
Usage:
1) add using xml:
<com.ravindu1024.indicatorlib.ViewPagerIndicator
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal|center_vertical"
android:id="@+id/pager_indicator"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
2) Then in code:
ViewPagerIndicator indicator = (ViewPagerIndicator) findViewById(R.id.pager_indicator);
indicator.setPager(pager); //pager - the target ViewPager
NOTE: Changes to the ViewPager pages at runtime will be automatically handled when you call notifyDataSetChanged().