From 6aa2d6a2c43b6e1431d6821b517d8e65ce16408c Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Thu, 11 Sep 2014 16:26:15 +0200 Subject: [PATCH] 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. --- .../org/transdroid/core/gui/search/SearchActivity.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/org/transdroid/core/gui/search/SearchActivity.java b/core/src/org/transdroid/core/gui/search/SearchActivity.java index b3ad5d2d..1ffb3ea7 100644 --- a/core/src/org/transdroid/core/gui/search/SearchActivity.java +++ b/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) { - lastUsedQuery = parseQuery(intent); + lastUsedQuery = parseQuery(intent); + // Is this actually a full HTTP URL? Then redirect this request to add the URL directly if (lastUsedQuery != null && (lastUsedQuery.startsWith("http") || lastUsedQuery.startsWith("https") || 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(); return; }