Skip to content

AmeenAhmed1/Dotty

Repository files navigation

A Minimal Lib for creating an indicator

Install Dotty to your project.

Add the dependency below to your module's build.gradle file:

    dependencies {
    implementation 'com.github.AmeenAhmed1:Dotty:1.0.0'
}

How to use

You can use it in your XML like code below it will show up with the default drawables styles.

<com.github.ameen.dottylib.Dotty
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

You can change the Dotty layout

<com.github.ameen.dottylib.Dotty
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:dottySelected="@drawable/your_drawable_file"
        app:dottyUnSelected="@drawable/your_drawable_file"
        app:dottySize="2dp"
        app:dottySpaceBetweenSize="2dp"
        app:dottyCount="5"
        app:dottyStartPosition="3"/>

How to handle Dotty selection within the Code

//Provide your steps counter.
binding.dotty.setIndicatorCount(adapter.itemCount)

//Provide selected position.
binding.dotty.selectCurrentPosition(position)

Dotty Attributes (Style)

Attribute Description Default
app:dottySelected Style for selected Dotty Rounded Black Circle
app:dottyUnSelected Style for UnSelected Dotty Rounded Gray Circle
app:dottySize Size for Each Dotty 10F
app:dottySpaceBetweenSize Size Between Each Dotty 2F
app:dottyCount Dotty Count to show 3
app:dottyStartPosition Selected position when creating the layout 0