diff options
author | Andrew Dolgov <[email protected]> | 2016-02-05 19:18:32 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2016-02-05 19:18:32 +0300 |
commit | 48d2b51a1a3d04e2d5a464476e34caed7e066fed (patch) | |
tree | 947139eb80c2d05f70ddd276f85e1e33a8f2cfff /org.fox.ttrss/src | |
parent | 895e87c2a3547604763e069d66bb2989c16755f5 (diff) |
openUri: handle scheme-less urls
Diffstat (limited to 'org.fox.ttrss/src')
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java index 65c97d10..70f1c251 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java @@ -319,10 +319,20 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc } // uses chrome custom tabs when available - public void openUri(final Uri uri) { + public void openUri(Uri uri) { boolean enableCustomTabs = m_prefs.getBoolean("enable_custom_tabs", true); final boolean askEveryTime = m_prefs.getBoolean("custom_tabs_ask_always", true); + if (uri.getScheme() == null) { + try { + uri = Uri.parse("https:" + uri.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + final Uri finalUri = uri; + if (enableCustomTabs && m_customTabClient != null) { if (askEveryTime) { @@ -345,7 +355,7 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc editor.apply(); } - openUriWithCustomTab(uri); + openUriWithCustomTab(finalUri); } }) @@ -361,7 +371,7 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc editor.apply(); } - Intent intent = new Intent(Intent.ACTION_VIEW, uri); + Intent intent = new Intent(Intent.ACTION_VIEW, finalUri); try { startActivity(intent); |