Add work profile footer in work tab

Screenshot(work mode is on): https://hsv.googleplex.com/6279751685636096
Screenshot (work mode is off): https://hsv.googleplex.com/6279751685636096

TODO:
It is just the UX bit, once the platform change is in, we should then
consume the new API to
1. Turn on / off work mode
2. Get the organization name and set the textview accordingly.

BUG=69905244

Change-Id: Id94ae57625d6b629dac89c1c28f8d65f395fff6c
This commit is contained in:
Tony Mak
2017-11-24 16:40:03 +08:00
parent 0c2d9b0f3e
commit 6ffe4e0eee
10 changed files with 170 additions and 16 deletions

View File

@@ -140,9 +140,9 @@ public class AlphabeticalAppsList {
return item;
}
public static AdapterItem asMarketDivider(int pos) {
public static AdapterItem asAllAppsDivider(int pos) {
AdapterItem item = new AdapterItem();
item.viewType = AllAppsGridAdapter.VIEW_TYPE_SEARCH_MARKET_DIVIDER;
item.viewType = AllAppsGridAdapter.VIEW_TYPE_ALL_APPS_DIVIDER;
item.position = pos;
return item;
}
@@ -160,6 +160,13 @@ public class AlphabeticalAppsList {
item.position = pos;
return item;
}
public static AdapterItem asWorkTabFooter(int pos) {
AdapterItem item = new AdapterItem();
item.viewType = AllAppsGridAdapter.VIEW_TYPE_WORK_TAB_FOOTER;
item.position = pos;
return item;
}
}
private final Launcher mLauncher;
@@ -179,6 +186,8 @@ public class AlphabeticalAppsList {
// The set of predicted apps resolved from the component names and the current set of apps
private final List<AppInfo> mPredictedApps = new ArrayList<>();
private final List<AppDiscoveryAppInfo> mDiscoveredApps = new ArrayList<>();
// Is it the work profile app list.
private final boolean mIsWork;
// The of ordered component names as a result of a search query
private ArrayList<ComponentKey> mSearchResults;
@@ -191,11 +200,16 @@ public class AlphabeticalAppsList {
private int mNumAppRowsInAdapter;
private ItemInfoMatcher mItemFilter;
public AlphabeticalAppsList(Context context, HashMap<ComponentKey, AppInfo> componentToAppMap) {
public AlphabeticalAppsList(
Context context,
HashMap<ComponentKey,
AppInfo> componentToAppMap,
boolean isWork) {
mComponentToAppMap = componentToAppMap;
mLauncher = Launcher.getLauncher(context);
mIndexer = new AlphabeticIndexCompat(context);
mAppNameComparator = new AppInfoComparator(context);
mIsWork = isWork;
}
public void updateItemFilter(ItemInfoMatcher itemFilter) {
@@ -545,7 +559,7 @@ public class AlphabeticalAppsList {
if (hasNoFilteredResults()) {
mAdapterItems.add(AdapterItem.asEmptySearch(position++));
} else {
mAdapterItems.add(AdapterItem.asMarketDivider(position++));
mAdapterItems.add(AdapterItem.asAllAppsDivider(position++));
}
mAdapterItems.add(AdapterItem.asMarketSearch(position++));
}
@@ -604,6 +618,12 @@ public class AlphabeticalAppsList {
break;
}
}
// Add the work profile footer if required.
if (mIsWork) {
mAdapterItems.add(AdapterItem.asAllAppsDivider(position++));
mAdapterItems.add(AdapterItem.asWorkTabFooter(position++));
}
}
public boolean isAppDiscoveryRunning() {