1/* 2 * Copyright (C) 2015 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 android.support.v7.widget.helper; 18 19import android.graphics.Canvas; 20import android.support.v7.widget.RecyclerView; 21import android.view.View; 22 23/** 24 * Utility class for {@link ItemTouchHelper} which handles item transformations for different 25 * API versions. 26 * <p/> 27 * This class has methods that map to {@link ItemTouchHelper.Callback}'s drawing methods. Default 28 * implementations in {@link ItemTouchHelper.Callback} call these methods with 29 * {@link RecyclerView.ViewHolder#itemView} and {@link ItemTouchUIUtil} makes necessary changes 30 * on the View depending on the API level. You can access the instance of {@link ItemTouchUIUtil} 31 * via {@link ItemTouchHelper.Callback#getDefaultUIUtil()} and call its methods with the children 32 * of ViewHolder that you want to apply default effects. 33 * 34 * @see ItemTouchHelper.Callback#getDefaultUIUtil() 35 */ 36public interface ItemTouchUIUtil { 37 38 /** 39 * The default implementation for {@link ItemTouchHelper.Callback#onChildDraw(Canvas, 40 * RecyclerView, RecyclerView.ViewHolder, float, float, int, boolean)} 41 */ 42 void onDraw(Canvas c, RecyclerView recyclerView, View view, 43 float dX, float dY, int actionState, boolean isCurrentlyActive); 44 45 /** 46 * The default implementation for {@link ItemTouchHelper.Callback#onChildDrawOver(Canvas, 47 * RecyclerView, RecyclerView.ViewHolder, float, float, int, boolean)} 48 */ 49 void onDrawOver(Canvas c, RecyclerView recyclerView, View view, 50 float dX, float dY, int actionState, boolean isCurrentlyActive); 51 52 /** 53 * The default implementation for {@link ItemTouchHelper.Callback#clearView(RecyclerView, 54 * RecyclerView.ViewHolder)} 55 */ 56 void clearView(View view); 57 58 /** 59 * The default implementation for {@link ItemTouchHelper.Callback#onSelectedChanged( 60 * RecyclerView.ViewHolder, int)} 61 */ 62 void onSelected(View view); 63} 64 65