Enabling Private Space Container in Launcher.

This CL adds the following:
1. Adds filtering and addition of Private Profile apps in main user
all apps recycler view
2. Enables decoration of Private Profile apps
3. Enables hiding Private Space container based upon a settings entry.

Flag: ACONFIG com.android.launcher3.Flags.enable_private_space DEVELOPMENT
Bug: 289223923
Test: Ran Launcher3 tests
Change-Id: I33dc55a3a39e75d3fc336ca6a488b282e2dd322c
This commit is contained in:
Himanshu Gupta
2023-11-06 17:47:29 +00:00
parent 8ed8d67d63
commit 739b3c9f22
12 changed files with 412 additions and 55 deletions
@@ -22,6 +22,7 @@ import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
@@ -139,9 +140,16 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
protected final OnClickListener mOnIconClickListener;
protected final OnLongClickListener mOnIconLongClickListener;
protected OnFocusChangeListener mIconFocusListener;
private final PrivateSpaceHeaderViewController mPrivateSpaceHeaderViewController;
public BaseAllAppsAdapter(T activityContext, LayoutInflater inflater,
AlphabeticalAppsList<T> apps, SearchAdapterProvider<?> adapterProvider) {
this(activityContext, inflater, apps, adapterProvider, null);
}
public BaseAllAppsAdapter(T activityContext, LayoutInflater inflater,
AlphabeticalAppsList<T> apps, SearchAdapterProvider<?> adapterProvider,
PrivateSpaceHeaderViewController privateSpaceHeaderViewController) {
mActivityContext = activityContext;
mApps = apps;
mLayoutInflater = inflater;
@@ -150,6 +158,7 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
mOnIconLongClickListener = mActivityContext.getAllAppsItemLongClickListener();
mAdapterProvider = adapterProvider;
mPrivateSpaceHeaderViewController = privateSpaceHeaderViewController;
}
/** Checks if the passed viewType represents all apps divider. */
@@ -162,6 +171,11 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
return isViewType(viewType, VIEW_TYPE_MASK_ICON);
}
/** Checks if the passed viewType represents private space header. */
public static boolean isPrivateSpaceHeaderView(int viewType) {
return isViewType(viewType, VIEW_TYPE_MASK_PRIVATE_SPACE_HEADER);
}
public void setIconFocusListener(OnFocusChangeListener focusListener) {
mIconFocusListener = focusListener;
}
@@ -230,6 +244,12 @@ public abstract class BaseAllAppsAdapter<T extends Context & ActivityContext> ex
break;
}
case VIEW_TYPE_PRIVATE_SPACE_HEADER:
RelativeLayout psHeaderLayout = holder.itemView.findViewById(
R.id.ps_header_layout);
assert mPrivateSpaceHeaderViewController != null;
assert psHeaderLayout != null;
mPrivateSpaceHeaderViewController.addPrivateSpaceHeaderViewElements(psHeaderLayout);
break;
case VIEW_TYPE_ALL_APPS_DIVIDER:
case VIEW_TYPE_WORK_DISABLED_CARD:
// nothing to do