Esempio n. 1
0
  private void addBookmark() {
    final FBReader fbreader = (FBReader) FBReader.Instance();
    final ZLTextView textView = fbreader.getTextView();
    final ZLTextWordCursor cursor = textView.getStartCursor();

    if (cursor.isNull()) {
      // TODO: implement
      return;
    }

    // TODO: text edit dialog
    final Bookmark bookmark =
        new Bookmark(
            fbreader.Model.Book, createBookmarkText(cursor), textView.getModel().getId(), cursor);
    myThisBookBookmarks.add(0, bookmark);
    AllBooksBookmarks.add(0, bookmark);
    invalidateAllViews();
  }
Esempio n. 2
0
  @Override
  public void onCreate(Bundle bundle) {
    super.onCreate(bundle);

    Thread.setDefaultUncaughtExceptionHandler(
        new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));

    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);

    final TabHost host = getTabHost();
    LayoutInflater.from(this).inflate(R.layout.bookmarks, host.getTabContentView(), true);

    AllBooksBookmarks = Bookmark.bookmarks();
    Collections.sort(AllBooksBookmarks, new Bookmark.ByTimeComparator());
    final FBReader fbreader = (FBReader) FBReader.Instance();

    if (fbreader.Model != null) {
      final long bookId = fbreader.Model.Book.getId();
      for (Bookmark bookmark : AllBooksBookmarks) {
        if (bookmark.getBookId() == bookId) {
          myThisBookBookmarks.add(bookmark);
        }
      }

      myThisBookView = createTab("thisBook", R.id.this_book);
      new BookmarksAdapter(myThisBookView, myThisBookBookmarks, true);
    } else {
      findViewById(R.id.this_book).setVisibility(View.GONE);
    }

    myAllBooksView = createTab("allBooks", R.id.all_books);
    new BookmarksAdapter(myAllBooksView, AllBooksBookmarks, false);

    findViewById(R.id.search_results).setVisibility(View.GONE);
  }