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 LoginMvpView extends MvpView { | |
void openMainActivity(); | |
void onLoginButtonClick(); | |
} |
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 LoginActivity extends BaseActivity implements LoginMvpView { | |
LoginPresenter loginPresenter; | |
EditText editTextEmail, editTextPassword; | |
Button button; | |
public static Intent getStartIntent(Context context) { | |
Intent intent = new Intent(context, LoginActivity.class); |
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 LoginMvpPresenter<V extends LoginMvpView> extends MvpPresenter<V> { | |
void startLogin(String emailId); | |
} |
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 LoginPresenter<V extends LoginMvpView> extends BasePresenter<V> implements LoginMvpPresenter<V> { | |
public LoginPresenter(DataManager dataManager) { | |
super(dataManager); | |
} | |
@Override | |
public void startLogin(String emailId) { | |
getDataManager().saveEmailId(emailId); | |
getDataManager().setLoggedIn(); |
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 MainActivity extends BaseActivity implements MainMvpView { | |
TextView textViewShow; | |
Button buttonLogout; | |
MainPresenter mainPresenter; | |
public static Intent getStartIntent(Context context) { | |
Intent intent = new Intent(context, MainActivity.class); | |
return intent; | |
} |
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 MainMvpPresenter<V extends MainMvpView> extends MvpPresenter<V> { | |
String getEmailId(); | |
void setUserLoggedOut(); | |
} |
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 MainMvpView extends MvpView { | |
void openSplashActivity(); | |
} |
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 MainPresenter<V extends MainMvpView> extends BasePresenter<V> implements MainMvpPresenter<V> { | |
public MainPresenter(DataManager dataManager) { | |
super(dataManager); | |
} | |
@Override | |
public String getEmailId() { | |
return getDataManager().getEmailId(); | |
} |
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 CommonUtils { | |
public static boolean isEmailValid(String email) { | |
Pattern pattern; | |
Matcher matcher; | |
final String EMAIL_PATTERN = | |
"^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" | |
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; | |
pattern = Pattern.compile(EMAIL_PATTERN); | |
matcher = pattern.matcher(email); |
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 MvpApp extends Application { | |
DataManager dataManager; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
SharedPrefsHelper sharedPrefsHelper = new SharedPrefsHelper(getApplicationContext()); | |
dataManager = new DataManager(sharedPrefsHelper); |