only / com.skydoves.only / Only

Only

object Only

Easy way to run block codes only as many times as necessary.

Types

Builder

Builder class for creating Only.

class Builder

Functions

affectVersion

get version data from the preference.

fun affectVersion(name: String, version: String): Boolean

clearAllOnly

clear all Only data from the preference.

fun clearAllOnly(): Unit

clearOnly

remove a Only data from the preference.

fun clearOnly(name: String): Unit

getMarking

gets Only marking data.

fun getMarking(name: String): String?

getOnBeforeDoneExecuted

get Only executed or not about onBeforeDone.

fun getOnBeforeDoneExecuted(name: String): Boolean

getOnlyTimes

get Only time from the preference.

fun getOnlyTimes(name: String): Int

init

initialize the Only default properties.

fun init(context: Context): Only
fun init(context: Context, buildVersion: String): Only

isDebugMode

check debug mode.

fun isDebugMode(): Boolean

mark

marks Only tag data.

fun mark(name: String, marking: Any?): Unit

onDo

execute the onDo block only as many times as necessary.

fun onDo(name: String, times: Int, onDO: Runnable): Only
fun onDo(name: String, times: Int, onDo: (Int) -> Unit): Only

execute the onDo block only as many times as necessary. if unnecessary, unCatch block will be executed.

fun onDo(name: String, times: Int, onDo: Runnable, onDone: Runnable): Only
fun onDo(name: String, times: Int, onDo: (Int) -> Unit, onDone: () -> Unit): Only

execute the onDo block only as many times as necessary. if the version is different from the old version, Only times will be initialized 0.

fun onDo(name: String, times: Int, onDo: Runnable, version: String = ""): Only
fun onDo(name: String, times: Int, onDo: (Int) -> Unit, version: String = ""): Only

execute the onDo block only as many times as necessary. if unnecessary, unCatch block will be executed. if the version is different from the old version, Only times will be initialized 0.

fun onDo(name: String, times: Int, onDo: Runnable, onDone: Runnable, version: String = ""): Only
fun onDo(name: String, times: Int, onDo: (Int) -> Unit, onDone: () -> Unit, version: String = ""): Only

execute the onDo block only as many times as necessary. if unnecessary, unCatch block will be executed. if the version is different from the old version, Only times will be initialized 0. onLastDo block will be run only once after the last run time of the onDo. onBeforeDone block will be run only once before the onDone block will be run.

fun onDo(name: String, times: Int, onDo: Runnable, onDone: Runnable, onLastDo: Runnable, onBeforeDone: Runnable): Only
fun onDo(name: String, times: Int, onDo: (Int) -> Unit, onDone: () -> Unit, onLastDo: () -> Unit = {}, onBeforeDone: () -> Unit = {}): Only

execute the onDo block only as many times as necessary with onLastDo and onBeforeDone. if unnecessary, unCatch block will be executed. if the version is different from the old version, Only times will be initialized 0.

fun onDo(name: String, times: Int, onDo: Runnable, onDone: Runnable, onLastDo: Runnable, onBeforeDone: Runnable, version: String = ""): Only
fun onDo(name: String, times: Int, onDo: (Int) -> Unit, onDone: () -> Unit, onLastDo: () -> Unit = {}, onBeforeDone: () -> Unit = {}, version: String = ""): Only

onDoOnce

execute the onDo block only once.

fun onDoOnce(name: String, onDo: Runnable, onDone: Runnable, version: String = ""): Only
fun onDoOnce(name: String, onDo: (Int) -> Unit, onDone: () -> Unit = {}, version: String = ""): Only

execute the onDo block only once with onLastDo and onBeforeDone.

fun onDoOnce(name: String, onDo: Runnable, onDone: Runnable, onLastDo: Runnable, onBeforeDone: Runnable, version: String = ""): Only
fun onDoOnce(name: String, onDo: (Int) -> Unit, onDone: () -> Unit = {}, onLastDo: () -> Unit = {}, onBeforeDone: () -> Unit = {}, version: String = ""): Only

onDoThrice

execute the onDo block only thrice.

fun onDoThrice(name: String, onDo: Runnable, onDone: Runnable, version: String = ""): Only
fun onDoThrice(name: String, onDo: (Int) -> Unit, onDone: () -> Unit = {}, version: String = ""): Only

execute the onDo block only thrice with onLastDo and onBeforeDone.

fun onDoThrice(name: String, onDo: Runnable, onDone: Runnable, onLastDo: Runnable, onBeforeDone: Runnable, version: String = ""): Only
fun onDoThrice(name: String, onDo: (Int) -> Unit, onDone: () -> Unit = {}, onLastDo: () -> Unit = {}, onBeforeDone: () -> Unit = {}, version: String = ""): Only

onDoTwice

execute the onDo block only twice.

fun onDoTwice(name: String, onDo: Runnable, onDone: Runnable, version: String = ""): Only
fun onDoTwice(name: String, onDo: (Int) -> Unit, onDone: () -> Unit = {}, version: String = ""): Only

execute the onDo block only twice with onLastDo and onBeforeDone.

fun onDoTwice(name: String, onDo: Runnable, onDone: Runnable, onLastDo: Runnable, onBeforeDone: Runnable, version: String = ""): Only
fun onDoTwice(name: String, onDo: (Int) -> Unit, onDone: () -> Unit = {}, onLastDo: () -> Unit = {}, onBeforeDone: () -> Unit = {}, version: String = ""): Only

onlyOnDoDebugMode

check debugging mode.

fun onlyOnDoDebugMode(ignore: Boolean): Only

setOnBeforeDoneExecuted

set Only executed or not about onBeforeDone.

fun setOnBeforeDoneExecuted(name: String): Unit

setOnlyTimes

set Only time from the preference.

fun setOnlyTimes(name: String, time: Int): Unit