notify android when select spinner is opened/closed (fix for #255)
This commit is contained in:
@ -5,6 +5,7 @@ import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.widget.Toast;
|
||||
|
||||
@ -28,6 +29,14 @@ public class IITC_JSInterface {
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
// disable javascript injection while spinner is enabled
|
||||
// prevent the spinner from closing automatically
|
||||
@JavascriptInterface
|
||||
public void spinnerEnabled(boolean en) {
|
||||
Log.d("iitcm", "disableJS? " + en);
|
||||
((IITC_Mobile) context).getWebView().disableJS(en);
|
||||
}
|
||||
|
||||
// copy link to specific portal to android clipboard
|
||||
@JavascriptInterface
|
||||
public void copy(String s) {
|
||||
|
@ -356,4 +356,8 @@ public class IITC_Mobile extends Activity {
|
||||
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||
this.getWindow().setAttributes(attrs);
|
||||
}
|
||||
|
||||
public IITC_WebView getWebView() {
|
||||
return this.iitc_view;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public class IITC_WebView extends WebView {
|
||||
private WebSettings settings;
|
||||
private IITC_WebViewClient webclient;
|
||||
private IITC_JSInterface js_interface;
|
||||
private boolean disableJS = false;
|
||||
|
||||
// init web view
|
||||
private void iitc_init(Context c) {
|
||||
@ -85,6 +86,11 @@ public class IITC_WebView extends WebView {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// do nothing if script is enabled;
|
||||
if (this.disableJS == true) {
|
||||
Log.d("iitcm", "javascript injection disabled...return");
|
||||
return;
|
||||
}
|
||||
if (!url.startsWith("javascript:")) {
|
||||
// force https if enabled in settings
|
||||
SharedPreferences sharedPref = PreferenceManager
|
||||
@ -123,4 +129,8 @@ public class IITC_WebView extends WebView {
|
||||
return wifi.getState() == NetworkInfo.State.CONNECTED;
|
||||
}
|
||||
|
||||
public void disableJS(boolean val) {
|
||||
this.disableJS = val;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user