mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Convert BasePresenter to kotlin
This commit is contained in:
parent
64808ed248
commit
41b41f7021
5 changed files with 13 additions and 21 deletions
|
|
@ -1,18 +0,0 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* Base presenter, enforcing contracts to atach and detach view
|
||||
*/
|
||||
public interface BasePresenter<T> {
|
||||
/**
|
||||
* Until a view is attached, it is open to listen events from the presenter
|
||||
*/
|
||||
void onAttachView(@NonNull T view);
|
||||
|
||||
/**
|
||||
* Detaching a view makes sure that the view no more receives events from the presenter
|
||||
*/
|
||||
void onDetachView();
|
||||
}
|
||||
10
app/src/main/java/fr/free/nrw/commons/BasePresenter.kt
Normal file
10
app/src/main/java/fr/free/nrw/commons/BasePresenter.kt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package fr.free.nrw.commons
|
||||
|
||||
/**
|
||||
* Base presenter, enforcing contracts to attach and detach view
|
||||
*/
|
||||
interface BasePresenter<T> {
|
||||
fun onAttachView(view: T)
|
||||
|
||||
fun onDetachView()
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ class CampaignsPresenter @Inject constructor(
|
|||
private val okHttpJsonApiClient: OkHttpJsonApiClient?,
|
||||
@param:Named(IO_THREAD) private val ioScheduler: Scheduler,
|
||||
@param:Named(MAIN_THREAD) private val mainThreadScheduler: Scheduler
|
||||
) : BasePresenter<ICampaignsView?> {
|
||||
) : BasePresenter<ICampaignsView> {
|
||||
private var view: ICampaignsView? = null
|
||||
private var disposable: Disposable? = null
|
||||
private var campaign: Campaign? = null
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class ContributionsListContract {
|
|||
fun showNoContributionsUI(shouldShow: Boolean)
|
||||
}
|
||||
|
||||
interface UserActionListener : BasePresenter<View?> {
|
||||
interface UserActionListener : BasePresenter<View> {
|
||||
fun refreshList(swipeRefreshLayout: SwipeRefreshLayout?)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ interface UploadMediaDetailsContract {
|
|||
fun showBadImagePopup(errorCode: Int, index: Int, uploadItem: UploadItem)
|
||||
}
|
||||
|
||||
interface UserActionListener : BasePresenter<View?> {
|
||||
interface UserActionListener : BasePresenter<View> {
|
||||
fun setupBasicKvStoreFactory(factory: (String) -> BasicKvStore)
|
||||
|
||||
fun receiveImage(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue