1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-06 12:00:17 +02:00

Bookshelf plugin reference in library view

This commit is contained in:
Nikolay Pultsin 2015-02-04 06:19:18 +00:00
parent a578a684ae
commit 92ff1c7ec7
38 changed files with 177 additions and 15 deletions

View file

@ -115,11 +115,15 @@ public class LibraryActivity extends TreeActivity<LibraryTree> implements MenuIt
@Override
protected void onListItemClick(ListView listView, View view, int position, long rowId) {
final LibraryTree tree = (LibraryTree)getListAdapter().getItem(position);
final Book book = tree.getBook();
if (book != null) {
showBookInfo(book);
if (tree instanceof ExternalViewTree) {
runOrInstallExternalView();
} else {
openTree(tree);
final Book book = tree.getBook();
if (book != null) {
showBookInfo(book);
} else {
openTree(tree);
}
}
}
@ -368,20 +372,22 @@ public class LibraryActivity extends TreeActivity<LibraryTree> implements MenuIt
tryToDeleteBooks(books);
}
case OptionsItemId.ExternalView:
{
try {
startActivity(new Intent(FBReaderIntents.Action.EXTERNAL_LIBRARY));
finish();
} catch (ActivityNotFoundException e) {
PackageUtil.installFromMarket(this, "org.fbreader.plugin.library");
}
runOrInstallExternalView();
return true;
}
default:
return true;
}
}
private void runOrInstallExternalView() {
try {
startActivity(new Intent(FBReaderIntents.Action.EXTERNAL_LIBRARY));
finish();
} catch (ActivityNotFoundException e) {
PackageUtil.installFromMarket(this, "org.fbreader.plugin.library");
}
}
//
// Book deletion
//