1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 04:12:08 +01:00

Handle links from browseable intent filter #38

This commit is contained in:
Gregor Santner 2016-07-30 16:48:43 +02:00
parent 389bb1b4e5
commit 05aa6231c7

View file

@ -279,7 +279,8 @@ public class MainActivity extends AppCompatActivity
//Set proxy
if (appSettings.isProxyEnabled()) {
if(!setProxy()) Toast.makeText(this, R.string.toast_set_proxy_failed, Toast.LENGTH_LONG).show();
if (!setProxy())
Toast.makeText(this, R.string.toast_set_proxy_failed, Toast.LENGTH_LONG).show();
}
/*
@ -431,16 +432,30 @@ public class MainActivity extends AppCompatActivity
}
private void handleIntent(Intent intent) {
if (intent == null) {
return;
}
String action = intent.getAction();
String loadUrl = null;
if (ACTION_OPEN_URL.equals(action)) {
String url = intent.getStringExtra(URL_MESSAGE);
webView.loadUrl(url);
loadUrl = intent.getStringExtra(URL_MESSAGE);
} else if (Intent.ACTION_VIEW.equals(action) && intent.getDataString() != null) {
loadUrl = intent.getDataString();
} else if (ACTION_CHANGE_ACCOUNT.equals(action)) {
app.resetPodData(webView);
Helpers.animateToActivity(MainActivity.this, PodSelectionActivity.class, true);
} else if (ACTION_CLEAR_CACHE.equals(action)) {
webView.clearCache(true);
}
if (loadUrl != null) {
webView.stopLoading();
navDrawer.closeDrawers();
webView.loadUrl(loadUrl);
}
}
@Override
@ -1001,6 +1016,7 @@ public class MainActivity extends AppCompatActivity
/**
* Set proxy according to arguments. host must not be "" or null, port must be positive.
* Return true on success and update appSettings' proxy related values.
*
* @param host proxy host (eg. localhost or 127.0.0.1)
* @param port proxy port (eg. 8118)
* @return success