@Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case 0:

        // Logout the user
        ParseUser.logOut();

        Intent intent2 = new Intent(UserListActivity.this, ChatActivity.class);

        // For testing. fix later
        intent2.putExtra("chatUserEmail", "*****@*****.**");

        startActivity(intent2);

        return true;
      case 1:

        // Logout the user
        ParseUser.logOut();

        Intent intent = new Intent(UserListActivity.this, LoginActivity.class);
        startActivity(intent);

        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
Esempio n. 2
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
      return true;
    }

    if (id == R.id.action_search) {
      Toast.makeText(getApplicationContext(), "Search action is selected!", Toast.LENGTH_SHORT)
          .show();
      return true;
    }

    if (id == R.id.logoutButton) {
      /*
       * Log current user out using ParseUser.logOut()
       */
      ParseUser.logOut();
      Intent intent = new Intent(this, LoginOrSignUpActivity.class);
      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      startActivity(intent);
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
Esempio n. 3
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    switch (id) {
      case R.id.action_logout:
        ParseUser.logOut();
        navigateToLogin();
        break;
      case R.id.action_edit_friends:
        Intent intent = new Intent(MainActivity.this, EditFriendsActivity.class);
        startActivity(intent);
        break;
      case R.id.action_camera:
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setItems(R.array.camera_choices, mDialogListener);
        AlertDialog dialog = builder.create();
        dialog.show();
    }

    return super.onOptionsItemSelected(item);
  }
Esempio n. 4
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // menu item selected
   switch (item.getItemId()) {
     case R.id.action_shuffle:
       musicSrv.get().setShuffle();
       break;
     case R.id.action_end:
       stopService(playIntent);
       musicSrv.set(null);
       System.exit(0);
       break;
     case R.id.followButton:
       startActivity(new Intent(this, SelectUsersActivity.class));
       return true;
     case R.id.logoutButton:
       /*
        * Log current user out using ParseUser.logOut()
        */
       ParseUser.logOut();
       Intent intent = new Intent(this, LoginOrSignupActivity.class);
       intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
       startActivity(intent);
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
   return super.onOptionsItemSelected(item);
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    switch (id) {
      case R.id.updateStatus:
        // take user to update status
        Intent intent = new Intent(this, UpdateStatusActivity.class);
        startActivity(intent);

        break;

      case R.id.logoutUser:
        // logout the user
        ParseUser.logOut();

        // Take the user back to login screen
        Intent takeUserLogin = new Intent(this, LoginActivity.class);
        startActivity(takeUserLogin);

        break;
    }

    return super.onOptionsItemSelected(item);
  }
 /**
  * The function is called when the user presses the logout button on the activity. This signs out
  * the current user and returns the user back to the MainActivity
  *
  * @param v
  */
 public void logout(View v) {
   if (ParseUser.getCurrentUser() != null) {
     ParseUser.logOut();
     Intent intent = new Intent(this, MainActivity.class);
     startActivity(intent);
   }
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.profile) {
      Intent intent = new Intent(this, ProfileActivity.class);
      startActivity(intent);
      finish();
    }

    if (id == R.id.logout) {
      ParseUser.logOut();
      finish();
    }

    if (id == R.id.courses) {
      // show courses taken
      Intent intent = new Intent(this, DegreeProgressActivity.class);
      startActivity(intent);
      finish();
    }

    if (id == R.id.get_advised) {
      // show courses taken
      Intent intent = new Intent(this, GenerateSchedule.class);
      startActivity(intent);
      finish();
    }
    return super.onOptionsItemSelected(item);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.

    if (mDrawerToggle.onOptionsItemSelected(item)) {
      return true;
    }
    // Handle action buttons
    switch (item.getItemId()) {
      case R.id.action_logout:
        ParseUser.logOut();
        navigateToLogin();
        return true;
      case R.id.popup_menu_product1:
        Intent intent = new Intent(this, AddProduct1_Activity.class);
        startActivity(intent);
        return true;
      case R.id.popup_menu_product2:
        Intent intent2 = new Intent(this, AddProduct2_Activity.class);
        startActivity(intent2);
        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
Esempio n. 9
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    switch (id) {
      case R.id.newWubble:
        Intent toNewWubble = new Intent(this, NewWubbleActivity.class);
        startActivity(toNewWubble);
        break;

      case R.id.logOut:
        ParseUser.logOut();
        Intent toLogin = new Intent(this, LoginActivity.class);
        startActivity(toLogin);
        finish();
        break;

      case R.id.profileAct:
        Intent toProfile = new Intent(MovieActivity.this, ProfileActivity.class);
        startActivity(toProfile);
        break;

      case R.id.peopleSearch:
        Intent toPeopleSearch = new Intent(MovieActivity.this, PeopleSearchActivity.class);
        startActivity(toPeopleSearch);
        break;
    }

    return super.onOptionsItemSelected(item);
  }
