Search in sources :

Example 1 with Bookmark

use of org.geometerplus.fbreader.book.Bookmark in project FBReaderJ by geometer.

the class SelectionBookmarkAction method run.

@Override
protected void run(Object... params) {
    final Bookmark bookmark;
    if (params.length != 0) {
        bookmark = (Bookmark) params[0];
    } else {
        bookmark = Reader.addSelectionBookmark();
    }
    if (bookmark == null) {
        return;
    }
    final SuperActivityToast toast = new SuperActivityToast(BaseActivity, SuperToast.Type.BUTTON);
    toast.setText(bookmark.getText());
    toast.setDuration(SuperToast.Duration.EXTRA_LONG);
    toast.setButtonIcon(android.R.drawable.ic_menu_edit, ZLResource.resource("dialog").getResource("button").getResource("edit").getValue());
    toast.setOnClickWrapper(new OnClickWrapper("bkmk", new SuperToast.OnClickListener() {

        @Override
        public void onClick(View view, Parcelable token) {
            final Intent intent = new Intent(BaseActivity.getApplicationContext(), EditBookmarkActivity.class);
            FBReaderIntents.putBookmarkExtra(intent, bookmark);
            OrientationUtil.startActivity(BaseActivity, intent);
        }
    }));
    BaseActivity.showToast(toast);
}
Also used : Bookmark(org.geometerplus.fbreader.book.Bookmark) OnClickWrapper(com.github.johnpersano.supertoasts.util.OnClickWrapper) SuperActivityToast(com.github.johnpersano.supertoasts.SuperActivityToast) Parcelable(android.os.Parcelable) Intent(android.content.Intent) View(android.view.View)

Aggregations

Intent (android.content.Intent)1 Parcelable (android.os.Parcelable)1 View (android.view.View)1 SuperActivityToast (com.github.johnpersano.supertoasts.SuperActivityToast)1 OnClickWrapper (com.github.johnpersano.supertoasts.util.OnClickWrapper)1 Bookmark (org.geometerplus.fbreader.book.Bookmark)1