Add support for play.google.com search urls
This commit is contained in:
parent
53aa7ec849
commit
8239f12ff7
@ -366,6 +366,18 @@
|
|||||||
<data android:scheme="market" android:host="search" />
|
<data android:scheme="market" android:host="search" />
|
||||||
</intent-filter>
|
</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
|
<meta-data
|
||||||
android:name="android.app.searchable"
|
android:name="android.app.searchable"
|
||||||
android:resource="@xml/searchable" />
|
android:resource="@xml/searchable" />
|
||||||
|
@ -36,16 +36,25 @@ public class SearchResultsFragment extends ListFragment implements LoaderManager
|
|||||||
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||||
query = intent.getStringExtra(SearchManager.QUERY);
|
query = intent.getStringExtra(SearchManager.QUERY);
|
||||||
} else {
|
} else {
|
||||||
Uri data = intent.getData();
|
final Uri data = intent.getData();
|
||||||
if (data != null && data.isHierarchical()) {
|
if (data == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (data.isHierarchical()) {
|
||||||
|
// market://search?q=foo
|
||||||
|
// https://play.google.com/store/search?q=foo
|
||||||
query = data.getQueryParameter("q");
|
query = data.getQueryParameter("q");
|
||||||
if (query != null && query.startsWith("pname:"))
|
if (query != null && query.startsWith("pname:"))
|
||||||
query = query.substring(6);
|
query = query.substring(6);
|
||||||
} else if (data!= null) {
|
} else {
|
||||||
|
// fdroid.search:foo
|
||||||
query = data.getEncodedSchemeSpecificPart();
|
query = data.getEncodedSchemeSpecificPart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return query == null ? "" : query;
|
if (query == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user