Esempio n. 10
0
  /**
   * Execute item code when it is pressed on navigation drawer
   *
   * @param item
   * @return returns true
   */
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_logout) {
      ParseUser.logOut();
      if (ParseUser.getCurrentUser() == null) {
        Toast.makeText(MainActivity.this, "Logout Successful!", Toast.LENGTH_LONG).show();
        startActivity(new Intent(MainActivity.this, LoginActivity.class));
        finish();
      } else {
        Toast.makeText(MainActivity.this, "Logout Unsuccessful!", Toast.LENGTH_LONG).show();
      }

    } else if (id == R.id.nav_account_mod) {
      Intent intent = new Intent(this, AccSetActivity.class);
      startActivity(intent);

    } else if (id == R.id.nav_profile_mod) {
      Intent intent = new Intent(this, ProfileEditActivity.class);
      startActivity(intent);
    } else if (id == R.id.nav_favorites) {
      Intent intent = new Intent(this, FavoritesActivity.class);
      startActivity(intent);
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }
Esempio n. 11
0
 public static void logout() {
   ParseUser currentUser = ParseUser.getCurrentUser();
   if (currentUser != null) {
     currentUser.logOut();
     if (currentUser.get("facebookData") != null) {
       LoginManager.getInstance().logOut();
     }
   }
 }
Esempio n. 12
0
 public void onLogoutClick(View v) {
   etUsername.setText("");
   etPassword.setText("");
   etEmail.setText("");
   saveLocalSharedPrefs("", "");
   Util.resetSettings();
   ParseUser.logOut(); // what for?...
   showLogInORLogOut(true, false);
   openDropDBDialog();
 }
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.action_logout:
       ParseUser.logOut();
       Intent intent = new Intent(this, LoginActivity.class);
       startActivity(intent);
       finish();
       return true;
   }
   return false;
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    switch (id) {
      case R.id.updateStatus:
        // take user to update status
        Intent intent = new Intent(this, UpdateStatusActivity.class);
        startActivity(intent);

        break;

      case R.id.logoutUser:
        // logout the user
        ParseUser.logOut();

        // Take the user back to login screen
        Intent takeUserLogin = new Intent(this, LoginActivity.class);
        startActivity(takeUserLogin);

        break;

      case R.id.reloadStatus:
        // Reload status
        ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Status");
        query.orderByAscending("createdAt");

        query.findInBackground(
            new FindCallback<ParseObject>() {
              @Override
              public void done(List<ParseObject> status, ParseException e) {
                if (e == null) {
                  // Success
                  /*mStatus = status;
                  StatusAdapter adapter = new StatusAdapter(getListView().getContext(), mStatus);
                  setListAdapter(adapter);*/

                  LoadStatus(status);

                } else {
                  // there was a problem. Alert user

                }
              }
            });
        break;
    }

    return super.onOptionsItemSelected(item);
  }
  @SuppressWarnings("deprecation")
  @Override
  public boolean onMenuItemSelected(int featureId, MenuItem item) {
    if (item.getItemId() == R.id.logout) {
      ParseUser.logOut();
      navigateToLogin();
    } else if (item.getItemId() == R.id.action_post) {
      PostMessage();
    } else if (item.getItemId() == R.id.rumour_refresh) {
      RefreshRumours();
    }

    return super.onMenuItemSelected(featureId, item);
  }
Esempio n. 16
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.menu_btn_all:
       searchType =
           Consts.GooglePlaceSearchTypes.cafe
               + "|"
               + Consts.GooglePlaceSearchTypes.casino
               + "|"
               + Consts.GooglePlaceSearchTypes.food
               + "|"
               + Consts.GooglePlaceSearchTypes.restaurant;
       setTitle("Enter search text");
       mMenu.showContent();
       break;
     case R.id.menu_btn_beer:
       searchType = Consts.GooglePlaceSearchTypes.bar;
       setTitle("Search for Bars");
       mMenu.showContent();
       break;
     case R.id.menu_btn_food:
       searchType = Consts.GooglePlaceSearchTypes.restaurant;
       setTitle("Search for Restaurants");
       mMenu.showContent();
       break;
     case R.id.menu_btn_night:
       searchType = Consts.GooglePlaceSearchTypes.night_club;
       setTitle("Search for Nightclubs");
       mMenu.showContent();
       break;
     case R.id.menu_btn_calendar:
       startActivity(new Intent(this, Calendar.class));
       break;
     case R.id.menu_btn_logout:
       ParseUser.logOut();
       finish();
       break;
   }
 }
Esempio n. 17
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {

    int id = item.getItemId();
    if (id == R.id.action_search_doctor) {
      Intent intent = new Intent(SearchPatientByAdmin.this, SearchDoctorByAdmin.class);
      startActivity(intent);
      finish();
      return true;
    } else if (id == R.id.action_update) {
      Intent intent = new Intent(SearchPatientByAdmin.this, UpdateMedSympByAdmin.class);
      startActivity(intent);
      finish();
      return true;
    } else if (id == R.id.action_logout) {
      ParseUser.logOut();
      Intent intent = new Intent(SearchPatientByAdmin.this, LoginActivity.class);
      startActivity(intent);
      finish();
      return true;
    }
    return super.onOptionsItemSelected(item);
  }
