Example #1
0
  @Override
  protected void onStart() {
    super.onStart();

    super.onStart();
    mInternetAvailable = NetworkChecker.isConnected(MainActivity.this);
    MyTextView errorMsg = (MyTextView) findViewById(R.id.noInternetMessage);
    if (mInternetAvailable) errorMsg.setVisibility(View.INVISIBLE);
    else errorMsg.setVisibility(View.VISIBLE);
  }
Example #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();
      }
    }
  }