extended JSInterface to finish app via js (see #312)
This commit is contained in:
@ -64,6 +64,13 @@ public class IITC_JSInterface {
|
|||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// exit IITC Mobile
|
||||||
|
@JavascriptInterface
|
||||||
|
public void exitIITC() {
|
||||||
|
Log.d("iitcm","no back stack...finishing iitc");
|
||||||
|
((IITC_Mobile) context).finish();
|
||||||
|
}
|
||||||
|
|
||||||
// get layers and list them in a dialog
|
// get layers and list them in a dialog
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void setLayers(String base_layer, String overlay_layer) {
|
public void setLayers(String base_layer, String overlay_layer) {
|
||||||
|
@ -17,7 +17,6 @@ import android.net.ConnectivityManager;
|
|||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -34,7 +33,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
private static final int REQUEST_LOGIN = 1;
|
private static final int REQUEST_LOGIN = 1;
|
||||||
|
|
||||||
private IITC_WebView iitc_view;
|
private IITC_WebView iitc_view;
|
||||||
private boolean back_button_pressed = false;
|
|
||||||
private OnSharedPreferenceChangeListener listener;
|
private OnSharedPreferenceChangeListener listener;
|
||||||
private String intel_url = "https://www.ingress.com/intel";
|
private String intel_url = "https://www.ingress.com/intel";
|
||||||
private boolean user_loc = false;
|
private boolean user_loc = false;
|
||||||
@ -236,22 +234,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
this.toggleFullscreen();
|
this.toggleFullscreen();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.back_button_pressed) {
|
|
||||||
super.onBackPressed();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
iitc_view.loadUrl("javascript: window.goBack();");
|
iitc_view.loadUrl("javascript: window.goBack();");
|
||||||
this.back_button_pressed = true;
|
|
||||||
Toast.makeText(this, "Press twice to exit", Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
// reset back button after 0.5 seconds
|
|
||||||
new Handler().postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
back_button_pressed = false;
|
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user