A simple and easy to use stopwatch and timer library for android

Overview

TimeIt

Now with Timer support!

Download Android Arsenal

A simple and easy to use stopwatch and timer library for android

Introduction

A stopwatch can be a very important widget in an app and yet creating it has been very difficult. Creating a stopwatch requires you to create a separate thread to keep track of the time and then post the updates on the UI thread. This process becomes complicated very quickly. Especially if you plan on adding features like pause and split.

Similarly, a timer is another important addon an app may need without going through all the hassle of running threads or handlers.

With TimeIt, you can create a stopwatch or a timer app with very few lines of code!

For example, to create and start a stopwatch and display it with a textView :

Stopwatch stopwatch = new Stopwatch();
stopwatch.setTextView(myTextView);
stopwatch.start();

Pausing a stopwatch and resuming it is as simple as calling stopwatch.pause(); and resume() respectively.

TimeIt also allows you to keep track of splits with the stopwatch by simply calling stopwatch.split();

Similarly, to set a timer:

Timer timer = new Timer(time_in_ms);
timer.setTextView(myTextView);
timer.start();

The timer provides utility functions to check the current time and current status (running, paused, stopped etc.). Please check the current status of the timer before actually starting/pausing/resuming the timer.

The Timer class provides an OnTickListener interface which you can register to, to listen for updates every clock cycle and receive a callback when the timer completes.

Features

  • NEW : Create Timers with pause and resume support!
  • Easy to use stopwatch library
  • No need to use separate threads. Multithreading is handled by the library itself
  • Supports pause/resume and split methods.
  • Supports an OnTickListener to listen for updates in clock.
  • Set the TextView directly with TimeIt (Automatically formats the time).
  • Set custom clock delay to update the time more or less frequently!
  • Much more to come!

Documentation

TimeIt is very easy to use. If you face any trouble, you can see the javadocs available here. A demo app is included here for your reference. It implements the basic features of the library.

Download

TimeIt is available on jcenter, jitpack and bintray. To download, use the badges above or follow these instructions:

Jcenter

Step 1. Add the JCenter repository to your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jcenter.bintray.com' }
		}
	}

Step 2 : Add the dependency in your app level build.gradle

implementation 'com.yashovardhan99.timeit:timeit:1.2.0'

Jitpack

Step 1. Add the JitPack repository to your root build.gradle at the end of repositories:

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

Step 2 : Add the dependency in your app level build.gradle

	dependencies {
	        implementation 'com.github.yashovardhan99:TimeIt:1.2.0'
	}

Bintray

Step 1 : Download or copy the Gradle configuration in your project level build.gradle:

repositories {
    maven {
        url  "https://dl.bintray.com/yashovardhan99/TimeIt" 
    }
}
        

Step 2 : Add the dependency in your app level build.gradle

implementation 'com.yashovardhan99.timeit:timeit:1.2.0'

Contributing

Contributing guidelines are available here. Feel free to report any issues or make new pull requests! TimeIt is an open source project and is free for all to use and improve!

License

Copyright 2018 Yashovardhan Dhanania

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You might also like...
EggTimer: a timer app for cooking eggs
EggTimer: a timer app for cooking eggs

EggTimer EggTimer is a timer app for cooking eggs. You can start and stop the ti

📱 Android Library to implement Rich, Beautiful, Stylish 😍 Material Navigation View for your project with Material Design Guidelines. Easy to use.
📱 Android Library to implement Rich, Beautiful, Stylish 😍 Material Navigation View for your project with Material Design Guidelines. Easy to use.

Material NavigationView for Android 📱 📱 Android Library to implement Rich, Beautiful Material Navigation View for your project with Material Design

An easy to use android library to let devs know how much internet-data their app is consuming
An easy to use android library to let devs know how much internet-data their app is consuming

EasyAnalytics! an easy to use android library to let developers know how much internet-data their app is consuming. We can identify this as we want ba

Abysl Asset Manager is an easy to use library management tool to index and search game assets
Abysl Asset Manager is an easy to use library management tool to index and search game assets

Abysl Asset Manager is an easy to use library management tool to index and search game assets. Features Itch.IO Library Import Hum

Easy-Note - Easy Note Application will help user to add and update their important notes
Easy-Note - Easy Note Application will help user to add and update their important notes

