Merge "Add app predictions to secondary display app drawer & fix tab UI." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bcbba897fc
@@ -25,4 +25,6 @@
|
|||||||
|
|
||||||
<string name="model_delegate_class" translatable="false">com.android.launcher3.model.QuickstepModelDelegate</string>
|
<string name="model_delegate_class" translatable="false">com.android.launcher3.model.QuickstepModelDelegate</string>
|
||||||
|
|
||||||
|
<string name="secondary_display_predictions_class" translatable="false">com.android.launcher3.secondarydisplay.SecondaryDisplayPredictionsImpl</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
+54
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -76,35 +76,8 @@
|
|||||||
android:paddingTop="@dimen/all_apps_header_top_padding"
|
android:paddingTop="@dimen/all_apps_header_top_padding"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip
|
<include layout="@layout/floating_header_content" />
|
||||||
android:id="@+id/tabs"
|
<include layout="@layout/all_apps_personal_work_tabs" />
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/all_apps_header_pill_height"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
style="@style/TextHeadline">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/tab_personal"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:text="@string/all_apps_personal_tab"
|
|
||||||
android:textAllCaps="true"
|
|
||||||
android:textColor="@color/all_apps_tab_text"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/tab_work"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:text="@string/all_apps_work_tab"
|
|
||||||
android:textAllCaps="true"
|
|
||||||
android:textColor="@color/all_apps_tab_text"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
</com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip>
|
|
||||||
</com.android.launcher3.allapps.FloatingHeaderView>
|
</com.android.launcher3.allapps.FloatingHeaderView>
|
||||||
|
|
||||||
<com.android.launcher3.allapps.search.AppsSearchContainerLayout
|
<com.android.launcher3.allapps.search.AppsSearchContainerLayout
|
||||||
|
|||||||
@@ -85,6 +85,7 @@
|
|||||||
<string name="launcher_activity_logic_class" translatable="false"></string>
|
<string name="launcher_activity_logic_class" translatable="false"></string>
|
||||||
<string name="model_delegate_class" translatable="false"></string>
|
<string name="model_delegate_class" translatable="false"></string>
|
||||||
<string name="window_manager_proxy_class" translatable="false"></string>
|
<string name="window_manager_proxy_class" translatable="false"></string>
|
||||||
|
<string name="secondary_display_predictions_class" translatable="false"></string>
|
||||||
|
|
||||||
<!-- View ID to use for QSB widget -->
|
<!-- View ID to use for QSB widget -->
|
||||||
<item type="id" name="qsb_widget" />
|
<item type="id" name="qsb_widget" />
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ import com.android.launcher3.BaseDraggingActivity;
|
|||||||
import com.android.launcher3.InvariantDeviceProfile;
|
import com.android.launcher3.InvariantDeviceProfile;
|
||||||
import com.android.launcher3.LauncherAppState;
|
import com.android.launcher3.LauncherAppState;
|
||||||
import com.android.launcher3.LauncherModel;
|
import com.android.launcher3.LauncherModel;
|
||||||
|
import com.android.launcher3.LauncherSettings;
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
|
import com.android.launcher3.Utilities;
|
||||||
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
|
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
|
||||||
import com.android.launcher3.model.BgDataModel;
|
import com.android.launcher3.model.BgDataModel;
|
||||||
import com.android.launcher3.model.StringCache;
|
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.PopupContainerWithArrow;
|
||||||
import com.android.launcher3.popup.PopupDataProvider;
|
import com.android.launcher3.popup.PopupDataProvider;
|
||||||
import com.android.launcher3.util.ComponentKey;
|
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.util.Themes;
|
||||||
import com.android.launcher3.views.BaseDragLayer;
|
import com.android.launcher3.views.BaseDragLayer;
|
||||||
|
|
||||||
@@ -61,6 +65,9 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
|||||||
private boolean mAppDrawerShown = false;
|
private boolean mAppDrawerShown = false;
|
||||||
|
|
||||||
private StringCache mStringCache;
|
private StringCache mStringCache;
|
||||||
|
private OnboardingPrefs<?> mOnboardingPrefs;
|
||||||
|
private boolean mBindingItems = false;
|
||||||
|
private SecondaryDisplayPredictions mSecondaryDisplayPredictions;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -69,6 +76,8 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
|||||||
if (getWindow().getDecorView().isAttachedToWindow()) {
|
if (getWindow().getDecorView().isAttachedToWindow()) {
|
||||||
initUi();
|
initUi();
|
||||||
}
|
}
|
||||||
|
mOnboardingPrefs = new OnboardingPrefs<>(this, Utilities.getPrefs(this));
|
||||||
|
mSecondaryDisplayPredictions = SecondaryDisplayPredictions.newInstance(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -204,6 +213,7 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
|||||||
mAppDrawerShown = true;
|
mAppDrawerShown = true;
|
||||||
mAppsView.setVisibility(View.VISIBLE);
|
mAppsView.setVisibility(View.VISIBLE);
|
||||||
mAppsButton.setVisibility(View.INVISIBLE);
|
mAppsButton.setVisibility(View.INVISIBLE);
|
||||||
|
mSecondaryDisplayPredictions.updateAppDivider();
|
||||||
} else {
|
} else {
|
||||||
mAppDrawerShown = false;
|
mAppDrawerShown = false;
|
||||||
animator.addListener(new AnimatorListenerAdapter() {
|
animator.addListener(new AnimatorListenerAdapter() {
|
||||||
@@ -218,6 +228,26 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
|||||||
animator.start();
|
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
|
@Override
|
||||||
public void bindDeepShortcutMap(HashMap<ComponentKey, Integer> deepShortcutMap) {
|
public void bindDeepShortcutMap(HashMap<ComponentKey, Integer> deepShortcutMap) {
|
||||||
mPopupDataProvider.setDeepShortcutMap(deepShortcutMap);
|
mPopupDataProvider.setDeepShortcutMap(deepShortcutMap);
|
||||||
@@ -229,6 +259,13 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
|||||||
PopupContainerWithArrow.dismissInvalidPopup(this);
|
PopupContainerWithArrow.dismissInvalidPopup(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bindExtraContainerItems(BgDataModel.FixedContainerItems item) {
|
||||||
|
if (item.containerId == LauncherSettings.Favorites.CONTAINER_PREDICTION) {
|
||||||
|
mSecondaryDisplayPredictions.setPredictedApps(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StringCache getStringCache() {
|
public StringCache getStringCache() {
|
||||||
return mStringCache;
|
return mStringCache;
|
||||||
@@ -259,7 +296,7 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
|||||||
Intent intent;
|
Intent intent;
|
||||||
if (item instanceof ItemInfoWithIcon
|
if (item instanceof ItemInfoWithIcon
|
||||||
&& (((ItemInfoWithIcon) item).runtimeStatusFlags
|
&& (((ItemInfoWithIcon) item).runtimeStatusFlags
|
||||||
& ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
|
& ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
|
||||||
ItemInfoWithIcon appInfo = (ItemInfoWithIcon) item;
|
ItemInfoWithIcon appInfo = (ItemInfoWithIcon) item;
|
||||||
intent = appInfo.getMarketIntent(this);
|
intent = appInfo.getMarketIntent(this);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -32,7 +32,7 @@ import org.junit.runner.RunWith;
|
|||||||
*/
|
*/
|
||||||
@MediumTest
|
@MediumTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class SDLauncherTest {
|
public class SecondaryDisplayLauncherTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
Reference in New Issue
Block a user