Skip to content

Instantly share code, notes, and snippets.

Arnaud Frugier quanturium

Block or report user

Report or block quanturium

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
zoltish /
Created Apr 23, 2015
A simple helper class that wraps a View with a Click- and/or LongClick- Listener and stores it inside a tag. Wonderful for use everywhere, especially in RecyclerView.
public final class Click<T> implements View.OnClickListener, View.OnLongClickListener {
private final WeakReference<ClickCallback<T>> mClickWeakReference;
private final WeakReference<LongClickCallback<T>> mLongClickWeakReference;
T mItem;
private Click(ClickCallback<T> callback, LongClickCallback<T> longClickCallback) {
mClickWeakReference = callback != null ? new WeakReference<>(callback) : null;
mLongClickWeakReference = longClickCallback != null ? new WeakReference<>(longClickCallback) : null;
You can’t perform that action at this time.