Пример #1
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
      case OUTLINE_REQUEST:
        if (resultCode >= 0) mDocView.setDisplayedViewIndex(resultCode);
        break;
      case PRINT_REQUEST:
        if (resultCode == RESULT_CANCELED) showInfo(getString(R.string.print_failed));
        break;
      case FILEPICK_REQUEST:
        if (mFilePicker != null && resultCode == RESULT_OK) mFilePicker.onPick(data.getData());
      case PROOF_REQUEST:
        //  we're returning from a proofing activity

        if (mProofFile != null) {
          core.endProof(mProofFile);
          mProofFile = null;
        }

        //  return the top bar to default
        mTopBarMode = TopBarMode.Main;
        mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal());
    }

    super.onActivityResult(requestCode, resultCode, data);
  }
Пример #2
0
 public void OnInkButtonClick(View v) {
   mTopBarMode = TopBarMode.Accept;
   mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal());
   mAcceptMode = AcceptMode.Ink;
   mDocView.setMode(MuPDFReaderView.Mode.Drawing);
   mAnnotTypeText.setText(R.string.ink);
   showInfo(getString(R.string.draw_annotation));
 }
Пример #3
0
 public void OnStrikeOutButtonClick(View v) {
   mTopBarMode = TopBarMode.Accept;
   mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal());
   mAcceptMode = AcceptMode.StrikeOut;
   mDocView.setMode(MuPDFReaderView.Mode.Selecting);
   mAnnotTypeText.setText(R.string.strike_out);
   showInfo(getString(R.string.select_text));
 }
Пример #4
0
 private void searchModeOn() {
   if (mTopBarMode != TopBarMode.Search) {
     mTopBarMode = TopBarMode.Search;
     // Focus on EditTextWidget
     mSearchText.requestFocus();
     showKeyboard();
     mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal());
   }
 }
Пример #5
0
 private void searchModeOff() {
   if (mTopBarMode == TopBarMode.Search) {
     mTopBarMode = TopBarMode.Main;
     hideKeyboard();
     mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal());
     SearchTaskResult.set(null);
     // Make the ReaderView act on the change to mSearchTaskResult
     // via overridden onChildSetup method.
     mDocView.resetupChildren();
   }
 }
Пример #6
0
 public void OnCancelAcceptButtonClick(View v) {
   MuPDFView pageView = (MuPDFView) mDocView.getDisplayedView();
   if (pageView != null) {
     pageView.deselectText();
     pageView.cancelDraw();
   }
   mDocView.setMode(MuPDFReaderView.Mode.Viewing);
   switch (mAcceptMode) {
     case CopyText:
       mTopBarMode = TopBarMode.More;
       break;
     default:
       mTopBarMode = TopBarMode.Annot;
       break;
   }
   mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal());
 }
Пример #7
0
  public void OnAcceptButtonClick(View v) {
    MuPDFView pageView = (MuPDFView) mDocView.getDisplayedView();
    boolean success = false;
    switch (mAcceptMode) {
      case CopyText:
        if (pageView != null) success = pageView.copySelection();
        mTopBarMode = TopBarMode.More;
        showInfo(
            success
                ? getString(R.string.copied_to_clipboard)
                : getString(R.string.no_text_selected));
        break;

      case Highlight:
        if (pageView != null) success = pageView.markupSelection(Annotation.Type.HIGHLIGHT);
        mTopBarMode = TopBarMode.Annot;
        if (!success) showInfo(getString(R.string.no_text_selected));
        break;

      case Underline:
        if (pageView != null) success = pageView.markupSelection(Annotation.Type.UNDERLINE);
        mTopBarMode = TopBarMode.Annot;
        if (!success) showInfo(getString(R.string.no_text_selected));
        break;

      case StrikeOut:
        if (pageView != null) success = pageView.markupSelection(Annotation.Type.STRIKEOUT);
        mTopBarMode = TopBarMode.Annot;
        if (!success) showInfo(getString(R.string.no_text_selected));
        break;

      case Ink:
        if (pageView != null) success = pageView.saveDraw();
        mTopBarMode = TopBarMode.Annot;
        if (!success) showInfo(getString(R.string.nothing_to_save));
        break;
    }
    mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal());
    mDocView.setMode(MuPDFReaderView.Mode.Viewing);
  }
Пример #8
0
 public void OnCancelDeleteButtonClick(View v) {
   MuPDFView pageView = (MuPDFView) mDocView.getDisplayedView();
   if (pageView != null) pageView.deselectAnnotation();
   mTopBarMode = TopBarMode.Annot;
   mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal());
 }
Пример #9
0
 public void OnCancelAnnotButtonClick(View v) {
   mTopBarMode = TopBarMode.More;
   mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal());
 }
Пример #10
0
 public void OnEditAnnotButtonClick(View v) {
   mTopBarMode = TopBarMode.Annot;
   mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal());
 }