diff --git a/quickstep/res/values/override.xml b/quickstep/res/values/override.xml
index 705ec9d48c..4f472f0625 100644
--- a/quickstep/res/values/override.xml
+++ b/quickstep/res/values/override.xml
@@ -25,4 +25,6 @@
com.android.launcher3.model.QuickstepModelDelegate
+ com.android.launcher3.secondarydisplay.SecondaryDisplayPredictionsImpl
+
diff --git a/quickstep/src/com/android/launcher3/secondarydisplay/SecondaryDisplayPredictionsImpl.java b/quickstep/src/com/android/launcher3/secondarydisplay/SecondaryDisplayPredictionsImpl.java
new file mode 100644
index 0000000000..5bf727a60b
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/secondarydisplay/SecondaryDisplayPredictionsImpl.java
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+package com.android.launcher3.secondarydisplay;
+
+import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT;
+
+import android.content.Context;
+
+import com.android.launcher3.appprediction.AppsDividerView;
+import com.android.launcher3.appprediction.PredictionRowView;
+import com.android.launcher3.model.BgDataModel;
+import com.android.launcher3.util.OnboardingPrefs;
+import com.android.launcher3.views.ActivityContext;
+
+/**
+ * Implementation of SecondaryDisplayPredictions.
+ */
+@SuppressWarnings("unused")
+public final class SecondaryDisplayPredictionsImpl extends SecondaryDisplayPredictions {
+ private final ActivityContext mActivityContext;
+
+ public SecondaryDisplayPredictionsImpl(Context context) {
+ mActivityContext = ActivityContext.lookupContext(context);
+ }
+
+ @Override
+ void updateAppDivider() {
+ OnboardingPrefs> onboardingPrefs = mActivityContext.getOnboardingPrefs();
+ mActivityContext.getAppsView().getFloatingHeaderView()
+ .findFixedRowByType(AppsDividerView.class)
+ .setShowAllAppsLabel(!onboardingPrefs.hasReachedMaxCount(ALL_APPS_VISITED_COUNT));
+ onboardingPrefs.incrementEventCount(ALL_APPS_VISITED_COUNT);
+ }
+
+ @Override
+ public void setPredictedApps(BgDataModel.FixedContainerItems item) {
+ mActivityContext.getAppsView().getFloatingHeaderView()
+ .findFixedRowByType(PredictionRowView.class)
+ .setPredictedApps(item.items);
+ }
+}
diff --git a/res/layout/secondary_launcher.xml b/res/layout/secondary_launcher.xml
index 23fe31ceb3..4be2e456ac 100644
--- a/res/layout/secondary_launcher.xml
+++ b/res/layout/secondary_launcher.xml
@@ -76,35 +76,8 @@
android:paddingTop="@dimen/all_apps_header_top_padding"
android:orientation="vertical" >
-
-
-
-
-
-
+
+
+
diff --git a/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java b/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java
index a2ab7f9d53..33b2f55c12 100644
--- a/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java
+++ b/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java
@@ -29,7 +29,9 @@ import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
+import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
import com.android.launcher3.model.BgDataModel;
import com.android.launcher3.model.StringCache;
@@ -39,6 +41,8 @@ import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.util.ComponentKey;
+import com.android.launcher3.util.IntSet;
+import com.android.launcher3.util.OnboardingPrefs;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.BaseDragLayer;
@@ -61,6 +65,9 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
private boolean mAppDrawerShown = false;
private StringCache mStringCache;
+ private OnboardingPrefs> mOnboardingPrefs;
+ private boolean mBindingItems = false;
+ private SecondaryDisplayPredictions mSecondaryDisplayPredictions;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -69,6 +76,8 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
if (getWindow().getDecorView().isAttachedToWindow()) {
initUi();
}
+ mOnboardingPrefs = new OnboardingPrefs<>(this, Utilities.getPrefs(this));
+ mSecondaryDisplayPredictions = SecondaryDisplayPredictions.newInstance(this);
}
@Override
@@ -204,6 +213,7 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
mAppDrawerShown = true;
mAppsView.setVisibility(View.VISIBLE);
mAppsButton.setVisibility(View.INVISIBLE);
+ mSecondaryDisplayPredictions.updateAppDivider();
} else {
mAppDrawerShown = false;
animator.addListener(new AnimatorListenerAdapter() {
@@ -218,6 +228,26 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
animator.start();
}
+ @Override
+ public OnboardingPrefs> getOnboardingPrefs() {
+ return mOnboardingPrefs;
+ }
+
+ @Override
+ public void startBinding() {
+ mBindingItems = true;
+ }
+
+ @Override
+ public boolean isBindingItems() {
+ return mBindingItems;
+ }
+
+ @Override
+ public void finishBindingItems(IntSet pagesBoundFirst) {
+ mBindingItems = false;
+ }
+
@Override
public void bindDeepShortcutMap(HashMap deepShortcutMap) {
mPopupDataProvider.setDeepShortcutMap(deepShortcutMap);
@@ -229,6 +259,13 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
PopupContainerWithArrow.dismissInvalidPopup(this);
}
+ @Override
+ public void bindExtraContainerItems(BgDataModel.FixedContainerItems item) {
+ if (item.containerId == LauncherSettings.Favorites.CONTAINER_PREDICTION) {
+ mSecondaryDisplayPredictions.setPredictedApps(item);
+ }
+ }
+
@Override
public StringCache getStringCache() {
return mStringCache;
@@ -259,7 +296,7 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
Intent intent;
if (item instanceof ItemInfoWithIcon
&& (((ItemInfoWithIcon) item).runtimeStatusFlags
- & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
+ & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
ItemInfoWithIcon appInfo = (ItemInfoWithIcon) item;
intent = appInfo.getMarketIntent(this);
} else {
diff --git a/src/com/android/launcher3/secondarydisplay/SecondaryDisplayPredictions.java b/src/com/android/launcher3/secondarydisplay/SecondaryDisplayPredictions.java
new file mode 100644
index 0000000000..a58916ad80
--- /dev/null
+++ b/src/com/android/launcher3/secondarydisplay/SecondaryDisplayPredictions.java
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package com.android.launcher3.secondarydisplay;
+
+import android.content.Context;
+
+import com.android.launcher3.R;
+import com.android.launcher3.model.BgDataModel;
+import com.android.launcher3.util.ResourceBasedOverride;
+
+/**
+ * Exposes Quickstep app prediction row APIs to {@link SecondaryDisplayLauncher}.
+ */
+public class SecondaryDisplayPredictions implements ResourceBasedOverride {
+ /**
+ * Creates a {@link SecondaryDisplayPredictions} instance.
+ */
+ static SecondaryDisplayPredictions newInstance(Context context) {
+ return Overrides.getObject(
+ SecondaryDisplayPredictions.class, context,
+ R.string.secondary_display_predictions_class);
+ }
+
+ /**
+ * Setup/update app divider separating app predictions from All Apps.
+ */
+ void updateAppDivider() {
+ }
+
+ /**
+ * Set predicted apps in top of app drawer.
+ */
+ public void setPredictedApps(BgDataModel.FixedContainerItems item) {
+ }
+}
diff --git a/tests/src/com/android/launcher3/secondarydisplay/SDLauncherTest.java b/tests/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncherTest.java
similarity index 97%
rename from tests/src/com/android/launcher3/secondarydisplay/SDLauncherTest.java
rename to tests/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncherTest.java
index fd86cf1144..93fa705880 100644
--- a/tests/src/com/android/launcher3/secondarydisplay/SDLauncherTest.java
+++ b/tests/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncherTest.java
@@ -32,7 +32,7 @@ import org.junit.runner.RunWith;
*/
@MediumTest
@RunWith(AndroidJUnit4.class)
-public class SDLauncherTest {
+public class SecondaryDisplayLauncherTest {
@Before
public void setUp() {