This commit is contained in:
Jon Atkins 2013-04-30 02:17:41 +01:00
commit 5a5e6b9850
15 changed files with 31 additions and 7 deletions

1
mobile/.gitignore vendored
View File

@ -7,4 +7,5 @@ libs/
proguard-project.txt proguard-project.txt
local.properties local.properties
assets/iitc.js assets/iitc.js
assets/user-location.user.js
assets/plugins/ assets/plugins/

View File

@ -14,7 +14,7 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/iitc_icon" android:icon="@drawable/ic_iitcm"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" > android:theme="@style/AppTheme" >
<activity <activity

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -18,7 +18,7 @@
<string name="pref_about_msg"> <string name="pref_about_msg">
<![CDATA[<big><b>Ingress Intel Total Conversion Mobile</b></big><br><br> <![CDATA[<big><b>Ingress Intel Total Conversion Mobile</b></big><br><br>
<b>by <a href="https://github.com/leCradle">cradle</a></b><br><br> <b>by <a href="https://github.com/leCradle">cradle</a></b><br><br>
<b>Icon by <a href="https://twitter.com/machtwerk">machtwerk</a></b><br><br> <b>Icon by <a href="http://www.ludolab.net">Giuseppe Lucido</a></b><br><br>
IITC Mobile is an optimized mobile browser for the IITC Mobile is an optimized mobile browser for the
Ingress Intel Total Conversion (IITC) userscript by <a href="https://github.com/breunigs"><b>breunigs</b></a>. Ingress Intel Total Conversion (IITC) userscript by <a href="https://github.com/breunigs"><b>breunigs</b></a>.
After Niantic asked the main developer to shut down his github project, development After Niantic asked the main developer to shut down his github project, development

View File

@ -23,6 +23,7 @@ import android.content.res.Configuration;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.Toast; import android.widget.Toast;
public class IITC_Mobile extends Activity { public class IITC_Mobile extends Activity {
@ -35,6 +36,7 @@ public class IITC_Mobile extends Activity {
private boolean user_loc = false; private boolean user_loc = false;
private LocationManager loc_mngr = null; private LocationManager loc_mngr = null;
private LocationListener loc_listener = null; private LocationListener loc_listener = null;
private boolean keyboad_open = false;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -59,6 +61,21 @@ public class IITC_Mobile extends Activity {
}; };
sharedPref.registerOnSharedPreferenceChangeListener(listener); 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 // Acquire a reference to the system Location Manager
loc_mngr = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); 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 // update the user location marker on the map
public void drawMarker(Location loc) { public void drawMarker(Location loc) {
Log.d("iitcm", "update location..." + loc.toString());
// throw away all positions with accuracy > 100 meters // throw away all positions with accuracy > 100 meters
// should avoid gps glitches // should avoid gps glitches
if (loc.getAccuracy() < 100) { if (loc.getAccuracy() < 100) {
iitc_view.loadUrl("javascript: " + if (keyboad_open == false) {
"window.plugin.userLocation.updateLocation( " + iitc_view.loadUrl("javascript: " +
loc.getLatitude() + ", " + loc.getLongitude() + ");"); "window.plugin.userLocation.updateLocation( " +
loc.getLatitude() + ", " + loc.getLongitude() + ");");
}
} }
} }
} }

View File

@ -34,9 +34,14 @@ window.plugin.userLocation.setup = function() {
iconRetinaUrl: iconRetImage 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; plugin.userLocation.marker = marker;
marker.addTo(window.map); marker.addTo(window.map);
// jQueryUI doesnt automatically notice the new markers
window.setupTooltips($(marker._icon));
}; };
window.plugin.userLocation.updateLocation = function(lat, lng) { window.plugin.userLocation.updateLocation = function(lat, lng) {