All Projects → krtkush → Lineartimer

krtkush / Lineartimer

Licence: gpl-3.0
A custom view for circular progress animation on Android.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Lineartimer

Suzaku
Hashed wheel timer in Swift
Stars: ✭ 77 (-40.31%)
Mutual labels:  timer
Moment Timer
Timer plugin for Moment.js that allows creation of setInterval and setTimeout-like timers.
Stars: ✭ 98 (-24.03%)
Mutual labels:  timer
React Timer Hook
React timer hook
Stars: ✭ 118 (-8.53%)
Mutual labels:  timer
Timerlab
⏰ A simple and customizable timer
Stars: ✭ 84 (-34.88%)
Mutual labels:  timer
Timer
This is a simple rxjava2/rxjava3/kotlin-flow timer
Stars: ✭ 93 (-27.91%)
Mutual labels:  timer
Use Timer
A timer hook for React
Stars: ✭ 113 (-12.4%)
Mutual labels:  timer
Swiftytimer
Swifty API for NSTimer
Stars: ✭ 1,143 (+786.05%)
Mutual labels:  timer
Livesplit Core
livesplit-core is a library that provides a lot of functionality for creating a speedrun timer.
Stars: ✭ 124 (-3.88%)
Mutual labels:  timer
Stopwatch
⏱️ Single-header C++11 RDTSCP clock and timing utilities released into the public domain.
Stars: ✭ 96 (-25.58%)
Mutual labels:  timer
Pomodoro
Command line pomodoro timer
Stars: ✭ 116 (-10.08%)
Mutual labels:  timer
Seckill
Chrome浏览器 抢购、秒杀插件,秒杀助手,定时自动点击
Stars: ✭ 1,278 (+890.7%)
Mutual labels:  timer
Dipstick
Configurable metrics toolkit for Rust applications
Stars: ✭ 92 (-28.68%)
Mutual labels:  timer
Tomighty Windows
Tomighty for Windows
Stars: ✭ 116 (-10.08%)
Mutual labels:  timer
Hackaru
Simple, cross-platform time tracking application
Stars: ✭ 82 (-36.43%)
Mutual labels:  timer
Uicircularprogressring
A circular progress bar for iOS written in Swift
Stars: ✭ 1,658 (+1185.27%)
Mutual labels:  timer
Flip Clock
A flip clock, timer and countdown made with Polymer
Stars: ✭ 69 (-46.51%)
Mutual labels:  timer
Repeat
🕦 Modern Timer in Swift, Debouncer and Throttler (alternative to NSTimer) made with GCD
Stars: ✭ 1,384 (+972.87%)
Mutual labels:  timer
Delta5 race timer
Multi-node video transmitter race timer for drone racing
Stars: ✭ 129 (+0%)
Mutual labels:  timer
Marinara
Pomodoro® time management assistant for Chrome
Stars: ✭ 1,806 (+1300%)
Mutual labels:  timer
Nose Timer
A timer plugin for nosetests (how much time does every test take?)
Stars: ✭ 116 (-10.08%)
Mutual labels:  timer

Android Arsenal

Linear Timer

Linear Timer is a custom view for Android that enables circular progress animation with respect to given duration.

Linear Timer supports following features -

  1. Progress animation in clock-wise or counter clock-wise direction.
  2. Get time elapsed since timer started or time left for the counter to complete.
  3. Provide Start and finish points for the animation.
  4. Pre-fill the progress up-till certain point.
  5. Resume the animation on the basis of duration elapsed from total duration.

...and much more.

Download the demo app -

Get it on Google Play

If you're using this library, please let me know; I'll feature your app in the wiki.

Screenshots

Versioning

Linear Timer follows the Semantic Versioning System.

Summery - MAJOR.MINOR.PATCH

Setup

Release

Setup is pretty straight forward. In your project's build.gradle add the following -

allprojects {
  repositories {
      jcenter()
      maven { url "https://jitpack.io" }
  }
}

And, in your app's build.gradle add this under dependencies block -

compile 'com.github.krtkush:LinearTimer:<version_available_on_jitpack>'

example - compile 'com.github.krtkush:LinearTimer:v2.1.1'

Usage

First, you need to add LinearTimerView into your XML layout -

xmlns:timer="http://schemas.android.com/apk/res-auto"

<io.github.krtkush.lineartimer.LinearTimerView
    android:id="@+id/linearTimer"
    android:layout_centerHorizontal="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    timer:radius="20dp"
    timer:strokeWidth="3dp"/>

Note that "wrap_content" for height and width is recommended. Using other values might not lead correct rendering of the view.

After adding the view, here is how it is initialized and used -

LinearTimerView linearTimerView = (LinearTimerView)
                                    findViewById(R.id.linearTimer);

LinearTimer linearTimer = new LinearTimer.Builder()
            .linearTimerView(linearTimerView)
            .duration(10 * 1000)
            .build();

// Start the timer.
findViewById(R.id.startTimer).setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
      linearTimer.startTimer();
    }
});

// Restart the timer.
findViewById(R.id.restartTimer).setOnClickListener(new View.OnClickListener() {
     @Override
     public void onClick(View view) {
        linearTimer.restartTimer();
      }
});

// Pause the timer
findViewById(R.id.pauseTimer).setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
         try {
            linearTimer.pauseTimer();
         } catch (IllegalStateException e) {
            e.printStackTrace();
            Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
         }
      }
 });

// Resume the timer
findViewById(R.id.resumeTimer).setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
          try {
            linearTimer.resumeTimer();
          } catch (IllegalStateException e) {
              e.printStackTrace();
              Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
          }
      }
 });

// Reset the timer
findViewById(R.id.resetTimer).setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(View v) {
       try {
           linearTimer.resetTimer();
       } catch (IllegalStateException e) {
           e.printStackTrace();
           Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
       }
   }
});

List of methods available to control the timer -

Method Description Exception
1. startTimer() Start the timer. IllegalStateException
2. pauseTimer() Pause the timer. IllegalStateException
3. resumeTimer() Resume the timer from its pause position. IllegalStateException
4. resetTimer() Reset the timer to the starting angle; the timer will not start after reset. IllegalStateException
5. restartTimer() Restart the timer from the starting angle; the timer will start again. None
5. getState() Get current state of the timer. None

For detailed documentation and on how to customise and use LinearTimer please refer to the wiki.

Refer here for Java Docs. General URL for Java Docs is https://jitpack.io/com/github/krtkush/lineartimer/<insert_version_of_choice>/javadoc/

Contribution

Any kind of contribution will be appreciated; feel free to create a pull request or file issues on the issue tracker.

List of current contributors can be found here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].