@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.upload) { uploadFile(); return true; } else if (id == R.id.switch_accounts) { switchAccounts(); return true; } else if (id == R.id.logout) { mSession.logout(); initialize(); return true; } else if (id == R.id.logoutAll) { new Thread() { @Override public void run() { BoxAuthentication.getInstance().logoutAllUsers(getApplicationContext()); } }.start(); return true; } return super.onOptionsItemSelected(item); }
@Override public void onLoggedOut(BoxAuthentication.BoxAuthenticationInfo info, Exception ex) { if (sameUser(info)) { if (ex instanceof BoxAuthentication.NonDefaultClientLogoutException) { logout(); } else if (sessionAuthListener != null) { sessionAuthListener.onLoggedOut(info, ex); } } }