Snap for 8502966 from a2d3bbe27e to tm-release
Change-Id: I7130abe1f3be18c27ee5f03023df975cf41561a7
This commit is contained in:
@@ -77,11 +77,12 @@ public final class AppSharing {
|
||||
return FileProvider.getUriForFile(context, authority, pathFile, displayName);
|
||||
}
|
||||
|
||||
private SystemShortcut<Launcher> getShortcut(Launcher launcher, ItemInfo info) {
|
||||
private SystemShortcut<Launcher> getShortcut(Launcher launcher, ItemInfo info,
|
||||
View originalView) {
|
||||
if (TextUtils.isEmpty(mSharingComponent)) {
|
||||
return null;
|
||||
}
|
||||
return new Share(launcher, info);
|
||||
return new Share(launcher, info, originalView);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,8 +105,9 @@ public final class AppSharing {
|
||||
private final PopupDataProvider mPopupDataProvider;
|
||||
private final boolean mSharingEnabledForUser;
|
||||
|
||||
public Share(Launcher target, ItemInfo itemInfo) {
|
||||
super(R.drawable.ic_share, R.string.app_share_drop_target_label, target, itemInfo);
|
||||
public Share(Launcher target, ItemInfo itemInfo, View originalView) {
|
||||
super(R.drawable.ic_share, R.string.app_share_drop_target_label, target, itemInfo,
|
||||
originalView);
|
||||
mPopupDataProvider = target.getPopupDataProvider();
|
||||
|
||||
mSharingEnabledForUser = bluetoothSharingEnabled(target);
|
||||
@@ -200,6 +202,7 @@ public final class AppSharing {
|
||||
/**
|
||||
* Shortcut factory for generating the Share App button
|
||||
*/
|
||||
public static final SystemShortcut.Factory<Launcher> SHORTCUT_FACTORY = (launcher, itemInfo) ->
|
||||
(new AppSharing(launcher)).getShortcut(launcher, itemInfo);
|
||||
public static final SystemShortcut.Factory<Launcher> SHORTCUT_FACTORY =
|
||||
(launcher, itemInfo, originalView) ->
|
||||
(new AppSharing(launcher)).getShortcut(launcher, itemInfo, originalView);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
layout="@layout/all_apps_bottom_sheet_background"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include
|
||||
layout="@layout/search_results_rv_layout"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include
|
||||
layout="@layout/all_apps_rv_layout"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -409,11 +409,11 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
@Nullable
|
||||
@Override
|
||||
public SystemShortcut<QuickstepLauncher> getShortcut(QuickstepLauncher activity,
|
||||
ItemInfo itemInfo) {
|
||||
ItemInfo itemInfo, View originalView) {
|
||||
if (itemInfo.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION) {
|
||||
return null;
|
||||
}
|
||||
return new PinPrediction(activity, itemInfo);
|
||||
return new PinPrediction(activity, itemInfo, originalView);
|
||||
}
|
||||
|
||||
private void preparePredictionInfo(WorkspaceItemInfo itemInfo, int rank) {
|
||||
@@ -498,9 +498,9 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
|
||||
private class PinPrediction extends SystemShortcut<QuickstepLauncher> {
|
||||
|
||||
private PinPrediction(QuickstepLauncher target, ItemInfo itemInfo) {
|
||||
private PinPrediction(QuickstepLauncher target, ItemInfo itemInfo, View originalView) {
|
||||
super(R.drawable.ic_pin, R.string.pin_prediction, target,
|
||||
itemInfo);
|
||||
itemInfo, originalView);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,6 +40,7 @@ import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.MainThread;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -193,7 +194,7 @@ public final class WellbeingModel extends BgObjectWithLooper {
|
||||
|
||||
@MainThread
|
||||
private SystemShortcut getShortcutForApp(String packageName, int userId,
|
||||
BaseDraggingActivity activity, ItemInfo info) {
|
||||
BaseDraggingActivity activity, ItemInfo info, View originalView) {
|
||||
Preconditions.assertUIThread();
|
||||
// Work profile apps are not recognized by digital wellbeing.
|
||||
if (userId != UserHandle.myUserId()) {
|
||||
@@ -217,7 +218,7 @@ public final class WellbeingModel extends BgObjectWithLooper {
|
||||
"getShortcutForApp [" + packageName + "]: action: '" + action.getTitle()
|
||||
+ "'");
|
||||
}
|
||||
return new RemoteActionShortcut(action, activity, info);
|
||||
return new RemoteActionShortcut(action, activity, info, originalView);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,8 +379,8 @@ public final class WellbeingModel extends BgObjectWithLooper {
|
||||
* Shortcut factory for generating wellbeing action
|
||||
*/
|
||||
public static final SystemShortcut.Factory<BaseDraggingActivity> SHORTCUT_FACTORY =
|
||||
(activity, info) -> (info.getTargetComponent() == null) ? null : INSTANCE.get(activity)
|
||||
.getShortcutForApp(
|
||||
(activity, info, originalView) -> (info.getTargetComponent() == null) ? null
|
||||
: INSTANCE.get(activity).getShortcutForApp(
|
||||
info.getTargetComponent().getPackageName(), info.user.getIdentifier(),
|
||||
activity, info);
|
||||
activity, info, originalView);
|
||||
}
|
||||
|
||||
@@ -34,8 +34,9 @@ public interface QuickstepSystemShortcut {
|
||||
|
||||
static SystemShortcut.Factory<BaseQuickstepLauncher> getSplitSelectShortcutByPosition(
|
||||
SplitPositionOption position) {
|
||||
return (activity, itemInfo) -> new QuickstepSystemShortcut.SplitSelectSystemShortcut(
|
||||
activity, itemInfo, position);
|
||||
return (activity, itemInfo, originalView) ->
|
||||
new QuickstepSystemShortcut.SplitSelectSystemShortcut(activity, itemInfo,
|
||||
originalView, position);
|
||||
}
|
||||
|
||||
class SplitSelectSystemShortcut extends SystemShortcut<BaseQuickstepLauncher> {
|
||||
@@ -43,8 +44,8 @@ public interface QuickstepSystemShortcut {
|
||||
private final SplitPositionOption mPosition;
|
||||
|
||||
public SplitSelectSystemShortcut(BaseQuickstepLauncher launcher, ItemInfo itemInfo,
|
||||
SplitPositionOption position) {
|
||||
super(position.iconResId, position.textResId, launcher, itemInfo);
|
||||
View originalView, SplitPositionOption position) {
|
||||
super(position.iconResId, position.textResId, launcher, itemInfo, originalView);
|
||||
|
||||
mPosition = position;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
mPopupDataProvider.getNotificationKeysForItem(item),
|
||||
// TODO (b/198438631): add support for INSTALL shortcut factory
|
||||
getSystemShortcuts()
|
||||
.map(s -> s.getShortcut(context, item))
|
||||
.map(s -> s.getShortcut(context, item, icon))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList()));
|
||||
container.requestFocus();
|
||||
@@ -242,7 +242,8 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
*/
|
||||
private SystemShortcut.Factory<BaseTaskbarContext> createSplitShortcutFactory(
|
||||
SplitPositionOption position) {
|
||||
return (context, itemInfo) -> new TaskbarSplitShortcut(context, itemInfo, position);
|
||||
return (context, itemInfo, originalView) -> new TaskbarSplitShortcut(context, itemInfo,
|
||||
originalView, position);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,9 +254,9 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
private static class TaskbarSplitShortcut extends SystemShortcut<BaseTaskbarContext> {
|
||||
private final SplitPositionOption mPosition;
|
||||
|
||||
TaskbarSplitShortcut(BaseTaskbarContext context, ItemInfo itemInfo,
|
||||
TaskbarSplitShortcut(BaseTaskbarContext context, ItemInfo itemInfo, View originalView,
|
||||
SplitPositionOption position) {
|
||||
super(position.iconResId, position.textResId, context, itemInfo);
|
||||
super(position.iconResId, position.textResId, context, itemInfo, originalView);
|
||||
mPosition = position;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -44,9 +44,10 @@ public class TaskbarAllAppsContainerView extends
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BaseAllAppsAdapter getAdapter(AlphabeticalAppsList<TaskbarAllAppsContext> mAppsList,
|
||||
protected BaseAllAppsAdapter<TaskbarAllAppsContext> createAdapter(
|
||||
AlphabeticalAppsList<TaskbarAllAppsContext> appsList,
|
||||
BaseAdapterProvider[] adapterProviders) {
|
||||
return new AllAppsGridAdapter<>(mActivityContext, getLayoutInflater(), mAppsList,
|
||||
return new AllAppsGridAdapter<>(mActivityContext, getLayoutInflater(), appsList,
|
||||
adapterProviders);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,8 +118,8 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
* * There aren't at least 2 tasks in overview to show split options for
|
||||
* * Device is in "Lock task mode"
|
||||
* * The taskView to show split options for is the focused task AND we haven't started
|
||||
* scrolling in overview (if we haven't scrolled, there's a split overview action button so
|
||||
* we don't need this menu option)
|
||||
* scrolling in overview (if we haven't scrolled, there's a split overview action button so
|
||||
* we don't need this menu option)
|
||||
*/
|
||||
private static void addSplitOptions(List<SystemShortcut> outShortcuts,
|
||||
BaseDraggingActivity activity, TaskView taskView, DeviceProfile deviceProfile) {
|
||||
@@ -156,13 +156,15 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
* Subclasses can attach any system listeners in this method, must be paired with
|
||||
* {@link #removeListeners()}
|
||||
*/
|
||||
public void initListeners() { }
|
||||
public void initListeners() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses should remove any system listeners in this method, must be paired with
|
||||
* {@link #initListeners()}
|
||||
*/
|
||||
public void removeListeners() { }
|
||||
public void removeListeners() {
|
||||
}
|
||||
|
||||
/** Note that these will be shown in order from top to bottom, if available for the task. */
|
||||
private static final TaskShortcutFactory[] MENU_OPTIONS = new TaskShortcutFactory[]{
|
||||
@@ -189,7 +191,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
mApplicationContext = taskThumbnailView.getContext().getApplicationContext();
|
||||
mThumbnailView = taskThumbnailView;
|
||||
mImageApi = new ImageActionsApi(
|
||||
mApplicationContext, mThumbnailView::getThumbnail);
|
||||
mApplicationContext, mThumbnailView::getThumbnail);
|
||||
}
|
||||
|
||||
protected T getActionsView() {
|
||||
@@ -263,7 +265,8 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
/**
|
||||
* Gets the modal state system shortcut.
|
||||
*/
|
||||
public SystemShortcut getModalStateSystemShortcut(WorkspaceItemInfo itemInfo) {
|
||||
public SystemShortcut getModalStateSystemShortcut(WorkspaceItemInfo itemInfo,
|
||||
View original) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -277,9 +280,10 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
* Gets the system shortcut for the screenshot that will be added to the task menu.
|
||||
*/
|
||||
public SystemShortcut getScreenshotShortcut(BaseDraggingActivity activity,
|
||||
ItemInfo iteminfo) {
|
||||
return new ScreenshotSystemShortcut(activity, iteminfo);
|
||||
ItemInfo iteminfo, View originalView) {
|
||||
return new ScreenshotSystemShortcut(activity, iteminfo, originalView);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the task snapshot as it is displayed on the screen.
|
||||
*
|
||||
@@ -320,8 +324,10 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
|
||||
private final BaseDraggingActivity mActivity;
|
||||
|
||||
ScreenshotSystemShortcut(BaseDraggingActivity activity, ItemInfo itemInfo) {
|
||||
super(R.drawable.ic_screenshot, R.string.action_screenshot, activity, itemInfo);
|
||||
ScreenshotSystemShortcut(BaseDraggingActivity activity, ItemInfo itemInfo,
|
||||
View originalView) {
|
||||
super(R.drawable.ic_screenshot, R.string.action_screenshot, activity, itemInfo,
|
||||
originalView);
|
||||
mActivity = activity;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecCompat;
|
||||
import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecsFuture;
|
||||
import com.android.systemui.shared.recents.view.RecentsTransition;
|
||||
import com.android.systemui.shared.system.ActivityCompat;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.ActivityOptionsCompat;
|
||||
import com.android.systemui.shared.system.WindowManagerWrapper;
|
||||
@@ -78,7 +77,7 @@ public interface TaskShortcutFactory {
|
||||
TaskUtils.getTitle(taskView.getContext(), taskContainer.getTask()),
|
||||
taskContainer.getA11yNodeId()
|
||||
);
|
||||
return new AppInfo(activity, taskContainer.getItemInfo(), accessibilityInfo);
|
||||
return new AppInfo(activity, taskContainer.getItemInfo(), taskView, accessibilityInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,7 +122,7 @@ public interface TaskShortcutFactory {
|
||||
private final SplitPositionOption mSplitPositionOption;
|
||||
public SplitSelectSystemShortcut(BaseDraggingActivity target, TaskView taskView,
|
||||
SplitPositionOption option) {
|
||||
super(option.iconResId, option.textResId, target, taskView.getItemInfo());
|
||||
super(option.iconResId, option.textResId, target, taskView.getItemInfo(), taskView);
|
||||
mTaskView = taskView;
|
||||
mSplitPositionOption = option;
|
||||
}
|
||||
@@ -147,7 +146,8 @@ public interface TaskShortcutFactory {
|
||||
public MultiWindowSystemShortcut(int iconRes, int textRes, BaseDraggingActivity activity,
|
||||
TaskIdAttributeContainer taskContainer, MultiWindowFactory factory,
|
||||
LauncherEvent launcherEvent) {
|
||||
super(iconRes, textRes, activity, taskContainer.getItemInfo());
|
||||
super(iconRes, textRes, activity, taskContainer.getItemInfo(),
|
||||
taskContainer.getTaskView());
|
||||
mLauncherEvent = launcherEvent;
|
||||
mHandler = new Handler(Looper.getMainLooper());
|
||||
mTaskView = taskContainer.getTaskView();
|
||||
@@ -320,7 +320,7 @@ public interface TaskShortcutFactory {
|
||||
public PinSystemShortcut(BaseDraggingActivity target,
|
||||
TaskIdAttributeContainer taskContainer) {
|
||||
super(R.drawable.ic_pin, R.string.recent_task_option_pin, target,
|
||||
taskContainer.getItemInfo());
|
||||
taskContainer.getItemInfo(), taskContainer.getTaskView());
|
||||
mTaskView = taskContainer.getTaskView();
|
||||
}
|
||||
|
||||
@@ -337,20 +337,23 @@ public interface TaskShortcutFactory {
|
||||
|
||||
TaskShortcutFactory INSTALL = (activity, taskContainer) ->
|
||||
InstantAppResolver.newInstance(activity).isInstantApp(activity,
|
||||
taskContainer.getTask().getTopComponent().getPackageName())
|
||||
? new SystemShortcut.Install(activity, taskContainer.getItemInfo()) : null;
|
||||
taskContainer.getTask().getTopComponent().getPackageName())
|
||||
? new SystemShortcut.Install(activity, taskContainer.getItemInfo(),
|
||||
taskContainer.getTaskView()) : null;
|
||||
|
||||
TaskShortcutFactory WELLBEING = (activity, taskContainer) ->
|
||||
WellbeingModel.SHORTCUT_FACTORY.getShortcut(activity, taskContainer.getItemInfo());
|
||||
WellbeingModel.SHORTCUT_FACTORY.getShortcut(activity, taskContainer.getItemInfo(),
|
||||
taskContainer.getTaskView());
|
||||
|
||||
TaskShortcutFactory SCREENSHOT = (activity, taskContainer) ->
|
||||
taskContainer.getThumbnailView().getTaskOverlay()
|
||||
.getScreenshotShortcut(activity, taskContainer.getItemInfo());
|
||||
.getScreenshotShortcut(activity, taskContainer.getItemInfo(),
|
||||
taskContainer.getTaskView());
|
||||
|
||||
TaskShortcutFactory MODAL = (activity, taskContainer) -> {
|
||||
if (ENABLE_OVERVIEW_SELECTIONS.get()) {
|
||||
return taskContainer.getThumbnailView()
|
||||
.getTaskOverlay().getModalStateSystemShortcut(taskContainer.getItemInfo());
|
||||
return taskContainer.getThumbnailView().getTaskOverlay().getModalStateSystemShortcut(
|
||||
taskContainer.getItemInfo(), taskContainer.getTaskView());
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false"
|
||||
android:showBackdrop="true">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_decelerate"
|
||||
android:startOffset="100"
|
||||
android:duration="350" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="-25%"
|
||||
android:toXDelta="0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="450" />
|
||||
|
||||
</set>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_accelerate"
|
||||
android:startOffset="0"
|
||||
android:duration="100" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="25%"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="450" />
|
||||
|
||||
</set>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false"
|
||||
android:showBackdrop="true">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_decelerate"
|
||||
android:startOffset="100"
|
||||
android:duration="350" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="25%"
|
||||
android:toXDelta="0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="450" />
|
||||
|
||||
</set>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_accelerate"
|
||||
android:startOffset="0"
|
||||
android:duration="100" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="-25%"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="450" />
|
||||
|
||||
</set>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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
|
||||
-->
|
||||
|
||||
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:pathData="M 0,0 C 0.05, 0, 0.133333, 0.06, 0.166666, 0.4 C 0.208333, 0.82, 0.25, 1, 1, 1"/>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:controlX1="0.3"
|
||||
android:controlY1="0"
|
||||
android:controlX2="1"
|
||||
android:controlY2="1"/>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:controlX1="0"
|
||||
android:controlY1="0"
|
||||
android:controlX2="0"
|
||||
android:controlY2="1"/>
|
||||
@@ -29,6 +29,10 @@
|
||||
layout="@layout/all_apps_bottom_sheet_background"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include
|
||||
layout="@layout/search_results_rv_layout"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include
|
||||
layout="@layout/all_apps_rv_layout"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
<com.android.launcher3.allapps.SearchRecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/search_results_list_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
android:focusable="true" />
|
||||
@@ -59,6 +59,10 @@
|
||||
layout="@layout/all_apps_bottom_sheet_background"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include
|
||||
layout="@layout/search_results_rv_layout"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include
|
||||
layout="@layout/all_apps_rv_layout"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<style name="HomeSettings.Theme" parent="@android:style/Theme.DeviceDefault.Settings">
|
||||
<item name="android:listPreferredItemPaddingEnd">16dp</item>
|
||||
<item name="android:listPreferredItemPaddingStart">24dp</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:switchStyle">@style/HomeSettings.SwitchStyle</item>
|
||||
<item name="android:textAppearanceListItem">@style/HomeSettings.PreferenceTitle</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="preferenceTheme">@style/HomeSettings.PreferenceTheme</item>
|
||||
<item name="android:windowAnimationStyle">@style/Animation.SharedBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="Animation.SharedBackground" parent="@android:style/Animation.Activity">
|
||||
<item name="android:activityOpenEnterAnimation">@anim/shared_x_axis_activity_open_enter</item>
|
||||
<item name="android:activityOpenExitAnimation">@anim/shared_x_axis_activity_open_exit</item>
|
||||
<item name="android:activityCloseEnterAnimation">@anim/shared_x_axis_activity_close_enter</item>
|
||||
<item name="android:activityCloseExitAnimation">@anim/shared_x_axis_activity_close_exit</item>
|
||||
</style>
|
||||
</resources>
|
||||
+5
-5
@@ -37,19 +37,19 @@ import com.android.launcher3.views.RecyclerViewFastScroller;
|
||||
* <li> Enable fast scroller.
|
||||
* </ul>
|
||||
*/
|
||||
public abstract class BaseRecyclerView extends RecyclerView {
|
||||
public abstract class FastScrollRecyclerView extends RecyclerView {
|
||||
|
||||
protected RecyclerViewFastScroller mScrollbar;
|
||||
|
||||
public BaseRecyclerView(Context context) {
|
||||
public FastScrollRecyclerView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public BaseRecyclerView(Context context, AttributeSet attrs) {
|
||||
public FastScrollRecyclerView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public BaseRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public FastScrollRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@@ -206,4 +206,4 @@ public abstract class BaseRecyclerView extends RecyclerView {
|
||||
}
|
||||
scrollToPosition(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2750,7 +2750,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
packageName);
|
||||
|
||||
if (supportsAllAppsState && isInState(LauncherState.ALL_APPS)) {
|
||||
return getFirstMatch(Collections.singletonList(mAppsView.getActiveRecyclerView()),
|
||||
return getFirstMatch(Collections.singletonList(mAppsView.getActiveAppsRecyclerView()),
|
||||
preferredItem, packageAndUserAndApp);
|
||||
} else {
|
||||
List<ViewGroup> containers = new ArrayList<>(mWorkspace.getPanelCount() + 1);
|
||||
|
||||
@@ -80,7 +80,7 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
|
||||
OnClickListener marketSearchClickListener = (v) -> mActivityContext.startActivitySafely(v,
|
||||
marketSearchIntent, null);
|
||||
for (int i = 0; i < mAH.size(); i++) {
|
||||
mAH.get(i).adapter.setLastSearchQuery(query, marketSearchClickListener);
|
||||
mAH.get(i).mAdapter.setLastSearchQuery(query, marketSearchClickListener);
|
||||
}
|
||||
mIsSearching = true;
|
||||
rebindAdapters();
|
||||
@@ -142,7 +142,7 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if (!mUsingTabs && mIsSearching) {
|
||||
if (!mUsingTabs && isSearching()) {
|
||||
return getContext().getString(R.string.all_apps_search_results);
|
||||
} else {
|
||||
return super.getDescription();
|
||||
@@ -150,8 +150,13 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showTabs() {
|
||||
return super.showTabs() && !mIsSearching;
|
||||
protected boolean shouldShowTabs() {
|
||||
return super.shouldShowTabs() && !isSearching();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSearching() {
|
||||
return mIsSearching;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,15 +178,19 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View replaceRVContainer(boolean showTabs) {
|
||||
View rvContainer = super.replaceRVContainer(showTabs);
|
||||
protected View replaceAppsRVContainer(boolean showTabs) {
|
||||
View rvContainer = super.replaceAppsRVContainer(showTabs);
|
||||
|
||||
removeCustomRules(rvContainer);
|
||||
removeCustomRules(getSearchRecyclerView());
|
||||
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
|
||||
alignParentTop(rvContainer, showTabs);
|
||||
alignParentTop(getSearchRecyclerView(), showTabs);
|
||||
layoutAboveSearchContainer(rvContainer);
|
||||
layoutAboveSearchContainer(getSearchRecyclerView());
|
||||
} else {
|
||||
layoutBelowSearchContainer(rvContainer, showTabs);
|
||||
layoutBelowSearchContainer(getSearchRecyclerView(), showTabs);
|
||||
}
|
||||
|
||||
return rvContainer;
|
||||
@@ -208,7 +217,7 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
|
||||
|
||||
float prog = Utilities.boundToRange((float) scrolledOffset / mHeaderThreshold, 0f, 1f);
|
||||
boolean bgVisible = mSearchUiManager.getBackgroundVisibility();
|
||||
if (scrolledOffset == 0 && !mIsSearching) {
|
||||
if (scrolledOffset == 0 && !isSearching()) {
|
||||
bgVisible = true;
|
||||
} else if (scrolledOffset > mHeaderThreshold) {
|
||||
bgVisible = false;
|
||||
@@ -242,7 +251,7 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
|
||||
int topMargin = getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.all_apps_header_top_margin);
|
||||
if (includeTabsMargin) {
|
||||
topMargin = topMargin + getContext().getResources().getDimensionPixelSize(
|
||||
topMargin += getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.all_apps_header_pill_height);
|
||||
}
|
||||
layoutParams.topMargin = topMargin;
|
||||
@@ -283,9 +292,9 @@ public class ActivityAllAppsContainerView<T extends Context & AppLauncher
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BaseAllAppsAdapter getAdapter(AlphabeticalAppsList<T> mAppsList,
|
||||
protected BaseAllAppsAdapter<T> createAdapter(AlphabeticalAppsList<T> appsList,
|
||||
BaseAdapterProvider[] adapterProviders) {
|
||||
return new AllAppsGridAdapter<>(mActivityContext, getLayoutInflater(), mAppsList,
|
||||
return new AllAppsGridAdapter<>(mActivityContext, getLayoutInflater(), appsList,
|
||||
adapterProviders);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.launcher3.BaseRecyclerView;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.FastScrollRecyclerView;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
@@ -53,13 +53,13 @@ import java.util.List;
|
||||
/**
|
||||
* A RecyclerView with custom fast scroll support for the all apps view.
|
||||
*/
|
||||
public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||
private static final String TAG = "AllAppsContainerView";
|
||||
public class AllAppsRecyclerView extends FastScrollRecyclerView {
|
||||
protected static final String TAG = "AllAppsRecyclerView";
|
||||
private static final boolean DEBUG = false;
|
||||
private static final boolean DEBUG_LATENCY = Utilities.isPropertyEnabled(SEARCH_LOGGING);
|
||||
|
||||
private AlphabeticalAppsList<?> mApps;
|
||||
private final int mNumAppsPerRow;
|
||||
protected AlphabeticalAppsList<?> mApps;
|
||||
protected final int mNumAppsPerRow;
|
||||
|
||||
// The specific view heights that we use to calculate scroll
|
||||
private final SparseIntArray mViewHeights = new SparseIntArray();
|
||||
@@ -74,8 +74,8 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||
};
|
||||
|
||||
// The empty-search result background
|
||||
private AllAppsBackgroundDrawable mEmptySearchBackground;
|
||||
private int mEmptySearchBackgroundTopOffset;
|
||||
protected AllAppsBackgroundDrawable mEmptySearchBackground;
|
||||
protected int mEmptySearchBackgroundTopOffset;
|
||||
|
||||
private ArrayList<View> mAutoSizedOverlays = new ArrayList<>();
|
||||
|
||||
@@ -112,7 +112,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||
return mApps;
|
||||
}
|
||||
|
||||
private void updatePoolSize() {
|
||||
protected void updatePoolSize() {
|
||||
DeviceProfile grid = ActivityContext.lookupContext(getContext()).getDeviceProfile();
|
||||
RecyclerView.RecycledViewPool pool = getRecycledViewPool();
|
||||
int approxRows = (int) Math.ceil(grid.availableHeightPx / grid.allAppsIconSizePx);
|
||||
@@ -137,8 +137,8 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||
Log.d(TAG, "onDraw at = " + System.currentTimeMillis());
|
||||
}
|
||||
if (DEBUG_LATENCY) {
|
||||
Log.d(SEARCH_LOGGING,
|
||||
"-- Recycle view onDraw, time stamp = " + System.currentTimeMillis());
|
||||
Log.d(SEARCH_LOGGING, getClass().getSimpleName() + " onDraw; time stamp = "
|
||||
+ System.currentTimeMillis());
|
||||
}
|
||||
super.onDraw(c);
|
||||
}
|
||||
@@ -223,8 +223,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||
&& mEmptySearchBackground != null && mEmptySearchBackground.getAlpha() > 0) {
|
||||
mEmptySearchBackground.setHotspot(e.getX(), e.getY());
|
||||
}
|
||||
hideKeyboardAsync(ActivityContext.lookupContext(getContext()),
|
||||
getApplicationWindowToken());
|
||||
hideKeyboardAsync(ActivityContext.lookupContext(getContext()), getApplicationWindowToken());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -359,13 +358,6 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsFastScrolling() {
|
||||
// Only allow fast scrolling when the user is not searching, since the results are not
|
||||
// grouped in a meaningful order
|
||||
return !mApps.hasFilter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentScrollY() {
|
||||
// Return early if there are no items or we haven't been measured
|
||||
@@ -376,7 +368,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||
|
||||
// Calculate the y and offset for the item
|
||||
View child = getChildAt(0);
|
||||
int position = getChildPosition(child);
|
||||
int position = getChildAdapterPosition(child);
|
||||
if (position == NO_POSITION) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,8 @@ public class AllAppsTransitionController
|
||||
@Override
|
||||
public Float get(AllAppsTransitionController controller) {
|
||||
if (controller.mIsTablet) {
|
||||
return controller.mAppsView.getRecyclerViewContainer().getTranslationY();
|
||||
return controller.mAppsView.getAppsRecyclerViewContainer()
|
||||
.getTranslationY();
|
||||
} else {
|
||||
return controller.getAppsViewPullbackTranslationY().get(
|
||||
controller.mAppsView);
|
||||
@@ -94,7 +95,7 @@ public class AllAppsTransitionController
|
||||
@Override
|
||||
public void setValue(AllAppsTransitionController controller, float translation) {
|
||||
if (controller.mIsTablet) {
|
||||
controller.mAppsView.getRecyclerViewContainer().setTranslationY(
|
||||
controller.mAppsView.getAppsRecyclerViewContainer().setTranslationY(
|
||||
translation);
|
||||
} else {
|
||||
controller.getAppsViewPullbackTranslationY().set(controller.mAppsView,
|
||||
@@ -109,7 +110,7 @@ public class AllAppsTransitionController
|
||||
@Override
|
||||
public Float get(AllAppsTransitionController controller) {
|
||||
if (controller.mIsTablet) {
|
||||
return controller.mAppsView.getRecyclerViewContainer().getAlpha();
|
||||
return controller.mAppsView.getAppsRecyclerViewContainer().getAlpha();
|
||||
} else {
|
||||
return controller.getAppsViewPullbackAlpha().getValue();
|
||||
}
|
||||
@@ -118,7 +119,7 @@ public class AllAppsTransitionController
|
||||
@Override
|
||||
public void setValue(AllAppsTransitionController controller, float alpha) {
|
||||
if (controller.mIsTablet) {
|
||||
controller.mAppsView.getRecyclerViewContainer().setAlpha(alpha);
|
||||
controller.mAppsView.getAppsRecyclerViewContainer().setAlpha(alpha);
|
||||
} else {
|
||||
controller.getAppsViewPullbackAlpha().setValue(alpha);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.android.launcher3.allapps;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
@@ -71,6 +73,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
|
||||
// The set of apps from the system
|
||||
private final List<AppInfo> mApps = new ArrayList<>();
|
||||
@Nullable
|
||||
private final AllAppsStore mAllAppsStore;
|
||||
|
||||
// The number of results in current adapter
|
||||
@@ -88,14 +91,16 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
private int mNumAppRowsInAdapter;
|
||||
private ItemInfoMatcher mItemFilter;
|
||||
|
||||
public AlphabeticalAppsList(Context context, AllAppsStore appsStore,
|
||||
public AlphabeticalAppsList(Context context, @Nullable AllAppsStore appsStore,
|
||||
WorkAdapterProvider adapterProvider) {
|
||||
mAllAppsStore = appsStore;
|
||||
mActivityContext = ActivityContext.lookupContext(context);
|
||||
mAppNameComparator = new AppInfoComparator(context);
|
||||
mWorkAdapterProvider = adapterProvider;
|
||||
mNumAppsPerRowAllApps = mActivityContext.getDeviceProfile().inv.numAllAppsColumns;
|
||||
mAllAppsStore.addUpdateListener(this);
|
||||
if (mAllAppsStore != null) {
|
||||
mAllAppsStore.addUpdateListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateItemFilter(ItemInfoMatcher itemFilter) {
|
||||
@@ -168,9 +173,9 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether there are is a filter set.
|
||||
* Returns whether there are search results which will hide the A-Z list.
|
||||
*/
|
||||
public boolean hasFilter() {
|
||||
public boolean hasSearchResults() {
|
||||
return !mSearchResults.isEmpty();
|
||||
}
|
||||
|
||||
@@ -178,7 +183,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
* Returns whether there are no filtered results.
|
||||
*/
|
||||
public boolean hasNoFilteredResults() {
|
||||
return hasFilter() && mAccessibilityResultsCount == 0;
|
||||
return hasSearchResults() && mAccessibilityResultsCount == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,13 +201,13 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean appendSearchResults(ArrayList<AdapterItem> results) {
|
||||
if (hasFilter() && results != null && results.size() > 0) {
|
||||
/** Appends results to search. */
|
||||
public void appendSearchResults(ArrayList<AdapterItem> results) {
|
||||
if (hasSearchResults() && results != null && results.size() > 0) {
|
||||
updateSearchAdapterItems(results, mSearchResults.size());
|
||||
mSearchResults.addAll(results);
|
||||
refreshRecyclerView();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void updateSearchAdapterItems(ArrayList<AdapterItem> list, int offset) {
|
||||
@@ -222,11 +227,14 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
*/
|
||||
@Override
|
||||
public void onAppsUpdated() {
|
||||
if (mAllAppsStore == null) {
|
||||
return;
|
||||
}
|
||||
// Sort the list of apps
|
||||
mApps.clear();
|
||||
|
||||
for (AppInfo app : mAllAppsStore.getApps()) {
|
||||
if (mItemFilter == null || mItemFilter.matches(app, null) || hasFilter()) {
|
||||
if (mItemFilter == null || mItemFilter.matches(app, null) || hasSearchResults()) {
|
||||
mApps.add(app);
|
||||
}
|
||||
}
|
||||
@@ -296,7 +304,18 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
// Recreate the filtered and sectioned apps (for convenience for the grid layout) from the
|
||||
// ordered set of sections
|
||||
|
||||
if (!hasFilter()) {
|
||||
if (hasSearchResults()) {
|
||||
if (!FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
|
||||
// Append the search market item
|
||||
if (hasNoFilteredResults()) {
|
||||
mSearchResults.add(AdapterItem.asEmptySearch(position++));
|
||||
} else {
|
||||
mSearchResults.add(AdapterItem.asAllAppsDivider(position++));
|
||||
}
|
||||
mSearchResults.add(AdapterItem.asMarketSearch(position++));
|
||||
}
|
||||
updateSearchAdapterItems(mSearchResults, 0);
|
||||
} else {
|
||||
mAccessibilityResultsCount = mApps.size();
|
||||
if (mWorkAdapterProvider != null) {
|
||||
position += mWorkAdapterProvider.addWorkItems(mAdapterItems);
|
||||
@@ -323,18 +342,6 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
||||
|
||||
mAdapterItems.add(appItem);
|
||||
}
|
||||
} else {
|
||||
updateSearchAdapterItems(mSearchResults, 0);
|
||||
if (!FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
|
||||
// Append the search market item
|
||||
if (hasNoFilteredResults()) {
|
||||
mAdapterItems.add(AdapterItem.asEmptySearch(position++));
|
||||
} else {
|
||||
mAdapterItems.add(AdapterItem.asAllAppsDivider(position++));
|
||||
}
|
||||
mAdapterItems.add(AdapterItem.asMarketSearch(position++));
|
||||
|
||||
}
|
||||
}
|
||||
if (mNumAppsPerRowAllApps != 0) {
|
||||
// Update the number of rows in the adapter after we do all the merging (otherwise, we
|
||||
|
||||
@@ -80,7 +80,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
OnDeviceProfileChangeListener, OnActivePageChangedListener,
|
||||
ScrimView.ScrimDrawingController {
|
||||
|
||||
private static final String BUNDLE_KEY_CURRENT_PAGE = "launcher.allapps.current_page";
|
||||
protected static final String BUNDLE_KEY_CURRENT_PAGE = "launcher.allapps.current_page";
|
||||
|
||||
public static final float PULL_MULTIPLIER = .02f;
|
||||
public static final float FLING_VELOCITY_MULTIPLIER = 1200f;
|
||||
@@ -109,6 +109,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
private int mNavBarScrimHeight = 0;
|
||||
|
||||
private AllAppsPagedView mViewPager;
|
||||
private SearchRecyclerView mSearchRecyclerView;
|
||||
|
||||
protected FloatingHeaderView mHeader;
|
||||
private View mBottomSheetBackground;
|
||||
@@ -141,9 +142,10 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
mActivityContext.getSystemService(UserManager.class),
|
||||
this,
|
||||
Utilities.getPrefs(mActivityContext));
|
||||
mAH = Arrays.asList(null, null);
|
||||
mAH.set(AdapterHolder.MAIN, new AdapterHolder(false /* isWork */));
|
||||
mAH.set(AdapterHolder.WORK, new AdapterHolder(true /* isWork */));
|
||||
mAH = Arrays.asList(null, null, null);
|
||||
mAH.set(AdapterHolder.MAIN, new AdapterHolder(AdapterHolder.MAIN));
|
||||
mAH.set(AdapterHolder.WORK, new AdapterHolder(AdapterHolder.WORK));
|
||||
mAH.set(AdapterHolder.SEARCH, new AdapterHolder(AdapterHolder.SEARCH));
|
||||
|
||||
mNavBarScrimPaint = new Paint();
|
||||
mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor));
|
||||
@@ -175,7 +177,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
Bundle state = (Bundle) sparseArray.get(R.id.work_tab_state_id, null);
|
||||
if (state != null) {
|
||||
int currentPage = state.getInt(BUNDLE_KEY_CURRENT_PAGE, 0);
|
||||
if (currentPage != 0 && mViewPager != null) {
|
||||
if (currentPage == AdapterHolder.WORK && mViewPager != null) {
|
||||
mViewPager.setCurrentPage(currentPage);
|
||||
rebindAdapters();
|
||||
} else {
|
||||
@@ -198,7 +200,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
*/
|
||||
public void setOnIconLongClickListener(OnLongClickListener listener) {
|
||||
for (AdapterHolder holder : mAH) {
|
||||
holder.adapter.setOnIconLongClickListener(listener);
|
||||
holder.mAdapter.setOnIconLongClickListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +215,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
@Override
|
||||
public void onDeviceProfileChanged(DeviceProfile dp) {
|
||||
for (AdapterHolder holder : mAH) {
|
||||
holder.adapter.setAppsPerRow(dp.numShownAllAppsColumns);
|
||||
holder.mAdapter.setAppsPerRow(dp.numShownAllAppsColumns);
|
||||
if (holder.mRecyclerView != null) {
|
||||
// Remove all views and clear the pool, while keeping the data same. After this
|
||||
// call, all the viewHolders will be recreated.
|
||||
@@ -237,7 +239,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
}
|
||||
}
|
||||
mHasWorkApps = hasWorkApps;
|
||||
if (!mAH.get(AdapterHolder.MAIN).mAppsList.hasFilter()) {
|
||||
if (!mAH.get(AdapterHolder.MAIN).mAppsList.hasSearchResults()) {
|
||||
rebindAdapters();
|
||||
if (hasWorkApps) {
|
||||
mWorkManager.reset();
|
||||
@@ -256,7 +258,11 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
if (mActivityContext.getDragLayer().isEventOverView(mBottomSheetHandleArea, ev)) {
|
||||
return true;
|
||||
}
|
||||
AllAppsRecyclerView rv = getActiveRecyclerView();
|
||||
if (isSearching()) {
|
||||
return mAH.get(AdapterHolder.SEARCH).mRecyclerView
|
||||
.shouldContainerScroll(ev, mActivityContext.getDragLayer());
|
||||
}
|
||||
AllAppsRecyclerView rv = getActiveAppsRecyclerView();
|
||||
if (rv == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -270,7 +276,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
AllAppsRecyclerView rv = getActiveRecyclerView();
|
||||
AllAppsRecyclerView rv = getActiveAppsRecyclerView();
|
||||
if (rv != null && rv.getScrollbar().isHitInParent(ev.getX(), ev.getY(),
|
||||
mFastScrollerOffset)) {
|
||||
mTouchHandler = rv.getScrollbar();
|
||||
@@ -287,7 +293,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
AllAppsRecyclerView rv = getActiveRecyclerView();
|
||||
AllAppsRecyclerView rv = getActiveAppsRecyclerView();
|
||||
if (rv != null && rv.getScrollbar().isHitInParent(ev.getX(), ev.getY(),
|
||||
mFastScrollerOffset)) {
|
||||
mTouchHandler = rv.getScrollbar();
|
||||
@@ -320,8 +326,8 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
return getContext().getString(R.string.all_apps_button_label);
|
||||
}
|
||||
|
||||
/** The current recycler view visible in the container. */
|
||||
public AllAppsRecyclerView getActiveRecyclerView() {
|
||||
/** The current apps recycler view in the container (may be hidden for search results). */
|
||||
public AllAppsRecyclerView getActiveAppsRecyclerView() {
|
||||
if (!mUsingTabs || isPersonalTab()) {
|
||||
return mAH.get(AdapterHolder.MAIN).mRecyclerView;
|
||||
} else {
|
||||
@@ -370,12 +376,15 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
// This is a focus listener that proxies focus from a view into the list view. This is to
|
||||
// work around the search box from getting first focus and showing the cursor.
|
||||
setOnFocusChangeListener((v, hasFocus) -> {
|
||||
if (hasFocus && getActiveRecyclerView() != null) {
|
||||
getActiveRecyclerView().requestFocus();
|
||||
if (hasFocus && getActiveAppsRecyclerView() != null) {
|
||||
getActiveAppsRecyclerView().requestFocus();
|
||||
}
|
||||
});
|
||||
|
||||
mHeader = findViewById(R.id.all_apps_header);
|
||||
mSearchRecyclerView = findViewById(R.id.search_results_list_view);
|
||||
mAH.get(AdapterHolder.SEARCH).setup(mSearchRecyclerView,
|
||||
/* Filter out A-Z apps */ (itemInfo, componentName) -> false);
|
||||
rebindAdapters(true /* force */);
|
||||
|
||||
mBottomSheetBackground = findViewById(R.id.bottom_sheet_background);
|
||||
@@ -438,13 +447,19 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
}
|
||||
|
||||
protected void rebindAdapters(boolean force) {
|
||||
boolean showTabs = showTabs();
|
||||
updateSearchResultsVisibility();
|
||||
|
||||
boolean showTabs = shouldShowTabs();
|
||||
if (showTabs == mUsingTabs && !force) {
|
||||
return;
|
||||
}
|
||||
mUsingTabs = showTabs;
|
||||
replaceRVContainer(mUsingTabs);
|
||||
|
||||
if (isSearching()) {
|
||||
return;
|
||||
}
|
||||
|
||||
replaceAppsRVContainer(mUsingTabs);
|
||||
mAllAppsStore.unregisterIconContainer(mAH.get(AdapterHolder.MAIN).mRecyclerView);
|
||||
mAllAppsStore.unregisterIconContainer(mAH.get(AdapterHolder.WORK).mRecyclerView);
|
||||
|
||||
@@ -479,6 +494,17 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
mAllAppsStore.registerIconContainer(mAH.get(AdapterHolder.WORK).mRecyclerView);
|
||||
}
|
||||
|
||||
private void updateSearchResultsVisibility() {
|
||||
if (isSearching()) {
|
||||
getSearchRecyclerView().setVisibility(VISIBLE);
|
||||
getAppsRecyclerViewContainer().setVisibility(GONE);
|
||||
} else {
|
||||
getSearchRecyclerView().setVisibility(GONE);
|
||||
getAppsRecyclerViewContainer().setVisibility(VISIBLE);
|
||||
}
|
||||
mHeader.setActiveRV(getCurrentPage());
|
||||
}
|
||||
|
||||
private void setDeviceManagementResources() {
|
||||
if (mActivityContext.getStringCache() != null) {
|
||||
Button personalTab = findViewById(R.id.tab_personal);
|
||||
@@ -489,18 +515,23 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean showTabs() {
|
||||
protected boolean shouldShowTabs() {
|
||||
return mHasWorkApps;
|
||||
}
|
||||
|
||||
protected View replaceRVContainer(boolean showTabs) {
|
||||
for (AdapterHolder adapterHolder : mAH) {
|
||||
protected boolean isSearching() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected View replaceAppsRVContainer(boolean showTabs) {
|
||||
for (int i = AdapterHolder.MAIN; i <= AdapterHolder.WORK; i++) {
|
||||
AdapterHolder adapterHolder = mAH.get(i);
|
||||
if (adapterHolder.mRecyclerView != null) {
|
||||
adapterHolder.mRecyclerView.setLayoutManager(null);
|
||||
adapterHolder.mRecyclerView.setAdapter(null);
|
||||
}
|
||||
}
|
||||
View oldView = getRecyclerViewContainer();
|
||||
View oldView = getAppsRecyclerViewContainer();
|
||||
int index = indexOfChild(oldView);
|
||||
removeView(oldView);
|
||||
int layout = showTabs ? R.layout.all_apps_tabs : R.layout.all_apps_rv_layout;
|
||||
@@ -521,13 +552,17 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
return newView;
|
||||
}
|
||||
|
||||
public View getRecyclerViewContainer() {
|
||||
public View getAppsRecyclerViewContainer() {
|
||||
return mViewPager != null ? mViewPager : findViewById(R.id.apps_list_view);
|
||||
}
|
||||
|
||||
public SearchRecyclerView getSearchRecyclerView() {
|
||||
return mSearchRecyclerView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivePageChanged(int currentActivePage) {
|
||||
mHeader.setMainActive(currentActivePage == AdapterHolder.MAIN);
|
||||
mHeader.setActiveRV(currentActivePage);
|
||||
if (mAH.get(currentActivePage).mRecyclerView != null) {
|
||||
mAH.get(currentActivePage).mRecyclerView.bindFastScrollbar();
|
||||
}
|
||||
@@ -556,8 +591,8 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
return isDescendantViewVisible(R.id.tab_work);
|
||||
}
|
||||
|
||||
public AlphabeticalAppsList<T> getApps() {
|
||||
return mAH.get(AdapterHolder.MAIN).mAppsList;
|
||||
public AlphabeticalAppsList<T> getSearchResultList() {
|
||||
return mAH.get(AdapterHolder.SEARCH).mAppsList;
|
||||
}
|
||||
|
||||
public FloatingHeaderView getFloatingHeaderView() {
|
||||
@@ -566,17 +601,19 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
|
||||
@VisibleForTesting
|
||||
public View getContentView() {
|
||||
return mViewPager == null ? getActiveRecyclerView() : mViewPager;
|
||||
return mViewPager == null ? getActiveAppsRecyclerView() : mViewPager;
|
||||
}
|
||||
|
||||
/** The current page visible in all apps. */
|
||||
public int getCurrentPage() {
|
||||
return mViewPager != null ? mViewPager.getCurrentPage() : AdapterHolder.MAIN;
|
||||
return isSearching()
|
||||
? AdapterHolder.SEARCH
|
||||
: mViewPager == null ? AdapterHolder.MAIN : mViewPager.getCurrentPage();
|
||||
}
|
||||
|
||||
/** The scroll bar for the active recycler view. */
|
||||
public RecyclerViewFastScroller getScrollBar() {
|
||||
AllAppsRecyclerView rv = getActiveRecyclerView();
|
||||
AllAppsRecyclerView rv = getActiveAppsRecyclerView();
|
||||
return rv == null ? null : rv.getScrollbar();
|
||||
}
|
||||
|
||||
@@ -585,7 +622,9 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
mHeader.setup(
|
||||
mAH.get(AdapterHolder.MAIN).mRecyclerView,
|
||||
mAH.get(AdapterHolder.WORK).mRecyclerView,
|
||||
mAH.get(AdapterHolder.WORK).mRecyclerView == null);
|
||||
(SearchRecyclerView) mAH.get(AdapterHolder.SEARCH).mRecyclerView,
|
||||
getCurrentPage(),
|
||||
/* tabsHidden= */ mAH.get(AdapterHolder.WORK).mRecyclerView == null);
|
||||
|
||||
int padding = mHeader.getMaxTranslation();
|
||||
for (int i = 0; i < mAH.size(); i++) {
|
||||
@@ -696,39 +735,48 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
return ColorUtils.blendARGB(mScrimColor, mHeaderProtectionColor, blendRatio);
|
||||
}
|
||||
|
||||
protected abstract BaseAllAppsAdapter getAdapter(AlphabeticalAppsList<T> mAppsList,
|
||||
protected abstract BaseAllAppsAdapter<T> createAdapter(AlphabeticalAppsList<T> mAppsList,
|
||||
BaseAdapterProvider[] adapterProviders);
|
||||
|
||||
protected int getHeaderBottom() {
|
||||
return (int) getTranslationY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a view that denotes the visible part of all apps container view.
|
||||
*/
|
||||
public View getVisibleContainerView() {
|
||||
return mActivityContext.getDeviceProfile().isTablet ? mBottomSheetBackground : this;
|
||||
}
|
||||
|
||||
/** Holds a {@link BaseAllAppsAdapter} and related fields. */
|
||||
public class AdapterHolder {
|
||||
public static final int MAIN = 0;
|
||||
public static final int WORK = 1;
|
||||
public static final int SEARCH = 2;
|
||||
|
||||
private final boolean mIsWork;
|
||||
public final BaseAllAppsAdapter<T> adapter;
|
||||
private final int mType;
|
||||
public final BaseAllAppsAdapter<T> mAdapter;
|
||||
final RecyclerView.LayoutManager mLayoutManager;
|
||||
final AlphabeticalAppsList<T> mAppsList;
|
||||
final Rect mPadding = new Rect();
|
||||
AllAppsRecyclerView mRecyclerView;
|
||||
boolean mVerticalFadingEdge;
|
||||
|
||||
AdapterHolder(boolean isWork) {
|
||||
mIsWork = isWork;
|
||||
mAppsList = new AlphabeticalAppsList<>(mActivityContext, mAllAppsStore,
|
||||
isWork ? mWorkManager.getAdapterProvider() : null);
|
||||
AdapterHolder(int type) {
|
||||
mType = type;
|
||||
mAppsList = new AlphabeticalAppsList<>(mActivityContext,
|
||||
isSearch() ? null : mAllAppsStore,
|
||||
isWork() ? mWorkManager.getAdapterProvider() : null);
|
||||
|
||||
BaseAdapterProvider[] adapterProviders =
|
||||
isWork ? new BaseAdapterProvider[]{mMainAdapterProvider,
|
||||
isWork() ? new BaseAdapterProvider[]{mMainAdapterProvider,
|
||||
mWorkManager.getAdapterProvider()}
|
||||
: new BaseAdapterProvider[]{mMainAdapterProvider};
|
||||
|
||||
adapter = getAdapter(mAppsList, adapterProviders);
|
||||
mAppsList.setAdapter(adapter);
|
||||
mLayoutManager = adapter.getLayoutManager();
|
||||
mAdapter = createAdapter(mAppsList, adapterProviders);
|
||||
mAppsList.setAdapter(mAdapter);
|
||||
mLayoutManager = mAdapter.getLayoutManager();
|
||||
}
|
||||
|
||||
void setup(@NonNull View rv, @Nullable ItemInfoMatcher matcher) {
|
||||
@@ -737,14 +785,14 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
mRecyclerView.setEdgeEffectFactory(createEdgeEffectFactory());
|
||||
mRecyclerView.setApps(mAppsList);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
// No animations will occur when changes occur to the items in this RecyclerView.
|
||||
mRecyclerView.setItemAnimator(null);
|
||||
mRecyclerView.addOnScrollListener(mScrollListener);
|
||||
FocusedItemDecorator focusedItemDecorator = new FocusedItemDecorator(mRecyclerView);
|
||||
mRecyclerView.addItemDecoration(focusedItemDecorator);
|
||||
adapter.setIconFocusListener(focusedItemDecorator.getFocusListener());
|
||||
mAdapter.setIconFocusListener(focusedItemDecorator.getFocusListener());
|
||||
applyVerticalFadingEdgeEnabled(mVerticalFadingEdge);
|
||||
applyPadding();
|
||||
}
|
||||
@@ -752,7 +800,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
void applyPadding() {
|
||||
if (mRecyclerView != null) {
|
||||
int bottomOffset = 0;
|
||||
if (mIsWork && mWorkManager.getWorkModeSwitch() != null) {
|
||||
if (isWork() && mWorkManager.getWorkModeSwitch() != null) {
|
||||
bottomOffset = mInsets.bottom + mWorkManager.getWorkModeSwitch().getHeight();
|
||||
}
|
||||
mRecyclerView.setPadding(mPadding.left, mPadding.top, mPadding.right,
|
||||
@@ -762,15 +810,15 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
|
||||
|
||||
private void applyVerticalFadingEdgeEnabled(boolean enabled) {
|
||||
mVerticalFadingEdge = enabled;
|
||||
mAH.get(AdapterHolder.MAIN).mRecyclerView.setVerticalFadingEdgeEnabled(!mUsingTabs
|
||||
&& mVerticalFadingEdge);
|
||||
mRecyclerView.setVerticalFadingEdgeEnabled(!mUsingTabs && mVerticalFadingEdge);
|
||||
}
|
||||
|
||||
private boolean isWork() {
|
||||
return mType == WORK;
|
||||
}
|
||||
|
||||
private boolean isSearch() {
|
||||
return mType == SEARCH;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a view that denotes the visible part of all apps container view.
|
||||
*/
|
||||
public View getVisibleContainerView() {
|
||||
return mActivityContext.getDeviceProfile().isTablet ? mBottomSheetBackground : this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.allapps.BaseAllAppsContainerView.AdapterHolder;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
@@ -90,8 +91,8 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
protected ViewGroup mTabLayout;
|
||||
private AllAppsRecyclerView mMainRV;
|
||||
private AllAppsRecyclerView mWorkRV;
|
||||
private SearchRecyclerView mSearchRV;
|
||||
private AllAppsRecyclerView mCurrentRV;
|
||||
private ViewGroup mParent;
|
||||
public boolean mHeaderCollapsed;
|
||||
protected int mSnappedScrolledY;
|
||||
private int mTranslationY;
|
||||
@@ -100,7 +101,6 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
|
||||
protected boolean mTabsHidden;
|
||||
protected int mMaxTranslation;
|
||||
private boolean mMainRVActive = true;
|
||||
|
||||
private boolean mCollapsed = false;
|
||||
|
||||
@@ -232,7 +232,8 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
return super.getFocusedChild();
|
||||
}
|
||||
|
||||
void setup(AllAppsRecyclerView mainRV, AllAppsRecyclerView workRV, boolean tabsHidden) {
|
||||
void setup(AllAppsRecyclerView mainRV, AllAppsRecyclerView workRV, SearchRecyclerView searchRV,
|
||||
int activeRV, boolean tabsHidden) {
|
||||
for (FloatingHeaderRow row : mAllRows) {
|
||||
row.setup(this, mAllRows, tabsHidden);
|
||||
}
|
||||
@@ -242,8 +243,8 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
mTabLayout.setVisibility(tabsHidden ? View.GONE : View.VISIBLE);
|
||||
mMainRV = setupRV(mMainRV, mainRV);
|
||||
mWorkRV = setupRV(mWorkRV, workRV);
|
||||
mParent = (ViewGroup) mMainRV.getParent();
|
||||
setMainActive(mMainRVActive || mWorkRV == null);
|
||||
mSearchRV = (SearchRecyclerView) setupRV(mSearchRV, searchRV);
|
||||
setActiveRV(activeRV);
|
||||
reset(false);
|
||||
}
|
||||
|
||||
@@ -267,9 +268,10 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
}
|
||||
}
|
||||
|
||||
public void setMainActive(boolean active) {
|
||||
mCurrentRV = active ? mMainRV : mWorkRV;
|
||||
mMainRVActive = active;
|
||||
public void setActiveRV(int rvType) {
|
||||
mCurrentRV =
|
||||
rvType == AdapterHolder.MAIN ? mMainRV
|
||||
: rvType == AdapterHolder.WORK ? mWorkRV : mSearchRV;
|
||||
}
|
||||
|
||||
public int getMaxTranslation() {
|
||||
@@ -332,10 +334,15 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
mHeaderClip.top = clipTop;
|
||||
// clipping on a draw might cause additional redraw
|
||||
setClipBounds(mHeaderClip);
|
||||
mMainRV.setClipBounds(mRVClip);
|
||||
if (mMainRV != null) {
|
||||
mMainRV.setClipBounds(mRVClip);
|
||||
}
|
||||
if (mWorkRV != null) {
|
||||
mWorkRV.setClipBounds(mRVClip);
|
||||
}
|
||||
if (mSearchRV != null) {
|
||||
mSearchRV.setClipBounds(mRVClip);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -402,8 +409,8 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
}
|
||||
|
||||
private void calcOffset(Point p) {
|
||||
p.x = getLeft() - mCurrentRV.getLeft() - mParent.getLeft();
|
||||
p.y = getTop() - mCurrentRV.getTop() - mParent.getTop();
|
||||
p.x = getLeft() - mCurrentRV.getLeft() - ((ViewGroup) mCurrentRV.getParent()).getLeft();
|
||||
p.y = getTop() - mCurrentRV.getTop() - ((ViewGroup) mCurrentRV.getParent()).getTop();
|
||||
}
|
||||
|
||||
public boolean hasVisibleContent() {
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.allapps;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/** A RecyclerView for AllApps Search results. */
|
||||
public class SearchRecyclerView extends AllAppsRecyclerView {
|
||||
private static final String TAG = "SearchRecyclerView";
|
||||
|
||||
public SearchRecyclerView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public SearchRecyclerView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public SearchRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
this(context, attrs, defStyleAttr, 0);
|
||||
}
|
||||
|
||||
public SearchRecyclerView(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updatePoolSize() {
|
||||
RecycledViewPool pool = getRecycledViewPool();
|
||||
pool.setMaxRecycledViews(AllAppsGridAdapter.VIEW_TYPE_ICON, mNumAppsPerRow);
|
||||
// TODO(b/206905515): Add maxes for other View types.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsFastScrolling() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class WorkEduCard extends FrameLayout implements
|
||||
super.onFinishInflate();
|
||||
findViewById(R.id.action_btn).setOnClickListener(this);
|
||||
MarginLayoutParams lp = ((MarginLayoutParams) findViewById(R.id.wrapper).getLayoutParams());
|
||||
lp.width = mActivityContext.getAppsView().getActiveRecyclerView().getTabWidth();
|
||||
lp.width = mActivityContext.getAppsView().getActiveAppsRecyclerView().getTabWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class AppsSearchContainerLayout extends ExtendedEditText
|
||||
private final AllAppsSearchBarController mSearchBarController;
|
||||
private final SpannableStringBuilder mSearchQueryBuilder;
|
||||
|
||||
private AlphabeticalAppsList<?> mApps;
|
||||
private AlphabeticalAppsList<?> mSearchResultsList;
|
||||
private ActivityAllAppsContainerView<?> mAppsView;
|
||||
|
||||
// The amount of pixels to shift down and overlap with the rest of the content.
|
||||
@@ -102,8 +102,8 @@ public class AppsSearchContainerLayout extends ExtendedEditText
|
||||
// Update the width to match the grid padding
|
||||
DeviceProfile dp = mLauncher.getDeviceProfile();
|
||||
int myRequestedWidth = getSize(widthMeasureSpec);
|
||||
int rowWidth = myRequestedWidth - mAppsView.getActiveRecyclerView().getPaddingLeft()
|
||||
- mAppsView.getActiveRecyclerView().getPaddingRight();
|
||||
int rowWidth = myRequestedWidth - mAppsView.getActiveAppsRecyclerView().getPaddingLeft()
|
||||
- mAppsView.getActiveAppsRecyclerView().getPaddingRight();
|
||||
|
||||
int cellWidth = DeviceProfile.calculateCellWidth(rowWidth,
|
||||
dp.cellLayoutBorderSpacePx.x, dp.numShownHotseatIcons);
|
||||
@@ -131,7 +131,7 @@ public class AppsSearchContainerLayout extends ExtendedEditText
|
||||
|
||||
@Override
|
||||
public void initializeSearch(ActivityAllAppsContainerView<?> appsView) {
|
||||
mApps = appsView.getApps();
|
||||
mSearchResultsList = appsView.getSearchResultList();
|
||||
mAppsView = appsView;
|
||||
mSearchBarController.initialize(
|
||||
new DefaultAppSearchAlgorithm(getContext()),
|
||||
@@ -170,7 +170,7 @@ public class AppsSearchContainerLayout extends ExtendedEditText
|
||||
@Override
|
||||
public void onSearchResult(String query, ArrayList<AdapterItem> items) {
|
||||
if (items != null) {
|
||||
mApps.setSearchResults(items);
|
||||
mSearchResultsList.setSearchResults(items);
|
||||
notifyResultChanged();
|
||||
mAppsView.setLastSearchQuery(query);
|
||||
}
|
||||
@@ -179,14 +179,14 @@ public class AppsSearchContainerLayout extends ExtendedEditText
|
||||
@Override
|
||||
public void onAppendSearchResult(String query, ArrayList<AdapterItem> items) {
|
||||
if (items != null) {
|
||||
mApps.appendSearchResults(items);
|
||||
mSearchResultsList.appendSearchResults(items);
|
||||
notifyResultChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSearchResult() {
|
||||
if (mApps.setSearchResults(null)) {
|
||||
if (mSearchResultsList.setSearchResults(null)) {
|
||||
notifyResultChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,9 @@ public class LauncherPopupLiveUpdateHandler extends PopupLiveUpdateHandler<Launc
|
||||
|
||||
@Override
|
||||
public void onWidgetsBound() {
|
||||
ItemInfo itemInfo = (ItemInfo) mPopupContainerWithArrow.getOriginalIcon().getTag();
|
||||
SystemShortcut widgetInfo = SystemShortcut.WIDGETS.getShortcut(mContext, itemInfo);
|
||||
BubbleTextView originalIcon = mPopupContainerWithArrow.getOriginalIcon();
|
||||
SystemShortcut widgetInfo = SystemShortcut.WIDGETS.getShortcut(mContext,
|
||||
(ItemInfo) originalIcon.getTag(), originalIcon);
|
||||
View widgetsView = getWidgetsView(mPopupContainerWithArrow);
|
||||
if (widgetsView == null && mPopupContainerWithArrow.getWidgetContainer() != null) {
|
||||
widgetsView = getWidgetsView(mPopupContainerWithArrow.getWidgetContainer());
|
||||
|
||||
@@ -218,7 +218,7 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
|
||||
popupDataProvider.getShortcutCountForItem(item),
|
||||
popupDataProvider.getNotificationKeysForItem(item),
|
||||
launcher.getSupportedShortcuts()
|
||||
.map(s -> s.getShortcut(launcher, item))
|
||||
.map(s -> s.getShortcut(launcher, item, icon))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList()));
|
||||
launcher.refreshAndBindWidgetsForPackageUser(PackageUserKey.fromItemInfo(item));
|
||||
|
||||
@@ -46,8 +46,8 @@ public class RemoteActionShortcut extends SystemShortcut<BaseDraggingActivity> {
|
||||
private final RemoteAction mAction;
|
||||
|
||||
public RemoteActionShortcut(RemoteAction action,
|
||||
BaseDraggingActivity activity, ItemInfo itemInfo) {
|
||||
super(0, R.id.action_remote_action_shortcut, activity, itemInfo);
|
||||
BaseDraggingActivity activity, ItemInfo itemInfo, View originalView) {
|
||||
super(0, R.id.action_remote_action_shortcut, activity, itemInfo, originalView);
|
||||
mAction = action;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,18 +46,21 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend
|
||||
|
||||
protected final T mTarget;
|
||||
protected final ItemInfo mItemInfo;
|
||||
protected final View mOriginalView;
|
||||
|
||||
/**
|
||||
* Indicates if it's invokable or not through some disabled UI
|
||||
*/
|
||||
private boolean isEnabled = true;
|
||||
|
||||
public SystemShortcut(int iconResId, int labelResId, T target, ItemInfo itemInfo) {
|
||||
public SystemShortcut(int iconResId, int labelResId, T target, ItemInfo itemInfo,
|
||||
View originalView) {
|
||||
mIconResId = iconResId;
|
||||
mLabelResId = labelResId;
|
||||
mAccessibilityActionId = labelResId;
|
||||
mTarget = target;
|
||||
mItemInfo = itemInfo;
|
||||
mOriginalView = originalView;
|
||||
}
|
||||
|
||||
public SystemShortcut(SystemShortcut<T> other) {
|
||||
@@ -66,6 +69,7 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend
|
||||
mAccessibilityActionId = other.mAccessibilityActionId;
|
||||
mTarget = other.mTarget;
|
||||
mItemInfo = other.mItemInfo;
|
||||
mOriginalView = other.mOriginalView;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,10 +111,10 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend
|
||||
|
||||
public interface Factory<T extends Context & ActivityContext> {
|
||||
|
||||
@Nullable SystemShortcut<T> getShortcut(T activity, ItemInfo itemInfo);
|
||||
@Nullable SystemShortcut<T> getShortcut(T activity, ItemInfo itemInfo, View originalView);
|
||||
}
|
||||
|
||||
public static final Factory<Launcher> WIDGETS = (launcher, itemInfo) -> {
|
||||
public static final Factory<Launcher> WIDGETS = (launcher, itemInfo, originalView) -> {
|
||||
if (itemInfo.getTargetComponent() == null) return null;
|
||||
final List<WidgetItem> widgets =
|
||||
launcher.getPopupDataProvider().getWidgetsForPackageUser(new PackageUserKey(
|
||||
@@ -118,12 +122,13 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend
|
||||
if (widgets.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return new Widgets(launcher, itemInfo);
|
||||
return new Widgets(launcher, itemInfo, originalView);
|
||||
};
|
||||
|
||||
public static class Widgets extends SystemShortcut<Launcher> {
|
||||
public Widgets(Launcher target, ItemInfo itemInfo) {
|
||||
super(R.drawable.ic_widget, R.string.widget_button_text, target, itemInfo);
|
||||
public Widgets(Launcher target, ItemInfo itemInfo, View originalView) {
|
||||
super(R.drawable.ic_widget, R.string.widget_button_text, target, itemInfo,
|
||||
originalView);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -145,9 +150,9 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend
|
||||
@Nullable
|
||||
private SplitAccessibilityInfo mSplitA11yInfo;
|
||||
|
||||
public AppInfo(T target, ItemInfo itemInfo) {
|
||||
public AppInfo(T target, ItemInfo itemInfo, View originalView) {
|
||||
super(R.drawable.ic_info_no_shadow, R.string.app_info_drop_target_label, target,
|
||||
itemInfo);
|
||||
itemInfo, originalView);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,8 +165,9 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend
|
||||
* That way it could directly create the correct node info for any shortcut that supports
|
||||
* split, but then we'll need custom resIDs for each pair of shortcuts.
|
||||
*/
|
||||
public AppInfo(T target, ItemInfo itemInfo, SplitAccessibilityInfo accessibilityInfo) {
|
||||
this(target, itemInfo);
|
||||
public AppInfo(T target, ItemInfo itemInfo, View originalView,
|
||||
SplitAccessibilityInfo accessibilityInfo) {
|
||||
this(target, itemInfo, originalView);
|
||||
mSplitA11yInfo = accessibilityInfo;
|
||||
mAccessibilityActionId = accessibilityInfo.nodeId;
|
||||
}
|
||||
@@ -203,28 +209,29 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend
|
||||
}
|
||||
}
|
||||
|
||||
public static final Factory<BaseDraggingActivity> INSTALL = (activity, itemInfo) -> {
|
||||
boolean supportsWebUI = (itemInfo instanceof WorkspaceItemInfo)
|
||||
&& ((WorkspaceItemInfo) itemInfo).hasStatusFlag(
|
||||
public static final Factory<BaseDraggingActivity> INSTALL =
|
||||
(activity, itemInfo, originalView) -> {
|
||||
boolean supportsWebUI = (itemInfo instanceof WorkspaceItemInfo)
|
||||
&& ((WorkspaceItemInfo) itemInfo).hasStatusFlag(
|
||||
WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI);
|
||||
boolean isInstantApp = false;
|
||||
if (itemInfo instanceof com.android.launcher3.model.data.AppInfo) {
|
||||
com.android.launcher3.model.data.AppInfo
|
||||
appInfo = (com.android.launcher3.model.data.AppInfo) itemInfo;
|
||||
isInstantApp = InstantAppResolver.newInstance(activity).isInstantApp(appInfo);
|
||||
}
|
||||
boolean enabled = supportsWebUI || isInstantApp;
|
||||
if (!enabled) {
|
||||
return null;
|
||||
}
|
||||
return new Install(activity, itemInfo);
|
||||
boolean isInstantApp = false;
|
||||
if (itemInfo instanceof com.android.launcher3.model.data.AppInfo) {
|
||||
com.android.launcher3.model.data.AppInfo
|
||||
appInfo = (com.android.launcher3.model.data.AppInfo) itemInfo;
|
||||
isInstantApp = InstantAppResolver.newInstance(activity).isInstantApp(appInfo);
|
||||
}
|
||||
boolean enabled = supportsWebUI || isInstantApp;
|
||||
if (!enabled) {
|
||||
return null;
|
||||
}
|
||||
return new Install(activity, itemInfo, originalView);
|
||||
};
|
||||
|
||||
public static class Install extends SystemShortcut<BaseDraggingActivity> {
|
||||
|
||||
public Install(BaseDraggingActivity target, ItemInfo itemInfo) {
|
||||
public Install(BaseDraggingActivity target, ItemInfo itemInfo, View originalView) {
|
||||
super(R.drawable.ic_install_no_shadow, R.string.install_drop_target_label,
|
||||
target, itemInfo);
|
||||
target, itemInfo, originalView);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -205,8 +205,8 @@ public class PinnedAppsAdapter extends BaseAdapter implements OnSharedPreference
|
||||
/**
|
||||
* Returns a system shortcut to pin/unpin a shortcut
|
||||
*/
|
||||
public SystemShortcut getSystemShortcut(ItemInfo info) {
|
||||
return new PinUnPinShortcut(mLauncher, info,
|
||||
public SystemShortcut getSystemShortcut(ItemInfo info, View originalView) {
|
||||
return new PinUnPinShortcut(mLauncher, info, originalView,
|
||||
mPinnedApps.contains(new ComponentKey(info.getTargetComponent(), info.user)));
|
||||
}
|
||||
|
||||
@@ -214,10 +214,11 @@ public class PinnedAppsAdapter extends BaseAdapter implements OnSharedPreference
|
||||
|
||||
private final boolean mIsPinned;
|
||||
|
||||
PinUnPinShortcut(SecondaryDisplayLauncher target, ItemInfo info, boolean isPinned) {
|
||||
PinUnPinShortcut(SecondaryDisplayLauncher target, ItemInfo info, View originalView,
|
||||
boolean isPinned) {
|
||||
super(isPinned ? R.drawable.ic_remove_no_shadow : R.drawable.ic_pin,
|
||||
isPinned ? R.string.remove_drop_target_label : R.string.action_add_to_workspace,
|
||||
target, info);
|
||||
target, info, originalView);
|
||||
mIsPinned = isPinned;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,8 +193,8 @@ public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher>
|
||||
container.populateAndShow((BubbleTextView) v,
|
||||
popupDataProvider.getShortcutCountForItem(item),
|
||||
Collections.emptyList(),
|
||||
Arrays.asList(mPinnedAppsAdapter.getSystemShortcut(item),
|
||||
APP_INFO.getShortcut(mActivity, item)));
|
||||
Arrays.asList(mPinnedAppsAdapter.getSystemShortcut(item, v),
|
||||
APP_INFO.getShortcut(mActivity, item, v)));
|
||||
v.getParent().requestDisallowInterceptTouchEvent(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class TestInformationHandler implements ResourceBasedOverride {
|
||||
|
||||
case TestProtocol.REQUEST_APPS_LIST_SCROLL_Y: {
|
||||
return getLauncherUIProperty(Bundle::putInt,
|
||||
l -> l.getAppsView().getActiveRecyclerView().getCurrentScrollY());
|
||||
l -> l.getAppsView().getActiveAppsRecyclerView().getCurrentScrollY());
|
||||
}
|
||||
|
||||
case TestProtocol.REQUEST_WIDGETS_SCROLL_Y: {
|
||||
|
||||
@@ -43,7 +43,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.launcher3.BaseRecyclerView;
|
||||
import com.android.launcher3.FastScrollRecyclerView;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.graphics.FastScrollThumbDrawable;
|
||||
@@ -127,7 +127,7 @@ public class RecyclerViewFastScroller extends View {
|
||||
private String mPopupSectionName;
|
||||
private Insets mSystemGestureInsets;
|
||||
|
||||
protected BaseRecyclerView mRv;
|
||||
protected FastScrollRecyclerView mRv;
|
||||
private RecyclerView.OnScrollListener mOnScrollListener;
|
||||
|
||||
private int mDownX;
|
||||
@@ -172,7 +172,7 @@ public class RecyclerViewFastScroller extends View {
|
||||
ta.recycle();
|
||||
}
|
||||
|
||||
public void setRecyclerView(BaseRecyclerView rv, TextView popupView) {
|
||||
public void setRecyclerView(FastScrollRecyclerView rv, TextView popupView) {
|
||||
if (mRv != null && mOnScrollListener != null) {
|
||||
mRv.removeOnScrollListener(mOnScrollListener);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.OnItemTouchListener;
|
||||
|
||||
import com.android.launcher3.BaseRecyclerView;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.FastScrollRecyclerView;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.launcher3.widget.model.WidgetListSpaceEntry;
|
||||
@@ -41,7 +41,7 @@ import com.android.launcher3.widget.picker.WidgetsSpaceViewHolderBinder.EmptySpa
|
||||
/**
|
||||
* The widgets recycler view.
|
||||
*/
|
||||
public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouchListener {
|
||||
public class WidgetsRecyclerView extends FastScrollRecyclerView implements OnItemTouchListener {
|
||||
|
||||
private WidgetsListAdapter mAdapter;
|
||||
|
||||
|
||||
@@ -525,7 +525,7 @@ public abstract class AbstractLauncherUiTest {
|
||||
}
|
||||
|
||||
protected int getAllAppsScroll(Launcher launcher) {
|
||||
return launcher.getAppsView().getActiveRecyclerView().getCurrentScrollY();
|
||||
return launcher.getAppsView().getActiveAppsRecyclerView().getCurrentScrollY();
|
||||
}
|
||||
|
||||
private void checkLauncherIntegrity(
|
||||
|
||||
@@ -134,8 +134,8 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
|
||||
executeOnLauncher(l -> {
|
||||
ActivityAllAppsContainerView<?> allApps = l.getAppsView();
|
||||
assertEquals("Work tab is not focused", allApps.getCurrentPage(), WORK_PAGE);
|
||||
View workPausedCard = allApps.getActiveRecyclerView().findViewHolderForAdapterPosition(
|
||||
0).itemView;
|
||||
View workPausedCard = allApps.getActiveAppsRecyclerView()
|
||||
.findViewHolderForAdapterPosition(0).itemView;
|
||||
workPausedCard.findViewById(R.id.enable_work_apps).performClick();
|
||||
});
|
||||
waitForLauncherCondition("Work profile toggle ON failed", launcher -> {
|
||||
@@ -155,7 +155,7 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
|
||||
});
|
||||
|
||||
waitForLauncherCondition("Work profile education not shown",
|
||||
l -> l.getAppsView().getActiveRecyclerView()
|
||||
l -> l.getAppsView().getActiveAppsRecyclerView()
|
||||
.findViewHolderForAdapterPosition(0).itemView instanceof WorkEduCard,
|
||||
LauncherInstrumentation.WAIT_TIME_MS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user