1 /*
2  * Copyright (C) 2021 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 com.android.launcher3.allapps.search;
18 
19 import android.net.Uri;
20 import android.view.View;
21 
22 import androidx.recyclerview.widget.RecyclerView;
23 
24 import com.android.launcher3.BaseDraggingActivity;
25 import com.android.launcher3.allapps.AllAppsContainerView;
26 import com.android.launcher3.allapps.BaseAdapterProvider;
27 
28 /**
29  * A UI expansion wrapper providing for search results
30  */
31 public abstract class SearchAdapterProvider extends BaseAdapterProvider {
32 
33     protected final BaseDraggingActivity mLauncher;
34 
SearchAdapterProvider(BaseDraggingActivity launcher, AllAppsContainerView appsView)35     public SearchAdapterProvider(BaseDraggingActivity launcher, AllAppsContainerView appsView) {
36         mLauncher = launcher;
37     }
38 
39     /**
40      * Called from LiveSearchManager to notify slice status updates.
41      */
onSliceStatusUpdate(Uri sliceUri)42     public void onSliceStatusUpdate(Uri sliceUri) {
43     }
44 
45     /**
46      * Handles selection event on search adapter item. Returns false if provider can not handle
47      * event
48      */
launchHighlightedItem()49     public abstract boolean launchHighlightedItem();
50 
51     /**
52      * Returns the current highlighted view
53      */
getHighlightedItem()54     public abstract View getHighlightedItem();
55 
56     /**
57      * Returns the item decorator.
58      */
getDecorator()59     public abstract RecyclerView.ItemDecoration getDecorator();
60 }
61