Add support for play.google.com search urls

This commit is contained in:
Daniel Martí 2015-03-30 18:36:32 +02:00
parent 53aa7ec849
commit 8239f12ff7
2 changed files with 25 additions and 4 deletions

View File

@ -366,6 +366,18 @@
<data android:scheme="market" android:host="search" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="play.google.com" /> <!-- they don't do www. -->
<data android:path="/store/search" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />

View File

@ -36,16 +36,25 @@ public class SearchResultsFragment extends ListFragment implements LoaderManager
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
query = intent.getStringExtra(SearchManager.QUERY);
} else {
Uri data = intent.getData();
if (data != null && data.isHierarchical()) {
final Uri data = intent.getData();
if (data == null) {
return "";
}
if (data.isHierarchical()) {
// market://search?q=foo
// https://play.google.com/store/search?q=foo
query = data.getQueryParameter("q");
if (query != null && query.startsWith("pname:"))
query = query.substring(6);
} else if (data!= null) {
} else {
// fdroid.search:foo
query = data.getEncodedSchemeSpecificPart();
}
}
return query == null ? "" : query;
if (query == null) {
return "";
}
return query;
}
@Override