コード例 #1
0
 public BookModel getBook() {
   if (this.getType() != null && this.getType().equals(TYPE_CONTENT)) {
     if (this.book == null) {
       NovelsDao dao = NovelsDao.getInstance();
       try {
         String bookTitle =
             parent.substring(
                 parent.indexOf(Constants.NOVEL_BOOK_DIVIDER)
                     + Constants.NOVEL_BOOK_DIVIDER.length());
         NovelCollectionModel details = dao.getNovelDetails(getParentPageModel(), null);
         for (Iterator<BookModel> iBook = details.getBookCollections().iterator();
             iBook.hasNext(); ) {
           BookModel tempBook = iBook.next();
           if (tempBook.getTitle().equals(bookTitle)) {
             this.book = tempBook;
             break;
           }
         }
       } catch (Exception e) {
         Log.e(TAG, "Unable to get book for: " + getPage(), e);
       }
     }
     return this.book;
   }
   return null;
 }
コード例 #2
0
 public BookModel getBook() {
   if (this.getType() != null && this.getType().equals(TYPE_CONTENT)) {
     if (this.book == null) {
       NovelsDao dao = NovelsDao.getInstance();
       try {
         String bookTitle = parent.substring(parent.indexOf(Constants.NOVEL_BOOK_DIVIDER) + 1);
         NovelCollectionModel details = dao.getNovelDetails(getParentPageModel(), null);
         for (Iterator<BookModel> iBook = details.getBookCollections().iterator();
             iBook.hasNext(); ) {
           BookModel tempBook = iBook.next();
           if (tempBook.getTitle().equals(bookTitle)) {
             this.book = tempBook;
             break;
           }
         }
       } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
     }
     return this.book;
   }
   return null;
 }