mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
Merge "Add a bubble option to launcher long press menus" into main
This commit is contained in:
@@ -16,19 +16,24 @@
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
|
||||
import com.android.launcher3.popup.SystemShortcut;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// TODO(b/218912746): Share more behavior to avoid all apps context depending directly on taskbar.
|
||||
/** Base for common behavior between taskbar window contexts. */
|
||||
public abstract class BaseTaskbarContext extends ContextThemeWrapper implements ActivityContext {
|
||||
public abstract class BaseTaskbarContext extends ContextThemeWrapper implements ActivityContext,
|
||||
SystemShortcut.BubbleActivityStarter {
|
||||
|
||||
protected final LayoutInflater mLayoutInflater;
|
||||
private final List<OnDeviceProfileChangeListener> mDPChangeListeners = new ArrayList<>();
|
||||
@@ -48,6 +53,18 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements
|
||||
return mDPChangeListeners;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showShortcutBubble(ShortcutInfo info) {
|
||||
if (info == null) return;
|
||||
SystemUiProxy.INSTANCE.get(this).showShortcutBubble(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showAppBubble(Intent intent) {
|
||||
if (intent == null || intent.getPackage() == null) return;
|
||||
SystemUiProxy.INSTANCE.get(this).showAppBubble(intent);
|
||||
}
|
||||
|
||||
/** Callback invoked when a drag is initiated within this context. */
|
||||
public abstract void onDragStart();
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.LogUtils;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -69,6 +70,9 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
private static final SystemShortcut.Factory<BaseTaskbarContext>
|
||||
APP_INFO = SystemShortcut.AppInfo::new;
|
||||
|
||||
private static final SystemShortcut.Factory<BaseTaskbarContext>
|
||||
BUBBLE = SystemShortcut.BubbleShortcut::new;
|
||||
|
||||
private final TaskbarActivityContext mContext;
|
||||
private final PopupDataProvider mPopupDataProvider;
|
||||
|
||||
@@ -182,10 +186,13 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
// Create a Stream of all applicable system shortcuts
|
||||
private Stream<SystemShortcut.Factory> getSystemShortcuts() {
|
||||
// append split options to APP_INFO shortcut, the order here will reflect in the popup
|
||||
return Stream.concat(
|
||||
Stream.of(APP_INFO),
|
||||
mControllers.uiController.getSplitMenuOptions()
|
||||
);
|
||||
ArrayList<SystemShortcut.Factory> shortcuts = new ArrayList<>();
|
||||
shortcuts.add(APP_INFO);
|
||||
shortcuts.addAll(mControllers.uiController.getSplitMenuOptions().toList());
|
||||
if (com.android.wm.shell.Flags.enableBubbleAnything()) {
|
||||
shortcuts.add(BUBBLE);
|
||||
}
|
||||
return shortcuts.stream();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,6 +45,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
||||
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
|
||||
import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition;
|
||||
import static com.android.launcher3.popup.SystemShortcut.APP_INFO;
|
||||
import static com.android.launcher3.popup.SystemShortcut.BUBBLE_SHORTCUT;
|
||||
import static com.android.launcher3.popup.SystemShortcut.DONT_SUGGEST_APP;
|
||||
import static com.android.launcher3.popup.SystemShortcut.INSTALL;
|
||||
import static com.android.launcher3.popup.SystemShortcut.PRIVATE_PROFILE_INSTALL;
|
||||
@@ -75,6 +76,7 @@ import android.app.ActivityOptions;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
@@ -215,7 +217,8 @@ import java.util.function.BiConsumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class QuickstepLauncher extends Launcher implements RecentsViewContainer {
|
||||
public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
SystemShortcut.BubbleActivityStarter {
|
||||
private static final boolean TRACE_LAYOUTS =
|
||||
SystemProperties.getBoolean("persist.debug.trace_layouts", false);
|
||||
private static final String TRACE_RELAYOUT_CLASS =
|
||||
@@ -466,6 +469,9 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer
|
||||
if (Flags.enablePrivateSpace()) {
|
||||
shortcuts.add(UNINSTALL_APP);
|
||||
}
|
||||
if (com.android.wm.shell.Flags.enableBubbleAnything()) {
|
||||
shortcuts.add(BUBBLE_SHORTCUT);
|
||||
}
|
||||
return shortcuts.stream();
|
||||
}
|
||||
|
||||
@@ -1436,6 +1442,18 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showShortcutBubble(ShortcutInfo info) {
|
||||
if (info == null) return;
|
||||
SystemUiProxy.INSTANCE.get(this).showShortcutBubble(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showAppBubble(Intent intent) {
|
||||
if (intent == null || intent.getPackage() == null) return;
|
||||
SystemUiProxy.INSTANCE.get(this).showAppBubble(intent);
|
||||
}
|
||||
|
||||
private static final class LauncherTaskViewController extends
|
||||
TaskViewTouchController<QuickstepLauncher> {
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ import android.view.IRecentsAnimationController;
|
||||
import android.view.IRecentsAnimationRunner;
|
||||
import android.view.IRemoteAnimationRunner;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.RemoteAnimationAdapter;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
import android.view.SurfaceControl;
|
||||
import android.window.IOnBackInvokedCallback;
|
||||
@@ -894,6 +893,36 @@ public class SystemUiProxy implements ISystemUiProxy, NavHandle, SafeCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells SysUI to show a shortcut bubble.
|
||||
*
|
||||
* @param info the shortcut info used to create or identify the bubble.
|
||||
*/
|
||||
public void showShortcutBubble(ShortcutInfo info) {
|
||||
try {
|
||||
if (mBubbles != null) {
|
||||
mBubbles.showShortcutBubble(info);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call show bubble for shortcut");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells SysUI to show a bubble of an app.
|
||||
*
|
||||
* @param intent the intent used to create the bubble.
|
||||
*/
|
||||
public void showAppBubble(Intent intent) {
|
||||
try {
|
||||
if (mBubbles != null) {
|
||||
mBubbles.showAppBubble(intent);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call show bubble for app");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Splitscreen
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user