Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cca18d80 authored by Brian Isganitis's avatar Brian Isganitis Committed by Android (Google) Code Review
Browse files

Merge "Support zero-state suggestions in Taskbar All Apps." into udc-qpr-dev

parents b1dc7718 d478b146
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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>
+1 −1
Original line number Diff line number Diff line
@@ -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;
+42 −0
Original line number Diff line number Diff line
/*
 * 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,
            )
        }
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -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);
+12 −0
Original line number Diff line number Diff line
@@ -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(
Loading