Skip to content

Android Library that provides developers a dialog box with an integrated timer along with a circular progress indicator

Notifications You must be signed in to change notification settings

pranavjayaraj/Timer-Dialog

Repository files navigation

Timer-Dialog

Android Library that provides developers a dialog box with an integrated countdown timer.
A circular progress bar is used to indicate the countdown to dialog dismiss.

Screenshots:

Usage

Gradle

Step 1. Add the JitPack repository to your build file
allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}
Step 2. Add the dependency
dependencies 
   {	      
       compile 'com.github.pranavj7Z:Timer-Dialog:1.04'
   }

Maven

Step 1. Add the JitPack repository to your build file
<repositories>
	<repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
	</repository>
</repositories>
Step 2. Add the dependency
<dependency>
	    <groupId>com.github.pranavj7Z</groupId>
	    <artifactId>Timer-Dialog</artifactId>
	    <version>1.04</version>
	</dependency>
Java Code:

 TimerDialog dialog = new TimerDialog(this);
        dialog.setTitle("Content Title");
        dialog.setAnimationEnable(true);
        dialog.setDuration(10000);
        dialog.setContentImage(getResources().getDrawable(R.mipmap.p));
        dialog.setPositiveListener("Ok", new TimerDialog.OnPositiveListener() {
            @Override
            public void onClick(TimerDialog dialog) {
                Toast.makeText(MainActivity.this, dialog.getPositiveText().toString(), Toast.LENGTH_SHORT).show();
                dialog.dismiss();
            }
        })
        .setNegativeListener(getString(R.string.cancel), new TimerDialog.OnNegativeListener() {
            @Override
            public void onClick(TimerDialog dialog) {
                Toast.makeText(MainActivity.this, dialog.getNegativeText().toString(), Toast.LENGTH_SHORT).show();
                dialog.dismiss();
            }
        }).show();

TimerDialog dialog = new TimerDialog(this);
        dialog.setTitle("Rewarded Video");
        dialog.setContentText("Watch a video to earn a life");
        dialog.setContentImage(getResources().getDrawable(R.mipmap.p));
        dialog.setAnimationEnable(true);
        dialog.setDuration(10000);
        dialog.setPositiveListener("watch video", new TimerDialog.OnPositiveListener() {
            @Override
            public void onClick(TimerDialog dialog) {
                Toast.makeText(MainActivity.this, dialog.getPositiveText().toString(), Toast.LENGTH_SHORT).show();
                dialog.dismiss();
            }
        }).show();
    }

About

Android Library that provides developers a dialog box with an integrated timer along with a circular progress indicator

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages