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;
|
2022-12-09 12:37:25 -08:00
|
|
|
import android.view.View;
|
2022-01-24 22:54:21 -05:00
|
|
|
|
2022-11-22 17:14:44 -08:00
|
|
|
import com.android.launcher3.R;
|
2022-03-16 10:53:39 -07:00
|
|
|
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
|
2023-04-04 11:16:54 -04:00
|
|
|
import com.android.launcher3.config.FeatureFlags;
|
2022-10-10 23:34:05 +00:00
|
|
|
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
|
2022-01-24 22:54:21 -05:00
|
|
|
|
|
|
|
|
/** All apps container accessible from taskbar. */
|
2022-03-16 10:53:39 -07:00
|
|
|
public class TaskbarAllAppsContainerView extends
|
2022-10-10 23:34:05 +00:00
|
|
|
ActivityAllAppsContainerView<TaskbarOverlayContext> {
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-09 12:37:25 -08:00
|
|
|
@Override
|
|
|
|
|
protected View inflateSearchBox() {
|
2023-04-04 11:16:54 -04:00
|
|
|
if (isSearchSupported()) {
|
|
|
|
|
return super.inflateSearchBox();
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-09 12:37:25 -08:00
|
|
|
// Remove top padding of header, since we do not have any search
|
|
|
|
|
mHeader.setPadding(mHeader.getPaddingLeft(), 0,
|
|
|
|
|
mHeader.getPaddingRight(), mHeader.getPaddingBottom());
|
|
|
|
|
|
|
|
|
|
TaskbarAllAppsFallbackSearchContainer searchView =
|
|
|
|
|
new TaskbarAllAppsFallbackSearchContainer(getContext(), null);
|
|
|
|
|
searchView.setId(R.id.search_container_all_apps);
|
|
|
|
|
searchView.setVisibility(GONE);
|
|
|
|
|
return searchView;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-28 20:53:25 +00:00
|
|
|
@Override
|
|
|
|
|
protected boolean isSearchSupported() {
|
2023-04-04 11:16:54 -04:00
|
|
|
return FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR.get();
|
2022-11-28 20:53:25 +00:00
|
|
|
}
|
2022-11-22 17:14:44 -08:00
|
|
|
|
2022-12-09 12:37:25 -08:00
|
|
|
@Override
|
|
|
|
|
public boolean isInAllApps() {
|
|
|
|
|
// All apps is always open
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-01-24 22:54:21 -05:00
|
|
|
}
|