Merge "Transient Taskbar's Background animation" into udc-dev
diff --git a/quickstep/res/layout/transient_taskbar.xml b/quickstep/res/layout/transient_taskbar.xml
index f9ece84..47d63e7 100644
--- a/quickstep/res/layout/transient_taskbar.xml
+++ b/quickstep/res/layout/transient_taskbar.xml
@@ -28,7 +28,7 @@
android:gravity="center"
android:forceHasOverlappingRendering="false"
android:layout_gravity="bottom"
- android:layout_marginBottom="@dimen/transient_taskbar_margin"
+ android:layout_marginBottom="@dimen/transient_taskbar_bottom_margin"
android:clipChildren="false" />
<com.android.launcher3.taskbar.TaskbarScrimView
diff --git a/quickstep/res/values-sw720dp/dimens.xml b/quickstep/res/values-sw720dp/dimens.xml
index 0832a91..9e832bc 100644
--- a/quickstep/res/values-sw720dp/dimens.xml
+++ b/quickstep/res/values-sw720dp/dimens.xml
@@ -38,10 +38,6 @@
<dimen name="allset_page_allset_text_size">42sp</dimen>
<dimen name="allset_page_swipe_up_text_size">16sp</dimen>
- <!-- Transient taskbar -->
- <dimen name="transient_taskbar_size">76dp</dimen>
- <dimen name="transient_taskbar_icon_size">52dp</dimen>
-
<!-- Taskbar swipe up thresholds -->
<dimen name="taskbar_from_nav_threshold">30dp</dimen>
<dimen name="taskbar_app_window_threshold">100dp</dimen>
diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml
index b61bdfb..0d3aeb3 100644
--- a/quickstep/res/values/config.xml
+++ b/quickstep/res/values/config.xml
@@ -55,4 +55,7 @@
<!-- Taskbar -->
<!-- Align the Taskbar to the start (Left/Right) of the device when 3 button nav is enabled. -->
<bool name="start_align_taskbar">false</bool>
+
+ <!-- This is a float because it is converted to dp later in DeviceProfile -->
+ <item name="taskbar_icon_size" type="dimen" format="float">44</item>
</resources>
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index c6e90c4..93fb65d 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -261,7 +261,6 @@
<!-- Taskbar -->
<dimen name="taskbar_size">@*android:dimen/taskbar_frame_height</dimen>
<dimen name="taskbar_ime_size">48dp</dimen>
- <dimen name="taskbar_icon_size">44dp</dimen>
<dimen name="taskbar_icon_min_touch_size">48dp</dimen>
<!-- Note that this applies to both sides of all icons, so visible space is double this. -->
<dimen name="taskbar_icon_spacing">12dp</dimen>
@@ -292,13 +291,12 @@
<!-- Transient taskbar -->
- <dimen name="transient_taskbar_size">72dp</dimen>
+ <dimen name="transient_taskbar_padding">12dp</dimen>
<dimen name="transient_taskbar_min_width">150dp</dimen>
- <dimen name="transient_taskbar_icon_size">48dp</dimen>
- <dimen name="transient_taskbar_margin">24dp</dimen>
+ <dimen name="transient_taskbar_bottom_margin">24dp</dimen>
<dimen name="transient_taskbar_shadow_blur">40dp</dimen>
<dimen name="transient_taskbar_key_shadow_distance">10dp</dimen>
- <dimen name="transient_taskbar_stashed_size">32dp</dimen>
+ <dimen name="transient_taskbar_stashed_height">32dp</dimen>
<dimen name="transient_taskbar_all_apps_button_translation_x_offset">4dp</dimen>
<dimen name="transient_taskbar_stash_spring_velocity_dp_per_s">400dp</dimen>
diff --git a/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java
index 48481d8..268024f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java
@@ -58,7 +58,7 @@
@Override
public void init(TaskbarControllers controllers) {
mControllers = controllers;
- mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarSize;
+ mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarHeight;
// Quick settings and notifications buttons
addButton(R.drawable.ic_sysbar_quick_settings, BUTTON_QUICK_SETTINGS,
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index 352740f..a713ff5 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -265,7 +265,7 @@
flags -> (flags & flagsToRemoveTranslation) != 0, AnimatedFloat.VALUE,
1, 0));
// Center nav buttons in new height for IME.
- float transForIme = (mContext.getDeviceProfile().taskbarSize
+ float transForIme = (mContext.getDeviceProfile().taskbarHeight
- mControllers.taskbarInsetsController.getTaskbarHeightForIme()) / 2f;
// For gesture nav, nav buttons only show for IME anyway so keep them translated down.
float defaultButtonTransY = alwaysShowButtons ? 0 : transForIme;
diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
index 48b3f72..941b4b0 100644
--- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
@@ -111,13 +111,11 @@
mStashedHandleWidth =
resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen);
} else {
- mTaskbarSize = deviceProfile.taskbarSize;
+ mTaskbarSize = deviceProfile.taskbarHeight;
mStashedHandleWidth = resources
.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width);
}
- int taskbarBottomMargin = DisplayController.isTransientTaskbar(mActivity)
- ? resources.getDimensionPixelSize(R.dimen.transient_taskbar_margin)
- : 0;
+ int taskbarBottomMargin = deviceProfile.taskbarBottomMargin;
mStashedHandleView.getLayoutParams().height = mTaskbarSize + taskbarBottomMargin;
mTaskbarStashedHandleAlpha.get(ALPHA_INDEX_STASHED).setValue(
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index 924d0c6..084e804 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -302,10 +302,7 @@
deviceProfile.hotseatQsbWidth = originDeviceProfile.hotseatQsbWidth;
// Update icon size
- deviceProfile.iconSizePx = resources.getDimensionPixelSize(
- DisplayController.isTransientTaskbar(TaskbarActivityContext.this)
- ? R.dimen.transient_taskbar_icon_size
- : R.dimen.taskbar_icon_size);
+ deviceProfile.iconSizePx = deviceProfile.taskbarIconSize;
deviceProfile.updateIconSize(1f, resources);
}).build();
}
@@ -715,13 +712,13 @@
}
if (DisplayController.isTransientTaskbar(this)) {
- int taskbarSize = resources.getDimensionPixelSize(R.dimen.transient_taskbar_size);
- return taskbarSize
- + (2 * resources.getDimensionPixelSize(R.dimen.transient_taskbar_margin))
+ return mDeviceProfile.taskbarHeight
+ + (2 * mDeviceProfile.taskbarBottomMargin)
+ resources.getDimensionPixelSize(R.dimen.transient_taskbar_shadow_blur);
}
- return mDeviceProfile.taskbarSize + Math.max(getLeftCornerRadius(), getRightCornerRadius());
+ return mDeviceProfile.taskbarHeight
+ + Math.max(getLeftCornerRadius(), getRightCornerRadius());
}
public int getSetupWindowHeight() {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt
index ebe057c..07cea01 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt
@@ -22,6 +22,7 @@
import android.graphics.Path
import android.graphics.RectF
import com.android.launcher3.R
+import com.android.launcher3.Utilities
import com.android.launcher3.Utilities.mapRange
import com.android.launcher3.Utilities.mapToRange
import com.android.launcher3.anim.Interpolators
@@ -31,17 +32,21 @@
/** Helps draw the taskbar background, made up of a rectangle plus two inverted rounded corners. */
class TaskbarBackgroundRenderer(context: TaskbarActivityContext) {
+ private val DARK_THEME_SHADOW_ALPHA = 51f
+ private val LIGHT_THEME_SHADOW_ALPHA = 25f
+
val paint = Paint()
val lastDrawnTransientRect = RectF()
- var backgroundHeight = context.deviceProfile.taskbarSize.toFloat()
+ var backgroundHeight = context.deviceProfile.taskbarHeight.toFloat()
var translationYForSwipe = 0f
var translationYForStash = 0f
- private var maxBackgroundHeight = context.deviceProfile.taskbarSize.toFloat()
+ private var maxBackgroundHeight = context.deviceProfile.taskbarHeight.toFloat()
private val transientBackgroundBounds = context.transientTaskbarBounds
private val isTransientTaskbar = DisplayController.isTransientTaskbar(context)
+ private val shadowAlpha: Float
private var shadowBlur = 0f
private var keyShadowDistance = 0f
private var bottomMargin = 0
@@ -69,11 +74,15 @@
if (isTransientTaskbar) {
val res = context.resources
- bottomMargin = res.getDimensionPixelSize(R.dimen.transient_taskbar_margin)
+ bottomMargin = res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin)
shadowBlur = res.getDimension(R.dimen.transient_taskbar_shadow_blur)
keyShadowDistance = res.getDimension(R.dimen.transient_taskbar_key_shadow_distance)
}
+ shadowAlpha =
+ if (Utilities.isDarkTheme(context)) DARK_THEME_SHADOW_ALPHA
+ else LIGHT_THEME_SHADOW_ALPHA
+
setCornerRoundness(DEFAULT_ROUNDNESS)
}
@@ -143,13 +152,13 @@
-mapRange(1f - progress, 0f, stashedHandleHeight / 2f)
// Draw shadow.
- val shadowAlpha =
- mapToRange(paint.alpha.toFloat(), 0f, 255f, 0f, 25f, Interpolators.LINEAR)
+ val newShadowAlpha =
+ mapToRange(paint.alpha.toFloat(), 0f, 255f, 0f, shadowAlpha, Interpolators.LINEAR)
paint.setShadowLayer(
shadowBlur,
0f,
keyShadowDistance,
- setColorAlphaBound(Color.BLACK, Math.round(shadowAlpha))
+ setColorAlphaBound(Color.BLACK, Math.round(newShadowAlpha))
)
lastDrawnTransientRect.set(
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
index 01cac2b..60b5c0d 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
@@ -94,7 +94,7 @@
*/
public Rect getFolderBoundingBox() {
Rect boundingBox = new Rect(0, 0, mTaskbarDragLayer.getWidth(),
- mTaskbarDragLayer.getHeight() - mActivity.getDeviceProfile().taskbarSize);
+ mTaskbarDragLayer.getHeight() - mActivity.getDeviceProfile().taskbarHeight);
boundingBox.inset(mFolderMargin, mFolderMargin);
return boundingBox;
}
@@ -242,7 +242,7 @@
deviceProfile.getDisplayInfo().currentSize.y :
taskbarDimensions.y;
} else {
- return deviceProfile.taskbarSize;
+ return deviceProfile.taskbarHeight;
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java
index d3f1b2f..d1b8644 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java
@@ -68,9 +68,7 @@
ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams) startButton.getLayoutParams();
DeviceProfile dp = overlayContext.getDeviceProfile();
- layoutParams.bottomMargin += DisplayController.isTransientTaskbar(overlayContext)
- ? dp.taskbarSize + dp.transientTaskbarMargin
- : dp.taskbarSize;
+ layoutParams.bottomMargin += dp.taskbarHeight + dp.taskbarBottomMargin;
mTaskbarEduView.init(new TaskbarEduCallbacks());
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt
index e56e258..bd8e346 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt
@@ -133,7 +133,7 @@
findViewById<View>(R.id.done_button)?.setOnClickListener { hide() }
if (DisplayController.isTransientTaskbar(activityContext)) {
(layoutParams as ViewGroup.MarginLayoutParams).bottomMargin +=
- activityContext.deviceProfile.taskbarSize
+ activityContext.deviceProfile.taskbarHeight
}
show()
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java
index cfc7813..90fcd37 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java
@@ -248,7 +248,7 @@
// Move the icon to align with the center-top of the touch point
Point iconShift = new Point();
iconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x;
- iconShift.y = mIconLastTouchPos.y - mContext.getDeviceProfile().iconSizePx;
+ iconShift.y = mIconLastTouchPos.y - mContext.getDeviceProfile().taskbarIconSize;
((TaskbarDragController) ActivityContext.lookupContext(
v.getContext()).getDragController()).startDragOnLongClick(sv, iconShift);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 1e1769c..41d35cf 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -39,7 +39,6 @@
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.content.SharedPreferences;
-import android.content.res.Resources;
import android.util.Log;
import android.view.InsetsController;
import android.view.View;
@@ -230,21 +229,9 @@
mPrefs = LauncherPrefs.getPrefs(mActivity);
mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity);
mAccessibilityManager = mActivity.getSystemService(AccessibilityManager.class);
- if (isPhoneMode()) {
- // DeviceProfile's taskbar vars aren't initialized w/ the flag off
- Resources resources = mActivity.getResources();
- boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivity);
- mUnstashedHeight = resources.getDimensionPixelSize(isTransientTaskbar
- ? R.dimen.transient_taskbar_size
- : R.dimen.taskbar_size);
- mStashedHeight = resources.getDimensionPixelSize(isTransientTaskbar
- ? R.dimen.transient_taskbar_stashed_size
- : R.dimen.taskbar_stashed_size);
- } else {
- mUnstashedHeight = mActivity.getDeviceProfile().taskbarSize;
- mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarSize;
- }
+ mUnstashedHeight = mActivity.getDeviceProfile().taskbarHeight;
+ mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarHeight;
}
public void init(TaskbarControllers controllers, boolean setupUIVisible) {
@@ -406,12 +393,9 @@
* Returns the height that taskbar will be touchable.
*/
public int getTouchableHeight() {
- int bottomMargin = 0;
- if (DisplayController.isTransientTaskbar(mActivity)) {
- bottomMargin = mActivity.getResources().getDimensionPixelSize(
- R.dimen.transient_taskbar_margin);
- }
- return mIsStashed ? mStashedHeight : (mUnstashedHeight + bottomMargin);
+ return mIsStashed
+ ? mStashedHeight
+ : (mUnstashedHeight + mActivity.getDeviceProfile().taskbarBottomMargin);
}
/**
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashViaTouchController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashViaTouchController.kt
index 0e5fa38..2373142 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashViaTouchController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashViaTouchController.kt
@@ -46,9 +46,9 @@
private val displacementInterpolator = LINEAR
/** How far we can translate the TaskbarView before it's offscreen. */
private val maxVisualDisplacement =
- activity.resources.getDimensionPixelSize(R.dimen.transient_taskbar_margin).toFloat()
+ activity.resources.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin).toFloat()
/** How far the swipe could go, if user swiped from the very top of TaskbarView. */
- private val maxTouchDisplacement = maxVisualDisplacement + activity.deviceProfile.taskbarSize
+ private val maxTouchDisplacement = maxVisualDisplacement + activity.deviceProfile.taskbarHeight
private val touchDisplacementToStash =
activity.resources.getDimensionPixelSize(R.dimen.taskbar_to_nav_threshold).toFloat()
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index 0eecc56..b7d5993 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -125,7 +125,7 @@
&& resources.getBoolean(R.bool.start_align_taskbar);
int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
- int actualIconSize = mActivityContext.getDeviceProfile().iconSizePx;
+ int actualIconSize = mActivityContext.getDeviceProfile().taskbarIconSize;
mIconTouchSize = Math.max(actualIconSize,
resources.getDimensionPixelSize(R.dimen.taskbar_icon_min_touch_size));
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index f2ba54a..4ab093f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -59,7 +59,6 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.ThemedIconDrawable;
import com.android.launcher3.model.data.ItemInfo;
-import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.LauncherBindableItemsContainer;
import com.android.launcher3.util.MultiPropertyFactory;
@@ -134,9 +133,7 @@
mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, NUM_ALPHA_CHANNELS);
mTaskbarIconAlpha.setUpdateVisibility(true);
mModelCallbacks = new TaskbarModelCallbacks(activity, mTaskbarView);
- mTaskbarBottomMargin = DisplayController.isTransientTaskbar(activity)
- ? activity.getResources().getDimensionPixelSize(R.dimen.transient_taskbar_margin)
- : 0;
+ mTaskbarBottomMargin = activity.getDeviceProfile().taskbarBottomMargin;
mStashedHandleHeight = activity.getResources()
.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_height);
mLauncherThemedIconsBackgroundColor = ThemedIconDrawable.getColors(mActivity)[0];
@@ -157,7 +154,7 @@
mTaskbarView.init(new TaskbarViewCallbacks());
mTaskbarView.getLayoutParams().height = isPhoneMode(mActivity.getDeviceProfile())
? mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_size)
- : mActivity.getDeviceProfile().taskbarSize;
+ : mActivity.getDeviceProfile().taskbarHeight;
mTaskbarIconScaleForStash.updateValue(1f);
@@ -429,7 +426,7 @@
PendingAnimation setter = new PendingAnimation(100);
DeviceProfile taskbarDp = mActivity.getDeviceProfile();
Rect hotseatPadding = launcherDp.getHotseatLayoutPadding(mActivity);
- float scaleUp = ((float) launcherDp.iconSizePx) / taskbarDp.iconSizePx;
+ float scaleUp = ((float) launcherDp.iconSizePx) / taskbarDp.taskbarIconSize;
int borderSpacing = launcherDp.hotseatBorderSpace;
int hotseatCellSize = DeviceProfile.calculateCellWidth(
launcherDp.availableWidthPx - hotseatPadding.left - hotseatPadding.right,
@@ -451,7 +448,7 @@
}
int collapsedHeight = mActivity.getDefaultTaskbarWindowHeight();
- int expandedHeight = Math.max(collapsedHeight, taskbarDp.taskbarSize + offsetY);
+ int expandedHeight = Math.max(collapsedHeight, taskbarDp.taskbarHeight + offsetY);
setter.addOnFrameListener(anim -> mActivity.setTaskbarWindowHeight(
anim.getAnimatedFraction() > 0 ? expandedHeight : collapsedHeight));
@@ -485,8 +482,9 @@
: hotseatPadding.left - borderSpacing - launcherDp.hotseatQsbWidth / 2f;
float childCenter = (child.getLeft() + child.getRight()) / 2f;
float halfQsbIconWidthDiff =
- (launcherDp.hotseatQsbWidth - taskbarDp.iconSizePx) / 2f;
- float scale = ((float) taskbarDp.iconSizePx) / launcherDp.hotseatQsbVisualHeight;
+ (launcherDp.hotseatQsbWidth - taskbarDp.taskbarIconSize) / 2f;
+ float scale = ((float) taskbarDp.taskbarIconSize)
+ / launcherDp.hotseatQsbVisualHeight;
setter.addFloat(child, SCALE_PROPERTY, scale, 1f, interpolator);
float fromX = isRtl ? -halfQsbIconWidthDiff : halfQsbIconWidthDiff;
@@ -559,7 +557,7 @@
return;
}
mActivity.setTaskbarWindowHeight(
- deviceProfile.taskbarSize + deviceProfile.getTaskbarOffsetY());
+ deviceProfile.taskbarHeight + deviceProfile.getTaskbarOffsetY());
mTaskbarNavButtonTranslationY.updateValue(-deviceProfile.getTaskbarOffsetY());
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index fad5bb2..7b81f32 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -20,10 +20,11 @@
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE;
import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED;
+import static com.android.launcher3.LauncherSettings.Animation.DEFAULT_NO_ICON;
+import static com.android.launcher3.LauncherSettings.Animation.VIEW_BACKGROUND;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
-import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SEARCH_ACTION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
@@ -1072,7 +1073,8 @@
activityOptions.options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_LAUNCHER,
mLastTouchUpTime);
}
- if (item != null && item.itemType == ITEM_TYPE_SEARCH_ACTION) {
+ if (item != null && (item.animationType == DEFAULT_NO_ICON
+ || item.animationType == VIEW_BACKGROUND)) {
activityOptions.options.setSplashScreenStyle(
SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR);
} else {
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 487da92..ce41c60 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -306,7 +306,7 @@
out.x = dp.widthPx;
out.y = dp.heightPx;
if (dp.isTablet && !DisplayController.isTransientTaskbar(context)) {
- out.y -= dp.taskbarSize;
+ out.y -= dp.taskbarHeight;
}
}
@@ -365,7 +365,7 @@
calculateTaskSize(context, dp, outRect, orientedState);
boolean isGridOnlyOverview = dp.isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get();
int claimedSpaceBelow = isGridOnlyOverview
- ? dp.overviewActionsTopMarginPx + dp.overviewActionsHeight + dp.stashedTaskbarSize
+ ? dp.overviewActionsTopMarginPx + dp.overviewActionsHeight + dp.stashedTaskbarHeight
: (dp.heightPx - outRect.bottom - dp.getInsets().bottom);
int minimumHorizontalPadding = 0;
if (!isGridOnlyOverview) {
diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
index 0d61bc8..f8893bd 100644
--- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
+++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
@@ -336,7 +336,7 @@
boolean isRtlEnabled = !mIsRecentsRtl;
mPositionHelper.updateThumbnailMatrix(
mThumbnailPosition, mThumbnailData, mTaskRect.width(), mTaskRect.height(),
- mDp.widthPx, mDp.heightPx, mDp.taskbarSize, mDp.isTablet,
+ mDp.widthPx, mDp.heightPx, mDp.taskbarHeight, mDp.isTablet,
mOrientationState.getRecentsActivityRotation(), isRtlEnabled);
mPositionHelper.getMatrix().invert(mInversePositionMatrix);
if (DEBUG) {
diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
index 409504b..e47c089 100644
--- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java
@@ -283,7 +283,7 @@
}
if (mDp.isTablet && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()) {
- return mDp.stashedTaskbarSize;
+ return mDp.stashedTaskbarHeight;
}
// Align to bottom of task Rect.
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index 899fea2..f746203 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -559,7 +559,7 @@
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
mPreviewPositionHelper.updateThumbnailMatrix(mPreviewRect, mThumbnailData,
getMeasuredWidth(), getMeasuredHeight(), dp.widthPx, dp.heightPx,
- dp.taskbarSize, dp.isTablet, currentRotation, isRtl);
+ dp.taskbarHeight, dp.isTablet, currentRotation, isRtl);
mBitmapShader.setLocalMatrix(mPreviewPositionHelper.getMatrix());
mPaint.setShader(mBitmapShader);
diff --git a/quickstep/tests/src/com/android/quickstep/FullscreenDrawParamsTest.kt b/quickstep/tests/src/com/android/quickstep/FullscreenDrawParamsTest.kt
index 6c0e7dc..a9dc043 100644
--- a/quickstep/tests/src/com/android/quickstep/FullscreenDrawParamsTest.kt
+++ b/quickstep/tests/src/com/android/quickstep/FullscreenDrawParamsTest.kt
@@ -64,7 +64,7 @@
canvasHeight,
dp.widthPx,
dp.heightPx,
- dp.taskbarSize,
+ dp.taskbarHeight,
dp.isTablet,
currentRotation,
isRtl
@@ -99,7 +99,7 @@
canvasHeight,
dp.widthPx,
dp.heightPx,
- dp.taskbarSize,
+ dp.taskbarHeight,
dp.isTablet,
currentRotation,
isRtl
@@ -134,7 +134,7 @@
canvasHeight,
dp.widthPx,
dp.heightPx,
- dp.taskbarSize,
+ dp.taskbarHeight,
dp.isTablet,
currentRotation,
isRtl
@@ -169,7 +169,7 @@
canvasHeight,
dp.widthPx,
dp.heightPx,
- dp.taskbarSize,
+ dp.taskbarHeight,
dp.isTablet,
currentRotation,
isRtl
diff --git a/res/layout/widgets_full_sheet_large_screen.xml b/res/layout/widgets_full_sheet_large_screen.xml
index 0626e60..f563baa 100644
--- a/res/layout/widgets_full_sheet_large_screen.xml
+++ b/res/layout/widgets_full_sheet_large_screen.xml
@@ -12,8 +12,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<com.android.launcher3.widget.picker.WidgetsFullSheet xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
+<com.android.launcher3.widget.picker.WidgetsTwoPaneSheet
+ xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -125,4 +125,4 @@
</FrameLayout>
</LinearLayout>
</com.android.launcher3.views.SpringRelativeLayout>
-</com.android.launcher3.widget.picker.WidgetsFullSheet>
+</com.android.launcher3.widget.picker.WidgetsTwoPaneSheet>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 5bacebc..04eb0db 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -379,6 +379,15 @@
<!-- defaults to hotseatQsbSpace, if not specified -->
<attr name="hotseatQsbSpaceTwoPanelPortrait" format="float" />
+ <!-- defaults to res.taskbar_icon_size, if not specified -->
+ <attr name="transientTaskbarIconSize" format="float" />
+ <!-- defaults to transientTaskbarIconSize, if not specified -->
+ <attr name="transientTaskbarIconSizeLandscape" format="float" />
+ <!-- defaults to transientTaskbarIconSize, if not specified -->
+ <attr name="transientTaskbarIconSizeTwoPanelLandscape" format="float" />
+ <!-- defaults to transientTaskbarIconSize, if not specified -->
+ <attr name="transientTaskbarIconSizeTwoPanelPortrait" format="float" />
+
<attr name="iconImageSize" format="float" />
<!-- defaults to iconImageSize, if not specified -->
<attr name="iconSizeLandscape" format="float" />
diff --git a/res/values/config.xml b/res/values/config.xml
index e13b51c..5a6698b 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -164,6 +164,10 @@
<item name="swipe_up_rect_xy_damping_ratio" type="dimen" format="float">0.8</item>
<item name="swipe_up_rect_xy_stiffness" type="dimen" format="float">200</item>
+ <!-- Taskbar -->
+ <!-- This is a float because it is converted to dp later in DeviceProfile -->
+ <item name="taskbar_icon_size" type="dimen" format="float">0</item>
+
<!-- These params are only used for hotseat items on devices that have a taskbar. -->
<item name="taskbar_swipe_up_rect_x_stiffness" type="dimen" format="float">350</item>
<item name="taskbar_swipe_up_rect_x_damping" type="dimen" format="float">0.9</item>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 70ec3a9..68e668f 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -372,14 +372,13 @@
<dimen name="min_hotseat_icon_space">18dp</dimen>
<dimen name="max_hotseat_icon_space">50dp</dimen>
<dimen name="min_hotseat_qsb_width">0dp</dimen>
- <dimen name="taskbar_icon_size">0dp</dimen>
- <dimen name="transient_taskbar_icon_size">0dp</dimen>
+
<!-- Transient taskbar (placeholders to compile in Launcher3 without Quickstep) -->
- <dimen name="transient_taskbar_size">0dp</dimen>
- <dimen name="transient_taskbar_margin">0dp</dimen>
+ <dimen name="transient_taskbar_padding">0dp</dimen>
+ <dimen name="transient_taskbar_bottom_margin">0dp</dimen>
<dimen name="transient_taskbar_shadow_blur">0dp</dimen>
<dimen name="transient_taskbar_key_shadow_distance">0dp</dimen>
- <dimen name="transient_taskbar_stashed_size">0dp</dimen>
+ <dimen name="transient_taskbar_stashed_height">0dp</dimen>
<dimen name="transient_taskbar_clamped_offset_bound">0dp</dimen>
<dimen name="taskbar_icon_spacing">0dp</dimen>
<dimen name="taskbar_nav_buttons_size">0dp</dimen>
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 8e1c279..53d9281 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -268,8 +268,10 @@
mDotParams.scale = 0f;
mForceHideDot = false;
setBackground(null);
- setSingleLine(true);
- setMaxLines(1);
+ if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()
+ || FeatureFlags.ENABLE_TWOLINE_DEVICESEARCH.get()) {
+ setMaxLines(1);
+ }
setTag(null);
if (mIconLoadRequest != null) {
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index aca03e3..fcb220e 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -44,6 +44,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.core.content.res.ResourcesCompat;
import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.DevicePaddings.DevicePadding;
@@ -262,10 +263,10 @@
public boolean isTaskbarPresent;
// Whether Taskbar will inset the bottom of apps by taskbarSize.
public boolean isTaskbarPresentInApps;
- public int taskbarSize;
- public int transientTaskbarSize;
- public int stashedTaskbarSize;
- public int transientTaskbarMargin;
+ public final int taskbarHeight;
+ public final int stashedTaskbarHeight;
+ public final int taskbarBottomMargin;
+ public final int taskbarIconSize;
// DragController
public int flingToDeleteThresholdVelocity;
@@ -328,17 +329,21 @@
}
}
- if (isTaskbarPresent) {
- transientTaskbarSize = res.getDimensionPixelSize(R.dimen.transient_taskbar_size);
- transientTaskbarMargin = res.getDimensionPixelSize(R.dimen.transient_taskbar_margin);
- if (DisplayController.isTransientTaskbar(context)) {
- taskbarSize = transientTaskbarSize;
- stashedTaskbarSize =
- res.getDimensionPixelSize(R.dimen.transient_taskbar_stashed_size);
- } else {
- taskbarSize = res.getDimensionPixelSize(R.dimen.taskbar_size);
- stashedTaskbarSize = res.getDimensionPixelSize(R.dimen.taskbar_stashed_size);
- }
+ if (DisplayController.isTransientTaskbar(context)) {
+ float invTransientIconSizeDp = inv.transientTaskbarIconSize[mTypeIndex];
+ taskbarIconSize = pxFromDp(invTransientIconSizeDp, mMetrics);
+ taskbarHeight = taskbarIconSize
+ + (2 * res.getDimensionPixelSize(R.dimen.transient_taskbar_padding));
+ stashedTaskbarHeight =
+ res.getDimensionPixelSize(R.dimen.transient_taskbar_stashed_height);
+ taskbarBottomMargin =
+ res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin);
+ } else {
+ taskbarIconSize = pxFromDp(ResourcesCompat.getFloat(res, R.dimen.taskbar_icon_size),
+ mMetrics);
+ taskbarHeight = res.getDimensionPixelSize(R.dimen.taskbar_size);
+ stashedTaskbarHeight = res.getDimensionPixelSize(R.dimen.taskbar_stashed_size);
+ taskbarBottomMargin = 0;
}
edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
@@ -1421,7 +1426,7 @@
* Returns the number of pixels the taskbar is translated from the bottom of the screen.
*/
public int getTaskbarOffsetY() {
- int taskbarIconBottomSpace = (taskbarSize - iconSizePx) / 2;
+ int taskbarIconBottomSpace = (taskbarHeight - iconSizePx) / 2;
int launcherIconBottomSpace =
Math.min((hotseatCellHeightPx - iconSizePx) / 2, gridVisualizationPaddingY);
return getHotseatBarBottomPadding() + launcherIconBottomSpace - taskbarIconBottomSpace;
@@ -1432,7 +1437,7 @@
*/
public int getOverviewActionsClaimedSpaceBelow() {
if (isTaskbarPresent) {
- return transientTaskbarSize + transientTaskbarMargin * 2;
+ return taskbarHeight + taskbarBottomMargin * 2;
}
return mInsets.bottom;
}
@@ -1470,7 +1475,7 @@
mInsets.top + availableHeightPx);
} else {
// Folders should only appear below the drop target bar and above the hotseat
- int hotseatTop = isTaskbarPresent ? taskbarSize : hotseatBarSizePx;
+ int hotseatTop = isTaskbarPresent ? taskbarHeight : hotseatBarSizePx;
return new Rect(mInsets.left + edgeMarginPx,
mInsets.top + dropTargetBarSizePx + edgeMarginPx,
mInsets.left + availableWidthPx - edgeMarginPx,
@@ -1671,7 +1676,10 @@
writer.println(prefix + "\tisTaskbarPresent:" + isTaskbarPresent);
writer.println(prefix + "\tisTaskbarPresentInApps:" + isTaskbarPresentInApps);
- writer.println(prefix + pxToDpStr("taskbarSize", taskbarSize));
+ writer.println(prefix + pxToDpStr("taskbarHeight", taskbarHeight));
+ writer.println(prefix + pxToDpStr("stashedTaskbarHeight", stashedTaskbarHeight));
+ writer.println(prefix + pxToDpStr("taskbarBottomMargin", taskbarBottomMargin));
+ writer.println(prefix + pxToDpStr("taskbarIconSize", taskbarIconSize));
writer.println(prefix + pxToDpStr("desiredWorkspaceHorizontalMarginPx",
desiredWorkspaceHorizontalMarginPx));
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index a498323..47396a5 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -149,6 +149,8 @@
public float[] allAppsIconTextSize;
public PointF[] allAppsBorderSpaces;
+ public float[] transientTaskbarIconSize;
+
private SparseArray<TypedValue> mExtraAttrs;
/**
@@ -396,6 +398,8 @@
inlineQsb = closestProfile.inlineQsb;
+ transientTaskbarIconSize = displayOption.transientTaskbarIconSize;
+
// If the partner customization apk contains any grid overrides, apply them
// Supported overrides: numRows, numColumns, iconSize
applyPartnerDeviceProfileOverrides(context, metrics);
@@ -908,9 +912,13 @@
private final float[] allAppsIconTextSizes = new float[COUNT_SIZES];
private final PointF[] allAppsBorderSpaces = new PointF[COUNT_SIZES];
+ private final float[] transientTaskbarIconSize = new float[COUNT_SIZES];
+
DisplayOption(GridOption grid, Context context, AttributeSet attrs) {
this.grid = grid;
+ Resources res = context.getResources();
+
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ProfileDisplayOption);
minWidthDps = a.getFloat(R.styleable.ProfileDisplayOption_minWidthDps, 0);
@@ -1101,8 +1109,7 @@
hotseatBarBottomSpace[INDEX_DEFAULT] = a.getFloat(
R.styleable.ProfileDisplayOption_hotseatBarBottomSpace,
- ResourcesCompat.getFloat(context.getResources(),
- R.dimen.hotseat_bar_bottom_space_default));
+ ResourcesCompat.getFloat(res, R.dimen.hotseat_bar_bottom_space_default));
hotseatBarBottomSpace[INDEX_LANDSCAPE] = a.getFloat(
R.styleable.ProfileDisplayOption_hotseatBarBottomSpaceLandscape,
hotseatBarBottomSpace[INDEX_DEFAULT]);
@@ -1115,8 +1122,7 @@
hotseatQsbSpace[INDEX_DEFAULT] = a.getFloat(
R.styleable.ProfileDisplayOption_hotseatQsbSpace,
- ResourcesCompat.getFloat(context.getResources(),
- R.dimen.hotseat_qsb_space_default));
+ ResourcesCompat.getFloat(res, R.dimen.hotseat_qsb_space_default));
hotseatQsbSpace[INDEX_LANDSCAPE] = a.getFloat(
R.styleable.ProfileDisplayOption_hotseatQsbSpaceLandscape,
hotseatQsbSpace[INDEX_DEFAULT]);
@@ -1127,6 +1133,19 @@
R.styleable.ProfileDisplayOption_hotseatQsbSpaceTwoPanelPortrait,
hotseatQsbSpace[INDEX_DEFAULT]);
+ transientTaskbarIconSize[INDEX_DEFAULT] = a.getFloat(
+ R.styleable.ProfileDisplayOption_transientTaskbarIconSize,
+ ResourcesCompat.getFloat(res, R.dimen.taskbar_icon_size));
+ transientTaskbarIconSize[INDEX_LANDSCAPE] = a.getFloat(
+ R.styleable.ProfileDisplayOption_transientTaskbarIconSizeLandscape,
+ transientTaskbarIconSize[INDEX_DEFAULT]);
+ transientTaskbarIconSize[INDEX_TWO_PANEL_LANDSCAPE] = a.getFloat(
+ R.styleable.ProfileDisplayOption_transientTaskbarIconSizeTwoPanelLandscape,
+ transientTaskbarIconSize[INDEX_DEFAULT]);
+ transientTaskbarIconSize[INDEX_TWO_PANEL_PORTRAIT] = a.getFloat(
+ R.styleable.ProfileDisplayOption_transientTaskbarIconSizeTwoPanelPortrait,
+ hotseatQsbSpace[INDEX_DEFAULT]);
+
a.recycle();
}
@@ -1148,6 +1167,7 @@
allAppsIconSizes[i] = 0;
allAppsIconTextSizes[i] = 0;
allAppsBorderSpaces[i] = new PointF();
+ transientTaskbarIconSize[i] = 0;
}
}
@@ -1168,6 +1188,7 @@
allAppsIconTextSizes[i] *= w;
allAppsBorderSpaces[i].x *= w;
allAppsBorderSpaces[i].y *= w;
+ transientTaskbarIconSize[i] *= w;
}
return this;
@@ -1190,6 +1211,7 @@
allAppsIconTextSizes[i] += p.allAppsIconTextSizes[i];
allAppsBorderSpaces[i].x += p.allAppsBorderSpaces[i].x;
allAppsBorderSpaces[i].y += p.allAppsBorderSpaces[i].y;
+ transientTaskbarIconSize[i] += p.transientTaskbarIconSize[i];
}
return this;
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 4472383..ad95f7e 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -285,6 +285,10 @@
Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE.equals(action) ||
Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action)) {
UserHandle user = intent.getParcelableExtra(Intent.EXTRA_USER);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.WORK_TAB_MISSING, "onBroadcastIntent intentAction: " + action +
+ " user: " + user);
+ }
if (user != null) {
if (Intent.ACTION_MANAGED_PROFILE_AVAILABLE.equals(action) ||
Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE.equals(action)) {
diff --git a/src/com/android/launcher3/LauncherSettings.java b/src/com/android/launcher3/LauncherSettings.java
index cef00d9..6e3e96c 100644
--- a/src/com/android/launcher3/LauncherSettings.java
+++ b/src/com/android/launcher3/LauncherSettings.java
@@ -41,6 +41,10 @@
* An animation using the view's background.
*/
public static final int VIEW_BACKGROUND = 1;
+ /**
+ * The default animation for a given view/item info type, but without the splash icon.
+ */
+ public static final int DEFAULT_NO_ICON = 2;
}
/**
diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java
index 3f2f21d..ca16b24 100644
--- a/src/com/android/launcher3/allapps/WorkModeSwitch.java
+++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java
@@ -15,8 +15,6 @@
*/
package com.android.launcher3.allapps;
-import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORK_FAB_BUTTON_COLLAPSE;
-import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORK_FAB_BUTTON_EXTEND;
import static com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip.getTabWidth;
import android.animation.LayoutTransition;
@@ -116,7 +114,7 @@
}
if (!dp.isGestureMode && dp.isTaskbarPresent) {
- bottomMargin += dp.taskbarSize;
+ bottomMargin += dp.taskbarHeight;
}
lp.bottomMargin = bottomMargin;
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java
index 9d06d4a..0edf292 100644
--- a/src/com/android/launcher3/popup/ArrowPopup.java
+++ b/src/com/android/launcher3/popup/ArrowPopup.java
@@ -140,13 +140,11 @@
mOutlineRadius = Themes.getDialogCornerRadius(context);
mActivityContext = ActivityContext.lookupContext(context);
mIsRtl = Utilities.isRtl(getResources());
-
- int popupPrimaryColor = Themes.getAttrColor(context, R.attr.popupColorPrimary);
- mArrowColor = popupPrimaryColor;
mElevation = getResources().getDimension(R.dimen.deep_shortcuts_elevation);
// Initialize arrow view
final Resources resources = getResources();
+ mArrowColor = getColorStateList(getContext(), R.color.popup_shade_first).getDefaultColor();
mMargin = resources.getDimensionPixelSize(R.dimen.popup_margin);
mArrowWidth = resources.getDimensionPixelSize(R.dimen.popup_arrow_width);
mArrowHeight = resources.getDimensionPixelSize(R.dimen.popup_arrow_height);
@@ -159,6 +157,7 @@
int smallerRadius = resources.getDimensionPixelSize(R.dimen.popup_smaller_radius);
mRoundedTop = new GradientDrawable();
+ int popupPrimaryColor = Themes.getAttrColor(context, R.attr.popupColorPrimary);
mRoundedTop.setColor(popupPrimaryColor);
mRoundedTop.setCornerRadii(new float[] { mOutlineRadius, mOutlineRadius, mOutlineRadius,
mOutlineRadius, smallerRadius, smallerRadius, smallerRadius, smallerRadius});
diff --git a/src/com/android/launcher3/util/DimensionUtils.kt b/src/com/android/launcher3/util/DimensionUtils.kt
index 1922310..9188c2e 100644
--- a/src/com/android/launcher3/util/DimensionUtils.kt
+++ b/src/com/android/launcher3/util/DimensionUtils.kt
@@ -37,7 +37,7 @@
// Taskbar for large screen
if (!isPhoneMode) {
p.x = ViewGroup.LayoutParams.MATCH_PARENT
- p.y = deviceProfile.taskbarSize
+ p.y = deviceProfile.taskbarHeight
return p
}
diff --git a/src/com/android/launcher3/views/ActivityContext.java b/src/com/android/launcher3/views/ActivityContext.java
index b6f6223..10f40b7 100644
--- a/src/com/android/launcher3/views/ActivityContext.java
+++ b/src/com/android/launcher3/views/ActivityContext.java
@@ -45,6 +45,7 @@
import android.view.WindowInsetsController;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
+import android.window.SplashScreen;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -320,7 +321,14 @@
return false;
}
- Bundle optsBundle = (v != null) ? getActivityLaunchOptions(v, item).toBundle() : null;
+ Bundle optsBundle = null;
+ if (v != null) {
+ optsBundle = getActivityLaunchOptions(v, item).toBundle();
+ } else if (item != null && item.animationType == LauncherSettings.Animation.DEFAULT_NO_ICON
+ && Utilities.ATLEAST_T) {
+ optsBundle = ActivityOptions.makeBasic()
+ .setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR).toBundle();
+ }
UserHandle user = item == null ? null : item.user;
// Prepare intent
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index 823003c..e4df413 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -559,7 +559,7 @@
DeviceProfile dp = mActivity.getDeviceProfile();
if (dp.isTaskbarPresent) {
// Ignore taskbar gesture insets to avoid interfering with TouchControllers.
- gestureInsetBottom = Math.max(0, gestureInsetBottom - dp.taskbarSize);
+ gestureInsetBottom = Math.max(0, gestureInsetBottom - dp.taskbarHeight);
}
mSystemGestureRegion.set(
Math.max(gestureInsets.left, imeInset.left),
diff --git a/src/com/android/launcher3/views/Snackbar.java b/src/com/android/launcher3/views/Snackbar.java
index 86b3419..8d5838e 100644
--- a/src/com/android/launcher3/views/Snackbar.java
+++ b/src/com/android/launcher3/views/Snackbar.java
@@ -101,7 +101,7 @@
DeviceProfile deviceProfile = activity.getDeviceProfile();
params.setMargins(0, 0, 0, marginBottom
+ (deviceProfile.isTaskbarPresent
- ? deviceProfile.taskbarSize + deviceProfile.getTaskbarOffsetY()
+ ? deviceProfile.taskbarHeight + deviceProfile.getTaskbarOffsetY()
: insets.bottom));
TextView labelView = snackbar.findViewById(R.id.label);
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index cfd241c..07c6ba4 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -32,7 +32,6 @@
import android.view.animation.Interpolator;
import android.widget.Toast;
-import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.core.view.ViewCompat;
@@ -182,7 +181,6 @@
* Measures the dimension of this view and its children by taking system insets, navigation bar,
* status bar, into account.
*/
- @GuardedBy("MainThread")
protected void doMeasure(int widthMeasureSpec, int heightMeasureSpec) {
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
int widthUsed;
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index bd75ce6..5293c3d 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -30,7 +30,6 @@
import android.content.pm.LauncherApps;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.graphics.Outline;
import android.graphics.Rect;
import android.os.Build;
import android.os.Process;
@@ -43,13 +42,10 @@
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewOutlineProvider;
import android.view.WindowInsets;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.Button;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
import android.widget.TextView;
import android.window.BackEvent;
@@ -68,10 +64,7 @@
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.model.UserManagerState;
import com.android.launcher3.model.WidgetItem;
-import com.android.launcher3.model.data.PackageItemInfo;
import com.android.launcher3.pm.UserCache;
-import com.android.launcher3.recyclerview.ViewHolderBinder;
-import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.views.ArrowTipView;
import com.android.launcher3.views.RecyclerViewFastScroller;
import com.android.launcher3.views.SpringRelativeLayout;
@@ -80,8 +73,6 @@
import com.android.launcher3.widget.BaseWidgetSheet;
import com.android.launcher3.widget.LauncherWidgetHolder.ProviderChangedListener;
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
-import com.android.launcher3.widget.model.WidgetsListContentEntry;
-import com.android.launcher3.widget.model.WidgetsListHeaderEntry;
import com.android.launcher3.widget.picker.search.SearchModeListener;
import com.android.launcher3.widget.picker.search.WidgetsSearchBar;
import com.android.launcher3.widget.util.WidgetsTableUtils;
@@ -89,7 +80,6 @@
import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip.OnActivePageChangedListener;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.IntStream;
@@ -105,27 +95,22 @@
private static final long EDUCATION_TIP_DELAY_MS = 200;
private static final long EDUCATION_DIALOG_DELAY_MS = 500;
private static final float VERTICAL_START_POSITION = 0.3f;
- private static final int PERSONAL_TAB = 0;
- private static final int WORK_TAB = 1;
- private static final String SUGGESTIONS_PACKAGE_NAME = "widgets_list_suggestions_entry";
// The widget recommendation table can easily take over the entire screen on devices with small
// resolution or landscape on phone. This ratio defines the max percentage of content area that
// the table can display.
private static final float RECOMMENDATION_TABLE_HEIGHT_RATIO = 0.75f;
-
private static final String KEY_WIDGETS_EDUCATION_DIALOG_SEEN =
"launcher.widgets_education_dialog_seen";
private final UserManagerState mUserManagerState = new UserManagerState();
-
- private final boolean mHasWorkProfile;
- private final SparseArray<AdapterHolder> mAdapters = new SparseArray();
private final UserHandle mCurrentUser = Process.myUserHandle();
private final Predicate<WidgetsListBaseEntry> mPrimaryWidgetsFilter =
entry -> mCurrentUser.equals(entry.mPkgItem.user);
private final Predicate<WidgetsListBaseEntry> mWorkWidgetsFilter =
entry -> !mCurrentUser.equals(entry.mPkgItem.user)
&& !mUserManagerState.isUserQuiet(entry.mPkgItem.user);
+ protected final boolean mHasWorkProfile;
+ protected final SparseArray<AdapterHolder> mAdapters = new SparseArray();
@Nullable private ArrowTipView mLatestEducationalTip;
private final OnLayoutChangeListener mLayoutChangeListenerToShowTips =
new OnLayoutChangeListener() {
@@ -175,52 +160,27 @@
@Px private final int mTabsHeight;
@Nullable private WidgetsRecyclerView mCurrentWidgetsRecyclerView;
- @Nullable private PersonalWorkPagedView mViewPager;
+ @Nullable private WidgetsRecyclerView mCurrentTouchEventRecyclerView;
+ @Nullable PersonalWorkPagedView mViewPager;
private boolean mIsInSearchMode;
private boolean mIsNoWidgetsViewNeeded;
@Px private int mMaxSpanPerRow;
- private TextView mNoWidgetsView;
-
- private StickyHeaderLayout mSearchScrollView;
- private WidgetsRecommendationTableLayout mRecommendedWidgetsTable;
- private LinearLayout mSuggestedWidgetsContainer;
- private WidgetsListHeader mSuggestedWidgetsHeader;
- private View mTabBar;
- private View mSearchBarContainer;
- private WidgetsSearchBar mSearchBar;
- private TextView mHeaderTitle;
- private LinearLayout mRightPane;
- private FrameLayout mRightPaneScrollView;
- private WidgetsListTableViewHolderBinder mWidgetsListTableViewHolderBinder;
private DeviceProfile mDeviceProfile;
- private final boolean mIsTwoPane;
private int mOrientation;
- private @Nullable WidgetsRecyclerView mCurrentTouchEventRecyclerView;
- private RecyclerViewFastScroller mFastScroller;
-
- private final ViewOutlineProvider mViewOutlineProviderRightPane = new ViewOutlineProvider() {
- @Override
- public void getOutline(View view, Outline outline) {
- outline.setRoundRect(
- 0,
- 0,
- view.getMeasuredWidth(),
- view.getMeasuredHeight() - getResources().getDimensionPixelSize(
- R.dimen.widget_list_horizontal_margin_large_screen),
- view.getResources().getDimensionPixelSize(
- R.dimen.widget_list_top_bottom_corner_radius)
- );
- }
- };
+ protected TextView mNoWidgetsView;
+ protected StickyHeaderLayout mSearchScrollView;
+ protected WidgetsRecommendationTableLayout mRecommendedWidgetsTable;
+ protected View mTabBar;
+ protected View mSearchBarContainer;
+ protected WidgetsSearchBar mSearchBar;
+ protected TextView mHeaderTitle;
+ protected RecyclerViewFastScroller mFastScroller;
public WidgetsFullSheet(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mDeviceProfile = Launcher.getLauncher(context).getDeviceProfile();
- mIsTwoPane = mDeviceProfile.isTablet
- && mDeviceProfile.isLandscape
- && LARGE_SCREEN_WIDGET_PICKER.get();
mHasWorkProfile = context.getSystemService(LauncherApps.class).getProfiles().size() > 1;
mOrientation = Launcher.getLauncher(context).getOrientation();
mAdapters.put(AdapterHolder.PRIMARY, new AdapterHolder(AdapterHolder.PRIMARY));
@@ -243,37 +203,39 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
+
mContent = findViewById(R.id.container);
setContentBackgroundWithParent(getContext().getDrawable(R.drawable.bg_widgets_full_sheet),
mContent);
-
mContent.setOutlineProvider(mViewOutlineProvider);
mContent.setClipToOutline(true);
+ setupSheet();
+ }
+ protected void setupSheet() {
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
+ int contentLayoutRes = mHasWorkProfile ? R.layout.widgets_full_sheet_paged_view
+ : R.layout.widgets_full_sheet_recyclerview;
+ layoutInflater.inflate(contentLayoutRes, mContent, true);
- if (mIsTwoPane) {
- layoutInflater.inflate(
- mHasWorkProfile
- ? R.layout.widgets_full_sheet_paged_view_large_screen
- : R.layout.widgets_full_sheet_recyclerview_large_screen,
- findViewById(R.id.recycler_view_container),
- true);
- } else {
- layoutInflater.inflate(
- mHasWorkProfile
- ? R.layout.widgets_full_sheet_paged_view
- : R.layout.widgets_full_sheet_recyclerview,
- mContent,
- true);
- }
+ setupViews();
+ mRecommendedWidgetsTable = mSearchScrollView.findViewById(R.id.recommended_widget_table);
+ mRecommendedWidgetsTable.setWidgetCellLongClickListener(this);
+ mRecommendedWidgetsTable.setWidgetCellOnClickListener(this);
+ mHeaderTitle = mSearchScrollView.findViewById(R.id.title);
+
+ onRecommendedWidgetsBound();
+ onWidgetsBound();
+ setUpEducationViewsIfNeeded();
+ }
+
+ protected void setupViews() {
+ mSearchScrollView = findViewById(R.id.search_and_recommendations_container);
+ mSearchScrollView.setCurrentRecyclerView(findViewById(R.id.primary_widgets_list_view));
+ mNoWidgetsView = findViewById(R.id.no_widgets_text);
mFastScroller = findViewById(R.id.fast_scroller);
- if (mIsTwoPane) {
- mFastScroller.setVisibility(GONE);
- }
mFastScroller.setPopupView(findViewById(R.id.fast_scroller_popup));
-
mAdapters.get(AdapterHolder.PRIMARY).setup(findViewById(R.id.primary_widgets_list_view));
mAdapters.get(AdapterHolder.SEARCH).setup(findViewById(R.id.search_widgets_list_view));
if (mHasWorkProfile) {
@@ -294,78 +256,12 @@
mViewPager = null;
}
- mNoWidgetsView = findViewById(R.id.no_widgets_text);
-
- mSearchScrollView = findViewById(R.id.search_and_recommendations_container);
- mSearchScrollView.setCurrentRecyclerView(findViewById(R.id.primary_widgets_list_view));
-
- mRecommendedWidgetsTable = mIsTwoPane
- ? mContent.findViewById(R.id.recommended_widget_table)
- : mSearchScrollView.findViewById(R.id.recommended_widget_table);
-
- mRecommendedWidgetsTable.setWidgetCellLongClickListener(this);
- mRecommendedWidgetsTable.setWidgetCellOnClickListener(this);
-
- // Add suggested widgets.
- if (mIsTwoPane) {
- mSuggestedWidgetsContainer = mSearchScrollView.findViewById(R.id.suggestions_header);
-
- // Inflate the suggestions header.
- mSuggestedWidgetsHeader = (WidgetsListHeader) layoutInflater.inflate(
- R.layout.widgets_list_row_header_two_pane,
- mSuggestedWidgetsContainer,
- false);
- mSuggestedWidgetsHeader.setExpanded(true);
-
- PackageItemInfo packageItemInfo = new PackageItemInfo(
- /* packageName= */ SUGGESTIONS_PACKAGE_NAME,
- Process.myUserHandle()) {
- @Override
- public boolean usingLowResIcon() {
- return false;
- }
- };
- packageItemInfo.title = getContext().getString(R.string.suggested_widgets_header_title);
- WidgetsListHeaderEntry widgetsListHeaderEntry = WidgetsListHeaderEntry.create(
- packageItemInfo,
- getContext().getString(R.string.suggested_widgets_header_title),
- mActivityContext.getPopupDataProvider().getRecommendedWidgets())
- .withWidgetListShown();
-
- mSuggestedWidgetsHeader.applyFromItemInfoWithIcon(widgetsListHeaderEntry);
- mSuggestedWidgetsHeader.setIcon(
- getContext().getDrawable(R.drawable.widget_suggestions_icon));
- mSuggestedWidgetsHeader.setOnClickListener(view -> {
- mSuggestedWidgetsHeader.setExpanded(true);
- resetExpandedHeaders();
- mRightPane.removeAllViews();
- mRightPane.addView(mRecommendedWidgetsTable);
- });
- mSuggestedWidgetsContainer.addView(mSuggestedWidgetsHeader);
- }
-
mTabBar = mSearchScrollView.findViewById(R.id.tabs);
mSearchBarContainer = mSearchScrollView.findViewById(R.id.search_bar_container);
mSearchBar = mSearchScrollView.findViewById(R.id.widgets_search_bar);
- mHeaderTitle = mIsTwoPane
- ? mContent.findViewById(R.id.title)
- : mSearchScrollView.findViewById(R.id.title);
- mRightPane = mIsTwoPane ? mContent.findViewById(R.id.right_pane) : null;
- if (mRightPane != null) {
- mRightPane.setOutlineProvider(mViewOutlineProviderRightPane);
- }
- mRightPaneScrollView = mIsTwoPane
- ? mContent.findViewById(R.id.right_pane_scroll_view) : null;
-
- mWidgetsListTableViewHolderBinder =
- new WidgetsListTableViewHolderBinder(mActivityContext, layoutInflater, this, this);
- onRecommendedWidgetsBound();
- onWidgetsBound();
mSearchBar.initialize(
mActivityContext.getPopupDataProvider(), /* searchModeListener= */ this);
-
- setUpEducationViewsIfNeeded();
}
private void setDeviceManagementResources() {
@@ -380,14 +276,6 @@
@Override
public void onActivePageChanged(int currentActivePage) {
-
- // if the current active page changes to personal or work we set suggestions
- // to be the selected widget
- if (mIsTwoPane && mSuggestedWidgetsHeader != null
- && (currentActivePage == PERSONAL_TAB || currentActivePage == WORK_TAB)) {
- mSuggestedWidgetsHeader.callOnClick();
- }
-
AdapterHolder currentAdapterHolder = mAdapters.get(currentActivePage);
WidgetsRecyclerView currentRecyclerView =
mAdapters.get(currentActivePage).mWidgetsRecyclerView;
@@ -415,14 +303,9 @@
}
}
- private void updateRecyclerViewVisibility(AdapterHolder adapterHolder) {
+ protected void updateRecyclerViewVisibility(AdapterHolder adapterHolder) {
// The first item is always an empty space entry. Look for any more items.
boolean isWidgetAvailable = adapterHolder.mWidgetsListAdapter.hasVisibleEntries();
-
- if (mIsTwoPane) {
- mRightPane.setVisibility(isWidgetAvailable ? VISIBLE : GONE);
- }
-
adapterHolder.mWidgetsRecyclerView.setVisibility(isWidgetAvailable ? VISIBLE : GONE);
if (adapterHolder.mAdapterType == AdapterHolder.SEARCH) {
@@ -468,9 +351,7 @@
super.onAttachedToWindow();
mActivityContext.getAppWidgetHolder().addProviderChangeListener(this);
notifyWidgetProvidersChanged();
- if (!mIsTwoPane) {
- onRecommendedWidgetsBound();
- }
+ onRecommendedWidgetsBound();
}
@Override
@@ -558,14 +439,8 @@
private boolean updateMaxSpansPerRow() {
if (getMeasuredWidth() == 0) return false;
- View content = mHasWorkProfile
- ? mViewPager
- : mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView;
- if (mIsTwoPane && mRightPane != null) {
- content = mRightPane;
- }
-
- @Px int maxHorizontalSpan = content.getMeasuredWidth() - (2 * mContentHorizontalMargin);
+ @Px int maxHorizontalSpan = getContentView().getMeasuredWidth()
+ - (2 * mContentHorizontalMargin);
if (mMaxSpanPerRow != maxHorizontalSpan) {
mMaxSpanPerRow = maxHorizontalSpan;
mAdapters.get(AdapterHolder.PRIMARY).mWidgetsListAdapter.setMaxHorizontalSpansPxPerRow(
@@ -582,6 +457,12 @@
return false;
}
+ protected View getContentView() {
+ return mHasWorkProfile
+ ? mViewPager
+ : mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView;
+ }
+
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int width = r - l;
@@ -656,19 +537,13 @@
public void onSearchResults(List<WidgetsListBaseEntry> entries) {
mAdapters.get(AdapterHolder.SEARCH).mWidgetsListAdapter.setWidgetsOnSearch(entries);
updateRecyclerViewVisibility(mAdapters.get(AdapterHolder.SEARCH));
- if (mIsTwoPane) {
- mAdapters.get(AdapterHolder.SEARCH).mWidgetsListAdapter.selectFirstHeaderEntry();
- }
mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView.scrollToTop();
}
- private void setViewVisibilityBasedOnSearch(boolean isInSearchMode) {
+ protected void setViewVisibilityBasedOnSearch(boolean isInSearchMode) {
mIsInSearchMode = isInSearchMode;
if (isInSearchMode) {
mRecommendedWidgetsTable.setVisibility(GONE);
- if (mIsTwoPane) {
- mSuggestedWidgetsContainer.setVisibility(GONE);
- }
if (mHasWorkProfile) {
mViewPager.setVisibility(GONE);
mTabBar.setVisibility(GONE);
@@ -680,10 +555,6 @@
mNoWidgetsView.setVisibility(GONE);
} else {
mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView.setVisibility(GONE);
- if (mIsTwoPane) {
- mSuggestedWidgetsContainer.setVisibility(VISIBLE);
- mSuggestedWidgetsHeader.callOnClick();
- }
// Visibility of recommended widgets, recycler views and headers are handled in methods
// below.
onRecommendedWidgetsBound();
@@ -691,7 +562,7 @@
}
}
- private void resetExpandedHeaders() {
+ protected void resetExpandedHeaders() {
mAdapters.get(AdapterHolder.PRIMARY).mWidgetsListAdapter.resetExpandedHeader();
mAdapters.get(AdapterHolder.WORK).mWidgetsListAdapter.resetExpandedHeader();
}
@@ -713,14 +584,14 @@
mNoWidgetsView.getText().length(), noWidgetsViewTextBounds);
noWidgetsViewHeight = noWidgetsViewTextBounds.height();
}
- doMeasure(
- makeMeasureSpec(mActivityContext.getDeviceProfile().availableWidthPx,
- MeasureSpec.EXACTLY),
- makeMeasureSpec(mActivityContext.getDeviceProfile().availableHeightPx,
- MeasureSpec.EXACTLY));
- float maxTableHeight = mIsTwoPane ? Float.MAX_VALUE : (mContent.getMeasuredHeight()
- - mTabsHeight - getHeaderViewHeight()
- - noWidgetsViewHeight) * RECOMMENDATION_TABLE_HEIGHT_RATIO;
+ if (!isTwoPane()) {
+ doMeasure(
+ makeMeasureSpec(mActivityContext.getDeviceProfile().availableWidthPx,
+ MeasureSpec.EXACTLY),
+ makeMeasureSpec(mActivityContext.getDeviceProfile().availableHeightPx,
+ MeasureSpec.EXACTLY));
+ }
+ float maxTableHeight = getMaxTableHeight(noWidgetsViewHeight);
List<ArrayList<WidgetItem>> recommendedWidgetsInTable =
WidgetsTableUtils.groupWidgetItemsUsingRowPxWithoutReordering(
@@ -732,13 +603,21 @@
mRecommendedWidgetsTable.setRecommendedWidgets(
recommendedWidgetsInTable, maxTableHeight);
} else {
- mRecommendedWidgetsTable.setVisibility(GONE);
- if (mSuggestedWidgetsContainer != null) {
- mSuggestedWidgetsContainer.setVisibility(GONE);
- }
+ hideRecommendations();
}
}
+ protected void hideRecommendations() {
+ mRecommendedWidgetsTable.setVisibility(GONE);
+ }
+
+ protected float getMaxTableHeight(float noWidgetsViewHeight) {
+ return (mContent.getMeasuredHeight()
+ - mTabsHeight - getHeaderViewHeight()
+ - noWidgetsViewHeight)
+ * RECOMMENDATION_TABLE_HEIGHT_RATIO;
+ }
+
private void open(boolean animate) {
if (animate) {
if (getPopupContainer().getInsets().bottom > 0) {
@@ -779,37 +658,49 @@
@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
- // Disable swipe down when recycler view is scrolling or scroll view is scrolling
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- mNoIntercept = false;
- WidgetsRecyclerView recyclerView = getRecyclerView();
- RecyclerViewFastScroller scroller = recyclerView.getScrollbar();
-
- if (scroller.getThumbOffsetY() >= 0
- && getPopupContainer().isEventOverView(scroller, ev)) {
- mNoIntercept = true;
- } else if (getPopupContainer().isEventOverView(recyclerView, ev)) {
- mNoIntercept = !recyclerView.shouldContainerScroll(ev, getPopupContainer());
- } else if (mIsTwoPane && mRightPaneScrollView != null
- && getPopupContainer().isEventOverView(mRightPaneScrollView, ev)) {
- mNoIntercept = mRightPaneScrollView.canScrollVertically(-1);
- }
+ mNoIntercept = shouldScroll(ev);
if (mSearchBar.isSearchBarFocused()
&& !getPopupContainer().isEventOverView(mSearchBarContainer, ev)) {
mSearchBar.clearSearchBarFocus();
}
}
+
return super.onControllerInterceptTouchEvent(ev);
}
+ protected boolean shouldScroll(MotionEvent ev) {
+ boolean intercept = false;
+ WidgetsRecyclerView recyclerView = getRecyclerView();
+ RecyclerViewFastScroller scroller = recyclerView.getScrollbar();
+ // Disable swipe down when recycler view is scrolling
+ if (scroller.getThumbOffsetY() >= 0 && getPopupContainer().isEventOverView(scroller, ev)) {
+ intercept = true;
+ } else if (getPopupContainer().isEventOverView(recyclerView, ev)) {
+ intercept = !recyclerView.shouldContainerScroll(ev, getPopupContainer());
+ }
+ return intercept;
+ }
+
/** Shows the {@link WidgetsFullSheet} on the launcher. */
public static WidgetsFullSheet show(Launcher launcher, boolean animate) {
- WidgetsFullSheet sheet = (WidgetsFullSheet) launcher.getLayoutInflater()
- .inflate(LARGE_SCREEN_WIDGET_PICKER.get()
- && launcher.getDeviceProfile().isTablet
- && launcher.getDeviceProfile().isLandscape
- ? R.layout.widgets_full_sheet_large_screen
- : R.layout.widgets_full_sheet, launcher.getDragLayer(), false);
+ boolean isTwoPane = LARGE_SCREEN_WIDGET_PICKER.get()
+ && launcher.getDeviceProfile().isTablet
+ && launcher.getDeviceProfile().isLandscape;
+
+ WidgetsFullSheet sheet;
+ if (isTwoPane) {
+ sheet = (WidgetsTwoPaneSheet) launcher.getLayoutInflater().inflate(
+ R.layout.widgets_full_sheet_large_screen,
+ launcher.getDragLayer(),
+ false);
+ } else {
+ sheet = (WidgetsFullSheet) launcher.getLayoutInflater().inflate(
+ R.layout.widgets_full_sheet,
+ launcher.getDragLayer(),
+ false);
+ }
+
sheet.attachToContainer();
sheet.mIsOpen = true;
sheet.open(animate);
@@ -973,7 +864,7 @@
|| Utilities.isRunningInTestHarness();
}
- private void setUpEducationViewsIfNeeded() {
+ protected void setUpEducationViewsIfNeeded() {
if (!hasSeenEducationDialog()) {
postDelayed(() -> {
WidgetsEduView eduDialog = showEducationDialog();
@@ -991,14 +882,18 @@
}
}
+ protected boolean isTwoPane() {
+ return false;
+ }
+
/** A holder class for holding adapters & their corresponding recycler view. */
- private final class AdapterHolder {
+ final class AdapterHolder {
static final int PRIMARY = 0;
static final int WORK = 1;
static final int SEARCH = 2;
private final int mAdapterType;
- private final WidgetsListAdapter mWidgetsListAdapter;
+ final WidgetsListAdapter mWidgetsListAdapter;
private final DefaultItemAnimator mWidgetsListItemAnimator;
private WidgetsRecyclerView mWidgetsRecyclerView;
@@ -1006,43 +901,14 @@
AdapterHolder(int adapterType) {
mAdapterType = adapterType;
Context context = getContext();
- HeaderChangeListener headerChangeListener = new HeaderChangeListener() {
- @Override
- public void onHeaderChanged(@NonNull PackageUserKey selectedHeader) {
- WidgetsListContentEntry contentEntry = mActivityContext.getPopupDataProvider()
- .getSelectedAppWidgets(selectedHeader);
- if (contentEntry == null || mRightPane == null) {
- return;
- }
-
- if (mSuggestedWidgetsHeader != null) {
- mSuggestedWidgetsHeader.setExpanded(false);
- }
- WidgetsRowViewHolder widgetsRowViewHolder =
- mWidgetsListTableViewHolderBinder.newViewHolder(mRightPane);
- mWidgetsListTableViewHolderBinder.bindViewHolder(widgetsRowViewHolder,
- contentEntry,
- ViewHolderBinder.POSITION_FIRST | ViewHolderBinder.POSITION_LAST,
- Collections.EMPTY_LIST);
- widgetsRowViewHolder.mDataCallback = data -> {
- mWidgetsListTableViewHolderBinder.bindViewHolder(widgetsRowViewHolder,
- contentEntry.withMaxSpanSize(mMaxSpanPerRow),
- ViewHolderBinder.POSITION_FIRST | ViewHolderBinder.POSITION_LAST,
- Collections.singletonList(data));
- };
-
- mRightPane.removeAllViews();
- mRightPane.addView(widgetsRowViewHolder.itemView);
- }
- };
mWidgetsListAdapter = new WidgetsListAdapter(
context,
LayoutInflater.from(context),
this::getEmptySpaceHeight,
/* iconClickListener= */ WidgetsFullSheet.this,
/* iconLongClickListener= */ WidgetsFullSheet.this,
- mIsTwoPane ? headerChangeListener : null);
+ isTwoPane());
mWidgetsListAdapter.setHasStableIds(true);
switch (mAdapterType) {
case PRIMARY:
@@ -1073,7 +939,7 @@
mWidgetsRecyclerView.bindFastScrollbar(mFastScroller);
mWidgetsRecyclerView.setItemAnimator(mWidgetsListItemAnimator);
mWidgetsRecyclerView.setHeaderViewDimensionsProvider(WidgetsFullSheet.this);
- if (!mIsTwoPane) {
+ if (!isTwoPane()) {
mWidgetsRecyclerView.setEdgeEffectFactory(
((SpringRelativeLayout) mContent).createEdgeEffectFactory());
}
@@ -1086,15 +952,4 @@
mWidgetsListAdapter.setMaxHorizontalSpansPxPerRow(mMaxSpanPerRow);
}
}
-
- /**
- * This is a listener for when the selected header gets changed in the left pane.
- */
- public interface HeaderChangeListener {
- /**
- * Sets the right pane to have the widgets for the currently selected header from
- * the left pane.
- */
- void onHeaderChanged(@NonNull PackageUserKey selectedHeader);
- }
}
diff --git a/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java b/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java
index c89eea8..723ea17 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java
@@ -89,7 +89,7 @@
private final SparseArray<ViewHolderBinder> mViewHolderBinders = new SparseArray<>();
private final WidgetListBaseRowEntryComparator mRowComparator =
new WidgetListBaseRowEntryComparator();
- @Nullable private final WidgetsFullSheet.HeaderChangeListener mHeaderChangeListener;
+ @Nullable private WidgetsTwoPaneSheet.HeaderChangeListener mHeaderChangeListener;
private final List<WidgetsListBaseEntry> mAllEntries = new ArrayList<>();
private ArrayList<WidgetsListBaseEntry> mVisibleEntries = new ArrayList<>();
@@ -107,8 +107,7 @@
public WidgetsListAdapter(Context context, LayoutInflater layoutInflater,
IntSupplier emptySpaceHeightProvider, OnClickListener iconClickListener,
OnLongClickListener iconLongClickListener,
- WidgetsFullSheet.HeaderChangeListener headerChangeListener) {
- mHeaderChangeListener = headerChangeListener;
+ boolean isTwoPane) {
mContext = context;
mMaxHorizontalSpan = WidgetSizes.getWidgetSizePx(
ActivityContext.lookupContext(context).getDeviceProfile(),
@@ -122,12 +121,17 @@
VIEW_TYPE_WIDGETS_HEADER,
new WidgetsListHeaderViewHolderBinder(
layoutInflater, /* onHeaderClickListener= */ this,
- headerChangeListener != null));
+ isTwoPane));
mViewHolderBinders.put(
VIEW_TYPE_WIDGETS_SPACE,
new WidgetsSpaceViewHolderBinder(emptySpaceHeightProvider));
}
+ public void setHeaderChangeListener(WidgetsTwoPaneSheet.HeaderChangeListener
+ headerChangeListener) {
+ mHeaderChangeListener = headerChangeListener;
+ }
+
@Override
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
mRecyclerView = recyclerView;
diff --git a/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java b/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java
new file mode 100644
index 0000000..de7497a
--- /dev/null
+++ b/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java
@@ -0,0 +1,271 @@
+/*
+ * Copyright (C) 2023 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.widget.picker;
+
+import android.content.Context;
+import android.graphics.Outline;
+import android.os.Process;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewOutlineProvider;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+import androidx.annotation.NonNull;
+
+import com.android.launcher3.R;
+import com.android.launcher3.model.data.PackageItemInfo;
+import com.android.launcher3.recyclerview.ViewHolderBinder;
+import com.android.launcher3.util.PackageUserKey;
+import com.android.launcher3.widget.model.WidgetsListBaseEntry;
+import com.android.launcher3.widget.model.WidgetsListContentEntry;
+import com.android.launcher3.widget.model.WidgetsListHeaderEntry;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Popup for showing the full list of available widgets with a two-pane layout.
+ */
+public class WidgetsTwoPaneSheet extends WidgetsFullSheet {
+
+ private static final int PERSONAL_TAB = 0;
+ private static final int WORK_TAB = 1;
+ private static final String SUGGESTIONS_PACKAGE_NAME = "widgets_list_suggestions_entry";
+
+ private LinearLayout mSuggestedWidgetsContainer;
+ private WidgetsListHeader mSuggestedWidgetsHeader;
+ private LinearLayout mRightPane;
+
+ private FrameLayout mRightPaneScrollView;
+ private WidgetsListTableViewHolderBinder mWidgetsListTableViewHolderBinder;
+
+ private final ViewOutlineProvider mViewOutlineProviderRightPane = new ViewOutlineProvider() {
+ @Override
+ public void getOutline(View view, Outline outline) {
+ outline.setRoundRect(
+ 0,
+ 0,
+ view.getMeasuredWidth(),
+ view.getMeasuredHeight() - getResources().getDimensionPixelSize(
+ R.dimen.widget_list_horizontal_margin_large_screen),
+ view.getResources().getDimensionPixelSize(
+ R.dimen.widget_list_top_bottom_corner_radius)
+ );
+ }
+ };
+
+ public WidgetsTwoPaneSheet(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ public WidgetsTwoPaneSheet(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void setupSheet() {
+ // Set the header change listener in the adapter
+ mAdapters.get(AdapterHolder.PRIMARY)
+ .mWidgetsListAdapter.setHeaderChangeListener(getHeaderChangeListener());
+ mAdapters.get(AdapterHolder.WORK)
+ .mWidgetsListAdapter.setHeaderChangeListener(getHeaderChangeListener());
+ mAdapters.get(AdapterHolder.SEARCH)
+ .mWidgetsListAdapter.setHeaderChangeListener(getHeaderChangeListener());
+
+ LayoutInflater layoutInflater = LayoutInflater.from(getContext());
+
+ int contentLayoutRes = mHasWorkProfile ? R.layout.widgets_full_sheet_paged_view_large_screen
+ : R.layout.widgets_full_sheet_recyclerview_large_screen;
+ layoutInflater.inflate(contentLayoutRes, findViewById(R.id.recycler_view_container), true);
+
+ setupViews();
+
+ mWidgetsListTableViewHolderBinder =
+ new WidgetsListTableViewHolderBinder(mActivityContext, layoutInflater, this, this);
+ mRecommendedWidgetsTable = mContent.findViewById(R.id.recommended_widget_table);
+ mRecommendedWidgetsTable.setWidgetCellLongClickListener(this);
+ mRecommendedWidgetsTable.setWidgetCellOnClickListener(this);
+ mHeaderTitle = mContent.findViewById(R.id.title);
+ mRightPane = mContent.findViewById(R.id.right_pane);
+ mRightPane.setOutlineProvider(mViewOutlineProviderRightPane);
+ mRightPaneScrollView = mContent.findViewById(R.id.right_pane_scroll_view);
+ mRightPaneScrollView.setOverScrollMode(View.OVER_SCROLL_NEVER);
+
+ setupSuggestedWidgets(layoutInflater);
+ onRecommendedWidgetsBound();
+ onWidgetsBound();
+ setUpEducationViewsIfNeeded();
+
+ // Set the fast scroller as not visible for two pane layout.
+ mFastScroller.setVisibility(GONE);
+ }
+
+ @Override
+ protected void hideRecommendations() {
+ super.hideRecommendations();
+ mSuggestedWidgetsContainer.setVisibility(GONE);
+ }
+
+ private void setupSuggestedWidgets(LayoutInflater layoutInflater) {
+ // Add suggested widgets.
+ mSuggestedWidgetsContainer = mSearchScrollView.findViewById(R.id.suggestions_header);
+
+ // Inflate the suggestions header.
+ mSuggestedWidgetsHeader = (WidgetsListHeader) layoutInflater.inflate(
+ R.layout.widgets_list_row_header_two_pane,
+ mSuggestedWidgetsContainer,
+ false);
+ mSuggestedWidgetsHeader.setExpanded(true);
+
+ PackageItemInfo packageItemInfo = new PackageItemInfo(
+ /* packageName= */ SUGGESTIONS_PACKAGE_NAME,
+ Process.myUserHandle()) {
+ @Override
+ public boolean usingLowResIcon() {
+ return false;
+ }
+ };
+ packageItemInfo.title = getContext().getString(R.string.suggested_widgets_header_title);
+ WidgetsListHeaderEntry widgetsListHeaderEntry = WidgetsListHeaderEntry.create(
+ packageItemInfo,
+ getContext().getString(R.string.suggested_widgets_header_title),
+ mActivityContext.getPopupDataProvider().getRecommendedWidgets())
+ .withWidgetListShown();
+
+ mSuggestedWidgetsHeader.applyFromItemInfoWithIcon(widgetsListHeaderEntry);
+ mSuggestedWidgetsHeader.setIcon(
+ getContext().getDrawable(R.drawable.widget_suggestions_icon));
+ mSuggestedWidgetsHeader.setOnClickListener(view -> {
+ mSuggestedWidgetsHeader.setExpanded(true);
+ resetExpandedHeaders();
+ mRightPane.removeAllViews();
+ mRightPane.addView(mRecommendedWidgetsTable);
+ });
+ mSuggestedWidgetsContainer.addView(mSuggestedWidgetsHeader);
+ }
+
+ @Override
+ protected float getMaxTableHeight(float noWidgetsViewHeight) {
+ return Float.MAX_VALUE;
+ }
+
+ @Override
+ public void onActivePageChanged(int currentActivePage) {
+ // if the current active page changes to personal or work we set suggestions
+ // to be the selected widget
+ if (currentActivePage == PERSONAL_TAB || currentActivePage == WORK_TAB) {
+ mSuggestedWidgetsHeader.callOnClick();
+ }
+
+ super.onActivePageChanged(currentActivePage);
+ }
+
+ @Override
+ protected void updateRecyclerViewVisibility(AdapterHolder adapterHolder) {
+ // The first item is always an empty space entry. Look for any more items.
+ boolean isWidgetAvailable = adapterHolder.mWidgetsListAdapter.hasVisibleEntries();
+
+ mRightPane.setVisibility(isWidgetAvailable ? VISIBLE : GONE);
+
+ super.updateRecyclerViewVisibility(adapterHolder);
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mSuggestedWidgetsContainer.setVisibility(VISIBLE);
+ }
+
+ @Override
+ public void onSearchResults(List<WidgetsListBaseEntry> entries) {
+ super.onSearchResults(entries);
+ mAdapters.get(AdapterHolder.SEARCH).mWidgetsListAdapter.selectFirstHeaderEntry();
+ }
+
+ @Override
+ protected boolean shouldScroll(MotionEvent ev) {
+ return getPopupContainer().isEventOverView(mRightPaneScrollView, ev)
+ ? mRightPaneScrollView.canScrollVertically(-1)
+ : super.shouldScroll(ev);
+ }
+
+ @Override
+ protected void setViewVisibilityBasedOnSearch(boolean isInSearchMode) {
+ if (isInSearchMode) {
+ mSuggestedWidgetsContainer.setVisibility(GONE);
+ } else {
+ mSuggestedWidgetsContainer.setVisibility(VISIBLE);
+ mSuggestedWidgetsHeader.callOnClick();
+ }
+ super.setViewVisibilityBasedOnSearch(isInSearchMode);
+ }
+
+ @Override
+ protected View getContentView() {
+ return mRightPane;
+ }
+
+ private HeaderChangeListener getHeaderChangeListener() {
+ return new HeaderChangeListener() {
+ @Override
+ public void onHeaderChanged(@NonNull PackageUserKey selectedHeader) {
+ WidgetsListContentEntry contentEntry = mActivityContext.getPopupDataProvider()
+ .getSelectedAppWidgets(selectedHeader);
+
+ if (contentEntry == null || mRightPane == null) {
+ return;
+ }
+
+ if (mSuggestedWidgetsHeader != null) {
+ mSuggestedWidgetsHeader.setExpanded(false);
+ }
+ WidgetsRowViewHolder widgetsRowViewHolder =
+ mWidgetsListTableViewHolderBinder.newViewHolder(mRightPane);
+ mWidgetsListTableViewHolderBinder.bindViewHolder(widgetsRowViewHolder,
+ contentEntry,
+ ViewHolderBinder.POSITION_FIRST | ViewHolderBinder.POSITION_LAST,
+ Collections.EMPTY_LIST);
+ widgetsRowViewHolder.mDataCallback = data -> {
+ mWidgetsListTableViewHolderBinder.bindViewHolder(widgetsRowViewHolder,
+ contentEntry,
+ ViewHolderBinder.POSITION_FIRST | ViewHolderBinder.POSITION_LAST,
+ Collections.singletonList(data));
+ };
+ mRightPane.removeAllViews();
+ mRightPane.addView(widgetsRowViewHolder.itemView);
+ }
+ };
+ }
+
+ @Override
+ protected boolean isTwoPane() {
+ return true;
+ }
+
+ /**
+ * This is a listener for when the selected header gets changed in the left pane.
+ */
+ public interface HeaderChangeListener {
+ /**
+ * Sets the right pane to have the widgets for the currently selected header from
+ * the left pane.
+ */
+ void onHeaderChanged(@NonNull PackageUserKey selectedHeader);
+ }
+}
diff --git a/tests/src/com/android/launcher3/nonquickstep/DeviceProfileDumpTest.kt b/tests/src/com/android/launcher3/nonquickstep/DeviceProfileDumpTest.kt
index 86d21f3..13db6c7 100644
--- a/tests/src/com/android/launcher3/nonquickstep/DeviceProfileDumpTest.kt
+++ b/tests/src/com/android/launcher3/nonquickstep/DeviceProfileDumpTest.kt
@@ -126,7 +126,10 @@
"\thotseatQsbWidth: 0.0px (0.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:false\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 21.0px (8.0dp)\n" +
"\tworkspacePadding.left: 0.0px (0.0dp)\n" +
"\tworkspacePadding.top: 0.0px (0.0dp)\n" +
@@ -258,7 +261,10 @@
"\thotseatQsbWidth: 0.0px (0.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:false\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 21.0px (8.0dp)\n" +
"\tworkspacePadding.left: 0.0px (0.0dp)\n" +
"\tworkspacePadding.top: 0.0px (0.0dp)\n" +
@@ -390,7 +396,10 @@
"\thotseatQsbWidth: 0.0px (0.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:false\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 0.0px (0.0dp)\n" +
"\tworkspacePadding.left: 10.0px (3.8095238dp)\n" +
"\tworkspacePadding.top: 0.0px (0.0dp)\n" +
@@ -522,7 +531,10 @@
"\thotseatQsbWidth: 0.0px (0.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:false\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 0.0px (0.0dp)\n" +
"\tworkspacePadding.left: 10.0px (3.8095238dp)\n" +
"\tworkspacePadding.top: 0.0px (0.0dp)\n" +
@@ -655,7 +667,10 @@
"\thotseatQsbWidth: 1224.0px (612.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:true\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 240.0px (120.0dp)\n" +
"\tworkspacePadding.left: 181.0px (90.5dp)\n" +
"\tworkspacePadding.top: 0.0px (0.0dp)\n" +
@@ -788,7 +803,10 @@
"\thotseatQsbWidth: 1224.0px (612.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:true\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 240.0px (120.0dp)\n" +
"\tworkspacePadding.left: 181.0px (90.5dp)\n" +
"\tworkspacePadding.top: 0.0px (0.0dp)\n" +
@@ -921,7 +939,10 @@
"\thotseatQsbWidth: 1300.0px (650.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:true\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 108.0px (54.0dp)\n" +
"\tworkspacePadding.left: 36.0px (18.0dp)\n" +
"\tworkspacePadding.top: 132.0px (66.0dp)\n" +
@@ -1054,7 +1075,10 @@
"\thotseatQsbWidth: 1300.0px (650.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:true\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 108.0px (54.0dp)\n" +
"\tworkspacePadding.left: 36.0px (18.0dp)\n" +
"\tworkspacePadding.top: 132.0px (66.0dp)\n" +
@@ -1192,7 +1216,10 @@
"\thotseatQsbWidth: 0.0px (0.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:true\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 21.0px (8.0dp)\n" +
"\tworkspacePadding.left: 21.0px (8.0dp)\n" +
"\tworkspacePadding.top: 30.0px (11.428572dp)\n" +
@@ -1329,7 +1356,10 @@
"\thotseatQsbWidth: 0.0px (0.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:true\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 21.0px (8.0dp)\n" +
"\tworkspacePadding.left: 21.0px (8.0dp)\n" +
"\tworkspacePadding.top: 30.0px (11.428572dp)\n" +
@@ -1466,7 +1496,10 @@
"\thotseatQsbWidth: 0.0px (0.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:true\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 21.0px (8.0dp)\n" +
"\tworkspacePadding.left: 21.0px (8.0dp)\n" +
"\tworkspacePadding.top: 24.0px (9.142858dp)\n" +
@@ -1599,7 +1632,10 @@
"\thotseatQsbWidth: 0.0px (0.0dp)\n" +
"\tisTaskbarPresent:false\n" +
"\tisTaskbarPresentInApps:true\n" +
- "\ttaskbarSize: 0.0px (0.0dp)\n" +
+ "\ttaskbarHeight: 0.0px (0.0dp)\n" +
+ "\tstashedTaskbarHeight: 0.0px (0.0dp)\n" +
+ "\ttaskbarBottomMargin: 0.0px (0.0dp)\n" +
+ "\ttaskbarIconSize: 0.0px (0.0dp)\n" +
"\tdesiredWorkspaceHorizontalMarginPx: 21.0px (8.0dp)\n" +
"\tworkspacePadding.left: 21.0px (8.0dp)\n" +
"\tworkspacePadding.top: 24.0px (9.142858dp)\n" +
diff --git a/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java b/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java
index d07c6c2..fdba4eb 100644
--- a/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java
+++ b/tests/src/com/android/launcher3/ui/BubbleTextViewTest.java
@@ -21,6 +21,7 @@
import static com.android.launcher3.config.FeatureFlags.ENABLE_TWOLINE_ALLAPPS;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import android.content.Context;
import android.graphics.Typeface;
@@ -79,7 +80,6 @@
mBubbleTextView = new BubbleTextView(mContext);
mBubbleTextView.reset();
mBubbleTextView.setDisplayAllApps();
- assertEquals(ONE_LINE, mBubbleTextView.getMaxLines());
BubbleTextView testView = new BubbleTextView(mContext);
testView.setTypeface(Typeface.MONOSPACE);
@@ -108,7 +108,7 @@
mBubbleTextView.setTypeface(Typeface.MONOSPACE);
mBubbleTextView.measure(mLimitedWidth, 0);
mBubbleTextView.onPreDraw();
- assertEquals(ONE_LINE, mBubbleTextView.getMaxLines());
+ assertNotEquals(TWO_LINE, mBubbleTextView.getMaxLines());
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/tests/src/com/android/launcher3/ui/WorkProfileTest.java b/tests/src/com/android/launcher3/ui/WorkProfileTest.java
index 9eeea24..c22f93d 100644
--- a/tests/src/com/android/launcher3/ui/WorkProfileTest.java
+++ b/tests/src/com/android/launcher3/ui/WorkProfileTest.java
@@ -72,7 +72,8 @@
}
updateWorkProfileSetupSuccessful("am start-user", output);
- Log.d(WORK_TAB_MISSING, "workProfileSuccessful? " + mWorkProfileSetupSuccessful);
+ Log.d(WORK_TAB_MISSING, "workProfileSuccessful? " + mWorkProfileSetupSuccessful +
+ " shellCmd: " + logStr);
if (!mWorkProfileSetupSuccessful) {
return; // no need to setup launcher since all tests will skip.
}