butterknife.OnItemLongClick Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of butterknife-annotations Show documentation
Show all versions of butterknife-annotations Show documentation
Field and method binding for Android views.
The newest version!
package butterknife;
import android.view.View;
import androidx.annotation.IdRes;
import butterknife.internal.ListenerClass;
import butterknife.internal.ListenerMethod;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static android.widget.AdapterView.OnItemLongClickListener;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Bind a method to an {@link OnItemLongClickListener OnItemLongClickListener} on the view for each
* ID specified.
*
* {@literal @}OnItemLongClick(R.id.example_list) boolean onItemLongClick(int position) {
* Toast.makeText(this, "Long clicked position " + position + "!", Toast.LENGTH_SHORT).show();
* return true;
* }
*
* Any number of parameters from
* {@link OnItemLongClickListener#onItemLongClick(android.widget.AdapterView, android.view.View,
* int, long) onItemLongClick} may be used on the method.
*
* @see OnItemLongClickListener
*/
@Target(METHOD)
@Retention(RUNTIME)
@ListenerClass(
targetType = "android.widget.AdapterView>",
setter = "setOnItemLongClickListener",
type = "android.widget.AdapterView.OnItemLongClickListener",
method = @ListenerMethod(
name = "onItemLongClick",
parameters = {
"android.widget.AdapterView>",
"android.view.View",
"int",
"long"
},
returnType = "boolean",
defaultReturn = "false"
)
)
public @interface OnItemLongClick {
/** View IDs to which the method will be bound. */
@IdRes int[] value() default { View.NO_ID };
}