Esempio n. 18
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();

    switch (itemId) {
      case R.id.action_logout:
        ParseUser.logOut();
        navigateToLogin();
        break;
      case R.id.action_edit_friends:
        Intent intent = new Intent(this, EditFriendsActivity.class);
        startActivity(intent);
        break;
      case R.id.action_camera:
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setItems(R.array.camera_choices, mDialogListener);
        AlertDialog dialog = builder.create();
        dialog.show();
        break;
    }

    return super.onOptionsItemSelected(item);
  }
Esempio n. 19
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //        //noinspection SimplifiableIfStatement
    //        if (id == R.id.action_settings) {
    //            return true;
    //        }
    // if the log out button is selected, log out of Parse and go back to log in page
    if (id == R.id.action_logout) {
      ParseUser.logOut();
      Intent intent = new Intent(NavigationActivity.this, LoginSignupActivity.class);
      startActivity(intent);
      Toast.makeText(getApplicationContext(), "Successfully Logged out", Toast.LENGTH_LONG).show();

      finish();
    }

    return super.onOptionsItemSelected(item);
  }
Esempio n. 20
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.logoutButton) {
      ParseUser.logOut();
      navigateToLogin();
    } else if (id == R.id.profileButton) {
      if (!isKid()) {
        Intent intent = new Intent(this, ParentView.class);
        startActivity(intent);
      }
    }

    //        else if (id== R.id.profileButton){
    //            startActivity(new Intent(this, ProfileActivity.class));
    //        }

    return super.onOptionsItemSelected(item);
  }
Esempio n. 21
0
 /** Called when the user clicks the Logout button */
 public void logoutCallback() {
   ParseUser.logOut();
   final Intent intent = new Intent(this, AuthenticationActivity.class);
   startActivity(intent);
 }
Esempio n. 22
0
 public static void logOutParseUser() {
   ParseUser.logOut();
   ParseUser currentUser = ParseUser.getCurrentUser(); // this will now be null
 }
Esempio n. 23
0
 @Override
 protected void onStop() {
   super.onStop();
   ParseUser.logOut();
 }
Esempio n. 24
0
 public static void logout() {
   ParseUser.logOut();
 }
Esempio n. 25
0
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {

    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
    /*
    Handle navigation view item clicks here and also
     handle the Fragment Transactions . @Skylifee7
     */

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(true);

    int id = item.getItemId();

    if (id == R.id.nav_home) {

      HomeFragment homeFragment = new HomeFragment();
      fragmentTransaction.replace(R.id.navcontent, homeFragment, "HOME_FRAGMENT");
      fragmentTransaction.commit();

      String mTitle = "Home";
      actionBar.setTitle(mTitle);

    } else if (id == R.id.nav_lastevent) {

      EventFragment eventFragment = new EventFragment();
      fragmentTransaction.replace(R.id.navcontent, eventFragment, "HOME_FRAGMENT");
      fragmentTransaction.commit();

      String mTitle = "Last Event";
      actionBar.setTitle(mTitle);

    } else if (id == R.id.nav_userprofile) {

      ProfileFragment profileFragment = new ProfileFragment();
      fragmentTransaction.replace(R.id.navcontent, profileFragment, "PROFILE_FRAGMENT");
      fragmentTransaction.commit();

      String mTitle = "Profile";
      actionBar.setTitle(mTitle);

    } else if (id == R.id.nav_settings) {

      String mTitle = "Settings";
      actionBar.setTitle(mTitle);

      Intent takeUsertoSettings = new Intent(this, SettingsActivity.class);
      startActivity(takeUsertoSettings);

    } else if (id == R.id.nav_security) {

      /*ProfileListFragment profileListFragment = new ProfileListFragment();
                  fragmentTransaction.replace(R.id.navcontent, profileListFragment, "PROFILELIST_FRAGMENT");
                  fragmentTransaction.commit();

      */

      if (isVerified) {

        Intent intent = new Intent(this, EventCreateActivity.class);
        startActivity(intent);

      } else {

        /*
                        Snackbar snackbar = Snackbar
                                .make(getApplicationContext(), "You are not authorized to create event!", Snackbar.LENGTH_LONG)
                                .setAction("action", null);
                        snackbar.show();

        */
        HomeFragment homeFragment = new HomeFragment();
        fragmentTransaction.replace(R.id.navcontent, homeFragment, "HOME_FRAGMENT");
        fragmentTransaction.commit();
      }
    } else if (id == R.id.nav_randomfacts) {

      RandomFacts facts = new RandomFacts();
      String fact = facts.getFact();
      NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
      Snackbar.make(navigationView, fact, Snackbar.LENGTH_LONG).setAction("Action", null).show();

      String mTitle = "Random Facts";
      actionBar.setTitle(mTitle);
    } else if (id == R.id.nav_logout) {

      /*
      Intent takeUserCreate = new Intent(this, EventCreateActivity.class);
      startActivity(takeUserCreate);
      */

      ParseUser.logOut();
      Intent takeUserLogin = new Intent(this, LoginActivity.class);
      startActivity(takeUserLogin);
    }

    /*
    Highlight the selected item, update the title, and close the drawer simultaneuosly @Skylifee7
     */
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }