Esempio n. 1
0
  /**
   * Activities containing this bar, will have to call this method when the back button is pressed
   * to provide correct backstack redirection and mode switching.
   *
   * @return Whether this view consumed the event.
   */
  public boolean pressBack() {
    // Switch mode.
    if (mCurrentMode == Mode.MANUAL_INPUT) {
      switchToStandardInput();
    }
    // Go back.
    else if (mCurrentMode == Mode.STANDARD_INPUT) {
      if (!backWillExit(mCurrentDirectory.getAbsolutePath())) {
        cd(mCurrentDirectory.getParent());
        return true;
      } else return false;
    }

    return true;
  }
Esempio n. 2
0
 /**
  * Sets the directory the parent activity showed first so that back behavior is fixed.
  *
  * @param initDir The directory.
  */
 public void setInitialDirectory(File initDir) {
   mInitialDirectory = initDir;
   cd(initDir);
 }