-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor presenter and synclifecyclecallback classes to 2 presenters
- Loading branch information
Showing
18 changed files
with
935 additions
and
948 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
48 changes: 48 additions & 0 deletions
48
p2p-sync/src/main/java/org/smartregister/p2p/presenter/BaseP2pModeSelectPresenter.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.smartregister.p2p.presenter; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
import org.smartregister.p2p.contract.P2pModeSelectContract; | ||
import org.smartregister.p2p.interactor.P2pModeSelectInteractor; | ||
|
||
/** | ||
* Created by Ephraim Kigamba - ekigamba@ona.io on 08/03/2019 | ||
*/ | ||
|
||
public abstract class BaseP2pModeSelectPresenter implements P2pModeSelectContract.BasePresenter { | ||
|
||
protected P2pModeSelectContract.View view; | ||
protected P2pModeSelectContract.Interactor interactor; | ||
|
||
public BaseP2pModeSelectPresenter(@NonNull P2pModeSelectContract.View view) { | ||
this(view, new P2pModeSelectInteractor(view.getContext())); | ||
} | ||
|
||
protected BaseP2pModeSelectPresenter(@NonNull P2pModeSelectContract.View view, @NonNull P2pModeSelectContract.Interactor p2pModeSelectInteractor) { | ||
this.view = view; | ||
this.interactor = p2pModeSelectInteractor; | ||
|
||
// This will be added when issue https://github.com/OpenSRP/android-p2p-sync/issues/24 | ||
// is being worked on | ||
//view.addOnResumeHandler(new AdvertisingResumeHandler(this, interactor)); | ||
} | ||
|
||
@Override | ||
public void sendTextMessage(@NonNull String message) { | ||
interactor.sendMessage(message); | ||
} | ||
|
||
@Override | ||
public void onStop() { | ||
view.dismissAllDialogs(); | ||
view.enableSendReceiveButtons(true); | ||
|
||
interactor.stopAdvertising(); | ||
interactor.stopDiscovering(); | ||
interactor.closeAllEndpoints(); | ||
|
||
interactor.cleanupResources(); | ||
interactor = null; | ||
} | ||
|
||
} |
Oops, something went wrong.