OnItemActivatedListener.java revision 60dadaeed4f5cee272b575dfde6c02e3506a2fa0
1/* 2 * Copyright 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package androidx.recyclerview.selection; 18 19import android.view.MotionEvent; 20 21import androidx.annotation.NonNull; 22import androidx.recyclerview.selection.ItemDetailsLookup.ItemDetails; 23 24/** 25 * Register an OnItemActivatedListener to be notified when an item is activated 26 * (tapped or double clicked). 27 * 28 * @param <K> Selection key type. @see {@link StorageStrategy} for supported types. 29 */ 30public interface OnItemActivatedListener<K> { 31 32 /** 33 * Called when an item is "activated". An item is activated, for example, when no selection 34 * exists and the user taps an item with her finger, or double clicks an item with a 35 * pointing device like a Mouse. 36 * 37 * @param item details of the item. 38 * @param e the event associated with item. 39 * 40 * @return true if the event was handled. 41 */ 42 boolean onItemActivated(@NonNull ItemDetails<K> item, @NonNull MotionEvent e); 43} 44