Moving apps search related logic into a custom layout file

This will allow derivative projects to easily change the search behavior
by simply overriding the xml file

Bug: 37616877
Change-Id: Ib8d6a2dab06819a52611e9a3d97c70c5a49bbf97
This commit is contained in:
Sunny Goyal
2017-05-07 11:56:00 -07:00
parent b73fa5d7a4
commit 161f96bc77
19 changed files with 355 additions and 320 deletions

View File

@@ -30,9 +30,11 @@ import android.os.UserHandle;
import android.text.TextUtils;
import com.android.launcher3.AppInfo;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.LauncherAppsCompat;
import java.net.URISyntaxException;
import java.util.List;
/**
@@ -149,4 +151,20 @@ public class PackageManagerHelper {
.appendQueryParameter("id", packageName)
.build());
}
/**
* Creates a new market search intent.
*/
public static Intent getMarketSearchIntent(Context context, String query) {
try {
Intent intent = Intent.parseUri(context.getString(R.string.market_search_intent), 0);
if (!TextUtils.isEmpty(query)) {
intent.setData(
intent.getData().buildUpon().appendQueryParameter("q", query).build());
}
return intent;
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
}