Пример #1
0
  @Override
  protected void onListItemClick(ListView listView, View view, int position, long rowId) {
    final LibraryTree tree = (LibraryTree) getListAdapter().getItem(position);
    final Book book = tree.getBook();
    mySelectedBook = book;
    if (book != null) {
      if (!accessibilityManager.isEnabled()) {
        showBookInfo(book);
      } else {

        ArrayList<Object> listItems = new ArrayList<Object>();
        listItems.add(resource.getResource("openBook").getValue());
        if (myLibrary.isBookInFavorites(book)) {
          listItems.add(resource.getResource("removeFromFavorites").getValue());
        } else {
          listItems.add(resource.getResource("addToFavorites").getValue());
        }
        if ((myLibrary.getRemoveBookMode(book) & Library.REMOVE_FROM_DISK) != 0) {
          listItems.add(resource.getResource("deleteBook").getValue());
        }

        LabelsListAdapter adapter = new LabelsListAdapter(listItems, this);
        list.setAdapter(adapter);
        list.setOnItemClickListener(new MenuClickListener(book));

        dialog.show();
      }
    } else {
      String id = tree.getUniqueKey().Id;
      if (id.equals(Library.ROOT_SEARCH)) {
        onSearchRequested();
      } else {
        openTree(tree);
      }
    }
  }
Пример #2
0
 @Override
 public boolean isTreeSelected(FBTree tree) {
   final LibraryTree lTree = (LibraryTree) tree;
   return lTree.isSelectable() && lTree.containsBook(mySelectedBook);
 }