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.
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
dependencies
{
compile 'com.github.pranavj7Z:Timer-Dialog:1.04'
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.pranavj7Z</groupId>
<artifactId>Timer-Dialog</artifactId>
<version>1.04</version>
</dependency>
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();
}