1 /*
2  * Copyright (C) 2022 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 package com.android.launcher3.allapps;
17 
18 import android.content.Context;
19 import android.util.AttributeSet;
20 import android.view.View;
21 
22 import androidx.annotation.NonNull;
23 import androidx.core.util.Consumer;
24 
25 import com.android.launcher3.views.RecyclerViewFastScroller;
26 
27 /** A RecyclerView for AllApps Search results. */
28 public class SearchRecyclerView extends AllAppsRecyclerView {
29 
SearchRecyclerView(Context context)30     public SearchRecyclerView(Context context) {
31         this(context, null);
32     }
33 
SearchRecyclerView(Context context, AttributeSet attrs)34     public SearchRecyclerView(Context context, AttributeSet attrs) {
35         this(context, attrs, 0);
36     }
37 
SearchRecyclerView(Context context, AttributeSet attrs, int defStyleAttr)38     public SearchRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) {
39         this(context, attrs, defStyleAttr, 0);
40     }
41 
SearchRecyclerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)42     public SearchRecyclerView(Context context, AttributeSet attrs, int defStyleAttr,
43             int defStyleRes) {
44         super(context, attrs, defStyleAttr, defStyleRes);
45     }
46 
47     @Override
updatePoolSize()48     protected void updatePoolSize() {
49         RecycledViewPool pool = getRecycledViewPool();
50         pool.setMaxRecycledViews(AllAppsGridAdapter.VIEW_TYPE_ICON, mNumAppsPerRow);
51         // TODO(b/206905515): Add maxes for other View types.
52     }
53 
54     @Override
supportsFastScrolling()55     public boolean supportsFastScrolling() {
56         return false;
57     }
58 
59     @Override
getScrollbar()60     public RecyclerViewFastScroller getScrollbar() {
61         return null;
62     }
63 }
64