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
public interface MvpView { | |
} |
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
public class BaseActivity extends AppCompatActivity implements MvpView { | |
} |
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
public interface MvpPresenter<V extends MvpView> { | |
void onAttach(V mvpView); | |
} |
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
public class BasePresenter<V extends MvpView> implements MvpPresenter<V> { | |
private V mMvpView; | |
DataManager mDataManager; | |
public BasePresenter(DataManager dataManager){ | |
mDataManager = dataManager; | |
} |
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
public class DataManager { | |
SharedPrefsHelper mSharedPrefsHelper; | |
public DataManager(SharedPrefsHelper sharedPrefsHelper) { | |
mSharedPrefsHelper = sharedPrefsHelper; | |
} | |
public void clear() { | |
mSharedPrefsHelper.clear(); |
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
public interface SplashMvpView extends MvpView { | |
void openMainActivity(); | |
void openLoginActivity(); | |
} |
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
public class SplashActivity extends BaseActivity implements SplashMvpView { | |
SplashPresenter mSplashPresenter; | |
public static Intent getStartIntent(Context context) { | |
Intent intent = new Intent(context, SplashActivity.class); | |
return intent; | |
} | |
@Override |
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
public interface SplashMvpPresenter<V extends SplashMvpView> extends MvpPresenter<V> { | |
void decideNextActivity(); | |
} |
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
public class SplashPresenter<V extends SplashMvpView> extends BasePresenter<V> implements SplashMvpPresenter<V> { | |
public SplashPresenter(DataManager dataManager) { | |
super(dataManager); | |
} | |
@Override | |
public void decideNextActivity() { | |
if (getDataManager().getLoggedInMode()) { | |
getMvpView().openMainActivity(); |
OlderNewer