Advertisement
Guest User

sajtoskuki

a guest
Jun 25th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. public class Auth {
  2.  
  3. public interface AuthOnCompleteListener {
  4. public void szöxessz();
  5. public void féjl();
  6. }
  7. ...
  8. private AuthOnCompleteListener listener;
  9. private NetworkManager nm;
  10. private static final String BASE_URL = "www.google.hu";
  11. private static final String LOGIN_URL = BASE_URL + "/login";
  12. ...
  13. public Auth(AuthOnCompleteListener listener){
  14. this.listener = listener;
  15. }
  16. ...
  17. public void login(String username, String pass){
  18. String shaPass = Encrypter.toSHA(pass);
  19. nm.get(LOGIN_URL+"?user="+username+"&password="+shaPass, new OnResponse(){
  20. public void onSuccess(){
  21. listener.szöxessz();
  22. }
  23. public void onFail(){
  24. listener.féjl()
  25. }
  26. })
  27. }
  28. ...
  29. }
  30.  
  31.  
  32. // másik file a controller
  33.  
  34. public class LoginScreenController extends Activity implements AuthOnCompleteListener {
  35. ...
  36. private Auth auth;
  37. ...
  38. public void onCreate(){
  39. auth = new Auth(this);
  40. }
  41. ...
  42. public void szöxessz(){
  43. ...
  44. }
  45. ...
  46. public void féjl(){
  47. ...
  48. }
  49. ...
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement