1 /*
2  * Copyright (C) 2016 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 
17 package androidx.core.widget;
18 
19 import android.widget.ListView;
20 
21 import org.jspecify.annotations.NonNull;
22 
23 /**
24  * Helper for accessing features in {@link ListView}.
25  *
26  * @deprecated Use {@link ListView} directly.
27  */
28 @Deprecated
29 public final class ListViewCompat {
30 
31     /**
32      * Scrolls the list items within the view by a specified number of pixels.
33      *
34      * @param listView the list to scroll
35      * @param y the amount of pixels to scroll by vertically
36      * @deprecated Use {@link ListView#scrollListBy(int)} directly.
37      */
38     @androidx.annotation.ReplaceWith(expression = "listView.scrollListBy(y)")
39     @Deprecated
scrollListBy(@onNull ListView listView, int y)40     public static void scrollListBy(@NonNull ListView listView, int y) {
41         // Call the framework version directly
42         listView.scrollListBy(y);
43     }
44 
45     /**
46      * Check if the items in the list can be scrolled in a certain direction.
47      *
48      * @param listView ListView for which to check the state.
49      * @param direction Negative to check scrolling up, positive to check
50      *            scrolling down.
51      * @return true if the list can be scrolled in the specified direction,
52      *         false otherwise.
53      * @see #scrollListBy(ListView, int)
54      * @deprecated Use {@link ListView#canScrollList(int)} directly.
55      */
56     @androidx.annotation.ReplaceWith(expression = "listView.canScrollList(direction)")
57     @Deprecated
canScrollList(@onNull ListView listView, int direction)58     public static boolean canScrollList(@NonNull ListView listView, int direction) {
59         // Call the framework version directly
60         return listView.canScrollList(direction);
61     }
62 
ListViewCompat()63     private ListViewCompat() {
64     }
65 }
66