A helper library for keeping and maintaining the state of Chronometers.
val chronometerPersist = ChronometerPersist.getInstance(
chronometer = chronometerView,
identifier = "mainChronometer", // unique identifier
sharedPreferences = mySharedPreferences
)
//Starting the chronometer
startChronometer();
//Stoping the chronometer
stopChronometer();
//Pausing the chronometer
pauseChronometer();
//Checking status
isRunning();
isPaused();
//if true then chronometer's format -> HH:MM:SS otherwise MM:SS
hourFormat(boolean);
//State recovery: call this in onResume()
resumeState();
The sample demonstrates how the library helps recover chronometer state even after the app stops.
Repository available on jCenter
implementation 'com.minimize.library:chronometerpersist:1.2.0'
If the dependency fails to resolve, add this to your project repositories
repositories {
maven {
url "http://dl.bintray.com/ahmedrizwan/maven"
}
}
Copyright 2015 Ahmed Rizwan
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.