private CurrentPage getBookPage(BookCategory bookCategory) {

    CurrentPage bookPage = null;
    if (bookCategory.equals(BookCategory.BIBLE)) {
      bookPage = currentBiblePage;
    } else if (bookCategory.equals(BookCategory.COMMENTARY)) {
      bookPage = currentCommentaryPage;
    } else if (bookCategory.equals(BookCategory.DICTIONARY)) {
      bookPage = currentDictionaryPage;
    } else if (bookCategory.equals(BookCategory.GENERAL_BOOK)) {
      bookPage = currentGeneralBookPage;
    } else if (bookCategory.equals(BookCategory.OTHER)) {
      bookPage = currentMyNotePage;
    }
    return bookPage;
  }
 /**
  * @param category
  * @return
  */
 public Image getBookCategoryImage(BookCategory category) {
   String key = "image.category." + category.toString();
   ImageRegistry registry = getImageRegistry();
   Image image = registry.get(key);
   if (image == null) {
     return ImageDescriptor.getMissingImageDescriptor().createImage();
   }
   return image;
 }
예제 #3
0
  private void adjustBookType() {
    // The book type represents the underlying category of book.
    // Fine tune it here.
    BookCategory focusedCategory = (BookCategory) getValue(ConfigEntryType.CATEGORY);
    questionable = focusedCategory == BookCategory.QUESTIONABLE;

    // From the config map, extract the important bean properties
    String modTypeName = (String) getValue(ConfigEntryType.MOD_DRV);
    if (modTypeName == null) {
      log.error(
          "Book not supported: malformed conf file for "
              + internal
              + " no "
              + ConfigEntryType.MOD_DRV.getName()
              + " found");
      supported = false;
      return;
    }

    bookType = BookType.fromString(modTypeName);
    if (getBookType() == null) {
      log.error("Book not supported: malformed conf file for " + internal + " no book type found");
      supported = false;
      return;
    }

    BookCategory basicCategory = getBookType().getBookCategory();
    if (basicCategory == null) {
      supported = false;
      return;
    }

    // The book type represents the underlying category of book.
    // Fine tune it here.
    if (focusedCategory == BookCategory.OTHER || focusedCategory == BookCategory.QUESTIONABLE) {
      focusedCategory = getBookType().getBookCategory();
    }

    add(ConfigEntryType.CATEGORY, focusedCategory.getName());
  }
  /**
   * called during app start-up to restore previous state
   *
   * @param inState
   */
  public void restoreState(SharedPreferences inState) {
    Log.i(TAG, "restore state");
    currentBiblePage.restoreState(inState);
    currentCommentaryPage.restoreState(inState);
    currentDictionaryPage.restoreState(inState);
    currentGeneralBookPage.restoreState(inState);

    String restoredPageCategoryName = inState.getString("currentPageCategory", null);
    if (StringUtils.isNotEmpty(restoredPageCategoryName)) {
      BookCategory restoredBookCategory = BookCategory.fromString(restoredPageCategoryName);
      currentDisplayedPage = getBookPage(restoredBookCategory);
    }

    // force an update here from default chapter/verse
    PassageChangeMediator.getInstance().onCurrentPageChanged();
    PassageChangeMediator.getInstance().onCurrentPageDetailChanged();
  }