Last active
March 18, 2020 09:42
-
-
Save stoichoandreev/52527647ef43fb9fdd4e96eee03494c4 to your computer and use it in GitHub Desktop.
Gist 1 B None Android Example
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
class AndroidLifeCycleComponent { | |
fun start() { | |
System.out.println("Robot Start") | |
} | |
fun resume() { | |
System.out.println("Robot Resume") | |
} | |
fun stop() { | |
System.out.println("Robot stop") | |
} | |
fun terminate() { | |
System.out.println("Robot terminate") | |
} | |
} |
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
class AndroidRobot(private val lifeCycleComponent: AndroidLifeCycleComponent) { | |
fun onCreate() { | |
lifeCycleComponent.start() | |
} | |
fun onResume() { | |
lifeCycleComponent.resume() | |
} | |
fun onPause() { | |
lifeCycleComponent.stop() | |
} | |
fun onShutdown() { | |
lifeCycleComponent.terminate() | |
} | |
} |
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
class FucsiaLifeCycleComponent { | |
fun start() { | |
System.out.println("Robot Start") | |
} | |
fun paint() { | |
System.out.println("Robot Paint") | |
} | |
fun stop() { | |
System.out.println("Robot stop") | |
} | |
fun terminate() { | |
System.out.println("Robot terminate") | |
} | |
} |
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
class FucsiaRobot(private val lifeCycleComponent: FucsiaLifeCycleComponent) { | |
fun onCanvasInitialised() { | |
lifeCycleComponent.start() | |
} | |
fun onCanvasDrawn() { | |
lifeCycleComponent.paint() | |
} | |
fun onCanvasClosed() { | |
lifeCycleComponent.stop() | |
} | |
fun onCanvasTerminated() { | |
lifeCycleComponent.terminate() | |
} | |
} |
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
class IOSLifeCycleComponent { | |
fun start() { | |
System.out.println("Robot Start") | |
} | |
fun stop() { | |
System.out.println("Robot stop") | |
} | |
fun terminate() { | |
System.out.println("Robot terminate") | |
} | |
} |
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
class IOSRobot(private val lifeCycleComponent: IOSLifeCycleComponent) { | |
fun onViewDidLoad() { | |
lifeCycleComponent.start() | |
} | |
fun onViewDisappear() { | |
lifeCycleComponent.stop() | |
} | |
fun onViewReleaseFromMemory() { | |
lifeCycleComponent.terminate() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment