File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
pythonforandroid/bootstraps/webview/build/src/main/java/org/kivy/android Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 3434
3535import android .webkit .WebViewClient ;
3636import android .webkit .WebView ;
37+ import android .webkit .CookieManager ;
3738import android .net .Uri ;
3839
3940import org .renpy .android .ResourceManager ;
@@ -165,16 +166,21 @@ public void onClick(DialogInterface dialog,int id) {
165166 mWebView .setWebViewClient (new WebViewClient () {
166167 @ Override
167168 public boolean shouldOverrideUrlLoading (WebView view , String url ) {
169+ Uri u = Uri .parse (url );
168170 if (mOpenExternalLinksInBrowser ) {
169- if (!(url . startsWith ( "file: " ) || url . startsWith ( "http:// 127.0.0.1: " ))) {
170- Intent i = new Intent (Intent .ACTION_VIEW , Uri . parse ( url ) );
171+ if (!(u . getScheme (). equals ( "file" ) || u . getHost (). equals ( " 127.0.0.1" ))) {
172+ Intent i = new Intent (Intent .ACTION_VIEW , u );
171173 startActivity (i );
172174 return true ;
173175 }
174176 }
175- view .loadUrl (url );
176177 return false ;
177178 }
179+
180+ @ Override
181+ public void onPageFinished (WebView view , String url ) {
182+ CookieManager .getInstance ().flush ();
183+ }
178184 });
179185 mLayout = new AbsoluteLayout (PythonActivity .mActivity );
180186 mLayout .addView (mWebView );
You can’t perform that action at this time.
0 commit comments