Skip to content

Instantly share code, notes, and snippets.

@radityagumay
Created December 5, 2020 12:02
Show Gist options
  • Save radityagumay/2eaae6454c4e1e335637f0b32f77568c to your computer and use it in GitHub Desktop.
Save radityagumay/2eaae6454c4e1e335637f0b32f77568c to your computer and use it in GitHub Desktop.
/**
* 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