Easy-Note 🗒️ Easy Note App helps you to create your notes. You can 📝 edit and

An easy-to-use CSML API Client for Android.
An easy-to-use CSML API Client for Android.

CSML Android SDK An easy-to-use CSML API Client for Android. Overview CSML (Conversational Standard Meta Language) is an Open-Source, Domain-Specific

The easy way to use biometric authentication in your Flutter app. Supports Fingerprint, FaceID and Iris.
The easy way to use biometric authentication in your Flutter app. Supports Fingerprint, FaceID and Iris.

BiometricX The easy way to use biometric authentication in your Flutter app. Supports Fingerprint, FaceID and Iris. Demo APK. Starting $ flutter pub a

Calculator provides an easy to use API to evaluate mathematical expressions

Calculator Calculator provides an easy to use API to evaluate mathematical expressions created with following operators: + - * / ( ) For example: This

Easy to use Overflow Menu for Jetpack Compose
Easy to use Overflow Menu for Jetpack Compose

Overflow Menu Android library for Jetpack Compose providing an Overflow Menu via fast and easy to use DSL. How to add to project Step 1. Add the JitPa

Comments
  • Timer should check if TextView is null

    Timer should check if TextView is null

    Thanks for this library.

    I believe Timer should check if textview is null before displaying the text. Similar to Stopwatch.

    This way it's not possible to use Timer without the textview and it also makes it hard to use the Timer in different scenarios.

    Thanks.

    opened by dirkam 1
  • Timer should have a finished state

    Timer should have a finished state

    Timer should have a finished state. Right now it's only possible to check this with a few checks, including the remaining time, which can go below zero (probably it should set itself to 0 instead of going below zero).

    enhancement 
    opened by dirkam 3
Releases(1.2.0)
Owner
Yashovardhan Dhanania
Associate Consultant @Microsoft; Founder @AndroidDevJaipur;
Yashovardhan Dhanania
A general purpose kotlin library that use kotlin coroutines, flows and channels to provide timer features with the most easy and efficient way

Timer Timer is a general purpose kotlin library that use kotlin coroutines, flows and channels to provide timer features with the most easy and effici

Amr Saraya 3 Jul 11, 2022
Pomodroid is a flexible and easy to use Android Pomodoro Technique Timer.

Pomodroid - Android App Pomodroid is a flexible and easy to use Android Pomodoro Technique Timer. Unlike other services, pomodroid is free and open so

Klejvi Kapaj 8 Oct 15, 2022
Simple timer app inspired by Newton's Cradle. Created in Jetpack Compose for #AndroidDevChallenge.

Newton's Timer ?? Description Simple timer app inspired by Newton's Cradle. Created in Jetpack Compose for #AndroidDevChallenge. ?? Motivation and Con

Maciej Ciemięga 278 Dec 28, 2022
Build a simple timer application with kotlin

3. Build a simple timer application which provides below features: a. A simple U

Nghe Pham 1 Dec 26, 2021
⏲ A highly customizable interval timer app for Android

TimeR Machine A highly customizable interval timer app for Android Structure The app uses the Navigation component. Modules whose names start with app

null 51 Dec 7, 2022
A material tea-timer for android

What is this This project emerged as a tea-timer is something I nearly use every day and the app I was using so far was not ideal to me. I used the on

ligi 34 Aug 30, 2022
Timer app for android

Android Countdown Timer This is a simple, no-frills but efficient timer app for android created based on my personal need. You can create multiple seq

Kaustav Banerjee 0 Dec 25, 2021
Task Timer - An android app that helps you to keep a track of how much time you spend on each task

Task Timer - An android app that helps you to keep a track of how much time you spend on each task

Hassan Al-Shammari 1 Feb 24, 2022
A minimalist but powerful productivity timer designed to keep you focused and free of distractions.

Goodtime A minimalist but powerful productivity timer designed to keep you focused and free of distractions. Alternate between focused work sessions a

Adrian Cotfas 692 Dec 27, 2022
Countdown timer app built in Jetpack Compose

TikTik: A beautiful countdown timer ?? Description TikTik is a beautiful countdown-timer app built in Jetpack Compose, which is submmited to Android D

fundroid 40 Dec 10, 2022