/**
  * The description is the opposite of the current state because the button text describes what
  * will happen if you press it.
  */
 public String getBibleBookSortOrderButtonDescription() {
   if (BibleBookSortOrder.BIBLE_BOOK.equals(getBibleBookSortOrder())) {
     return CommonUtils.getResourceString(R.string.sort_by_alphabetical);
   } else {
     return CommonUtils.getResourceString(R.string.sort_by_bible_book);
   }
 }
 @Override
 protected String getTitle() {
   if (isOn()) {
     return CommonUtils.getResourceString(R.string.deuterocanonical);
   } else {
     return CommonUtils.getResourceString(R.string.bible);
   }
 }
Beispiel #3
0
  /** enter text selection mode */
  @Override
  public void selectAndCopyText(LongPressControl longPressControl) {
    Log.d(TAG, "enter text selection mode");

    // JellyBean
    if (CommonUtils.isJellyBeanPlus()) {
      Log.d(TAG, "keycode Enter for JB+");
      // retrigger a long-press but allow it to be handled by WebView
      KeyEvent enterEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER, 0, 0);
      longPressControl.ignoreNextLongPress();
      enterEvent.dispatch(this);
    } else {

      try {
        Log.d(TAG, "selectText for ICS");
        // ICS
        WebView.class.getMethod("selectText").invoke(this);
      } catch (Exception e1) {
        try {
          Log.d(TAG, "emulateShiftHeld");
          Method m = WebView.class.getMethod("emulateShiftHeld", (Class[]) null);
          m.invoke(this, (Object[]) null);
        } catch (Exception e2) {
          Log.d(TAG, "shiftPressEvent");
          // fallback
          KeyEvent shiftPressEvent =
              new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
          shiftPressEvent.dispatch(this);
        }
      }
    }
  }
  /**
   * check index exists and go to search screen if index exists if no more jobs in progress and no
   * index then error
   */
  @Override
  protected void jobFinished(Progress jobJustFinished) {
    // give the document up to 12 secs to reload - the Progress declares itself finished before the
    // index status has been changed
    int attempts = 0;
    while (!IndexStatus.DONE.equals(documentBeingIndexed.getIndexStatus()) && attempts++ < 6) {
      CommonUtils.pause(2);
    }

    // if index is fine then goto search
    if (IndexStatus.DONE.equals(documentBeingIndexed.getIndexStatus())) {
      Log.i(TAG, "Index created");
      Intent intent = null;
      if (StringUtils.isNotEmpty(getIntent().getStringExtra(SearchControl.SEARCH_TEXT))) {
        // the search string was passed in so execute it directly
        intent = new Intent(this, SearchResults.class);
        intent.putExtras(getIntent().getExtras());
      } else {
        // just go to the normal Search screen
        intent = new Intent(this, Search.class);
      }
      startActivity(intent);
      finish();
    } else {
      // if jobs still running then just wait else error

      if (isAllJobsFinished()) {
        Log.e(TAG, "Index finished but document's index is invalid");
        showErrorMsg(R.string.error_occurred);
      }
    }
  }
  @Override
  public void applyPreferenceSettings() {
    changeBackgroundColour();

    SharedPreferences preferences = CommonUtils.getSharedPreferences();
    int fontSize = preferences.getInt("text_size_pref", 16);
    setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
  }
  @Override
  protected void jobFinished(Progress prog) {
    Log.d(TAG, "Finished download, going to main screen");
    if (SwordDocumentFacade.getInstance().getBibles().size() > 0) {
      gotoMainScreen();
    } else {

      Log.w(TAG, "Could not immediately find downloaded bible");
      // can't find downloaded bible, wait a sec and try again
      CommonUtils.pause(2);
      if (SwordDocumentFacade.getInstance().getBibles().size() > 0) {
        Log.d(TAG, "Downloaded bible found now");
        gotoMainScreen();
      } else {
        Log.e(TAG, "Downloaded bible not found");
        if (JobManager.getJobs().size() == 0) {
          // something went wrong with the download
          Dialogs.getInstance().showErrorMsg(R.string.download_complete_no_bibles);
        }
      }
    }
  }
 public void setBibleBookSortOrder(BibleBookSortOrder bibleBookSortOrder) {
   CommonUtils.saveSharedPreference(BIBLE_BOOK_SORT_ORDER, bibleBookSortOrder.toString());
 }
 public BibleBookSortOrder getBibleBookSortOrder() {
   String bibleBookSortOrderStr =
       CommonUtils.getSharedPreference(
           BIBLE_BOOK_SORT_ORDER, BibleBookSortOrder.BIBLE_BOOK.toString());
   return BibleBookSortOrder.valueOf(bibleBookSortOrderStr);
 }
Beispiel #9
0
 public LHandler(OsisToHtmlParameters parameters, HtmlTextWriter writer) {
   this.parameters = parameters;
   this.writer = writer;
   int indentCharCount = CommonUtils.getResourceInteger(R.integer.poetry_indent_chars);
   indent_html = StringUtils.repeat(HTML.NBSP, indentCharCount);
 }