Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sureshmaidaragi1919/circulartimer

Edited version of Circular timer with Kotlin Extensions
https://github.com/sureshmaidaragi1919/circulartimer

android android-development android-library animation-library circulartimerlibrary dependency gradle gradle-android-plugin kotlin-android kotlin-library kotlin-native kotlinlibrary progress-bar timer

Last synced: 3 months ago
JSON representation

Edited version of Circular timer with Kotlin Extensions

Awesome Lists containing this project

README

        

# CircularTimerView
[![](https://jitpack.io/v/sureshmaidaragi1919/CircularTimerView.svg)](https://jitpack.io/#sureshmaidaragi/CircularTimerView)

A simple library for creating circular progress bar timer view for Android.

## Examples



## Installation
- Add jitpack.io as your dependency to build.gradle file

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

- Add dependency as follows

```gradle
dependencies {
implementation 'com.github.sureshmaidaragi1919:CircularTimer:1.3'

}
```

## Usage

1) Add CircularTimerView to your layout

```xml

```

2) Get it from your activity/fragment etc.

```java
CircularTimerView progressBar = findViewById(R.id.progress_circular);
progressBar.setProgress(0);

// To Initialize Timer
progressBar.setCircularTimerListener(new CircularTimerListener() {
@Override
public String updateDataOnTick(long remainingTimeInMs) {
return String.valueOf((int)Math.ceil((remainingTimeInMs / 1000.f)));
}

@Override
public void onTimerFinished() {
Toast.makeText(MainActivity.this, "FINISHED", Toast.LENGTH_SHORT).show();
progressBar.setPrefix("");
progressBar.setSuffix("");
progressBar.setText("FINISHED THANKS!");
}
}, 10, TimeFormatEnum.SECONDS, 10);

// To start timer

progressBar.startTimer();

```

You can modify it programmatically if you want

Setters

```java
progressBar.setProgress(progress); // set progress value
progressBar.setMaxValue(100); // set progress max value
progressBar.setStrokeWidthDimension(10); // set stroke width
progressBar.setBackgroundWidth(10); // set progress background width
progressBar.setProgressColor("#FF6FD99D"); // set progress color
progressBar.setBackgroundColor("#FFF9916B"); // set progress backgorund color
progressBar.setText(String.valueOf(progress)); // set progress text
progressBar.setTextColor("#FF6FD99D"); // set text color
progressBar.setSuffix("%"); // set suffix
progressBar.setPrefix(""); // set prefix
progress.setClockwise(true); // clocksie if false than anticlockwise timer rotation
progress.setStartingAngle(top); // top means start timer from top

```

Getters

```java
progressBar.getProgress(); // get progress value
progressBar.getProgressPercentage(); // get progress percentage
progressBar.getMaxValue(); // get progress max value
progressBar.getStrokeWidthDimension(); // get stroke width
progressBar.getBackgroundWidth(); // get progress background width
progressBar.getProgressColor(); // get progress color
progressBar.getBackgroundColor(); // get progress backgorund color
progressBar.getText(); // get progress text
progressBar.getTextColor(); // get text color
progressBar.getSuffix(); // get suffix
progressBar.getPrefix(); // get prefix
progressBar.getClockwise(); // getclocksise boolean
progressBar.getStartingAngle(); // get startangle

```

## LICENSE

MIT License

Copyright (c) 2019 Suresh Maidaragi original from hamzaahmedkhan and uzairiqbal91

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.