diff --git a/mobile/.gitignore b/mobile/.gitignore index 42222e62..c104ea4e 100644 --- a/mobile/.gitignore +++ b/mobile/.gitignore @@ -7,4 +7,5 @@ libs/ proguard-project.txt local.properties assets/iitc.js +assets/user-location.user.js assets/plugins/ diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml index df3e6002..a9d1bb84 100644 --- a/mobile/AndroidManifest.xml +++ b/mobile/AndroidManifest.xml @@ -14,7 +14,7 @@ Ingress Intel Total Conversion Mobile

by cradle

- Icon by machtwerk

+ Icon by Giuseppe Lucido

IITC Mobile is an optimized mobile browser for the Ingress Intel Total Conversion (IITC) userscript by breunigs. After Niantic asked the main developer to shut down his github project, development diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 46c45b1c..e69b7bc9 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -23,6 +23,7 @@ import android.content.res.Configuration; import android.util.Log; import android.view.Menu; import android.view.MenuItem; +import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.widget.Toast; public class IITC_Mobile extends Activity { @@ -35,6 +36,7 @@ public class IITC_Mobile extends Activity { private boolean user_loc = false; private LocationManager loc_mngr = null; private LocationListener loc_listener = null; + private boolean keyboad_open = false; @Override protected void onCreate(Bundle savedInstanceState) { @@ -59,6 +61,21 @@ public class IITC_Mobile extends Activity { }; sharedPref.registerOnSharedPreferenceChangeListener(listener); + // we need this one to prevent location updates to javascript when keyboard is open + // it closes on updates + iitc_view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + if ((iitc_view.getRootView().getHeight() - iitc_view.getHeight()) > + iitc_view.getRootView().getHeight()/3) { + Log.d("iitcm", "Open Keyboard..."); + IITC_Mobile.this.keyboad_open = true; + } else { + Log.d("iitcm", "Close Keyboard..."); + IITC_Mobile.this.keyboad_open = false; + } + } + }); // Acquire a reference to the system Location Manager loc_mngr = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); @@ -251,13 +268,14 @@ public class IITC_Mobile extends Activity { // update the user location marker on the map public void drawMarker(Location loc) { - Log.d("iitcm", "update location..." + loc.toString()); // throw away all positions with accuracy > 100 meters // should avoid gps glitches if (loc.getAccuracy() < 100) { - iitc_view.loadUrl("javascript: " + - "window.plugin.userLocation.updateLocation( " + - loc.getLatitude() + ", " + loc.getLongitude() + ");"); + if (keyboad_open == false) { + iitc_view.loadUrl("javascript: " + + "window.plugin.userLocation.updateLocation( " + + loc.getLatitude() + ", " + loc.getLongitude() + ");"); + } } } } \ No newline at end of file diff --git a/mobile/user-location.user.js b/mobile/user-location.user.js index fe118b7f..9658212e 100644 --- a/mobile/user-location.user.js +++ b/mobile/user-location.user.js @@ -34,9 +34,14 @@ window.plugin.userLocation.setup = function() { iconRetinaUrl: iconRetImage }}); - var marker = L.marker(window.map.getCenter(), {icon: new plugin.userLocation.icon()}); + var marker = L.marker(window.map.getCenter(), { + title: "User Location", + icon: new plugin.userLocation.icon() + }); plugin.userLocation.marker = marker; marker.addTo(window.map); + // jQueryUI doesn’t automatically notice the new markers + window.setupTooltips($(marker._icon)); }; window.plugin.userLocation.updateLocation = function(lat, lng) {