Example #1
0
  @Override
  public void setEnabled(boolean enabled) {
    if (enabled) switchToStandardInput();
    else switchToManualInput();
    mPathEditText.setEnabled(enabled);
    mGoButton.setVisibility(enabled ? View.VISIBLE : View.GONE);

    super.setEnabled(enabled);
  }
Example #2
0
 /**
  * Use instead of {@link #cd(String)} when in {@link Mode#MANUAL_INPUT}.
  *
  * @param path The path to cd() to.
  * @return true if the cd succeeded.
  */
 private boolean manualInputCd(String path) {
   if (cd(path)) {
     // if cd() successful, hide the keyboard
     InputMethodManager imm =
         (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
     imm.hideSoftInputFromWindow(getWindowToken(), 0);
     switchToStandardInput();
     return true;
   } else {
     Log.w(TAG, "Input path does not exist or is not a folder!");
     return false;
   }
 }
Example #3
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;
  }