Search in sources :

Example 6 with SuperActivityToast

use of com.github.johnpersano.supertoasts.SuperActivityToast 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

SuperActivityToast (com.github.johnpersano.supertoasts.SuperActivityToast)6 Intent (android.content.Intent)4 View (android.view.View)4 Parcelable (android.os.Parcelable)3 OnClickWrapper (com.github.johnpersano.supertoasts.util.OnClickWrapper)3 ActivityNotFoundException (android.content.ActivityNotFoundException)2 SuperToast (com.github.johnpersano.supertoasts.SuperToast)2 Sensor (android.hardware.Sensor)1 ViewPager (android.support.v4.view.ViewPager)1 ViewTreeObserver (android.view.ViewTreeObserver)1 Window (android.view.Window)1 AdapterView (android.widget.AdapterView)1 TextView (android.widget.TextView)1 InjectView (butterknife.InjectView)1 BmobUser (cn.bmob.v3.BmobUser)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 MaterialMenuView (com.balysv.materialmenu.MaterialMenuView)1 OnDismissWrapper (com.github.johnpersano.supertoasts.util.OnDismissWrapper)1 ButtonGridViewAdapter (com.nightonke.saver.adapter.ButtonGridViewAdapter)1 EditMoneyRemarkFragmentAdapter (com.nightonke.saver.adapter.EditMoneyRemarkFragmentAdapter)1