Fix views being visible after closing private space.
Its possible views are still being binded before the app list is refreshed. So instead make the views gone in that case (by making sure private profile is disabled). Fixes: - install app icon still showing because it is not identified as a private space item - Divider still containing a decorator when collapsing before app list is refreshed. bug: 334868779 Test video manualy: before:https://drive.google.com/file/d/1IWdGsTSq7-xRZKOJso-5p9g-j7RTEkas/view?usp=sharing after:https://drive.google.com/file/d/1IVNTksryFi5o4uHzZtzNC0Yz7-rxrje3/view?usp=sharing Flag: ACONFIG com.android.launcher3.Flags.private_space_animation trunkfood Change-Id: If93e39753352741fb6f0728f717a67b7f9315d0b
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.android.launcher3.allapps;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_BOTTOM_LEFT;
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_BOTTOM_RIGHT;
|
||||
import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_NOTHING;
|
||||
@@ -42,6 +44,7 @@ import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.allapps.search.SearchAdapterProvider;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
|
||||
/**
|
||||
@@ -263,15 +266,25 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
|
||||
icon.applyFromApplicationInfo(adapterItem.itemInfo);
|
||||
icon.setOnFocusChangeListener(mIconFocusListener);
|
||||
PrivateProfileManager privateProfileManager = mApps.getPrivateProfileManager();
|
||||
// Set the alpha of the private space icon to 0 upon expanding the header so the
|
||||
// alpha can animate -> 1.
|
||||
if (icon.getAlpha() == 0 || icon.getAlpha() == 1) {
|
||||
icon.setAlpha(privateProfileManager != null
|
||||
&& privateProfileManager.isPrivateSpaceItem(adapterItem)
|
||||
&& privateProfileManager.getAnimationScrolling()
|
||||
&& privateProfileManager.getAnimate()
|
||||
&& privateProfileManager.getCurrentState() == STATE_ENABLED
|
||||
? 0 : 1);
|
||||
if (privateProfileManager != null) {
|
||||
// Set the alpha of the private space icon to 0 upon expanding the header so the
|
||||
// alpha can animate -> 1.
|
||||
boolean isPrivateSpaceItem =
|
||||
privateProfileManager.isPrivateSpaceItem(adapterItem);
|
||||
if (icon.getAlpha() == 0 || icon.getAlpha() == 1) {
|
||||
icon.setAlpha(isPrivateSpaceItem
|
||||
&& privateProfileManager.getAnimationScrolling()
|
||||
&& privateProfileManager.getAnimate()
|
||||
&& privateProfileManager.getCurrentState() == STATE_ENABLED
|
||||
? 0 : 1);
|
||||
}
|
||||
// Views can still be bounded before the app list is updated hence showing icons
|
||||
// after collapsing.
|
||||
if (privateProfileManager.getCurrentState() == STATE_DISABLED
|
||||
&& isPrivateSpaceItem) {
|
||||
adapterItem.decorationInfo = null;
|
||||
icon.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -298,7 +311,8 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
|
||||
break;
|
||||
case VIEW_TYPE_PRIVATE_SPACE_SYS_APPS_DIVIDER:
|
||||
adapterItem = mApps.getAdapterItems().get(position);
|
||||
adapterItem.decorationInfo = new SectionDecorationInfo(mActivityContext,
|
||||
adapterItem.decorationInfo = mApps.getPrivateProfileManager().getCurrentState()
|
||||
== STATE_DISABLED ? null : new SectionDecorationInfo(mActivityContext,
|
||||
ROUND_NOTHING, true /* decorateTogether */);
|
||||
break;
|
||||
case VIEW_TYPE_ALL_APPS_DIVIDER:
|
||||
|
||||
Reference in New Issue
Block a user