1c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar/*
2c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * Copyright (C) 2015 The Android Open Source Project
3c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar *
4c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * Licensed under the Apache License, Version 2.0 (the "License");
5c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * you may not use this file except in compliance with the License.
6c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * You may obtain a copy of the License at
7c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar *
8c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar *      http://www.apache.org/licenses/LICENSE-2.0
9c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar *
10c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * Unless required by applicable law or agreed to in writing, software
11c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * distributed under the License is distributed on an "AS IS" BASIS,
12c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * See the License for the specific language governing permissions and
14c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * limitations under the License.
15c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar */
16c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar
17c0459105252a3db52bc44ad62ecff4288860180dYigit Boyarpackage android.support.v7.widget.helper;
18c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar
19c0459105252a3db52bc44ad62ecff4288860180dYigit Boyarimport android.graphics.Canvas;
20c0459105252a3db52bc44ad62ecff4288860180dYigit Boyarimport android.support.v7.widget.RecyclerView;
21c0459105252a3db52bc44ad62ecff4288860180dYigit Boyarimport android.view.View;
22c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar
23c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar/**
24c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * Utility class for {@link ItemTouchHelper} which handles item transformations for different
25c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * API versions.
26c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * <p/>
27c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * This class has methods that map to {@link ItemTouchHelper.Callback}'s drawing methods. Default
28c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * implementations in {@link ItemTouchHelper.Callback} call these methods with
29c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * {@link RecyclerView.ViewHolder#itemView} and {@link ItemTouchUIUtil} makes necessary changes
30c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * on the View depending on the API level. You can access the instance of {@link ItemTouchUIUtil}
31c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * via {@link ItemTouchHelper.Callback#getDefaultUIUtil()} and call its methods with the children
32c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * of ViewHolder that you want to apply default effects.
33c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar *
34c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar * @see ItemTouchHelper.Callback#getDefaultUIUtil()
35c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar */
36c0459105252a3db52bc44ad62ecff4288860180dYigit Boyarpublic interface ItemTouchUIUtil {
37c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar
38c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar    /**
39c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     * The default implementation for {@link ItemTouchHelper.Callback#onChildDraw(Canvas,
40c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     * RecyclerView, RecyclerView.ViewHolder, float, float, int, boolean)}
41c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     */
42c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar    void onDraw(Canvas c, RecyclerView recyclerView, View view,
43c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar            float dX, float dY, int actionState, boolean isCurrentlyActive);
44c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar
45c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar    /**
46c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     * The default implementation for {@link ItemTouchHelper.Callback#onChildDrawOver(Canvas,
47c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     * RecyclerView, RecyclerView.ViewHolder, float, float, int, boolean)}
48c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     */
49c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar    void onDrawOver(Canvas c, RecyclerView recyclerView, View view,
50c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar            float dX, float dY, int actionState, boolean isCurrentlyActive);
51c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar
52c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar    /**
53c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     * The default implementation for {@link ItemTouchHelper.Callback#clearView(RecyclerView,
54c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     * RecyclerView.ViewHolder)}
55c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     */
56c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar    void clearView(View view);
57c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar
58c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar    /**
59c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     * The default implementation for {@link ItemTouchHelper.Callback#onSelectedChanged(
60c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     * RecyclerView.ViewHolder, int)}
61c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar     */
62c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar    void onSelected(View view);
63c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar}
64c0459105252a3db52bc44ad62ecff4288860180dYigit Boyar
65