Loading quickstep/res/drawable/ic_floating_task_button.xml 0 → 100644 +29 −0 Original line number Diff line number Diff line <?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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:pathData="M17.6258,4.96L19.0358,6.37L7.4058,18.01L5.9958,16.6L17.6258,4.96ZM16.1358,3.62L4.1258,15.63L3.0158,19.83C2.9058,20.45 3.3858,21 3.9958,21C4.0558,21 4.1058,21 4.1658,20.99L8.3658,19.88L20.3758,7.86C20.7758,7.46 20.9958,6.93 20.9958,6.37C20.9958,5.81 20.7758,5.28 20.3758,4.88L19.1058,3.61C18.7158,3.22 18.1858,3 17.6258,3C17.0658,3 16.5358,3.22 16.1358,3.62Z" android:fillColor="#636C6F"/> <path android:pathData="M20.1936,15.3369C20.3748,16.3837 19.9151,17.5414 18.8846,18.7597C19.1546,18.872 19.4576,18.9452 19.7724,18.9867C20.0839,19.0278 20.3683,19.0325 20.5749,19.0266C20.6772,19.0236 20.7578,19.0181 20.8101,19.0138C20.8362,19.0116 20.855,19.0097 20.8657,19.0085L20.8754,19.0074L20.875,19.0075C21.4217,18.9385 21.9214,19.325 21.9918,19.8718C22.0624,20.4195 21.6756,20.9208 21.1279,20.9914L21,19.9996C21.1279,20.9914 21.1265,20.9916 21.1265,20.9916L21.1249,20.9918L21.1211,20.9923L21.1107,20.9935L21.0795,20.997C21.0542,20.9998 21.0199,21.0032 20.9775,21.0067C20.8929,21.0138 20.7753,21.0216 20.6323,21.0257C20.3481,21.0339 19.9533,21.0279 19.5109,20.9695C18.873,20.8854 18.0393,20.6793 17.3106,20.1662C16.9605,20.3559 16.5876,20.4952 16.2299,20.6003C15.5742,20.7927 14.8754,20.8968 14.2534,20.9534C13.6801,21.0055 13.4553,21.0037 13.1015,21.0008C13.0689,21.0005 13.0352,21.0002 13,21H12.8594C12.8214,21.0002 12.785,21.0006 12.7504,21.0009C12.6524,21.0019 12.5683,21.0027 12.5,21H12.0562C12.0277,21.0003 12.0054,21.0006 11.9926,21.001L11.9751,21H9L11,19H11.9795C11.9929,18.9997 12.0064,18.9997 12.0199,19H12.4117C12.4534,18.9996 12.4864,18.9995 12.5,19H12.9675C12.977,18.9999 12.9878,18.9999 13,19C13.0446,19.0003 13.0859,19.0007 13.1249,19.0011C13.4259,19.0038 13.591,19.0054 14.0723,18.9616C14.6201,18.9118 15.1795,18.8242 15.6665,18.6813C15.753,18.6559 15.8346,18.6295 15.9114,18.6022C15.0315,17.2981 14.7125,16.1044 15.015,15.0829C15.4095,13.7511 16.6784,13.2418 17.7026,13.2864C18.7262,13.3309 19.954,13.9529 20.1936,15.3369ZM16.9327,15.6508C16.873,15.8523 16.8651,16.3878 17.4697,17.334C18.2007,16.4284 18.2585,15.8839 18.2229,15.6781C18.1939,15.5108 18.0297,15.3025 17.6157,15.2845C17.2025,15.2665 16.9885,15.4626 16.9327,15.6508Z" android:fillColor="#636C6F" android:fillType="evenOdd"/> </vector> quickstep/src/com/android/launcher3/taskbar/FloatingTaskIntentResolver.java 0 → 100644 +97 −0 Original line number Diff line number Diff line /* * 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.taskbar; import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY; import android.annotation.Nullable; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.text.TextUtils; import android.util.Log; import com.android.launcher3.R; // TODO: This would be replaced by the thing that has the role and provides the intent. /** * Helper to determine what intent should be used to display in a floating window, if one * exists. */ public class FloatingTaskIntentResolver { private static final String TAG = FloatingTaskIntentResolver.class.getSimpleName(); @Nullable /** Gets an intent for a floating task, if one exists. */ public static Intent getIntent(Context context) { PackageManager pm = context.getPackageManager(); String pkg = context.getString(R.string.floating_task_package); String action = context.getString(R.string.floating_task_action); if (TextUtils.isEmpty(pkg) || TextUtils.isEmpty(action)) { Log.d(TAG, "intent could not be found, pkg= " + pkg + " action= " + action); return null; } Intent intent = createIntent(pm, null, pkg, action); if (intent != null) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return intent; } Log.d(TAG, "No valid intent found!"); return null; } @Nullable private static Intent createIntent(PackageManager pm, @Nullable String activityName, String packageName, String action) { if (TextUtils.isEmpty(activityName)) { activityName = queryActivityForAction(pm, packageName, action); } if (TextUtils.isEmpty(activityName)) { Log.d(TAG, "Activity name is empty even after action search: " + action); return null; } ComponentName component = new ComponentName(packageName, activityName); Intent intent = new Intent(action).setComponent(component); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Log.d(TAG, "createIntent returning: " + intent); return intent; } @Nullable private static String queryActivityForAction(PackageManager pm, String packageName, String action) { Intent intent = new Intent(action).setPackage(packageName); ResolveInfo resolveInfo = pm.resolveActivity(intent, MATCH_DEFAULT_ONLY); if (resolveInfo == null || resolveInfo.activityInfo == null) { Log.d(TAG, "queryActivityForAction: + " + resolveInfo); return null; } ActivityInfo info = resolveInfo.activityInfo; if (!info.exported) { Log.d(TAG, "queryActivityForAction: + " + info + " not exported"); return null; } if (!info.enabled) { Log.d(TAG, "queryActivityForAction: + " + info + " not enabled"); return null; } return resolveInfo.activityInfo.name; } } quickstep/src/com/android/launcher3/taskbar/LaunchFloatingTaskButton.java 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * 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.taskbar; import android.content.Context; import android.graphics.Bitmap; import android.util.AttributeSet; import android.view.ContextThemeWrapper; import com.android.launcher3.BubbleTextView; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.icons.FastBitmapDrawable; /** * Button in Taskbar that opens something in a floating task. */ public class LaunchFloatingTaskButton extends BubbleTextView { public LaunchFloatingTaskButton(Context context) { this(context, null); } public LaunchFloatingTaskButton(Context context, AttributeSet attrs) { this(context, attrs, 0); } public LaunchFloatingTaskButton(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); Context theme = new ContextThemeWrapper(context, R.style.AllAppsButtonTheme); Bitmap bitmap = LauncherAppState.getInstance(context).getIconCache().getIconFactory() .createScaledBitmapWithShadow( theme.getDrawable(R.drawable.ic_floating_task_button)); setIcon(new FastBitmapDrawable(bitmap)); } } quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +36 −0 Original line number Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.launcher3.taskbar; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Rect; import android.os.SystemProperties; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; Loading Loading @@ -53,6 +56,7 @@ import java.util.function.Predicate; * Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of other apps. */ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconParent, Insettable { private static final String TAG = TaskbarView.class.getSimpleName(); private static final float TASKBAR_BACKGROUND_LUMINANCE = 0.30f; public int mThemeIconsBackground; Loading Loading @@ -81,6 +85,12 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar private View mQsb; // Only non-null when device supports having a floating task. private @Nullable BubbleTextView mFloatingTaskButton; private @Nullable Intent mFloatingTaskIntent; private static final boolean FLOATING_TASKS_ENABLED = SystemProperties.getBoolean("persist.wm.debug.floating_tasks", false); public TaskbarView(@NonNull Context context) { this(context, null); } Loading Loading @@ -123,6 +133,19 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // TODO: Disable touch events on QSB otherwise it can crash. mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false); if (FLOATING_TASKS_ENABLED) { mFloatingTaskIntent = FloatingTaskIntentResolver.getIntent(context); if (mFloatingTaskIntent != null) { mFloatingTaskButton = new LaunchFloatingTaskButton(context); mFloatingTaskButton.setLayoutParams( new ViewGroup.LayoutParams(mIconTouchSize, mIconTouchSize)); mFloatingTaskButton.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding); } else { Log.d(TAG, "Floating tasks is enabled but no intent was found!"); } } } private int getColorWithGivenLuminance(int color, float luminance) { Loading Loading @@ -150,6 +173,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar if (mAllAppsButton != null) { mAllAppsButton.setOnClickListener(mControllerCallbacks.getAllAppsButtonClickListener()); } if (mFloatingTaskButton != null) { mFloatingTaskButton.setOnClickListener( mControllerCallbacks.getFloatingTaskButtonListener(mFloatingTaskIntent)); } } private void removeAndRecycle(View view) { Loading @@ -174,6 +201,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } removeView(mQsb); if (mFloatingTaskButton != null) { removeView(mFloatingTaskButton); } for (int i = 0; i < hotseatItemInfos.length; i++) { ItemInfo hotseatItemInfo = hotseatItemInfos[i]; if (hotseatItemInfo == null) { Loading Loading @@ -255,6 +286,11 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar mQsb.setVisibility(View.INVISIBLE); } if (mFloatingTaskButton != null) { int index = Utilities.isRtl(getResources()) ? 0 : getChildCount(); addView(mFloatingTaskButton, index); } mThemeIconsBackground = calculateThemeIconsBackground(); setThemedIconsBackgroundColor(mThemeIconsBackground); } Loading quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +9 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static com.android.launcher3.taskbar.TaskbarManager.isPhoneMode; import static com.android.quickstep.AnimatedFloat.VALUE; import android.annotation.NonNull; import android.content.Intent; import android.graphics.Rect; import android.util.FloatProperty; import android.util.Log; Loading Loading @@ -51,6 +52,7 @@ import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LauncherBindableItemsContainer; import com.android.launcher3.util.MultiValueAlpha; import com.android.quickstep.AnimatedFloat; import com.android.quickstep.SystemUiProxy; import java.io.PrintWriter; import java.util.function.Predicate; Loading Loading @@ -427,6 +429,13 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar }; } public View.OnClickListener getFloatingTaskButtonListener(@NonNull Intent intent) { return v -> { SystemUiProxy proxy = SystemUiProxy.INSTANCE.get(v.getContext()); proxy.showFloatingTask(intent); }; } public View.OnLongClickListener getIconOnLongClickListener() { return mControllers.taskbarDragController::startDragOnLongClick; } Loading Loading
quickstep/res/drawable/ic_floating_task_button.xml 0 → 100644 +29 −0 Original line number Diff line number Diff line <?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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:pathData="M17.6258,4.96L19.0358,6.37L7.4058,18.01L5.9958,16.6L17.6258,4.96ZM16.1358,3.62L4.1258,15.63L3.0158,19.83C2.9058,20.45 3.3858,21 3.9958,21C4.0558,21 4.1058,21 4.1658,20.99L8.3658,19.88L20.3758,7.86C20.7758,7.46 20.9958,6.93 20.9958,6.37C20.9958,5.81 20.7758,5.28 20.3758,4.88L19.1058,3.61C18.7158,3.22 18.1858,3 17.6258,3C17.0658,3 16.5358,3.22 16.1358,3.62Z" android:fillColor="#636C6F"/> <path android:pathData="M20.1936,15.3369C20.3748,16.3837 19.9151,17.5414 18.8846,18.7597C19.1546,18.872 19.4576,18.9452 19.7724,18.9867C20.0839,19.0278 20.3683,19.0325 20.5749,19.0266C20.6772,19.0236 20.7578,19.0181 20.8101,19.0138C20.8362,19.0116 20.855,19.0097 20.8657,19.0085L20.8754,19.0074L20.875,19.0075C21.4217,18.9385 21.9214,19.325 21.9918,19.8718C22.0624,20.4195 21.6756,20.9208 21.1279,20.9914L21,19.9996C21.1279,20.9914 21.1265,20.9916 21.1265,20.9916L21.1249,20.9918L21.1211,20.9923L21.1107,20.9935L21.0795,20.997C21.0542,20.9998 21.0199,21.0032 20.9775,21.0067C20.8929,21.0138 20.7753,21.0216 20.6323,21.0257C20.3481,21.0339 19.9533,21.0279 19.5109,20.9695C18.873,20.8854 18.0393,20.6793 17.3106,20.1662C16.9605,20.3559 16.5876,20.4952 16.2299,20.6003C15.5742,20.7927 14.8754,20.8968 14.2534,20.9534C13.6801,21.0055 13.4553,21.0037 13.1015,21.0008C13.0689,21.0005 13.0352,21.0002 13,21H12.8594C12.8214,21.0002 12.785,21.0006 12.7504,21.0009C12.6524,21.0019 12.5683,21.0027 12.5,21H12.0562C12.0277,21.0003 12.0054,21.0006 11.9926,21.001L11.9751,21H9L11,19H11.9795C11.9929,18.9997 12.0064,18.9997 12.0199,19H12.4117C12.4534,18.9996 12.4864,18.9995 12.5,19H12.9675C12.977,18.9999 12.9878,18.9999 13,19C13.0446,19.0003 13.0859,19.0007 13.1249,19.0011C13.4259,19.0038 13.591,19.0054 14.0723,18.9616C14.6201,18.9118 15.1795,18.8242 15.6665,18.6813C15.753,18.6559 15.8346,18.6295 15.9114,18.6022C15.0315,17.2981 14.7125,16.1044 15.015,15.0829C15.4095,13.7511 16.6784,13.2418 17.7026,13.2864C18.7262,13.3309 19.954,13.9529 20.1936,15.3369ZM16.9327,15.6508C16.873,15.8523 16.8651,16.3878 17.4697,17.334C18.2007,16.4284 18.2585,15.8839 18.2229,15.6781C18.1939,15.5108 18.0297,15.3025 17.6157,15.2845C17.2025,15.2665 16.9885,15.4626 16.9327,15.6508Z" android:fillColor="#636C6F" android:fillType="evenOdd"/> </vector>
quickstep/src/com/android/launcher3/taskbar/FloatingTaskIntentResolver.java 0 → 100644 +97 −0 Original line number Diff line number Diff line /* * 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.taskbar; import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY; import android.annotation.Nullable; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.text.TextUtils; import android.util.Log; import com.android.launcher3.R; // TODO: This would be replaced by the thing that has the role and provides the intent. /** * Helper to determine what intent should be used to display in a floating window, if one * exists. */ public class FloatingTaskIntentResolver { private static final String TAG = FloatingTaskIntentResolver.class.getSimpleName(); @Nullable /** Gets an intent for a floating task, if one exists. */ public static Intent getIntent(Context context) { PackageManager pm = context.getPackageManager(); String pkg = context.getString(R.string.floating_task_package); String action = context.getString(R.string.floating_task_action); if (TextUtils.isEmpty(pkg) || TextUtils.isEmpty(action)) { Log.d(TAG, "intent could not be found, pkg= " + pkg + " action= " + action); return null; } Intent intent = createIntent(pm, null, pkg, action); if (intent != null) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return intent; } Log.d(TAG, "No valid intent found!"); return null; } @Nullable private static Intent createIntent(PackageManager pm, @Nullable String activityName, String packageName, String action) { if (TextUtils.isEmpty(activityName)) { activityName = queryActivityForAction(pm, packageName, action); } if (TextUtils.isEmpty(activityName)) { Log.d(TAG, "Activity name is empty even after action search: " + action); return null; } ComponentName component = new ComponentName(packageName, activityName); Intent intent = new Intent(action).setComponent(component); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Log.d(TAG, "createIntent returning: " + intent); return intent; } @Nullable private static String queryActivityForAction(PackageManager pm, String packageName, String action) { Intent intent = new Intent(action).setPackage(packageName); ResolveInfo resolveInfo = pm.resolveActivity(intent, MATCH_DEFAULT_ONLY); if (resolveInfo == null || resolveInfo.activityInfo == null) { Log.d(TAG, "queryActivityForAction: + " + resolveInfo); return null; } ActivityInfo info = resolveInfo.activityInfo; if (!info.exported) { Log.d(TAG, "queryActivityForAction: + " + info + " not exported"); return null; } if (!info.enabled) { Log.d(TAG, "queryActivityForAction: + " + info + " not enabled"); return null; } return resolveInfo.activityInfo.name; } }
quickstep/src/com/android/launcher3/taskbar/LaunchFloatingTaskButton.java 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * 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.taskbar; import android.content.Context; import android.graphics.Bitmap; import android.util.AttributeSet; import android.view.ContextThemeWrapper; import com.android.launcher3.BubbleTextView; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.icons.FastBitmapDrawable; /** * Button in Taskbar that opens something in a floating task. */ public class LaunchFloatingTaskButton extends BubbleTextView { public LaunchFloatingTaskButton(Context context) { this(context, null); } public LaunchFloatingTaskButton(Context context, AttributeSet attrs) { this(context, attrs, 0); } public LaunchFloatingTaskButton(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); Context theme = new ContextThemeWrapper(context, R.style.AllAppsButtonTheme); Bitmap bitmap = LauncherAppState.getInstance(context).getIconCache().getIconFactory() .createScaledBitmapWithShadow( theme.getDrawable(R.drawable.ic_floating_task_button)); setIcon(new FastBitmapDrawable(bitmap)); } }
quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +36 −0 Original line number Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.launcher3.taskbar; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Rect; import android.os.SystemProperties; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; Loading Loading @@ -53,6 +56,7 @@ import java.util.function.Predicate; * Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of other apps. */ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconParent, Insettable { private static final String TAG = TaskbarView.class.getSimpleName(); private static final float TASKBAR_BACKGROUND_LUMINANCE = 0.30f; public int mThemeIconsBackground; Loading Loading @@ -81,6 +85,12 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar private View mQsb; // Only non-null when device supports having a floating task. private @Nullable BubbleTextView mFloatingTaskButton; private @Nullable Intent mFloatingTaskIntent; private static final boolean FLOATING_TASKS_ENABLED = SystemProperties.getBoolean("persist.wm.debug.floating_tasks", false); public TaskbarView(@NonNull Context context) { this(context, null); } Loading Loading @@ -123,6 +133,19 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // TODO: Disable touch events on QSB otherwise it can crash. mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false); if (FLOATING_TASKS_ENABLED) { mFloatingTaskIntent = FloatingTaskIntentResolver.getIntent(context); if (mFloatingTaskIntent != null) { mFloatingTaskButton = new LaunchFloatingTaskButton(context); mFloatingTaskButton.setLayoutParams( new ViewGroup.LayoutParams(mIconTouchSize, mIconTouchSize)); mFloatingTaskButton.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding); } else { Log.d(TAG, "Floating tasks is enabled but no intent was found!"); } } } private int getColorWithGivenLuminance(int color, float luminance) { Loading Loading @@ -150,6 +173,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar if (mAllAppsButton != null) { mAllAppsButton.setOnClickListener(mControllerCallbacks.getAllAppsButtonClickListener()); } if (mFloatingTaskButton != null) { mFloatingTaskButton.setOnClickListener( mControllerCallbacks.getFloatingTaskButtonListener(mFloatingTaskIntent)); } } private void removeAndRecycle(View view) { Loading @@ -174,6 +201,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } removeView(mQsb); if (mFloatingTaskButton != null) { removeView(mFloatingTaskButton); } for (int i = 0; i < hotseatItemInfos.length; i++) { ItemInfo hotseatItemInfo = hotseatItemInfos[i]; if (hotseatItemInfo == null) { Loading Loading @@ -255,6 +286,11 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar mQsb.setVisibility(View.INVISIBLE); } if (mFloatingTaskButton != null) { int index = Utilities.isRtl(getResources()) ? 0 : getChildCount(); addView(mFloatingTaskButton, index); } mThemeIconsBackground = calculateThemeIconsBackground(); setThemedIconsBackgroundColor(mThemeIconsBackground); } Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +9 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static com.android.launcher3.taskbar.TaskbarManager.isPhoneMode; import static com.android.quickstep.AnimatedFloat.VALUE; import android.annotation.NonNull; import android.content.Intent; import android.graphics.Rect; import android.util.FloatProperty; import android.util.Log; Loading Loading @@ -51,6 +52,7 @@ import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LauncherBindableItemsContainer; import com.android.launcher3.util.MultiValueAlpha; import com.android.quickstep.AnimatedFloat; import com.android.quickstep.SystemUiProxy; import java.io.PrintWriter; import java.util.function.Predicate; Loading Loading @@ -427,6 +429,13 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar }; } public View.OnClickListener getFloatingTaskButtonListener(@NonNull Intent intent) { return v -> { SystemUiProxy proxy = SystemUiProxy.INSTANCE.get(v.getContext()); proxy.showFloatingTask(intent); }; } public View.OnLongClickListener getIconOnLongClickListener() { return mControllers.taskbarDragController::startDragOnLongClick; } Loading