Created
March 22, 2017 08:21
-
-
Save AkshayChordiya/a737024d4c449d32c2f1018858733883 to your computer and use it in GitHub Desktop.
Kotlin Article: TimerUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val PREF_TIME_KEY = "Start_time" | |
fun didTimeStart(context: Context): Boolean { | |
when { | |
exists(context, PREF_TIME_KEY) -> return true | |
else -> return getStartTime(context) != 0L | |
} | |
} | |
fun removeStartTime(context: Context) { | |
remove(context, PREF_TIME_KEY) | |
} | |
fun getStartTime(context: Context): Long { | |
return getLong(context, PREF_TIME_KEY, 0) | |
} | |
fun setStartTime(context: Context, time: Long) { | |
putLong(context, PREF_TIME_KEY, time) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment