Browse Source

Fixed support for catching SEND intents in the search acitivity to handle magnet, http and https links directly and add them via Transdroid. Fixes #129.

pull/173/head
Eric Kok 10 years ago
parent
commit
6aa2d6a2c4
  1. 6
      core/src/org/transdroid/core/gui/search/SearchActivity.java

6
core/src/org/transdroid/core/gui/search/SearchActivity.java

@ -184,13 +184,17 @@ public class SearchActivity extends Activity implements OnNavigationListener {
} }
private void handleIntent(Intent intent) { private void handleIntent(Intent intent) {
lastUsedQuery = parseQuery(intent); lastUsedQuery = parseQuery(intent);
// Is this actually a full HTTP URL? Then redirect this request to add the URL directly // Is this actually a full HTTP URL? Then redirect this request to add the URL directly
if (lastUsedQuery != null if (lastUsedQuery != null
&& (lastUsedQuery.startsWith("http") || lastUsedQuery.startsWith("https") && (lastUsedQuery.startsWith("http") || lastUsedQuery.startsWith("https")
|| lastUsedQuery.startsWith("magnet") || lastUsedQuery.startsWith("file"))) { || lastUsedQuery.startsWith("magnet") || lastUsedQuery.startsWith("file"))) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(lastUsedQuery))); // Don't broadcast this intent; we can safely assume this is intended for Transdroid only
Intent i = TorrentsActivity_.intent(this).get();
i.setData(Uri.parse(lastUsedQuery));
startActivity(i);
finish(); finish();
return; return;
} }

Loading…
Cancel
Save