Skip to content

Instantly share code, notes, and snippets.

@stoichoandreev
Last active March 18, 2020 09:43
Show Gist options
  • Save stoichoandreev/a7ae97a943d2bc17e453cc0e7cfdf536 to your computer and use it in GitHub Desktop.
Save stoichoandreev/a7ae97a943d2bc17e453cc0e7cfdf536 to your computer and use it in GitHub Desktop.
Gist 1 A - None Android Example
class AndroidRobot: BaseLifeCycle() {
fun onCreate() {
start()
}
fun onResume() {
resume()
}
fun onPause() {
stop()
}
fun onDestroy() {
terminate()
}
}
abstract class BaseLifeCycle {
fun start() {
System.out.println("Robot Start")
}
fun paint() {
System.out.println("Robot Paint")
}
fun resume() {
System.out.println("Robot Resume")
}
fun stop() {
System.out.println("Robot stop")
}
fun terminate() {
System.out.println("Robot terminate")
}
}
class FucsiaRobot: BaseLifeCycle() {
fun onCanvasInitialised() {
start()
}
fun onCanvasDrawn() {
paint()
}
fun onCanvasClosed() {
stop()
}
fun onCanvasTerminated() {
terminate()
}
}
class IOSRobot: BaseLifeCycle() {
fun onViewDidLoad() {
start()
}
fun onViewDisappear() {
stop()
}
fun onViewReleaseFromMemory() {
terminate()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment