Adds Blur and BlurFallback styles for All Apps.
Technically these styles can be used throughout Launcher, e.g. Widget Picker and Folders, but this CL only applies it to All Apps. At a high level, views wishing to apply transparency to show blur should use these new attr values rather than colors directly. When blur changes, e.g. starting or stopping battery saver, the style is re-applied and revelant views are invalidated. For Launcher, this is handled by DepthController, and for Taskbar it's handled by a CrossWindowBlurListener. Also updated the Private Space animation slightly to account for the translucent decorators (specifically, we can't use the mask view to cover them when blur is enabled). Screenshots: https://drive.google.com/drive/folders/1tU472KHotgEBpT-Ec9VOBWPBf_YdVqv2?resourcekey=0-ebf7W8O6iDJ4UVMtRzTABg&usp=sharing Private Space animations: https://drive.google.com/file/d/1h5pn8Xb17TPcbujr7uSAJNTq8kwNZoIp/view?usp=drive_link&resourcekey=0-TzpaJ16Gg8_QJctBx4oiIg Private Space QS Tile animations: https://drive.google.com/file/d/1dCuqnqd5z2kSBEakGobMlEkMwFDBWRbJ/view?usp=drive_link&resourcekey=0-qRVFPb-a6OzaZQOf4x86Jw Bug: 371343636 Test: Manual Flag: com.android.launcher3.all_apps_blur Change-Id: Ia9f581f50d1adc0830569656bdeb751deb710a9c
This commit is contained in:
@@ -203,8 +203,7 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
|
||||
BaseAllAppsAdapter.AdapterItem item = new BaseAllAppsAdapter.AdapterItem(VIEW_TYPE_ICON);
|
||||
item.itemInfo = itemInfo;
|
||||
item.decorationInfo = new SectionDecorationInfo(context, ROUND_NOTHING,
|
||||
/* decorateTogether */ true);
|
||||
item.decorationInfo = new SectionDecorationInfo(context, ROUND_NOTHING);
|
||||
|
||||
adapterItems.add(item);
|
||||
mAllApps.mAH.get(MAIN).mAdapter.notifyItemInserted(adapterItems.size() - 1);
|
||||
@@ -224,9 +223,7 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the current state of Private Profile, w.r.t. to Launcher. The decorator should only
|
||||
* be applied upon expand before animating. When collapsing, reset() will remove the decorator
|
||||
* when animation is not running.
|
||||
* Resets the current state of Private Profile, w.r.t. to Launcher.
|
||||
*/
|
||||
public void reset() {
|
||||
Trace.beginSection("PrivateProfileManager#reset");
|
||||
@@ -248,7 +245,7 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
} else if (previousState == STATE_ENABLED && updatedState == STATE_DISABLED){
|
||||
executeLock();
|
||||
}
|
||||
addPrivateSpaceDecorator(updatedState);
|
||||
addPrivateSpaceDecorator();
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
@@ -282,26 +279,24 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
setPrivateSpaceSettingsAvailable(apiWrapper.getPrivateSpaceSettingsIntent() != null);
|
||||
}
|
||||
|
||||
/** Adds a private space decorator only when STATE_ENABLED. */
|
||||
/** Adds a private space decorator to the main (personal) app recyclerview. */
|
||||
@VisibleForTesting
|
||||
void addPrivateSpaceDecorator(int updatedState) {
|
||||
void addPrivateSpaceDecorator() {
|
||||
ActivityAllAppsContainerView<?>.AdapterHolder mainAdapterHolder = mAllApps.mAH.get(MAIN);
|
||||
if (updatedState == STATE_ENABLED) {
|
||||
// Create a new decorator instance if not already available.
|
||||
if (mPrivateAppsSectionDecorator == null) {
|
||||
mPrivateAppsSectionDecorator = new PrivateAppsSectionDecorator(
|
||||
mainAdapterHolder.mAppsList);
|
||||
}
|
||||
for (int i = 0; i < mainAdapterHolder.mRecyclerView.getItemDecorationCount(); i++) {
|
||||
if (mainAdapterHolder.mRecyclerView.getItemDecorationAt(i)
|
||||
.equals(mPrivateAppsSectionDecorator)) {
|
||||
// No need to add another decorator if one is already present in recycler view.
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Add Private Space Decorator to the Recycler view.
|
||||
mainAdapterHolder.mRecyclerView.addItemDecoration(mPrivateAppsSectionDecorator);
|
||||
// Create a new decorator instance if not already available.
|
||||
if (mPrivateAppsSectionDecorator == null) {
|
||||
mPrivateAppsSectionDecorator = new PrivateAppsSectionDecorator(
|
||||
mainAdapterHolder.mAppsList);
|
||||
}
|
||||
for (int i = 0; i < mainAdapterHolder.mRecyclerView.getItemDecorationCount(); i++) {
|
||||
if (mainAdapterHolder.mRecyclerView.getItemDecorationAt(i)
|
||||
.equals(mPrivateAppsSectionDecorator)) {
|
||||
// No need to add another decorator if one is already present in recycler view.
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Add Private Space Decorator to the Recycler view.
|
||||
mainAdapterHolder.mRecyclerView.addItemDecoration(mPrivateAppsSectionDecorator);
|
||||
}
|
||||
|
||||
public void setQuietMode(boolean enable) {
|
||||
@@ -440,7 +435,7 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
setQuietMode(lock);
|
||||
}
|
||||
|
||||
/** Finds the private space header to scroll to and set the private space icons to GONE. */
|
||||
/** Finds the private space header to smooth scroll to. */
|
||||
private void collapse() {
|
||||
AllAppsRecyclerView allAppsRecyclerView = mAllApps.getActiveRecyclerView();
|
||||
List<BaseAllAppsAdapter.AdapterItem> appListAdapterItems =
|
||||
@@ -463,23 +458,9 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
RecyclerView.LayoutManager layoutManager = allAppsRecyclerView.getLayoutManager();
|
||||
if (layoutManager != null) {
|
||||
startAnimationScroll(allAppsRecyclerView, layoutManager, smoothScroller);
|
||||
// Preserve decorator if floating mask view exists.
|
||||
if (mFloatingMaskView == null) {
|
||||
currentItem.decorationInfo = null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Make the private space apps gone to "collapse".
|
||||
if ((mFloatingMaskView == null && isPrivateSpaceItem(currentItem)) ||
|
||||
currentItem.viewType == VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER) {
|
||||
RecyclerView.ViewHolder viewHolder =
|
||||
allAppsRecyclerView.findViewHolderForAdapterPosition(i);
|
||||
if (viewHolder != null) {
|
||||
viewHolder.itemView.setVisibility(GONE);
|
||||
currentItem.decorationInfo = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -695,8 +676,6 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
+ mPrivateSpaceSettingsButton.getVisibility()
|
||||
+ " settingsCogAlpha: " + mPrivateSpaceSettingsButton.getAlpha());
|
||||
if (!expand) {
|
||||
mAllApps.mAH.get(MAIN).mRecyclerView.removeItemDecoration(
|
||||
mPrivateAppsSectionDecorator);
|
||||
// Call onAppsUpdated() because it may be canceled when this animation occurs.
|
||||
if (!Utilities.isRunningInTestHarness()) {
|
||||
mAllApps.getPersonalAppList().onAppsUpdated();
|
||||
@@ -861,7 +840,8 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
}
|
||||
|
||||
private void attachFloatingMaskView(boolean expand) {
|
||||
if (!Flags.privateSpaceAddFloatingMaskView()) {
|
||||
// Floating mask can't block the transparent background if blur is enabled, so don't add it.
|
||||
if (!Flags.privateSpaceAddFloatingMaskView() || mAllApps.isBackgroundBlurEnabled()) {
|
||||
return;
|
||||
}
|
||||
// Use getLocationOnScreen() as simply checking for mPSHeader.getBottom() is only relative
|
||||
|
||||
Reference in New Issue
Block a user