2022-01-24 22:54:21 -05:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2022 The Android Open Source Project
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
2022-02-07 22:22:09 -05:00
|
|
|
package com.android.launcher3.taskbar.allapps;
|
2022-01-24 22:54:21 -05:00
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
import android.view.WindowInsets;
|
|
|
|
|
|
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
|
|
|
|
|
import com.android.launcher3.allapps.AllAppsGridAdapter;
|
2022-03-09 17:45:45 +00:00
|
|
|
import com.android.launcher3.allapps.AlphabeticalAppsList;
|
|
|
|
|
import com.android.launcher3.allapps.BaseAdapterProvider;
|
|
|
|
|
import com.android.launcher3.allapps.BaseAllAppsAdapter;
|
2022-01-24 22:54:21 -05:00
|
|
|
import com.android.launcher3.allapps.BaseAllAppsContainerView;
|
|
|
|
|
import com.android.launcher3.allapps.search.SearchAdapterProvider;
|
|
|
|
|
|
|
|
|
|
/** All apps container accessible from taskbar. */
|
2022-02-07 22:22:09 -05:00
|
|
|
public class TaskbarAllAppsContainerView extends BaseAllAppsContainerView<TaskbarAllAppsContext> {
|
2022-01-24 22:54:21 -05:00
|
|
|
|
|
|
|
|
public TaskbarAllAppsContainerView(Context context, AttributeSet attrs) {
|
|
|
|
|
this(context, attrs, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TaskbarAllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
|
|
|
super(context, attrs, defStyleAttr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected SearchAdapterProvider<?> createMainAdapterProvider() {
|
2022-02-07 22:22:09 -05:00
|
|
|
// Taskbar all apps does not yet support search, so this implementation is minimal.
|
|
|
|
|
return new SearchAdapterProvider<TaskbarAllAppsContext>(mActivityContext) {
|
2022-01-24 22:54:21 -05:00
|
|
|
@Override
|
|
|
|
|
public boolean launchHighlightedItem() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public View getHighlightedItem() {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RecyclerView.ItemDecoration getDecorator() {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isViewSupported(int viewType) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onBindView(AllAppsGridAdapter.ViewHolder holder, int position) { }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public AllAppsGridAdapter.ViewHolder onCreateViewHolder(LayoutInflater layoutInflater,
|
|
|
|
|
ViewGroup parent, int viewType) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
2022-02-07 22:22:09 -05:00
|
|
|
setInsets(insets.getInsets(WindowInsets.Type.systemBars()).toRect());
|
2022-01-24 22:54:21 -05:00
|
|
|
return super.onApplyWindowInsets(insets);
|
|
|
|
|
}
|
2022-03-09 17:45:45 +00:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected BaseAllAppsAdapter getAdapter(AlphabeticalAppsList<TaskbarAllAppsContext> mAppsList,
|
|
|
|
|
BaseAdapterProvider[] adapterProviders) {
|
|
|
|
|
return new AllAppsGridAdapter<>(mActivityContext, getLayoutInflater(), mAppsList,
|
|
|
|
|
adapterProviders);
|
|
|
|
|
}
|
2022-01-24 22:54:21 -05:00
|
|
|
}
|