Skip to content

Instantly share code, notes, and snippets.

@ismailgungor
Last active April 11, 2019 14:22
Show Gist options
  • Save ismailgungor/1c8cccea03a9de59593c8a15fcbb049e to your computer and use it in GitHub Desktop.
Save ismailgungor/1c8cccea03a9de59593c8a15fcbb049e to your computer and use it in GitHub Desktop.
/**
* Responsible to manage Handler Process
*
* @author ismailgungor
* @since 1.0
*/
class HandlerProcessManagement {
companion object {
const val DEFAULT_HANDLER_DURATION = 2000L
}
/**
* This method provides post delayed handler with given duration.
* After the specified period, triggers with given callback where it is called
*
* @param callback as HandlerCallback
* @param duration as Long
* @author ismailgungor
* @since 1.0
*/
fun providePostDelayedHandler(callback: HandlerCallback, duration: Long) {
Handler().postDelayed({
callback.onCompleted()
}, duration)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment