@Override
 public void onBackPressed() {
   Fragment fragment = getMainFragment();
   if (!(fragment instanceof BaseFragment)) {
     super.onBackPressed();
   } else if (((BaseFragment) fragment).onBackKeyPressed()) {
     super.onBackPressed();
   }
 }
  @Override
  public void onBackPressed() {
    super.onBackPressed();

    Intent NextActivity = new Intent(CreateAccountActivity.this, LoginActivity.class);
    startActivity(NextActivity);
  }
  @Override
  public void onBackPressed() {
    if (getFragmentManager().getBackStackEntryCount() != 0) {
      // show action bar
      ActionBar actionBar = getSupportActionBar();
      if (actionBar != null) actionBar.show();
      // show main fragment
      getFragmentManager().popBackStack();
    } else {
      if (doubleBackToExitPressedOnce) {
        super.onBackPressed();
        timer.cancel();
      }

      this.doubleBackToExitPressedOnce = true;
      Toast.makeText(this, getString(R.string.fragment_login_twotaptoexit), Toast.LENGTH_SHORT)
          .show();
      new Handler()
          .postDelayed(
              new Runnable() {

                @Override
                public void run() {
                  doubleBackToExitPressedOnce = false;
                }
              },
              3000);
    }
  }
 @Override
 public void onBackPressed() {
   if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
     drawerLayout.closeDrawers();
     return;
   } else {
     if (((BaseFragment) mStacks.get(mCurrentTab).lastElement()).onBackPressed() == false) {
       /*
        * top fragment in current tab doesn't handles back press, we can do our thing, which is
        *
        * if current tab has only one fragment in stack, ie first fragment is showing for this tab.
        *        finish the activity
        * else
        *        pop to previous fragment in stack for the same tab
        *
        */
       if (mStacks.get(mCurrentTab).size() == 1) {
         super.onBackPressed(); // or call finish..
       } else {
         popFragments();
       }
     } else {
       // do nothing.. fragment already handled back button press.
     }
   }
 }
  @Override
  public void onBackPressed() {

    // Fragment f = getFragmentManager().findFragmentById(R.id.content_frame);

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
      drawer.closeDrawer(GravityCompat.START);
    } else if (getFragmentManager().getBackStackEntryCount() > 0) {

      getFragmentManager().popBackStack();
      getFragmentManager().executePendingTransactions();
      Fragment f = getFragmentManager().findFragmentById(R.id.content_frame);
      int id = f.getArguments().getInt(FoodFragment.ARG_CAT_NUMBER);
      setPageTitle(id);

      // Fragment f = getFragmentManager().findFragmentById(R.id.content_frame);
      // int id = f.getArguments().getInt(FoodFragment.ARG_CAT_NUMBER);
      // setPageTitle(id);
      Log.w("EatThruCollege", "popped from backstack");
      //   getSupportFragmentManager().executePendingTransactions();
    } else {
      Log.w("EatThruCollege", "did not add to backstack");
      super.onBackPressed();
    }
  }
 @Override
 public void onBackPressed() {
   finish();
   overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
   startActivity(new Intent(SessionsListActivity.this, MainActivity.class));
   super.onBackPressed();
 }
示例#7
0
 @Override
 public void onBackPressed() {
   // Do nothing if go back lock is enabled or slide has custom policy.
   if (!isGoBackLockEnabled) {
     super.onBackPressed();
   }
 }
示例#8
0
 @Override
 public void onBackPressed() {
   if (!morphyToolbar.isCollapsed()) {
     hideFab();
     morphyToolbar.collapse();
   } else super.onBackPressed();
 }
  @Override
  public void onBackPressed() {

    if (isImagesThumbnailShown()) {
      // Return to albums fragment
      getSupportFragmentManager().popBackStack();
      getSupportActionBar().setTitle(R.string.albums_title);
      mShouldShowUp = mPickOptions.backBtnInMainActivity;
      getSupportActionBar().setDisplayHomeAsUpEnabled(mShouldShowUp);
      hideSelectAll();
      hideDeselectAll();

    } else if (isImagesPagerShown()) {
      // Returns to images thumbnail fragment

      if (mSelectedAlbum == null) {
        mSelectedAlbum =
            EventBus.getDefault().getStickyEvent(Events.OnClickAlbumEvent.class).albumEntry;
      }
      mDoneFab.setVisibility(View.GONE);
      getSupportFragmentManager().popBackStack(ImagesThumbnailFragment.TAG, 0);
      getSupportActionBar().setTitle(mSelectedAlbum.name);
      getSupportActionBar().show();
      showSelectAll();

    } else {
      // User on album fragment
      super.onBackPressed();
      onCancel();
    }
  }
 @Override
 public void onBackPressed() {
   if (mActionMode != null) {
     mActionMode.finish();
     closeActionMode();
   } else super.onBackPressed();
 }
示例#11
0
  @Override
  public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
      drawer.closeDrawer(GravityCompat.START);
    } else {
      super.onBackPressed();
    }

    if (isSearchOpened) {
      handleMenuSearch();
      return;
    } else {
      super.onBackPressed();
    }
  }
  @Override
  public void onBackPressed() {
    mwBoard.setConnectionStateHandler(null);
    mwBoard.disconnect();

    super.onBackPressed();
  }
  @Override
  public void onBackPressed() {
    super.onBackPressed();

    Utilities.setDirectionImage("STOP", ivDirection, bt);
    bt.stop();
  }
