Search in sources :

Example 1 with Favorite

use of io.github.hidroh.materialistic.data.Favorite in project materialistic by hidroh.

the class FavoriteRecyclerViewAdapter method dismiss.

@Synthetic
void dismiss(final int position) {
    final Favorite item = getItem(position);
    mSelected.put(position, item.getId());
    mFavoriteManager.remove(mContext, mSelected.values());
    Snackbar.make(mRecyclerView, R.string.toast_removed, Snackbar.LENGTH_LONG).setAction(R.string.undo, v -> {
        mPendingAdd = position;
        mFavoriteManager.add(mContext, item);
    }).show();
}
Also used : Favorite(io.github.hidroh.materialistic.data.Favorite) ComposeActivity(io.github.hidroh.materialistic.ComposeActivity) Context(android.content.Context) Favorite(io.github.hidroh.materialistic.data.Favorite) Intent(android.content.Intent) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) AppUtils(io.github.hidroh.materialistic.AppUtils) ArrayMap(android.support.v4.util.ArrayMap) ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) Toast(android.widget.Toast) Menu(android.view.Menu) View(android.view.View) Canvas(android.graphics.Canvas) Synthetic(io.github.hidroh.materialistic.annotation.Synthetic) Build(android.os.Build) WeakReference(java.lang.ref.WeakReference) ActionMode(android.support.v7.view.ActionMode) ContextCompat(android.support.v4.content.ContextCompat) ViewGroup(android.view.ViewGroup) UserServices(io.github.hidroh.materialistic.accounts.UserServices) RecyclerView(android.support.v7.widget.RecyclerView) Gravity(android.view.Gravity) List(java.util.List) MenuTintDelegate(io.github.hidroh.materialistic.MenuTintDelegate) R(io.github.hidroh.materialistic.R) ItemManager(io.github.hidroh.materialistic.data.ItemManager) Snackbar(android.support.design.widget.Snackbar) Collections(java.util.Collections) Synthetic(io.github.hidroh.materialistic.annotation.Synthetic)

Example 2 with Favorite

use of io.github.hidroh.materialistic.data.Favorite in project materialistic by hidroh.

the class FavoriteRecyclerViewAdapter method bindItem.

@Override
protected void bindItem(final ItemViewHolder holder) {
    final Favorite favorite = getItem(holder.getAdapterPosition());
    holder.itemView.setOnLongClickListener(v -> {
        if (mActionModeDelegate.startActionMode(mActionModeCallback)) {
            toggle(favorite.getId(), holder.getAdapterPosition());
            return true;
        }
        return false;
    });
    holder.mStoryView.getMoreOptions().setOnClickListener(v -> showMoreOptions(v, favorite));
}
Also used : Favorite(io.github.hidroh.materialistic.data.Favorite)

Aggregations

Favorite (io.github.hidroh.materialistic.data.Favorite)2 Context (android.content.Context)1 Intent (android.content.Intent)1 Canvas (android.graphics.Canvas)1 Build (android.os.Build)1 Snackbar (android.support.design.widget.Snackbar)1 ContextCompat (android.support.v4.content.ContextCompat)1 ArrayMap (android.support.v4.util.ArrayMap)1 ActionMode (android.support.v7.view.ActionMode)1 RecyclerView (android.support.v7.widget.RecyclerView)1 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)1 Gravity (android.view.Gravity)1 Menu (android.view.Menu)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 Toast (android.widget.Toast)1 AppUtils (io.github.hidroh.materialistic.AppUtils)1 ComposeActivity (io.github.hidroh.materialistic.ComposeActivity)1 MenuTintDelegate (io.github.hidroh.materialistic.MenuTintDelegate)1