mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Merge "Support zero-state suggestions in Taskbar All Apps." into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
cca18d8028
@@ -29,4 +29,6 @@
|
||||
|
||||
<string name="secondary_display_predictions_class" translatable="false">com.android.launcher3.secondarydisplay.SecondaryDisplayPredictionsImpl</string>
|
||||
|
||||
<string name="taskbar_model_callbacks_factory_class" translatable="false">com.android.launcher3.taskbar.TaskbarModelCallbacksFactory</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -57,7 +57,7 @@ public class TaskbarModelCallbacks implements
|
||||
private final TaskbarView mContainer;
|
||||
|
||||
// Initialized in init.
|
||||
private TaskbarControllers mControllers;
|
||||
protected TaskbarControllers mControllers;
|
||||
|
||||
// Used to defer any UI updates during the SUW unstash animation.
|
||||
private boolean mDeferUpdatesForSUW;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2023 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.
|
||||
*/
|
||||
|
||||
package com.android.launcher3.taskbar
|
||||
|
||||
import android.content.Context
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.util.ResourceBasedOverride
|
||||
import com.android.launcher3.util.ResourceBasedOverride.Overrides
|
||||
|
||||
/** Creates [TaskbarModelCallbacks] instances. */
|
||||
open class TaskbarModelCallbacksFactory : ResourceBasedOverride {
|
||||
|
||||
open fun create(
|
||||
activityContext: TaskbarActivityContext,
|
||||
container: TaskbarView,
|
||||
): TaskbarModelCallbacks = TaskbarModelCallbacks(activityContext, container)
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(context: Context): TaskbarModelCallbacksFactory {
|
||||
return Overrides.getObject(
|
||||
TaskbarModelCallbacksFactory::class.java,
|
||||
context,
|
||||
R.string.taskbar_model_callbacks_factory_class,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
mTaskbarView = taskbarView;
|
||||
mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, NUM_ALPHA_CHANNELS);
|
||||
mTaskbarIconAlpha.setUpdateVisibility(true);
|
||||
mModelCallbacks = new TaskbarModelCallbacks(activity, mTaskbarView);
|
||||
mModelCallbacks = TaskbarModelCallbacksFactory.newInstance(mActivity)
|
||||
.create(mActivity, mTaskbarView);
|
||||
mTaskbarBottomMargin = activity.getDeviceProfile().taskbarBottomMargin;
|
||||
mStashedHandleHeight = activity.getResources()
|
||||
.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_height);
|
||||
|
||||
@@ -54,6 +54,7 @@ public final class TaskbarAllAppsController {
|
||||
private AppInfo[] mApps;
|
||||
private int mAppsModelFlags;
|
||||
private List<ItemInfo> mPredictedApps;
|
||||
private @Nullable List<ItemInfo> mZeroStateSearchSuggestions;
|
||||
private boolean mDisallowGlobalDrag;
|
||||
private boolean mDisallowLongClick;
|
||||
|
||||
@@ -108,6 +109,14 @@ public final class TaskbarAllAppsController {
|
||||
}
|
||||
}
|
||||
|
||||
/** Updates the current search suggestions. */
|
||||
public void setZeroStateSearchSuggestions(List<ItemInfo> zeroStateSearchSuggestions) {
|
||||
mZeroStateSearchSuggestions = zeroStateSearchSuggestions;
|
||||
if (mSearchSessionController != null) {
|
||||
mSearchSessionController.setZeroStateSearchSuggestions(zeroStateSearchSuggestions);
|
||||
}
|
||||
}
|
||||
|
||||
/** Updates the current notification dots. */
|
||||
public void updateNotificationDots(Predicate<PackageUserKey> updatedDots) {
|
||||
if (mAppsView != null) {
|
||||
@@ -143,6 +152,9 @@ public final class TaskbarAllAppsController {
|
||||
mSearchSessionController = TaskbarSearchSessionController.newInstance(mOverlayContext);
|
||||
mOverlayContext.setSearchSessionController(mSearchSessionController);
|
||||
mSearchSessionController.setZeroStatePredictedItems(mPredictedApps);
|
||||
if (mZeroStateSearchSuggestions != null) {
|
||||
mSearchSessionController.setZeroStateSearchSuggestions(mZeroStateSearchSuggestions);
|
||||
}
|
||||
mSearchSessionController.startLifecycle();
|
||||
|
||||
mSlideInView = (TaskbarAllAppsSlideInView) mOverlayContext.getLayoutInflater().inflate(
|
||||
|
||||
@@ -35,6 +35,9 @@ open class TaskbarSearchSessionController : ResourceBasedOverride {
|
||||
/** Updates the predicted items shown in the zero-state. */
|
||||
open fun setZeroStatePredictedItems(items: List<ItemInfo>) {}
|
||||
|
||||
/** Updates the search suggestions shown in the zero-state. */
|
||||
open fun setZeroStateSearchSuggestions(items: List<ItemInfo>) {}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(context: Context): TaskbarSearchSessionController {
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
<string name="secondary_display_predictions_class" translatable="false"></string>
|
||||
<string name="widget_holder_factory_class" translatable="false"></string>
|
||||
<string name="taskbar_search_session_controller_class" translatable="false"></string>
|
||||
<string name="taskbar_model_callbacks_factory_class" translatable="false"></string>
|
||||
|
||||
<!-- View ID to use for QSB widget -->
|
||||
<item type="id" name="qsb_widget" />
|
||||
|
||||
Reference in New Issue
Block a user