示例#14
0
 @Override
 public void onBackPressed() {
   if (onBackPressed) super.onBackPressed();
   else {
     showBackDialog();
   }
 }
  @Override
  public void onBackPressed() {
    drawerLayout.closeDrawers();
    int count = getSupportFragmentManager().getBackStackEntryCount();
    if (count > 0) {
      FragmentManager.BackStackEntry entry =
          getSupportFragmentManager().getBackStackEntryAt(count - 1);
      if (entry.getName().equalsIgnoreCase(HOME_FRAGMENT_TAG)) {

        which = HOME_FRAGMENT;
        invalidateOptionsMenu();
      } else if (entry.getName().equalsIgnoreCase(DIET_FRAGMENT_TAG)) {
        which = HOME_FRAGMENT;
        invalidateOptionsMenu();
      } else if (entry.getName().equalsIgnoreCase(GENERAL_FRAGMENT_TAG)) {
        which = HOME_FRAGMENT;
        invalidateOptionsMenu();
      } else if (entry.getName().equalsIgnoreCase(CREATE_DIET_FRAGMENT_TAG)) {
        which = DIET_FRAGMENT;
        invalidateOptionsMenu();
      }
    }
    mode = EDIT_MODE;
    super.onBackPressed();
    overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
  }
示例#16
0
 @Override
 public void onBackPressed() {
   if (mLayout != null && (mLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED)) {
     mLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
     setAllBtmButtonsVisible();
     setAllPanelsGone();
   } else if (mLayout2 != null
       && (mLayout2.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED)) {
     mLayout2.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
     setAllBtmButtonsVisible();
     setAllPanelsGone();
   } else if (mLayout3 != null
       && (mLayout3.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED)) {
     mLayout3.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
     setAllBtmButtonsVisible();
     setAllPanelsGone();
   } else if (mLayout4 != null
       && (mLayout4.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED)) {
     mLayout4.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
     setAllBtmButtonsVisible();
     setAllPanelsGone();
   } else {
     super.onBackPressed();
   }
 }
 public void onBackPressed() {
   if (getFragmentManager().getBackStackEntryCount() == 0) {
     super.onBackPressed();
   } else {
     getFragmentManager().popBackStack();
   }
 }
 @Override
 public void onBackPressed() {
   if (JCVideoPlayer.backPress()) {
     return;
   }
   super.onBackPressed();
 }
示例#19
0
 @Override
 public void onBackPressed() {
   DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
   String attachedFragment = fragmentManager.findFragmentById(R.id.container).getTag();
   if (drawer.isDrawerOpen(GravityCompat.START)) {
     drawer.closeDrawer(GravityCompat.START);
   } else {
     switch (attachedFragment) {
       case Constants.FRAGMENT_NOTE:
       case Constants.FRAGMENT_TRASH_NOTE:
         if (textToFind.length() == 0) attachFragment(Constants.FRAGMENT_LIST);
         else attachFragment(Constants.FRAGMENT_SEARCH);
         break;
       case Constants.FRAGMENT_SEARCH:
         attachFragment(Constants.FRAGMENT_LIST);
         break;
       case Constants.FRAGMENT_LIST:
         if (!exit) {
           exit = true;
           handler.postDelayed(exitRunnable, 5000);
           Utils.showToast(this, getString(R.string.press_back_button_again_to_exit));
         } else {
           // Exit flag reset and canceling exit runnable in onStop method to handle home button
           // presses
           super.onBackPressed();
         }
         break;
     }
   }
 }
示例#20
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (item.getItemId() == android.R.id.home && mIsBackNav) {
     super.onBackPressed();
   }
   return super.onOptionsItemSelected(item);
 }
示例#21
0
 @Override
 public void onBackPressed() {
   if (getSupportFragmentManager().getBackStackEntryCount() < 2) {
     finish();
   }
   super.onBackPressed();
 }
 @Override
 public void onBackPressed() {
   super.onBackPressed();
   bt.sendMessage(Integer.toString(3));
   bt.stop();
   finish();
 }
示例#23
0
 @Override
 public void onBackPressed() {
   if (menuDrawer != null && menuDrawer.isDrawerOpen()) {
     menuDrawer.closeDrawer();
   } else {
     super.onBackPressed();
   }
 }
 @Override
 public void onBackPressed() {
   if (frame_controls.getVisibility() == RelativeLayout.VISIBLE) displayOptions();
   else {
     sendBT("212");
     super.onBackPressed();
   }
 }
示例#25
0
 @Override
 public void onBackPressed() {
   if (drawerLayout.isDrawerOpen(Gravity.START)) {
     drawerLayout.closeDrawers();
     return;
   }
   super.onBackPressed();
 }
 @Override
 public void onBackPressed() {
   if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
     hideDrawer();
   } else {
     super.onBackPressed();
   }
 }
 @Override
 public void onBackPressed() {
   if (getmBackHandler() != null) {
     getmBackHandler().onBackPressed();
   } else {
     super.onBackPressed();
   }
 }
示例#28
0
 @Override
 public void onBackPressed() {
   if (_drawer.isDrawerOpen(GravityCompat.START)) {
     _drawer.closeDrawer(GravityCompat.START);
   } else {
     super.onBackPressed();
   }
 }
示例#29
0
 @Override
 public void onBackPressed() {
   if (result != null && result.isDrawerOpen()) {
     result.closeDrawer();
   } else {
     super.onBackPressed();
   }
 }
 @Override
 public void onBackPressed() {
   BasePresenter presenter = getPresenter();
   if (presenter != null && presenter.onBackPressed()) {
     return;
   }
   super.onBackPressed();
 }