Guest User

Untitled

a guest
Dec 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. package com.anubhavmalikdeveloper.letsmvp.Presenter;
  2.  
  3. import android.content.Context;
  4. import android.content.Intent;
  5. import android.support.v4.app.Fragment;
  6. import android.widget.Toast;
  7.  
  8. import com.anubhavmalikdeveloper.letsmvp.Contracts.LoginContract;
  9.  
  10. public class LoginPresenter implements LoginContract.MainContract {
  11. private Context context;
  12. private LoginContract.View view;
  13.  
  14. public LoginPresenter(Context context, LoginContract.View view) {
  15. this.context = context;
  16. this.view = view;
  17. }
  18.  
  19. @Override
  20. public void startActivity(Context context, Class target) {
  21. context.startActivity(new Intent(context, target));
  22. }
  23.  
  24. @Override
  25. public void switchFragment(Context context, Fragment fragment) {
  26. //
  27. }
  28.  
  29. @Override
  30. public boolean validateLogin(String email, String password) {
  31. //This should contains business logic to authenticate and verify user
  32. // and then based on the result provide a boolean
  33. // indicating the status of login of the user
  34. // Since we are not doing any of those things here,
  35. //we will just return true every time indicating that user is authenticated.
  36.  
  37. view.showToast(context, "Login successful", Toast.LENGTH_SHORT);
  38. return true;
  39. }
  40. }
Add Comment
Please, Sign In to add comment