private void updateOrFinish() {
   if (authenticationGateway.isAuthenticated()) {
     update();
   } else {
     finish();
   }
 }
 private void updateOrSignIn() {
   if (authenticationGateway.isAuthenticated()) {
     update();
   } else {
     showSignInDialog();
   }
 }
 private void addSignOutMenuItem(Menu menu) {
   MenuItem signOutMenuItem = menu.add("Sign Out");
   signOutMenuItem.setEnabled(authenticationGateway.isAuthenticated());
   signOutMenuItem.setOnMenuItemClickListener(
       new MenuItem.OnMenuItemClickListener() {
         @Override
         public boolean onMenuItemClick(MenuItem item) {
           authenticationGateway.signOut();
           finish();
           return true;
         }
       });
 }