App discovery integration in All Apps search

This is the basis for app discovery integration while searching in all apps.
This does NOT include binding to the actual service and retrieving results,
but instead provides all the UI to show suggested instant apps and apps
from a store with star rating and pricing.

Change-Id: I1605b52848491acee4ac1d15c0112e6a768363f6
This commit is contained in:
Mario Bertschler
2017-02-17 12:16:13 -08:00
parent 74480b7bca
commit 0fc6f684e7
20 changed files with 798 additions and 86 deletions

View File

@@ -20,6 +20,8 @@ import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.InsetDrawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.text.Selection;
import android.text.Spannable;
@@ -46,6 +48,8 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.discovery.AppDiscoveryItem;
import com.android.launcher3.discovery.AppDiscoveryUpdateState;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.folder.Folder;
@@ -211,7 +215,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
// IF scroller is at the very top OR there is no scroll bar because there is probably not
// enough items to scroll, THEN it's okay for the container to be pulled down.
if (mAppsRecyclerView.getScrollBar().getThumbOffsetY() <= 0) {
if (mAppsRecyclerView.getCurrentScrollY() == 0) {
return true;
}
return false;
@@ -425,13 +429,21 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
@Override
public void onSearchResult(String query, ArrayList<ComponentKey> apps) {
if (apps != null) {
if (mApps.setOrderedFilter(apps)) {
mAppsRecyclerView.onSearchResultsChanged();
}
mApps.setOrderedFilter(apps);
mAppsRecyclerView.onSearchResultsChanged();
mAdapter.setLastSearchQuery(query);
}
}
@Override
public void onAppDiscoverySearchUpdate(@Nullable AppDiscoveryItem app,
@NonNull AppDiscoveryUpdateState state) {
if (!mLauncher.isDestroyed()) {
mApps.onAppDiscoverySearchUpdate(app, state);
mAppsRecyclerView.onSearchResultsChanged();
}
}
@Override
public void clearSearchResult() {
if (mApps.setOrderedFilter(null)) {