Example #1
0
 /**
  * Handles what happens when user wants to reset password.
  *
  * @param view the button clicked
  */
 public void resetPassword(View view) {
   Log.i("Leaderboard", "user resets password");
   // Sort through the reset info
   AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
   lp.resetPassword(alertDialogBuilder);
   // Go back to the login popup
   buildPopup(true);
 }
Example #2
0
 /**
  * Exits the login popup window
  *
  * @param view the button clicked
  */
 public void exitLoginPopup(View view) {
   Log.i("Leaderboard", "user exits log in");
   lp.exitLoginPopup();
   // add the relativeScore tab
   FragmentTransaction fst = getSupportFragmentManager().beginTransaction();
   fst.replace(R.id.leaderboard_layout, mainCurrentFragment);
   fst.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
   fst.commit();
 }
Example #3
0
  /**
   * Builds a popup window for the login popup
   *
   * @param dismisspsw If the password popup is currently being displayed (and therefore should be
   *     dismissed)
   */
  private void buildPopup(boolean dismisspsw) {
    // set up the layout inflater to inflate the popup layout
    LayoutInflater layoutInflater =
        (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    // the parent layout to put the layout in
    ViewGroup parentLayout = (ViewGroup) findViewById(R.id.leaderboard_layout);

    // inflate either the login layout
    lp.buildLoginPopup(layoutInflater, parentLayout, dismisspsw);
  }
Example #4
0
  /**
   * Handles what happens when user clicks the "Forgot your password" link
   *
   * @param view Button that is pressed
   */
  public final void forgotPassword(View view) {
    Log.i("Leaderboard", "user has forgotten password");

    // set up the layout inflater to inflate the popup layout
    LayoutInflater layoutInflater =
        (LayoutInflater) getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);

    // the parent layout to put the layout in
    ViewGroup parentLayout = (ViewGroup) findViewById(R.id.leaderboard_layout);

    // inflate the password layout
    lp.buildResetPopup(layoutInflater, parentLayout);
  }
Example #5
0
 /**
  * Handles what happens when user clicks the login button
  *
  * @param view Button that is pressed
  */
 public void loginButton(final View view) {
   // Try to login
   String usernameString;
   try {
     usernameString = lp.loginButton();
   } catch (InternetConnectionException e) {
     e.fillInStackTrace();
     Log.i("Leaderboard", "triggering internet connection error screen");
     Intent intent = new Intent(this, ErrorScreen.class);
     intent.putExtra("error", R.layout.activity_connection_error_lb);
     startActivity(intent);
     return;
   }
   // If login was successful, go to the multiplayer game
   if (!usernameString.equals("")) {
     exitLoginPopup(view);
     relativeUserScore();
   }
 }