mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-24 01:25:50 +01:00
Intercept clay pebblejs://close url
This commit is contained in:
parent
2da50e27c2
commit
d378b4eb7b
@ -9,6 +9,7 @@ import android.view.MenuItem;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.json.JSONException;
|
||||
@ -61,6 +62,7 @@ public class ExternalPebbleJSActivity extends Activity {
|
||||
|
||||
WebView myWebView = (WebView) findViewById(R.id.configureWebview);
|
||||
myWebView.clearCache(true);
|
||||
myWebView.setWebViewClient(new GBWebClient());
|
||||
WebSettings webSettings = myWebView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
//needed to access the DOM
|
||||
@ -87,6 +89,16 @@ public class ExternalPebbleJSActivity extends Activity {
|
||||
return null;
|
||||
}
|
||||
|
||||
private class GBWebClient extends WebViewClient {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
url = url.replaceFirst("^pebblejs://close#", "file:///android_asset/app_config/configure.html?config=true&json=");
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private class JSInterface {
|
||||
|
||||
public JSInterface() {
|
||||
|
Loading…
Reference in New Issue
Block a user