Created
December 5, 2020 12:02
-
-
Save radityagumay/2eaae6454c4e1e335637f0b32f77568c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Implementation Detail | |
*/ | |
interface FooPresenterContract { | |
interface Presenter { | |
fun doWork() | |
} | |
interface View { | |
fun inflated(message: String) | |
} | |
} | |
class FooView : FooPresenterContract.View { | |
private val presenter: FooPresenterContract.Presenter = FooPresenter(this) | |
@override | |
fun onViewAttached() { | |
presenter.doWork() | |
} | |
} | |
class FooPresenter( | |
private val view: FooPresenterContract.View | |
): FooPresenterContract.Presenter { | |
override fun doWork() { | |
// simulate computation | |
Thread.sleep(1000) | |
view.inflated("it was success!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment