示例#1
0
  /**
   * parseLoginService
   *
   * @param responseStr
   * @throws Exception
   */
  private void parseLoginService(String responseStr) throws Exception {
    Log.i("Login", responseStr);
    Gson gson = new Gson();
    LoginResponseModel get_Response = gson.fromJson(responseStr, LoginResponseModel.class);

    if (get_Response != null) {
      if (get_Response.getReponseCode().equals(ApplicationConstants.SUCCESS_CODE)) {
        try {
          setDataToMemory(get_Response);
        } catch (Exception ex) {
          ex.printStackTrace();
        }
        // startService(new Intent(LoginActivity.this,NotificationService.class));
        // NotificationAlart.stop(LoginActivity.this);
        // NotificationAlart.start(LoginActivity.this);
        saveSharedPreference.setIsLogin(LoginActivity.this, "");
        if (null != saveSharedPreference.getGroupId(LoginActivity.this)
            && !saveSharedPreference.getGroupId(LoginActivity.this).equals("")) {
          moveToDashboardScreen();
        } else {
          moveToGroupSelectionActivity();
        }

      } else {
        ErrorMsgDialog.showErrorAlert(LoginActivity.this, "", get_Response.getMessage());
      }
    } else {
      ErrorMsgDialog.showErrorAlert(
          LoginActivity.this, "", getString(R.string.wrng_str_server_error));
    }
  }
示例#2
0
 /**
  * This method is use for to save the data in memory
  *
  * @param mLoginResponseModel
  * @throws Exception
  */
 private void setDataToMemory(LoginResponseModel mLoginResponseModel) throws Exception {
   if (mLoginResponseModel.getData != null) {
     if (mLoginResponseModel.getData.getId() != null) {
       saveSharedPreference.setUserId(LoginActivity.this, mLoginResponseModel.getData.getId());
     }
     if (mLoginResponseModel.getData.getUser_email() != null) {
       saveSharedPreference.setUserEmail(
           LoginActivity.this, mLoginResponseModel.getData.getUser_email());
     }
     if (mLoginResponseModel.getData.getIs_active() != null) {
       saveSharedPreference.setUserIsActive(
           LoginActivity.this, mLoginResponseModel.getData.getIs_active().toString());
     }
     if (mLoginResponseModel.getData.getIs_confirm() != null) {
       saveSharedPreference.setUserIsConfirm(
           LoginActivity.this, mLoginResponseModel.getData.getIs_confirm().toString());
     }
     if (mLoginResponseModel.getData.getProfile_image() != null) {
       saveSharedPreference.setUserImage(
           LoginActivity.this, mLoginResponseModel.getData.getProfile_image());
     }
     if (mLoginResponseModel.getData.getProfile_completion_status() != null) {
       saveSharedPreference.setUserProfilePercentage(
           LoginActivity.this, mLoginResponseModel.getData.getProfile_completion_status());
     }
     if (mLoginResponseModel.getData.getGroup_type() != null) {
       saveSharedPreference.setGroupType(
           LoginActivity.this, mLoginResponseModel.getData.getGroup_type());
     }
     if (mLoginResponseModel.getData.getRating() != null) {
       saveSharedPreference.setUserRating(
           LoginActivity.this, mLoginResponseModel.getData.getRating());
     }
     if (mLoginResponseModel.getData.getNext_shuffle() != null) {
       saveSharedPreference.setUserNextShuffle(
           LoginActivity.this, mLoginResponseModel.getData.getNext_shuffle());
     }
     if (mLoginResponseModel.getData.getFname() != null) {
       saveSharedPreference.setUserFname(
           LoginActivity.this, mLoginResponseModel.getData.getFname());
     }
     if (mLoginResponseModel.getData.getLname() != null) {
       saveSharedPreference.setUserLname(
           LoginActivity.this, mLoginResponseModel.getData.getLname());
     }
     if (mLoginResponseModel.getData.getGroup_id() != null) {
       saveSharedPreference.setGroupId(
           LoginActivity.this, mLoginResponseModel.getData.getGroup_id());
     }
     if (mLoginResponseModel.getData.getCity() != null) {
       saveSharedPreference.setCity(LoginActivity.this, mLoginResponseModel.getData.getCity());
     }
     if (mLoginResponseModel.getData.getZipcode() != null) {
       saveSharedPreference.setZipCode(
           LoginActivity.this, mLoginResponseModel.getData.getZipcode());
     }
   }
 }