Ejemplo n.º 1
0
  @Override
  protected void onResponseReceived(
      boolean succeed, JSONObject jsonResponse, Request request, Response response) {
    if (succeed) {
      // Parsing project
      Project proj = getProps().getProject();
      proj.setName(project);
      JSONProjectParser projParser = new JSONProjectParser();
      JSONObject projectJSON = jsonResponse.get(JSONConstants.KEY_PROJECT).isObject();
      projParser.fillProject(proj, projectJSON);

      // Parsing current user
      User user = getProps().getUser();
      user.setLogin(login);
      user.setPwd(pwd);
      JSONObject userJSON = jsonResponse.get(JSONConstants.KEY_USER).isObject();
      JSONUserParser userParser = new JSONUserParser();
      userParser.fillUser(user, userJSON);

      // parsing of the project members
      JSONMemberParser.parseListMembers(jsonResponse, proj);

      parentScreen.onValidLogin();
    } else {
      parentScreen.onWrongLogin();
    }
  }
Ejemplo n.º 2
0
  /**
   * login handler
   *
   * @param parentScreen
   */
  public LoginRequestHandler(LoginScreen parentScreen, String project, String login, String pwd) {
    super(parentScreen.getApp().getProps());
    this.parentScreen = parentScreen;

    this.project = project;
    this.login = login;
    this.pwd = pwd;
  }