Skip to content

Android library to create a circular countdown, fully written in Kotlin

Notifications You must be signed in to change notification settings

douglasspgyn/CircularCountdown

Repository files navigation

Circular Countdown

platform API GitHub version JitPack version

A custom Progress Bar that looks like a Countdown.

You can see a Sample Project here and learn more on the Wiki.

This lib was based on another project but fully written in Kotlin.

XML

<douglasspgyn.com.github.circularcountdown.CircularCountdown
                android:id="@+id/circularCountdown"
                android:layout_width="72dp"
                android:layout_height="72dp"
                app:countdownBackgroundColor="@color/colorAccent"
                app:countdownForegroundColor="@color/colorPrimary"
                app:countdownTextColor="@color/colorPrimaryDark"
                app:countdownTextSize="24sp" />

Circular Countdown

circularCountdown.create(3, 10, CircularCountdown.TYPE_SECOND)
                .listener(object : CircularListener{
                    override fun onTick(progress: Int) {

                    }
                    
                    override fun onFinish(newCycle: Boolean, cycleCount: Int) {
                        
                    }
                })
                .start()

Circular Cascade Countdown

CircularCascadeCountdown(86405000,
                circularCountdownSeconds,
                circularCountdownMinutes,
                circularCountdownHours,
                circularCountdownDays)
                .listener(object : CascadeListener {
                    override fun onFinish() {
                        
                    }
                })
                .start()

Add to your project:

You just need to add the Maven Jitpack repository on Project Gradle:

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

and the library dependence on Module Gradle:

 dependencies {
    compile 'com.github.douglasspgyn:CircularCountdown:0.3.0'
 }