Esempio n. 1
0
  private boolean checkValidation() {
    boolean ret = true;

    if (!Validation.hasText(username)) ret = false;
    if (!Validation.hasText(password)) ret = false;

    return ret;
  }
Esempio n. 2
0
  /**
   * Called when user presses Login button.
   *
   * <p>Checks to see if user-entered username is an already registered user. If not, it prompts the
   * user to register.
   *
   * @param view view that is clicked
   */
  public void logInUser(View view) {
    EditText etUsername = (EditText) findViewById(R.id.enterUsername);
    String username = etUsername.getText().toString().trim();

    UserRegistrationController urc = new UserRegistrationController(this);
    userManager = new ESUserManager("");

    // Try to retrieve the data. If no internet, pop up some toast to say so.
    if (!NetworkChecker.isNetworkAvailable(this)) {
      Toast.makeText(
              this,
              "No internet connection.  Please check your internet connection and try again.",
              Toast.LENGTH_LONG)
          .show();
    } else {
      if (Validation.hasText(etUsername)) {
        // Calls GetThreat to check if user is on server
        Thread thread = new GetThread(username);
        thread.start();
      }
    }
  }