Created
April 5, 2019 10:09
-
-
Save ntngel1/78c4aa49b8f6d3a66dc33f56f8a22f2a to your computer and use it in GitHub Desktop.
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
@InjectViewState | |
class MainPresenter : MvpPresenter<MainView>() { | |
private val uploadFragment = UploadFragment.newInstance().apply { | |
// Задаем callback на нажатие кнопки Show после загрузки фото | |
onShowPhoto = { photoModel -> | |
viewState.openScreen(newPhotosFragment) | |
currentFragment = newPhotosFragment | |
viewState.setNavigationSelection(R.id.navigation_new) | |
newPhotosFragment.presenter.onHighlightPhoto(photoModel) | |
} | |
} | |
} | |
class UploadFragment : MvpFragment(), UploadView { | |
@InjectPresenter | |
lateinit var presenter: UploadPresenter | |
// После поворота экрана будет пересоздание фрагмента и callback будет утерян :( | |
var onShowPhoto: ((photo: PhotoModel) -> Unit)? = null | |
private val photoUploadedDialog = PhotoUploadedDialog().apply { | |
onShowClickedListener = { onShowPhoto?.invoke(photoModel) } | |
} | |
....... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment