Dots indicator that shows the current position on a View Pager. It does all the work for you with a few customisations.

Overview

Dots

License

Screenshot 2

What is Dots?

Dots is a library that helps in implementing a simple yet effective dots indicator for the View Pagers used in your android code. It combines the usage of observers and state drawables to indicate the current visible page's position in a badass way.

Implementation

[1] In your app module gradle file

dependencies {
    implementation 'com.github.tizisdeepan:dots:1.0.1'
}

[2] In your project level gradle file

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

[3] Use DotsIndicator in your layout.xml

<com.make.dots.dotsindicator.DotsIndicator
    android:id="@+id/dotsIndicator"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="12dp"
    android:background="@drawable/dots_background"
    android:padding="6dp"
    app:dot_drawable="@drawable/ic_dot_darkgrey"
    app:dot_drawable_unselected="@drawable/ic_dot_lightgrey"
    app:dot_height="8dp"
    app:dot_margin="6dp"
    app:dot_width="8dp" />

[4] Link the View Pager with the Dots Indicator in your Java / Kotlin code

dotsIndicator.setViewPager(imageViewPager)
imageViewPager.adapter?.registerDataSetObserver(dotsIndicator.dataSetObserver)

Documentation

XML

  1. dot_drawable: Drawable that is used to indicated the current selected page
  2. dot_drawable_unselected: Drawable that is used to indicated the unselected pages
  3. dot_height: Height of the Dot indicator in dp
  4. dot_width: Width of the Dot indicator in dp
  5. dot_margin: Marginal spaces between the Dots

Kotlin / Java

// This attaches the DotsIndicator with the ViewPager
DotsIndicator.setViewPager(ViewPager)

Voila! You have implemented a simple Dots indicator for your View Pager now!

Check out this medium publication: https://medium.com/@tizisdeepan/android-dots-indicator-a093d9dc3f5f

Developed By

Follow me on Twitter Add me to Linkedin

License

This library falls under Apache v2

You might also like...
A somewhat copy past of Jetbrain's code from the kotlin plugin repo to make it humanly possible to test Intellij IDEA kotlin plugins that work on kotlin

A somewhat copy past of Jetbrain's code from the kotlin plugin repo to make it humanly possible to test Intellij IDEA kotlin plugins that work on kotlin

A simple and easy adapter for RecyclerView. You don't have to make adapters and view holders anymore. Slush will help you.
A simple and easy adapter for RecyclerView. You don't have to make adapters and view holders anymore. Slush will help you.

한국어 No more boilerplate adapters and view holders. Slush will make using RecyclerView easy and fast. The goal of this project is to make RecyclerView,

Koin Annotations - help declare Koin definition in a very fast and intuitive way, and generate all underlying Koin DSL for you

The goal of Koin Annotations project is to help declare Koin definition in a very fast and intuitive way, and generate all underlying Koin DSL for you. The goal is to help developer experience to scale and go fast 🚀 , thanks to Kotlin Compilers.

👋 A common toolkit (utils) ⚒️ built to help you further reduce Kotlin boilerplate code and improve development efficiency. Do you think 'kotlin-stdlib' or 'android-ktx' is not sweet enough? You need this! 🍭

Toolkit [ 🚧 Work in progress ⛏ 👷 🔧️ 🚧 ] Snapshot version: repositories { maven("https://s01.oss.sonatype.org/content/repositories/snapshots") }

A simple demo that shows how WebWorkers can be used in Kotlin/JS

Web Workers in KotlinJS This repo demonstrates how to set up a Web Worker in Kotlin/JS. It is a very simple demo that creates a new worker that sends

Sample project that shows an approach for designing a multi-module architecture for Jetpack Compose Android applications.
Sample project that shows an approach for designing a multi-module architecture for Jetpack Compose Android applications.

Compose Multi-Module Architecture Sample Sample project that shows an approach for designing a multi-module architecture for Jetpack Compose Android a

AsyncSport - AsyncSports Async sports is very simple application that shows athletes video feeds
AsyncSport - AsyncSports Async sports is very simple application that shows athletes video feeds

AsyncLabs Interview Solution 👀 Writing AsyncLabs Interview Solution App using A

This sample Kotlin app shows a list of custom shoes added by the users

Shoe-store This sample Kotlin app shows a list of custom shoes added by the users. The app displays the content with RecyclerView and uses a tradition

A native android app that shows how much calories one must consume based on their profile
A native android app that shows how much calories one must consume based on their profile

Healtify is a native android app which allows the user to track the amout of Calories they are consuming. It not only tracks the calories but also shows how much of fat, protein and carbs they have consumed and how much they should be doing.

Releases(1.0.1)
Owner
Deepan
Android Developer
Deepan
A nice weather that helps you get all information including: current weather, hourly weather and also forecasts for 16 days

WeatherForecast This is an ongoing project where I fetch all the weather data using Retrofit and Kotlin Coroutines over two APIs containing both curre

null 2 Jul 26, 2022
An android application that made as an exercise, that does 4 different conversions.

Following android studio basic course, this is my second (and bit more complicate this time) "practice on your own" project. In few words, it is an an

null 1 Dec 1, 2021
Android Ptrace Inject for all ABIs and all APIs. Help you inject Shared Library on Android.

Android Ptrace Inject 中文可以参考我的注释内容进行理解 我写的注释相对来说比较全面了 How to build Make sure you have CMake and Ninja in your PATH Edit CMakeLists.txt. Set ANDROID_ND

SsageParuders 65 Dec 19, 2022
Reapp is everything you need to build amazing apps with React: a collection of packages that work together, our UI kit, and a CLI that scaffolds your app and includes a server and build system.

What is it? Reapp is everything you need to build amazing apps with React: a collection of packages that work together, our UI kit, and a CLI that sca

reapp 3.4k Nov 20, 2022
An Android template project (in Kotlin) with boilerplate and current patterns.

android-starter-v4 An Android template project (in Kotlin) with boilerplate and plumbing, exploring current architecture patterns. A bit too much for

Matthias Urhahn 14 Nov 4, 2022
Show weather data for the current location [Apollo Agriculture Interview Solution], for the Senior Android Engineer Role

Apollo Agriculture Android Take Home Assignment Writing Apollo Agriculture App using Android Architecture Components, in 100% Kotlin, using Android Je

Juma Allan 23 Nov 23, 2022
Coin Stalker App is an android application that displays current crypto currency rates.

Coin-Stalker Coin Stalker App is an android application that displays current crypto currency rates based on modern Android application tech-stacks an

Barış Sağlam 1 Aug 16, 2022
WaxedNotWaxed - Adds a simple indicator to know if a copper block is waxed or not

Waxed Not Waxed Adds a simple indicator to know if a copper block is waxed or no

Mateusz 2 Nov 11, 2022
A Kotlin work manager library for Android with progress notifications and Hilt support.

Boot Laces A kotlin work manager library for Android that includes notifications and Hilt support. User Instructions Add the JitPack repository to you

Chris Basinger 35 Oct 8, 2022
A set of extension properties on Int, Long, Double, and Duration, that makes it easier to work with Kotlin Duration

Kotlin Duration Extensions Gradle Groovy repositories { mavenCentral() } implementation 'com.eygraber:kotlin-duration-extensions:1.0.1' Kotlin rep

Eliezer Graber 8 Nov 8, 2022