Merge git://github.com/jonatkins/ingress-intel-total-conversion into dialog
22
.gitattributes
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Custom for Visual Studio
|
||||||
|
*.cs diff=csharp
|
||||||
|
*.sln merge=union
|
||||||
|
*.csproj merge=union
|
||||||
|
*.vbproj merge=union
|
||||||
|
*.fsproj merge=union
|
||||||
|
*.dbproj merge=union
|
||||||
|
|
||||||
|
# Standard to msysgit
|
||||||
|
*.doc diff=astextplain
|
||||||
|
*.DOC diff=astextplain
|
||||||
|
*.docx diff=astextplain
|
||||||
|
*.DOCX diff=astextplain
|
||||||
|
*.dot diff=astextplain
|
||||||
|
*.DOT diff=astextplain
|
||||||
|
*.pdf diff=astextplain
|
||||||
|
*.PDF diff=astextplain
|
||||||
|
*.rtf diff=astextplain
|
||||||
|
*.RTF diff=astextplain
|
4
build.py
@ -220,6 +220,10 @@ if buildMobile:
|
|||||||
# copy the user location script into the mobile folder.
|
# copy the user location script into the mobile folder.
|
||||||
shutil.copy(os.path.join(outDir,"user-location.user.js"), "mobile/assets/user-location.user.js")
|
shutil.copy(os.path.join(outDir,"user-location.user.js"), "mobile/assets/user-location.user.js")
|
||||||
# also copy plugins
|
# also copy plugins
|
||||||
|
try:
|
||||||
|
os.makedirs("mobile/assets/plugins")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
shutil.rmtree("mobile/assets/plugins")
|
shutil.rmtree("mobile/assets/plugins")
|
||||||
shutil.copytree(os.path.join(outDir,"plugins"), "mobile/assets/plugins", ignore=shutil.ignore_patterns('*.meta.js', 'force-https*'))
|
shutil.copytree(os.path.join(outDir,"plugins"), "mobile/assets/plugins", ignore=shutil.ignore_patterns('*.meta.js', 'force-https*'))
|
||||||
|
|
||||||
|
14
code/boot.js
@ -3,6 +3,8 @@
|
|||||||
// created a basic framework. All of these functions should only ever
|
// created a basic framework. All of these functions should only ever
|
||||||
// be run once.
|
// be run once.
|
||||||
|
|
||||||
|
// Used to disable on multitouch devices
|
||||||
|
window.showZoom = true;
|
||||||
|
|
||||||
window.setupBackButton = function() {
|
window.setupBackButton = function() {
|
||||||
var c = window.isSmartphone()
|
var c = window.isSmartphone()
|
||||||
@ -156,7 +158,7 @@ window.setupMap = function() {
|
|||||||
|
|
||||||
|
|
||||||
window.map = new L.Map('map', $.extend(getPosition(),
|
window.map = new L.Map('map', $.extend(getPosition(),
|
||||||
{zoomControl: true}
|
{zoomControl: window.showZoom}
|
||||||
));
|
));
|
||||||
|
|
||||||
var addLayers = {};
|
var addLayers = {};
|
||||||
@ -169,20 +171,20 @@ window.setupMap = function() {
|
|||||||
var t = (i === 0 ? 'Unclaimed' : 'Level ' + i) + ' Portals';
|
var t = (i === 0 ? 'Unclaimed' : 'Level ' + i) + ' Portals';
|
||||||
addLayers[t] = portalsLayers[i];
|
addLayers[t] = portalsLayers[i];
|
||||||
// Store it in hiddenLayer to remove later
|
// Store it in hiddenLayer to remove later
|
||||||
if(!isLayerGroupDisplayed(t)) hiddenLayer.push(portalsLayers[i]);
|
if(!isLayerGroupDisplayed(t, true)) hiddenLayer.push(portalsLayers[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsLayer = L.layerGroup([]);
|
fieldsLayer = L.layerGroup([]);
|
||||||
map.addLayer(fieldsLayer, true);
|
map.addLayer(fieldsLayer, true);
|
||||||
addLayers['Fields'] = fieldsLayer;
|
addLayers['Fields'] = fieldsLayer;
|
||||||
// Store it in hiddenLayer to remove later
|
// Store it in hiddenLayer to remove later
|
||||||
if(!isLayerGroupDisplayed('Fields')) hiddenLayer.push(fieldsLayer);
|
if(!isLayerGroupDisplayed('Fields', true)) hiddenLayer.push(fieldsLayer);
|
||||||
|
|
||||||
linksLayer = L.layerGroup([]);
|
linksLayer = L.layerGroup([]);
|
||||||
map.addLayer(linksLayer, true);
|
map.addLayer(linksLayer, true);
|
||||||
addLayers['Links'] = linksLayer;
|
addLayers['Links'] = linksLayer;
|
||||||
// Store it in hiddenLayer to remove later
|
// Store it in hiddenLayer to remove later
|
||||||
if(!isLayerGroupDisplayed('Links')) hiddenLayer.push(linksLayer);
|
if(!isLayerGroupDisplayed('Links', true)) hiddenLayer.push(linksLayer);
|
||||||
|
|
||||||
window.layerChooser = new L.Control.Layers({
|
window.layerChooser = new L.Control.Layers({
|
||||||
'MapQuest OSM': views[0],
|
'MapQuest OSM': views[0],
|
||||||
@ -236,8 +238,8 @@ window.setupMap = function() {
|
|||||||
map.on('moveend zoomend', function() { window.mapRunsUserAction = false });
|
map.on('moveend zoomend', function() { window.mapRunsUserAction = false });
|
||||||
|
|
||||||
// update map hooks
|
// update map hooks
|
||||||
map.on('movestart zoomstart', window.requests.abort);
|
map.on('movestart zoomstart', function() { window.requests.abort(); window.startRefreshTimeout(-1); });
|
||||||
map.on('moveend zoomend', function() { console.log('map moveend'); window.startRefreshTimeout(ON_MOVE_REFRESH*1000) });
|
map.on('moveend zoomend', function() { window.startRefreshTimeout(ON_MOVE_REFRESH*1000) });
|
||||||
|
|
||||||
window.addResumeFunction(window.requestData);
|
window.addResumeFunction(window.requestData);
|
||||||
window.requests.addRefreshFunction(window.requestData);
|
window.requests.addRefreshFunction(window.requestData);
|
||||||
|
23
code/chat.js
@ -473,16 +473,14 @@ window.chat.needMoreMessages = function() {
|
|||||||
chat.requestPublic(true);
|
chat.requestPublic(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.chat.chooseAnchor = function(t) {
|
||||||
window.chat.chooser = function(event) {
|
|
||||||
var t = $(event.target);
|
|
||||||
var tt = t.text();
|
var tt = t.text();
|
||||||
|
|
||||||
var mark = $('#chatinput mark');
|
var mark = $('#chatinput mark');
|
||||||
var input = $('#chatinput input');
|
var input = $('#chatinput input');
|
||||||
|
|
||||||
$('#chatcontrols .active').removeClass('active');
|
$('#chatcontrols .active').removeClass('active');
|
||||||
t.addClass('active');
|
$("#chatcontrols a:contains('" + tt + "')").addClass('active');
|
||||||
|
|
||||||
$('#chat > div').hide();
|
$('#chat > div').hide();
|
||||||
|
|
||||||
@ -520,10 +518,23 @@ window.chat.chooser = function(event) {
|
|||||||
elm.scrollTop(elm.data('needsScrollTop'));
|
elm.scrollTop(elm.data('needsScrollTop'));
|
||||||
elm.data('needsScrollTop', null);
|
elm.data('needsScrollTop', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
chat.needMoreMessages();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.chat.show = function(name) {
|
||||||
|
window.isSmartphone
|
||||||
|
? $('#updatestatus').hide()
|
||||||
|
: $('#updatestatus').show();
|
||||||
|
$('#chat, #chatinput').show();
|
||||||
|
$('#map').css('visibility', 'hidden');
|
||||||
|
|
||||||
|
var t = $('<a>'+name+'</a>');
|
||||||
|
window.chat.chooseAnchor(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.chat.chooser = function(event) {
|
||||||
|
var t = $(event.target);
|
||||||
|
window.chat.chooseAnchor(t);
|
||||||
|
}
|
||||||
|
|
||||||
// contains the logic to keep the correct scroll position.
|
// contains the logic to keep the correct scroll position.
|
||||||
window.chat.keepScrollPosition = function(box, scrollBefore, isOldMsgs) {
|
window.chat.keepScrollPosition = function(box, scrollBefore, isOldMsgs) {
|
||||||
|
@ -48,16 +48,23 @@ window.debug.console = function() {
|
|||||||
$('#debugconsole').text();
|
$('#debugconsole').text();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.debug.console.create = function() {
|
window.debug.console.show = function() {
|
||||||
if($('#debugconsole').length) return;
|
$('#scrollwrapper, #updatestatus').hide();
|
||||||
$('#chatcontrols').append('<a>debug</a>');
|
// not displaying the map causes bugs in Leaflet
|
||||||
$('#chatcontrols a:last').click(function() {
|
$('#map').css('visibility', 'hidden');
|
||||||
|
$('#chat, #chatinput').show();
|
||||||
|
window.debug.console.create();
|
||||||
$('#chatinput mark').css('cssText', 'color: #bbb !important').text('debug:');
|
$('#chatinput mark').css('cssText', 'color: #bbb !important').text('debug:');
|
||||||
$('#chat > div').hide();
|
$('#chat > div').hide();
|
||||||
$('#debugconsole').show();
|
$('#debugconsole').show();
|
||||||
$('#chatcontrols .active').removeClass('active');
|
$('#chatcontrols .active').removeClass('active');
|
||||||
$(this).addClass('active');
|
$("#chatcontrols a:contains('debug')").addClass('active');
|
||||||
});
|
}
|
||||||
|
|
||||||
|
window.debug.console.create = function() {
|
||||||
|
if($('#debugconsole').length) return;
|
||||||
|
$('#chatcontrols').append('<a>debug</a>');
|
||||||
|
$('#chatcontrols a:last').click(window.debug.console.show);
|
||||||
$('#chat').append('<div style="display: none" id="debugconsole"><table></table></div>');
|
$('#chat').append('<div style="display: none" id="debugconsole"><table></table></div>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,9 +95,16 @@ window.setPortalIndicators = function(d) {
|
|||||||
).addTo(map);
|
).addTo(map);
|
||||||
else
|
else
|
||||||
portalAccessIndicator.setLatLng(coord);
|
portalAccessIndicator.setLatLng(coord);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.clearPortalIndicators = function() {
|
||||||
|
if(portalRangeIndicator) map.removeLayer(portalRangeIndicator);
|
||||||
|
portalRangeIndicator = null;
|
||||||
|
if(portalAccessIndicator) map.removeLayer(portalAccessIndicator);
|
||||||
|
portalAccessIndicator = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// highlights portal with given GUID. Automatically clears highlights
|
// highlights portal with given GUID. Automatically clears highlights
|
||||||
// on old selection. Returns false if the selected portal changed.
|
// on old selection. Returns false if the selected portal changed.
|
||||||
// Returns true if it’s still the same portal that just needs an
|
// Returns true if it’s still the same portal that just needs an
|
||||||
@ -123,4 +130,5 @@ window.unselectOldPortal = function() {
|
|||||||
if(oldPortal) portalResetColor(oldPortal);
|
if(oldPortal) portalResetColor(oldPortal);
|
||||||
selectedPortal = null;
|
selectedPortal = null;
|
||||||
$('#portaldetails').html('');
|
$('#portaldetails').html('');
|
||||||
|
clearPortalIndicators();
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ window.requests.abort = function() {
|
|||||||
// gives user feedback about pending operations. Draws current status
|
// gives user feedback about pending operations. Draws current status
|
||||||
// to website. Updates info in layer chooser.
|
// to website. Updates info in layer chooser.
|
||||||
window.renderUpdateStatus = function() {
|
window.renderUpdateStatus = function() {
|
||||||
|
|
||||||
var t = '<b>map status:</b> ';
|
var t = '<b>map status:</b> ';
|
||||||
if(mapRunsUserAction)
|
if(mapRunsUserAction)
|
||||||
t += 'paused during interaction';
|
t += 'paused during interaction';
|
||||||
@ -48,7 +49,7 @@ window.renderUpdateStatus = function() {
|
|||||||
else if(window.requests._quickRefreshPending)
|
else if(window.requests._quickRefreshPending)
|
||||||
t += 'refreshing...';
|
t += 'refreshing...';
|
||||||
else
|
else
|
||||||
t += 'Up to date.';
|
t += 'Up to date. <a style="cursor: pointer" onclick="startRefreshTimeout(10)" title="Refresh">⟳</a>';
|
||||||
|
|
||||||
if(renderLimitReached())
|
if(renderLimitReached())
|
||||||
t += ' <span style="color:#f66" class="help" title="Can only render so much before it gets unbearably slow. Not all entities are shown. Zoom in or increase the limit (search for MAX_DRAWN_*).">RENDER LIMIT</span> '
|
t += ' <span style="color:#f66" class="help" title="Can only render so much before it gets unbearably slow. Not all entities are shown. Zoom in or increase the limit (search for MAX_DRAWN_*).">RENDER LIMIT</span> '
|
||||||
@ -82,6 +83,8 @@ window.startRefreshTimeout = function(override) {
|
|||||||
// status bar
|
// status bar
|
||||||
window.renderUpdateStatus();
|
window.renderUpdateStatus();
|
||||||
if(refreshTimeout) clearTimeout(refreshTimeout);
|
if(refreshTimeout) clearTimeout(refreshTimeout);
|
||||||
|
if(override == -1) return; //don't set a new timeout
|
||||||
|
|
||||||
var t = 0;
|
var t = 0;
|
||||||
if(override) {
|
if(override) {
|
||||||
window.requests._quickRefreshPending = true;
|
window.requests._quickRefreshPending = true;
|
||||||
|
@ -34,20 +34,12 @@ window.runOnSmartphonesBeforeBoot = function() {
|
|||||||
+ '</style>');
|
+ '</style>');
|
||||||
}
|
}
|
||||||
|
|
||||||
// this also matches the expand button, but it is hidden via CSS
|
|
||||||
$('#chatcontrols a').click(function() {
|
|
||||||
$('#scrollwrapper, #updatestatus').hide();
|
|
||||||
// not displaying the map causes bugs in Leaflet
|
|
||||||
$('#map').css('visibility', 'hidden');
|
|
||||||
$('#chat, #chatinput').show();
|
|
||||||
});
|
|
||||||
|
|
||||||
window.smartphone.mapButton = $('<a>map</a>').click(function() {
|
window.smartphone.mapButton = $('<a>map</a>').click(function() {
|
||||||
$('#chat, #chatinput, #scrollwrapper').hide();
|
$('#chat, #chatinput, #scrollwrapper').hide();
|
||||||
$('#map').css('visibility', 'visible');
|
$('#map').css('visibility', 'visible');
|
||||||
$('#updatestatus').show();
|
$('#updatestatus').show();
|
||||||
$('.active').removeClass('active');
|
$('#chatcontrols a .active').removeClass('active');
|
||||||
$(this).addClass('active');
|
$("#chatcontrols a:contains('map')").addClass('active');
|
||||||
});
|
});
|
||||||
|
|
||||||
window.smartphone.sideButton = $('<a>info</a>').click(function() {
|
window.smartphone.sideButton = $('<a>info</a>').click(function() {
|
||||||
@ -55,7 +47,7 @@ window.runOnSmartphonesBeforeBoot = function() {
|
|||||||
$('#map').css('visibility', 'hidden');
|
$('#map').css('visibility', 'hidden');
|
||||||
$('#scrollwrapper').show();
|
$('#scrollwrapper').show();
|
||||||
$('.active').removeClass('active');
|
$('.active').removeClass('active');
|
||||||
$(this).addClass('active');
|
$("#chatcontrols a:contains('info')").addClass('active');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#chatcontrols').append(smartphone.mapButton).append(smartphone.sideButton);
|
$('#chatcontrols').append(smartphone.mapButton).append(smartphone.sideButton);
|
||||||
@ -80,7 +72,6 @@ window.runOnSmartphonesAfterBoot = function() {
|
|||||||
if(!isSmartphone()) return;
|
if(!isSmartphone()) return;
|
||||||
console.warn('running smartphone post boot stuff');
|
console.warn('running smartphone post boot stuff');
|
||||||
|
|
||||||
chat.toggle();
|
|
||||||
smartphone.mapButton.click();
|
smartphone.mapButton.click();
|
||||||
|
|
||||||
// disable img full view
|
// disable img full view
|
||||||
|
30
code/window_management.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// created to start cleaning up "window" interaction
|
||||||
|
//
|
||||||
|
window.show = function(id) {
|
||||||
|
switch(id) {
|
||||||
|
case 'full':
|
||||||
|
window.chat.show('full');
|
||||||
|
break;
|
||||||
|
case 'compact':
|
||||||
|
window.chat.show('compact');
|
||||||
|
break;
|
||||||
|
case 'public':
|
||||||
|
window.chat.show('public');
|
||||||
|
break;
|
||||||
|
case 'faction':
|
||||||
|
window.chat.show('faction');
|
||||||
|
break;
|
||||||
|
case 'debug':
|
||||||
|
window.debug.console.show();
|
||||||
|
break;
|
||||||
|
case 'map':
|
||||||
|
window.smartphone.mapButton.click();
|
||||||
|
break;
|
||||||
|
case 'info':
|
||||||
|
window.smartphone.sideButton.click();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
window.smartphone.mapButton.click();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.cradle.iitc_mobile"
|
package="com.cradle.iitc_mobile"
|
||||||
android:versionCode="17"
|
android:versionCode="18"
|
||||||
android:versionName="0.3.5" >
|
android:versionName="0.3.6" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="14"
|
android:minSdkVersion="14"
|
||||||
@ -16,7 +16,7 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_iitcm"
|
android:icon="@drawable/ic_iitcm"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme" android:uiOptions="splitActionBarWhenNarrow">
|
||||||
<activity
|
<activity
|
||||||
android:name="com.cradle.iitc_mobile.IITC_Mobile"
|
android:name="com.cradle.iitc_mobile.IITC_Mobile"
|
||||||
android:theme="@style/AppBaseTheme"
|
android:theme="@style/AppBaseTheme"
|
||||||
|
BIN
mobile/res/drawable-hdpi/action_about.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/res/drawable-hdpi/action_search.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
mobile/res/drawable-hdpi/action_settings.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
mobile/res/drawable-hdpi/alerts_and_states_warning.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/res/drawable-hdpi/av_full_screen.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
mobile/res/drawable-hdpi/content_remove.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mobile/res/drawable-hdpi/device_access_location_found.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.0 KiB |
BIN
mobile/res/drawable-hdpi/location_map.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
mobile/res/drawable-hdpi/navigation_refresh.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mobile/res/drawable-hdpi/social_group.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.7 KiB |
BIN
mobile/res/drawable-mdpi/action_about.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mobile/res/drawable-mdpi/action_search.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
mobile/res/drawable-mdpi/action_settings.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mobile/res/drawable-mdpi/alerts_and_states_warning.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mobile/res/drawable-mdpi/av_full_screen.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
mobile/res/drawable-mdpi/content_remove.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
mobile/res/drawable-mdpi/device_access_location_found.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB |
BIN
mobile/res/drawable-mdpi/location_map.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/res/drawable-mdpi/navigation_refresh.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
mobile/res/drawable-mdpi/social_group.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/res/drawable-xhdpi/action_about.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
mobile/res/drawable-xhdpi/action_search.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
mobile/res/drawable-xhdpi/action_settings.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/res/drawable-xhdpi/alerts_and_states_warning.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
mobile/res/drawable-xhdpi/av_full_screen.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
mobile/res/drawable-xhdpi/content_remove.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mobile/res/drawable-xhdpi/device_access_location_found.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.8 KiB |
BIN
mobile/res/drawable-xhdpi/location_map.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
mobile/res/drawable-xhdpi/navigation_refresh.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mobile/res/drawable-xhdpi/social_group.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
@ -1,30 +1,92 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
<item android:id="@+id/reload_button"
|
|
||||||
android:icon="@drawable/ic_menu_refresh"
|
|
||||||
android:orderInCategory="90"
|
|
||||||
android:showAsAction="ifRoom"
|
|
||||||
android:title="@string/reload"></item>
|
|
||||||
|
|
||||||
<item android:id="@+id/settings"
|
<item
|
||||||
android:orderInCategory="120"
|
android:id="@+id/menu_map"
|
||||||
|
android:icon="@drawable/location_map"
|
||||||
|
android:orderInCategory="20"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:title="@string/menu_map">
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_info"
|
||||||
|
android:icon="@drawable/action_about"
|
||||||
|
android:orderInCategory="30"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:title="@string/menu_info">
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_chat"
|
||||||
|
android:icon="@drawable/social_group"
|
||||||
|
android:orderInCategory="35"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:title="@string/menu_chat">
|
||||||
|
<menu>
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_full"
|
||||||
|
android:orderInCategory="40"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/action_settings"></item>
|
android:title="@string/menu_full">
|
||||||
|
</item>
|
||||||
<item android:id="@+id/cache_clear"
|
<item
|
||||||
android:orderInCategory="100"
|
android:id="@+id/menu_compact"
|
||||||
|
android:orderInCategory="50"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/cache_clear"></item>
|
android:title="@string/menu_compact">
|
||||||
|
</item>
|
||||||
<item android:id="@+id/toggle_fullscreen"
|
<item
|
||||||
android:orderInCategory="100"
|
android:id="@+id/menu_public"
|
||||||
android:showAsAction="ifRoom"
|
android:orderInCategory="60"
|
||||||
android:title="@string/toggle_fullscreen"
|
android:showAsAction="never"
|
||||||
android:icon="@android:drawable/ic_menu_zoom"></item>
|
android:title="@string/menu_public">
|
||||||
|
</item>
|
||||||
<item android:id="@+id/locate"
|
<item
|
||||||
android:icon="@android:drawable/ic_menu_mylocation"
|
android:id="@+id/menu_faction"
|
||||||
android:orderInCategory="80"
|
android:orderInCategory="70"
|
||||||
android:showAsAction="ifRoom"
|
android:showAsAction="never"
|
||||||
android:title="@string/locate"></item>
|
android:title="@string/menu_faction">
|
||||||
|
</item>
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/locate"
|
||||||
|
android:icon="@drawable/device_access_location_found"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:title="@string/locate">
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/reload_button"
|
||||||
|
android:icon="@drawable/navigation_refresh"
|
||||||
|
android:orderInCategory="110"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:title="@string/reload">
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/toggle_fullscreen"
|
||||||
|
android:icon="@drawable/av_full_screen"
|
||||||
|
android:orderInCategory="120"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:title="@string/toggle_fullscreen">
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_settings"
|
||||||
|
android:icon="@drawable/action_settings"
|
||||||
|
android:orderInCategory="130"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:title="@string/action_settings">
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/cache_clear"
|
||||||
|
android:icon="@drawable/content_remove"
|
||||||
|
android:orderInCategory="150"
|
||||||
|
android:showAsAction="never"
|
||||||
|
android:title="@string/cache_clear">
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_debug"
|
||||||
|
android:icon="@drawable/alerts_and_states_warning"
|
||||||
|
android:orderInCategory="190"
|
||||||
|
android:showAsAction="never"
|
||||||
|
android:title="@string/menu_debug">
|
||||||
|
</item>
|
||||||
</menu>
|
</menu>
|
@ -18,7 +18,7 @@
|
|||||||
<!-- Use CDATA to prevent android from parsing html tags....we are doing this with Html.fromHtml() -->
|
<!-- Use CDATA to prevent android from parsing html tags....we are doing this with Html.fromHtml() -->
|
||||||
<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> and contributors</b><br><br>
|
||||||
<b>Icon by <a href="http://www.ludolab.net">Giuseppe Lucido</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>.
|
||||||
@ -34,10 +34,12 @@
|
|||||||
<string name="pref_misc_cat">Misc</string>
|
<string name="pref_misc_cat">Misc</string>
|
||||||
<string name="pref_plugins">Plugins</string>
|
<string name="pref_plugins">Plugins</string>
|
||||||
<string name="pref_plugins_title">Available plugins</string>
|
<string name="pref_plugins_title">Available plugins</string>
|
||||||
<string name="pref_force_desktop">Force desktop mode</string>
|
|
||||||
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
|
||||||
<string name="pref_user_loc">Display user location</string>
|
<string name="pref_user_loc">Display user location</string>
|
||||||
<string name="pref_user_loc_sum">Show users position on map</string>
|
<string name="pref_user_loc_sum">Show users position on map</string>
|
||||||
|
<string name="pref_user_zoom">Show zoom control</string>
|
||||||
|
<string name="pref_user_zoom_sum">Shows +/- buttons even on multitouch capable devices.</string>
|
||||||
|
<string name="pref_fullscreen_actionbar">Hide Action Bar in fullscreen mode</string>
|
||||||
|
<string name="pref_fullscreen_actionbar_sum">Nice for screenshots. Note: IITCM cannot be controlled without Action Bar.</string>
|
||||||
<string name="pref_force_https">Force https</string>
|
<string name="pref_force_https">Force https</string>
|
||||||
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
||||||
<string name="pref_developer_options">Developer options</string>
|
<string name="pref_developer_options">Developer options</string>
|
||||||
@ -46,4 +48,12 @@
|
|||||||
Please copy all sources from $IITC_folder/build/mobile/ to /sdcard/IITC_Mobile/dev/.</string>
|
Please copy all sources from $IITC_folder/build/mobile/ to /sdcard/IITC_Mobile/dev/.</string>
|
||||||
<string name="pref_select_iitc">IITC source</string>
|
<string name="pref_select_iitc">IITC source</string>
|
||||||
|
|
||||||
|
<string name="menu_chat">Chat</string>
|
||||||
|
<string name="menu_map">Map</string>
|
||||||
|
<string name="menu_full">Full</string>
|
||||||
|
<string name="menu_compact">Compact</string>
|
||||||
|
<string name="menu_public">Public</string>
|
||||||
|
<string name="menu_faction">Faction</string>
|
||||||
|
<string name="menu_info">Info</string>
|
||||||
|
<string name="menu_debug">Debug</string>
|
||||||
</resources>
|
</resources>
|
@ -12,16 +12,21 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pref_about_cat"
|
android:key="pref_about_cat"
|
||||||
android:title="@string/pref_ui_cat">
|
android:title="@string/pref_ui_cat">
|
||||||
<CheckBoxPreference
|
|
||||||
android:key="pref_force_desktop"
|
|
||||||
android:title="@string/pref_force_desktop"
|
|
||||||
android:summary="@string/pref_force_desktop_sum"
|
|
||||||
android:defaultValue="false" />
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="pref_user_loc"
|
android:key="pref_user_loc"
|
||||||
android:title="@string/pref_user_loc"
|
android:title="@string/pref_user_loc"
|
||||||
android:summary="@string/pref_user_loc_sum"
|
android:summary="@string/pref_user_loc_sum"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_user_zoom"
|
||||||
|
android:title="@string/pref_user_zoom"
|
||||||
|
android:summary="@string/pref_user_zoom_sum"
|
||||||
|
android:defaultValue="false" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_fullscreen_actionbar"
|
||||||
|
android:title="@string/pref_fullscreen_actionbar"
|
||||||
|
android:summary="@string/pref_fullscreen_actionbar_sum"
|
||||||
|
android:defaultValue="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
@ -30,6 +30,7 @@ body {
|
|||||||
#chatcontrols {
|
#chatcontrols {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hide shrink button */
|
/* hide shrink button */
|
||||||
@ -52,7 +53,7 @@ body {
|
|||||||
#chat {
|
#chat {
|
||||||
left:0;
|
left:0;
|
||||||
right:0;
|
right:0;
|
||||||
top:37px !important;
|
top: 1px !important;
|
||||||
bottom:30px;
|
bottom:30px;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
@ -66,15 +67,21 @@ body {
|
|||||||
width: 77px;
|
width: 77px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#chatcontrols a.active {
|
||||||
|
border-color: #FFCE00;
|
||||||
|
border-bottom-width:0px;
|
||||||
|
font-weight:bold
|
||||||
|
}
|
||||||
|
|
||||||
|
#chatcontrols a.active + a {
|
||||||
|
border-left-color: #FFCE00
|
||||||
|
}
|
||||||
|
|
||||||
#sidebartoggle {
|
#sidebartoggle {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#scrollwrapper {
|
#scrollwrapper {
|
||||||
top: 36px;
|
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
max-height: none !important;
|
max-height: none !important;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
|
@ -20,11 +20,10 @@ public class IITC_AboutDialogPreference extends DialogPreference{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* start a little about-dialog
|
* start a little about-dialog srsly...I found no better way for clickable
|
||||||
* srsly...I found no better way for clickable links in a TextView then
|
* links in a TextView then using Html.fromHtml...Linkify is just broken and
|
||||||
* using Html.fromHtml...Linkify is just broken and does not understand
|
* does not understand html href tags...so let's tag the @string/about_msg
|
||||||
* html href tags...so let's tag the @string/about_msg with CDATA and
|
* with CDATA and use Html.fromHtml(...) for clickable hrefs with tags.
|
||||||
* use Html.fromHtml(...) for clickable hrefs with tags.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onPrepareDialogBuilder(Builder builder) {
|
protected void onPrepareDialogBuilder(Builder builder) {
|
||||||
@ -32,8 +31,7 @@ public class IITC_AboutDialogPreference extends DialogPreference{
|
|||||||
String about_msg = context.getText(R.string.pref_about_msg).toString();
|
String about_msg = context.getText(R.string.pref_about_msg).toString();
|
||||||
message.setText(Html.fromHtml(about_msg));
|
message.setText(Html.fromHtml(about_msg));
|
||||||
message.setMovementMethod(LinkMovementMethod.getInstance());
|
message.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
builder.setView(message)
|
builder.setView(message).setTitle(R.string.about)
|
||||||
.setTitle(R.string.about)
|
|
||||||
.setIcon(android.R.drawable.ic_dialog_info)
|
.setIcon(android.R.drawable.ic_dialog_info)
|
||||||
.setNeutralButton(R.string.close, new OnClickListener() {
|
.setNeutralButton(R.string.close, new OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
@ -21,7 +21,8 @@ public class IITC_JSInterface {
|
|||||||
// send geo intent for navigation apps like gmaps or waze etc...
|
// send geo intent for navigation apps like gmaps or waze etc...
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void intentPosLink(String lat, String lng, String portal_name) {
|
public void intentPosLink(String lat, String lng, String portal_name) {
|
||||||
String uri = "geo:" + lat + "," + lng + "?q=" + lat + "," + lng + portal_name;
|
String uri = "geo:" + lat + "," + lng + "?q=" + lat + "," + lng
|
||||||
|
+ portal_name;
|
||||||
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
|
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
|
||||||
Uri.parse(uri));
|
Uri.parse(uri));
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
@ -30,9 +31,11 @@ public class IITC_JSInterface {
|
|||||||
// copy link to specific portal to android clipboard
|
// copy link to specific portal to android clipboard
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void copy(String s) {
|
public void copy(String s) {
|
||||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
ClipboardManager clipboard = (ClipboardManager) context
|
||||||
|
.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
ClipData clip = ClipData.newPlainText("Copied Text ", s);
|
ClipData clip = ClipData.newPlainText("Copied Text ", s);
|
||||||
clipboard.setPrimaryClip(clip);
|
clipboard.setPrimaryClip(clip);
|
||||||
Toast.makeText(context, "copied to clipboard", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "copied to clipboard", Toast.LENGTH_SHORT)
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package com.cradle.iitc_mobile;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import com.cradle.iitc_mobile.R;
|
import com.cradle.iitc_mobile.R;
|
||||||
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.location.LocationListener;
|
import android.location.LocationListener;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
@ -14,6 +13,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.app.ActionBar;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -32,7 +32,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
|
|
||||||
private IITC_WebView iitc_view;
|
private IITC_WebView iitc_view;
|
||||||
private boolean back_button_pressed = false;
|
private boolean back_button_pressed = false;
|
||||||
private boolean desktop = 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;
|
||||||
@ -40,36 +39,57 @@ public class IITC_Mobile extends Activity {
|
|||||||
private LocationListener loc_listener = null;
|
private LocationListener loc_listener = null;
|
||||||
private boolean keyboad_open = false;
|
private boolean keyboad_open = false;
|
||||||
private boolean fullscreen_mode = false;
|
private boolean fullscreen_mode = false;
|
||||||
|
private boolean fullscreen_actionbar = false;
|
||||||
|
private ActionBar actionBar;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// TODO build an async task for url.openStream() in IITC_WebViewClient
|
// TODO build an async task for url.openStream() in IITC_WebViewClient
|
||||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
|
||||||
|
.permitAll().build();
|
||||||
StrictMode.setThreadPolicy(policy);
|
StrictMode.setThreadPolicy(policy);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
iitc_view = (IITC_WebView) findViewById(R.id.iitc_webview);
|
iitc_view = (IITC_WebView) findViewById(R.id.iitc_webview);
|
||||||
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
actionBar = this.getActionBar();
|
||||||
|
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME
|
||||||
|
| ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
|
||||||
|
actionBar.setTitle(getString(R.string.menu_map));
|
||||||
|
actionBar.setHomeButtonEnabled(true);
|
||||||
|
|
||||||
|
// do something if user changed something in the settings
|
||||||
|
SharedPreferences sharedPref = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(this);
|
||||||
listener = new OnSharedPreferenceChangeListener() {
|
listener = new OnSharedPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(
|
||||||
if (key.equals("pref_force_desktop"))
|
SharedPreferences sharedPreferences, String key) {
|
||||||
desktop = sharedPreferences.getBoolean("pref_force_desktop", false);
|
|
||||||
if (key.equals("pref_user_loc"))
|
if (key.equals("pref_user_loc"))
|
||||||
user_loc = sharedPreferences.getBoolean("pref_user_loc", false);
|
user_loc = sharedPreferences.getBoolean("pref_user_loc",
|
||||||
|
false);
|
||||||
|
if (key.equals("pref_fullscreen_actionbar")) {
|
||||||
|
fullscreen_actionbar =sharedPreferences.getBoolean("pref_fullscreen_actionbar",
|
||||||
|
false);
|
||||||
|
if (fullscreen_mode)
|
||||||
|
IITC_Mobile.this.getActionBar().hide();
|
||||||
|
}
|
||||||
IITC_Mobile.this.loadUrl(intel_url);
|
IITC_Mobile.this.loadUrl(intel_url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
sharedPref.registerOnSharedPreferenceChangeListener(listener);
|
sharedPref.registerOnSharedPreferenceChangeListener(listener);
|
||||||
|
|
||||||
// we need this one to prevent location updates to javascript when keyboard is open
|
// we need this one to prevent location updates to javascript when
|
||||||
|
// keyboard is open
|
||||||
// it closes on updates
|
// it closes on updates
|
||||||
iitc_view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
|
iitc_view.getViewTreeObserver().addOnGlobalLayoutListener(
|
||||||
|
new OnGlobalLayoutListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
Rect r = new Rect();
|
Rect r = new Rect();
|
||||||
//r will be populated with the coordinates of your view that area still visible.
|
// r will be populated with the coordinates of your view
|
||||||
|
// that area still visible.
|
||||||
iitc_view.getWindowVisibleDisplayFrame(r);
|
iitc_view.getWindowVisibleDisplayFrame(r);
|
||||||
|
|
||||||
int screenHeight = iitc_view.getRootView().getHeight();
|
int screenHeight = iitc_view.getRootView().getHeight();
|
||||||
@ -85,29 +105,40 @@ public class IITC_Mobile extends Activity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 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);
|
||||||
|
|
||||||
// Define a listener that responds to location updates
|
// Define a listener that responds to location updates
|
||||||
loc_listener = new LocationListener() {
|
loc_listener = new LocationListener() {
|
||||||
public void onLocationChanged(Location location) {
|
public void onLocationChanged(Location location) {
|
||||||
// Called when a new location is found by the network location provider.
|
// Called when a new location is found by the network location
|
||||||
|
// provider.
|
||||||
drawMarker(location);
|
drawMarker(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
public void onStatusChanged(String provider, int status,
|
||||||
|
Bundle extras) {
|
||||||
|
}
|
||||||
|
|
||||||
public void onProviderEnabled(String provider) {}
|
public void onProviderEnabled(String provider) {
|
||||||
|
}
|
||||||
|
|
||||||
public void onProviderDisabled(String provider) {}
|
public void onProviderDisabled(String provider) {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
user_loc = sharedPref.getBoolean("pref_user_loc", false);
|
user_loc = sharedPref.getBoolean("pref_user_loc", false);
|
||||||
if (user_loc == true) {
|
if (user_loc == true) {
|
||||||
// Register the listener with the Location Manager to receive location updates
|
// Register the listener with the Location Manager to receive
|
||||||
loc_mngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, loc_listener);
|
// location updates
|
||||||
loc_mngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, loc_listener);
|
loc_mngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
|
||||||
|
0, 0, loc_listener);
|
||||||
|
loc_mngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
|
||||||
|
loc_listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fullscreen_actionbar = sharedPref.getBoolean("pref_fullscreen_actionbar", false);
|
||||||
|
|
||||||
// load new iitc web view with ingress intel page
|
// load new iitc web view with ingress intel page
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
@ -121,8 +152,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
Log.d("iitcm", "loading url...");
|
Log.d("iitcm", "loading url...");
|
||||||
this.loadUrl(url);
|
this.loadUrl(url);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.loadUrl(intel_url);
|
this.loadUrl(intel_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,9 +168,12 @@ public class IITC_Mobile extends Activity {
|
|||||||
iitc_view.updateCaching();
|
iitc_view.updateCaching();
|
||||||
|
|
||||||
if (user_loc == true) {
|
if (user_loc == true) {
|
||||||
// Register the listener with the Location Manager to receive location updates
|
// Register the listener with the Location Manager to receive
|
||||||
loc_mngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, loc_listener);
|
// location updates
|
||||||
loc_mngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, loc_listener);
|
loc_mngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
|
||||||
|
0, 0, loc_listener);
|
||||||
|
loc_mngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
|
||||||
|
loc_listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,25 +181,32 @@ public class IITC_Mobile extends Activity {
|
|||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
ConnectivityManager conMan = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
ConnectivityManager conMan = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
|
||||||
NetworkInfo mobile = conMan.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
NetworkInfo mobile = conMan
|
||||||
|
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
||||||
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||||
|
|
||||||
// check if Mobile or Wifi module is available..then handle states
|
// check if Mobile or Wifi module is available..then handle states
|
||||||
// TODO: theory...we do not have to check for a Wifi module...every android device should have one
|
// TODO: theory...we do not have to check for a Wifi module...every
|
||||||
|
// android device should have one
|
||||||
if (mobile != null) {
|
if (mobile != null) {
|
||||||
Log.d("iitcm", "mobile internet module detected...check states");
|
Log.d("iitcm", "mobile internet module detected...check states");
|
||||||
if (mobile.getState() == NetworkInfo.State.CONNECTED || mobile.getState() == NetworkInfo.State.CONNECTING) {
|
if (mobile.getState() == NetworkInfo.State.CONNECTED
|
||||||
Log.d("iitcm", "connected to mobile net...abort all running requests");
|
|| mobile.getState() == NetworkInfo.State.CONNECTING) {
|
||||||
|
Log.d("iitcm",
|
||||||
|
"connected to mobile net...abort all running requests");
|
||||||
// cancel all current requests
|
// cancel all current requests
|
||||||
iitc_view.loadUrl("javascript: window.requests.abort()");
|
iitc_view.loadUrl("javascript: window.requests.abort()");
|
||||||
// set idletime to maximum...no need for more
|
// set idletime to maximum...no need for more
|
||||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||||
} else if (wifi.getState() == NetworkInfo.State.CONNECTED || wifi.getState() == NetworkInfo.State.CONNECTING) {
|
} else if (wifi.getState() == NetworkInfo.State.CONNECTED
|
||||||
|
|| wifi.getState() == NetworkInfo.State.CONNECTING) {
|
||||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d("iitcm", "no mobile internet module detected...check wifi state");
|
Log.d("iitcm",
|
||||||
if (wifi.getState() == NetworkInfo.State.CONNECTED || wifi.getState() == NetworkInfo.State.CONNECTING) {
|
"no mobile internet module detected...check wifi state");
|
||||||
|
if (wifi.getState() == NetworkInfo.State.CONNECTED
|
||||||
|
|| wifi.getState() == NetworkInfo.State.CONNECTING) {
|
||||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,7 +232,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
// leave fullscreen mode if it is enabled
|
// leave fullscreen mode if it is enabled
|
||||||
if (fullscreen_mode) {
|
if (fullscreen_mode) {
|
||||||
// get back action bar
|
if (fullscreen_actionbar)
|
||||||
this.getActionBar().show();
|
this.getActionBar().show();
|
||||||
// show notification bar again
|
// show notification bar again
|
||||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||||
@ -223,6 +263,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
getMenuInflater().inflate(R.menu.main, menu);
|
getMenuInflater().inflate(R.menu.main, menu);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,8 +271,17 @@ public class IITC_Mobile extends Activity {
|
|||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
// Handle item selection
|
// Handle item selection
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home :
|
||||||
|
iitc_view.loadUrl("javascript: window.show('map');");
|
||||||
|
actionBar.setTitle(getString(R.string.menu_map));
|
||||||
|
return true;
|
||||||
|
case R.id.menu_map :
|
||||||
|
iitc_view.loadUrl("javascript: window.show('map');");
|
||||||
|
actionBar.setTitle(getString(R.string.menu_map));
|
||||||
|
return true;
|
||||||
case R.id.reload_button :
|
case R.id.reload_button :
|
||||||
this.loadUrl(intel_url);
|
this.loadUrl(intel_url);
|
||||||
|
actionBar.setTitle(getString(R.string.menu_map));
|
||||||
return true;
|
return true;
|
||||||
// clear cache
|
// clear cache
|
||||||
case R.id.cache_clear :
|
case R.id.cache_clear :
|
||||||
@ -242,21 +292,24 @@ public class IITC_Mobile extends Activity {
|
|||||||
// toggle fullscreen
|
// toggle fullscreen
|
||||||
case R.id.toggle_fullscreen :
|
case R.id.toggle_fullscreen :
|
||||||
if (!this.fullscreen_mode) {
|
if (!this.fullscreen_mode) {
|
||||||
// get rid of action bar
|
if (fullscreen_actionbar)
|
||||||
this.getActionBar().hide();
|
this.getActionBar().hide();
|
||||||
// hide notification bar
|
// hide notification bar
|
||||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
WindowManager.LayoutParams attrs = getWindow()
|
||||||
|
.getAttributes();
|
||||||
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
this.getWindow().setAttributes(attrs);
|
this.getWindow().setAttributes(attrs);
|
||||||
this.fullscreen_mode = true;
|
this.fullscreen_mode = true;
|
||||||
// show a little toast for the user
|
// show a little toast for the user
|
||||||
Toast.makeText(this, "Press back button to exit fullscreen", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this,
|
||||||
}
|
"Press back button to exit fullscreen",
|
||||||
else {
|
Toast.LENGTH_SHORT).show();
|
||||||
// get back action bar
|
} else {
|
||||||
|
if (fullscreen_actionbar)
|
||||||
this.getActionBar().show();
|
this.getActionBar().show();
|
||||||
// show notification bar again
|
// show notification bar again
|
||||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
WindowManager.LayoutParams attrs = getWindow()
|
||||||
|
.getAttributes();
|
||||||
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
this.getWindow().setAttributes(attrs);
|
this.getWindow().setAttributes(attrs);
|
||||||
this.fullscreen_mode = false;
|
this.fullscreen_mode = false;
|
||||||
@ -264,14 +317,42 @@ public class IITC_Mobile extends Activity {
|
|||||||
return true;
|
return true;
|
||||||
// get the users current location and focus it on map
|
// get the users current location and focus it on map
|
||||||
case R.id.locate :
|
case R.id.locate :
|
||||||
iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 13});");
|
iitc_view.loadUrl("javascript: window.show('map');");
|
||||||
|
iitc_view
|
||||||
|
.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 13});");
|
||||||
|
actionBar.setTitle(getString(R.string.menu_map));
|
||||||
return true;
|
return true;
|
||||||
// start settings activity
|
// start settings activity
|
||||||
case R.id.settings:
|
case R.id.action_settings :
|
||||||
Intent intent = new Intent(this, IITC_Settings.class);
|
Intent intent = new Intent(this, IITC_Settings.class);
|
||||||
intent.putExtra("iitc_version", iitc_view.getWebViewClient().getIITCVersion());
|
intent.putExtra("iitc_version", iitc_view.getWebViewClient()
|
||||||
|
.getIITCVersion());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.menu_info :
|
||||||
|
iitc_view.loadUrl("javascript: window.show('info');");
|
||||||
|
actionBar.setTitle(getString(R.string.menu_info));
|
||||||
|
return true;
|
||||||
|
case R.id.menu_full :
|
||||||
|
iitc_view.loadUrl("javascript: window.show('full');");
|
||||||
|
actionBar.setTitle(getString(R.string.menu_full));
|
||||||
|
return true;
|
||||||
|
case R.id.menu_compact :
|
||||||
|
iitc_view.loadUrl("javascript: window.show('compact');");
|
||||||
|
actionBar.setTitle(getString(R.string.menu_compact));
|
||||||
|
return true;
|
||||||
|
case R.id.menu_public :
|
||||||
|
iitc_view.loadUrl("javascript: window.show('public');");
|
||||||
|
actionBar.setTitle(getString(R.string.menu_public));
|
||||||
|
return true;
|
||||||
|
case R.id.menu_faction :
|
||||||
|
iitc_view.loadUrl("javascript: window.show('faction');");
|
||||||
|
actionBar.setTitle(getString(R.string.menu_faction));
|
||||||
|
return true;
|
||||||
|
case R.id.menu_debug :
|
||||||
|
iitc_view.loadUrl("javascript: window.show('debug')");
|
||||||
|
actionBar.setTitle(getString(R.string.menu_debug));
|
||||||
|
return true;
|
||||||
default :
|
default :
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
@ -287,14 +368,9 @@ public class IITC_Mobile extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// vp=f enables desktop mode...vp=m is the defaul mobile view
|
// Force mobile view.
|
||||||
|
// New actions are not compatible with desktop mode
|
||||||
private String addUrlParam(String url) {
|
private String addUrlParam(String url) {
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
this.desktop = sharedPref.getBoolean("pref_force_desktop", false);
|
|
||||||
|
|
||||||
if (desktop)
|
|
||||||
return (url + "?vp=f");
|
|
||||||
else
|
|
||||||
return (url + "?vp=m");
|
return (url + "?vp=m");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,9 +389,9 @@ public class IITC_Mobile extends Activity {
|
|||||||
// should avoid gps glitches
|
// should avoid gps glitches
|
||||||
if (loc.getAccuracy() < 100) {
|
if (loc.getAccuracy() < 100) {
|
||||||
if (keyboad_open == false) {
|
if (keyboad_open == false) {
|
||||||
iitc_view.loadUrl("javascript: " +
|
iitc_view.loadUrl("javascript: "
|
||||||
"window.plugin.userLocation.updateLocation( " +
|
+ "window.plugin.userLocation.updateLocation( "
|
||||||
loc.getLatitude() + ", " + loc.getLongitude() + ");");
|
+ loc.getLatitude() + ", " + loc.getLongitude() + ");");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,16 @@ public class IITC_Settings extends Activity {
|
|||||||
Scanner s = null;
|
Scanner s = null;
|
||||||
String src = "";
|
String src = "";
|
||||||
try {
|
try {
|
||||||
s = new Scanner(am.open("plugins/" + asset_array[i])).useDelimiter("\\A");
|
s = new Scanner(am.open("plugins/" + asset_array[i]))
|
||||||
|
.useDelimiter("\\A");
|
||||||
} catch (IOException e2) {
|
} catch (IOException e2) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
}
|
}
|
||||||
if (s != null) src = s.hasNext() ? s.next() : "";
|
if (s != null)
|
||||||
String header = src.substring(src.indexOf("==UserScript=="), src.indexOf("==/UserScript=="));
|
src = s.hasNext() ? s.next() : "";
|
||||||
|
String header = src.substring(src.indexOf("==UserScript=="),
|
||||||
|
src.indexOf("==/UserScript=="));
|
||||||
// remove new line comments and replace with space
|
// remove new line comments and replace with space
|
||||||
// this way we get double spaces instead of newline + double slash
|
// this way we get double spaces instead of newline + double slash
|
||||||
header = header.replace("\n//", " ");
|
header = header.replace("\n//", " ");
|
||||||
@ -48,7 +51,8 @@ public class IITC_Settings extends Activity {
|
|||||||
String plugin_name = "not found";
|
String plugin_name = "not found";
|
||||||
for (int j = 0; j < attributes.length; j++) {
|
for (int j = 0; j < attributes.length; j++) {
|
||||||
// search for name and use the value
|
// search for name and use the value
|
||||||
if (attributes[j].equals("@name")) plugin_name = attributes[j+1];
|
if (attributes[j].equals("@name"))
|
||||||
|
plugin_name = attributes[j + 1];
|
||||||
}
|
}
|
||||||
asset_list.add(plugin_name);
|
asset_list.add(plugin_name);
|
||||||
// real value
|
// real value
|
||||||
@ -56,13 +60,14 @@ public class IITC_Settings extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bundle bundle = getIntent().getExtras();
|
Bundle bundle = getIntent().getExtras();
|
||||||
bundle.putStringArray("ASSETS", (String[]) asset_list.toArray(new String[0]));
|
bundle.putStringArray("ASSETS",
|
||||||
bundle.putStringArray("ASSETS_VAL", (String[]) asset_values.toArray(new String[0]));
|
(String[]) asset_list.toArray(new String[0]));
|
||||||
|
bundle.putStringArray("ASSETS_VAL",
|
||||||
|
(String[]) asset_values.toArray(new String[0]));
|
||||||
settings.setArguments(bundle);
|
settings.setArguments(bundle);
|
||||||
|
|
||||||
// Display the fragment as the main content.
|
// Display the fragment as the main content.
|
||||||
getFragmentManager().beginTransaction()
|
getFragmentManager().beginTransaction()
|
||||||
.replace(android.R.id.content, settings)
|
.replace(android.R.id.content, settings).commit();
|
||||||
.commit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,17 +26,18 @@ public class IITC_SettingsFragment extends PreferenceFragment {
|
|||||||
// plugins
|
// plugins
|
||||||
MultiSelectListPreference pref_plugins = (MultiSelectListPreference) findPreference("pref_plugins");
|
MultiSelectListPreference pref_plugins = (MultiSelectListPreference) findPreference("pref_plugins");
|
||||||
pref_plugins.setEntries(getArguments().getStringArray("ASSETS"));
|
pref_plugins.setEntries(getArguments().getStringArray("ASSETS"));
|
||||||
pref_plugins.setEntryValues(getArguments().getStringArray("ASSETS_VAL"));
|
pref_plugins
|
||||||
|
.setEntryValues(getArguments().getStringArray("ASSETS_VAL"));
|
||||||
|
|
||||||
// set build version
|
// set build version
|
||||||
ListPreference pref_build_version = (ListPreference) findPreference("pref_build_version");
|
ListPreference pref_build_version = (ListPreference) findPreference("pref_build_version");
|
||||||
PackageManager pm = getActivity().getPackageManager();
|
PackageManager pm = getActivity().getPackageManager();
|
||||||
String version = "unknown";
|
String version = "unknown";
|
||||||
try {
|
try {
|
||||||
PackageInfo info = pm.getPackageInfo(getActivity().getPackageName(), 0);
|
PackageInfo info = pm.getPackageInfo(
|
||||||
|
getActivity().getPackageName(), 0);
|
||||||
version = info.versionName;
|
version = info.versionName;
|
||||||
}
|
} catch (NameNotFoundException e) {
|
||||||
catch (NameNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
pref_build_version.setSummary(version);
|
pref_build_version.setSummary(version);
|
||||||
@ -47,16 +48,20 @@ public class IITC_SettingsFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
// set iitc source
|
// set iitc source
|
||||||
EditTextPreference pref_iitc_source = (EditTextPreference) findPreference("pref_iitc_source");
|
EditTextPreference pref_iitc_source = (EditTextPreference) findPreference("pref_iitc_source");
|
||||||
pref_iitc_source.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
pref_iitc_source
|
||||||
|
.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference,
|
||||||
|
Object newValue) {
|
||||||
preference.setSummary((CharSequence) newValue);
|
preference.setSummary((CharSequence) newValue);
|
||||||
// TODO: update iitc_version when iitc source has changed
|
// TODO: update iitc_version when iitc source has
|
||||||
|
// changed
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// first init of summary
|
// first init of summary
|
||||||
String pref_iitc_source_sum = (String) pref_iitc_source.getSummary() + pref_iitc_source.getText();
|
String pref_iitc_source_sum = (String) pref_iitc_source.getSummary()
|
||||||
|
+ pref_iitc_source.getText();
|
||||||
pref_iitc_source.setSummary(pref_iitc_source_sum);
|
pref_iitc_source.setSummary(pref_iitc_source_sum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,10 @@ public class IITC_WebView extends WebView {
|
|||||||
settings.setAllowFileAccess(true);
|
settings.setAllowFileAccess(true);
|
||||||
settings.setGeolocationEnabled(true);
|
settings.setGeolocationEnabled(true);
|
||||||
settings.setAppCacheEnabled(true);
|
settings.setAppCacheEnabled(true);
|
||||||
settings.setDatabasePath(this.getContext().getApplicationInfo().dataDir + "/databases/");
|
settings.setDatabasePath(this.getContext().getApplicationInfo().dataDir
|
||||||
settings.setAppCachePath(this.getContext().getCacheDir().getAbsolutePath());
|
+ "/databases/");
|
||||||
|
settings.setAppCachePath(this.getContext().getCacheDir()
|
||||||
|
.getAbsolutePath());
|
||||||
// use cache if on mobile network...saves traffic
|
// use cache if on mobile network...saves traffic
|
||||||
this.js_interface = new IITC_JSInterface(c);
|
this.js_interface = new IITC_JSInterface(c);
|
||||||
this.addJavascriptInterface(js_interface, "android");
|
this.addJavascriptInterface(js_interface, "android");
|
||||||
@ -38,7 +40,8 @@ public class IITC_WebView extends WebView {
|
|||||||
// allow access by default
|
// allow access by default
|
||||||
this.setWebChromeClient(new WebChromeClient() {
|
this.setWebChromeClient(new WebChromeClient() {
|
||||||
@Override
|
@Override
|
||||||
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
|
public void onGeolocationPermissionsShowPrompt(String origin,
|
||||||
|
GeolocationPermissions.Callback callback) {
|
||||||
callback.invoke(origin, true, false);
|
callback.invoke(origin, true, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -65,13 +68,15 @@ public class IITC_WebView extends WebView {
|
|||||||
|
|
||||||
iitc_init(context);
|
iitc_init(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadUrl(String url) {
|
public void loadUrl(String url) {
|
||||||
if (!url.startsWith("javascript:")) {
|
if (!url.startsWith("javascript:")) {
|
||||||
// force https if enabled in settings
|
// force https if enabled in settings
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
|
SharedPreferences sharedPref = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(getContext());
|
||||||
if (sharedPref.getBoolean("pref_force_https", true))
|
if (sharedPref.getBoolean("pref_force_https", true))
|
||||||
url = url.replace("http://", "https://");
|
url = url.replace("http://", "https://");
|
||||||
else
|
else
|
||||||
@ -90,8 +95,7 @@ public class IITC_WebView extends WebView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateCaching() {
|
public void updateCaching() {
|
||||||
if (!this.isConnectedToWifi())
|
if (!this.isConnectedToWifi()) {
|
||||||
{
|
|
||||||
Log.d("iitcm", "not connected to wifi...load tiles from cache");
|
Log.d("iitcm", "not connected to wifi...load tiles from cache");
|
||||||
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
||||||
} else {
|
} else {
|
||||||
@ -101,7 +105,8 @@ public class IITC_WebView extends WebView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isConnectedToWifi() {
|
private boolean isConnectedToWifi() {
|
||||||
ConnectivityManager conMan = (ConnectivityManager) getContext().getSystemService( Context.CONNECTIVITY_SERVICE );
|
ConnectivityManager conMan = (ConnectivityManager) getContext()
|
||||||
|
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||||
return wifi.getState() == NetworkInfo.State.CONNECTED;
|
return wifi.getState() == NetworkInfo.State.CONNECTED;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.cradle.iitc_mobile;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.net.http.SslError;
|
import android.net.http.SslError;
|
||||||
@ -25,8 +26,10 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class IITC_WebViewClient extends WebViewClient {
|
public class IITC_WebViewClient extends WebViewClient {
|
||||||
private static final ByteArrayInputStream style = new ByteArrayInputStream(
|
private static final ByteArrayInputStream style = new ByteArrayInputStream(
|
||||||
"body, #dashboard_container, #map_canvas { background: #000 !important; }".getBytes());
|
"body, #dashboard_container, #map_canvas { background: #000 !important; }"
|
||||||
private static final ByteArrayInputStream empty = new ByteArrayInputStream("".getBytes());
|
.getBytes());
|
||||||
|
private static final ByteArrayInputStream empty = new ByteArrayInputStream(
|
||||||
|
"".getBytes());
|
||||||
|
|
||||||
private WebResourceResponse iitcjs;
|
private WebResourceResponse iitcjs;
|
||||||
private String js = null;
|
private String js = null;
|
||||||
@ -35,7 +38,8 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
|
|
||||||
public IITC_WebViewClient(Context c) {
|
public IITC_WebViewClient(Context c) {
|
||||||
this.context = c;
|
this.context = c;
|
||||||
this.iitc_path = Environment.getExternalStorageDirectory().getPath() + "/IITC_Mobile/";
|
this.iitc_path = Environment.getExternalStorageDirectory().getPath()
|
||||||
|
+ "/IITC_Mobile/";
|
||||||
try {
|
try {
|
||||||
loadIITC_JS(c);
|
loadIITC_JS(c);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -46,7 +50,8 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
public String getIITCVersion() {
|
public String getIITCVersion() {
|
||||||
String header = "";
|
String header = "";
|
||||||
if (js != null)
|
if (js != null)
|
||||||
header = js.substring(js.indexOf("==UserScript=="), js.indexOf("==/UserScript=="));
|
header = js.substring(js.indexOf("==UserScript=="),
|
||||||
|
js.indexOf("==/UserScript=="));
|
||||||
// remove new line comments
|
// remove new line comments
|
||||||
header = header.replace("\n//", "");
|
header = header.replace("\n//", "");
|
||||||
// get a list of key-value
|
// get a list of key-value
|
||||||
@ -54,35 +59,46 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
String iitc_version = "not found";
|
String iitc_version = "not found";
|
||||||
for (int i = 0; i < attributes.length; i++) {
|
for (int i = 0; i < attributes.length; i++) {
|
||||||
// search for version and use the value
|
// search for version and use the value
|
||||||
if (attributes[i].equals("@version")) iitc_version = attributes[i+1];
|
if (attributes[i].equals("@version"))
|
||||||
|
iitc_version = attributes[i + 1];
|
||||||
}
|
}
|
||||||
return iitc_version;
|
return iitc_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadIITC_JS(Context c) throws java.io.IOException {
|
public void loadIITC_JS(Context c) throws java.io.IOException {
|
||||||
// You are able to load the script from external source
|
// You are able to load the script from external source
|
||||||
// if a http address is given, use script from this address. else use the local script
|
// if a http address is given, use script from this address. else use
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(c);
|
// the local script
|
||||||
|
SharedPreferences sharedPref = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(c);
|
||||||
String iitc_source = sharedPref.getString("pref_iitc_source", "local");
|
String iitc_source = sharedPref.getString("pref_iitc_source", "local");
|
||||||
String js = "";
|
String js = "";
|
||||||
|
|
||||||
// if developer mode are enabled, load all iitc script from external storage
|
// if developer mode are enabled, load all iitc script from external
|
||||||
|
// storage
|
||||||
if (sharedPref.getBoolean("pref_dev_checkbox", false)) {
|
if (sharedPref.getBoolean("pref_dev_checkbox", false)) {
|
||||||
js = this.fileToString(iitc_path + "dev/total-conversion-build.user.js", false);
|
js = this.fileToString(iitc_path
|
||||||
|
+ "dev/total-conversion-build.user.js", false);
|
||||||
if (js.equals("false")) {
|
if (js.equals("false")) {
|
||||||
Toast.makeText(context, "File " + iitc_path +
|
Toast.makeText(
|
||||||
"dev/total-conversion-build.user.js not found. " +
|
context,
|
||||||
"Disable developer mode or add iitc files " +
|
"File "
|
||||||
"to the dev folder.", Toast.LENGTH_LONG).show();
|
+ iitc_path
|
||||||
|
+ "dev/total-conversion-build.user.js not found. "
|
||||||
|
+ "Disable developer mode or add iitc files "
|
||||||
|
+ "to the dev folder.", Toast.LENGTH_LONG)
|
||||||
|
.show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(context, "Developer mode enabled", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Developer mode enabled",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// load iitc script from web or asset folder
|
// load iitc script from web or asset folder
|
||||||
if (iitc_source.contains("http")) {
|
if (iitc_source.contains("http")) {
|
||||||
URL url = new URL(iitc_source);
|
URL url = new URL(iitc_source);
|
||||||
js = new Scanner(url.openStream(), "UTF-8").useDelimiter("\\A").next();
|
js = new Scanner(url.openStream(), "UTF-8").useDelimiter("\\A")
|
||||||
|
.next();
|
||||||
} else {
|
} else {
|
||||||
js = this.fileToString("total-conversion-build.user.js", true);
|
js = this.fileToString("total-conversion-build.user.js", true);
|
||||||
}
|
}
|
||||||
@ -90,6 +106,15 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
|
|
||||||
this.js = js;
|
this.js = js;
|
||||||
|
|
||||||
|
PackageManager pm = context.getPackageManager();
|
||||||
|
boolean hasMultitouch = pm
|
||||||
|
.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
|
||||||
|
boolean forcedZoom = sharedPref.getBoolean("pref_user_zoom", false);
|
||||||
|
if (hasMultitouch && !forcedZoom) {
|
||||||
|
js = js.replace("window.showZoom = true;",
|
||||||
|
"window.showZoom = false;");
|
||||||
|
}
|
||||||
|
|
||||||
// need to wrap the mobile iitc.js version in a document ready. IITC
|
// need to wrap the mobile iitc.js version in a document ready. IITC
|
||||||
// expects to be injected after the DOM has been loaded completely.
|
// expects to be injected after the DOM has been loaded completely.
|
||||||
// Since the mobile client injects IITC by replacing the gen_dashboard
|
// Since the mobile client injects IITC by replacing the gen_dashboard
|
||||||
@ -97,16 +122,14 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
// so it boots correctly.
|
// so it boots correctly.
|
||||||
js = "$(document).ready(function(){" + js + "});";
|
js = "$(document).ready(function(){" + js + "});";
|
||||||
|
|
||||||
iitcjs = new WebResourceResponse(
|
iitcjs = new WebResourceResponse("text/javascript", "UTF-8",
|
||||||
"text/javascript",
|
new ByteArrayInputStream(js.getBytes()));
|
||||||
"UTF-8",
|
|
||||||
new ByteArrayInputStream(js.getBytes())
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// enable https
|
// enable https
|
||||||
@Override
|
@Override
|
||||||
public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
|
public void onReceivedSslError(WebView view, SslErrorHandler handler,
|
||||||
|
SslError error) {
|
||||||
handler.proceed();
|
handler.proceed();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -116,9 +139,10 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
super.onPageFinished(view, url);
|
super.onPageFinished(view, url);
|
||||||
|
|
||||||
// get the plugin preferences
|
// get the plugin preferences
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sharedPref = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
Set<String> plugin_list = sharedPref.getStringSet("pref_plugins", null);
|
Set<String> plugin_list = sharedPref.getStringSet("pref_plugins", null);
|
||||||
boolean dev_enabled = sharedPref.getBoolean("pref_dev_checkbox", true);
|
boolean dev_enabled = sharedPref.getBoolean("pref_dev_checkbox", false);
|
||||||
|
|
||||||
// iterate through all enabled plugins and load them
|
// iterate through all enabled plugins and load them
|
||||||
if (plugin_list != null) {
|
if (plugin_list != null) {
|
||||||
@ -127,7 +151,8 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
for (int i = 0; i < plugin_list.size(); i++) {
|
for (int i = 0; i < plugin_list.size(); i++) {
|
||||||
Log.d("iitcm", "adding plugin " + plugin_array[i]);
|
Log.d("iitcm", "adding plugin " + plugin_array[i]);
|
||||||
if (dev_enabled)
|
if (dev_enabled)
|
||||||
this.loadJS(iitc_path + "dev/plugins/" + plugin_array[i], false, view);
|
this.loadJS(iitc_path + "dev/plugins/" + plugin_array[i],
|
||||||
|
false, view);
|
||||||
else
|
else
|
||||||
this.loadJS("plugins/" + plugin_array[i], true, view);
|
this.loadJS("plugins/" + plugin_array[i], true, view);
|
||||||
}
|
}
|
||||||
@ -143,7 +168,8 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (int i = 0; i < files.length; ++i) {
|
for (int i = 0; i < files.length; ++i) {
|
||||||
if (this.loadJS(files[i].toString(), false, view))
|
if (this.loadJS(files[i].toString(), false, view))
|
||||||
Log.d("iitcm", "loading additional plugin " + files[i].toString());
|
Log.d("iitcm",
|
||||||
|
"loading additional plugin " + files[i].toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,7 +211,8 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s != null) src = s.hasNext() ? s.next() : "";
|
if (s != null)
|
||||||
|
src = s.hasNext() ? s.next() : "";
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,16 +224,19 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
String js = fileToString(file, asset);
|
String js = fileToString(file, asset);
|
||||||
if (js.equals("false"))
|
if (js.equals("false"))
|
||||||
return false;
|
return false;
|
||||||
else view.loadUrl("javascript:" + js);
|
else
|
||||||
|
view.loadUrl("javascript:" + js);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check every external resource if it’s okay to load it and maybe replace it
|
// Check every external resource if it’s okay to load it and maybe replace
|
||||||
|
// it
|
||||||
// with our own content. This is used to block loading Niantic resources
|
// with our own content. This is used to block loading Niantic resources
|
||||||
// which aren’t required and to inject IITC early into the site.
|
// which aren’t required and to inject IITC early into the site.
|
||||||
// via http://stackoverflow.com/a/8274881/1684530
|
// via http://stackoverflow.com/a/8274881/1684530
|
||||||
@Override
|
@Override
|
||||||
public WebResourceResponse shouldInterceptRequest (final WebView view, String url) {
|
public WebResourceResponse shouldInterceptRequest(final WebView view,
|
||||||
|
String url) {
|
||||||
if (url.contains("/css/common.css")) {
|
if (url.contains("/css/common.css")) {
|
||||||
return new WebResourceResponse("text/css", "UTF-8", style);
|
return new WebResourceResponse("text/css", "UTF-8", style);
|
||||||
} else if (url.contains("gen_dashboard.js")) {
|
} else if (url.contains("gen_dashboard.js")) {
|
||||||
@ -230,13 +260,18 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
if (url.contains("ingress.com") || url.contains("appengine.google.com")) {
|
if (url.contains("ingress.com") || url.contains("appengine.google.com")) {
|
||||||
// reload iitc if a poslink is clicked inside the app
|
// reload iitc if a poslink is clicked inside the app
|
||||||
if (url.contains("intel?ll=") || (url.contains("latE6") && url.contains("lngE6"))) {
|
if (url.contains("intel?ll=")
|
||||||
Log.d("iitcm", "should be an internal clicked position link...reload script for: " + url);
|
|| (url.contains("latE6") && url.contains("lngE6"))) {
|
||||||
|
Log.d("iitcm",
|
||||||
|
"should be an internal clicked position link...reload script for: "
|
||||||
|
+ url);
|
||||||
((IITC_Mobile) context).loadUrl(url);
|
((IITC_Mobile) context).loadUrl(url);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
Log.d("iitcm", "no ingress intel link, start external app to load url: " + url);
|
Log.d("iitcm",
|
||||||
|
"no ingress intel link, start external app to load url: "
|
||||||
|
+ url);
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
104
plugins/players-resonators.user.js
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-players-resonators@rbino
|
||||||
|
// @name IITC plugin: Player's Resonators
|
||||||
|
// @version 0.1.4.@@DATETIMEVERSION@@
|
||||||
|
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||||
|
// @updateURL @@UPDATEURL@@
|
||||||
|
// @downloadURL @@DOWNLOADURL@@
|
||||||
|
// @description [@@BUILDNAME@@-@@BUILDDATE@@] The plugins finds the resonators of a given player. The input is in the sidebar. Useful for revenge.
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
/*********************************************************************************************************
|
||||||
|
* Changelog:
|
||||||
|
*
|
||||||
|
* 0.1.4 Added focus link in the toolbox. Some renaming. Removed div to use sidebar style.
|
||||||
|
* 0.1.3 Effective player name (with wrong capitalization) if it finds some reso
|
||||||
|
* 0.1.2 Made nickname case insensitive
|
||||||
|
* 0.1.1 Added mouseover for portal location. Dirty hack to not show mousehover when the alert is fired.
|
||||||
|
* 0.1.0 First public release
|
||||||
|
*********************************************************************************************************/
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.playersResonators = function() {};
|
||||||
|
|
||||||
|
window.plugin.playersResonators.findReso = function(playername) {
|
||||||
|
var s = "";
|
||||||
|
var portalSet = {};
|
||||||
|
var effectiveNick = "";
|
||||||
|
// Assuming there can be no agents with same nick with different lower/uppercase
|
||||||
|
var nickToFind = playername.toLowerCase();
|
||||||
|
$.each(window.portals, function(ind, portal){
|
||||||
|
var r = portal.options.details.resonatorArray.resonators;
|
||||||
|
$.each(r, function(ind, reso) {
|
||||||
|
if (!reso) return true;
|
||||||
|
var nick = getPlayerName(reso.ownerGuid);
|
||||||
|
if (nick.toLowerCase() === nickToFind){
|
||||||
|
if (!effectiveNick) {
|
||||||
|
effectiveNick = nick;
|
||||||
|
}
|
||||||
|
if (!portalSet.hasOwnProperty(portal.options.guid)){
|
||||||
|
portalSet[portal.options.guid] = true;
|
||||||
|
console.log(portalSet);
|
||||||
|
var latlng = [portal.options.details.locationE6.latE6/1E6, portal.options.details.locationE6.lngE6/1E6].join();
|
||||||
|
var guid = portal.options.guid;
|
||||||
|
var zoomPortal = 'window.zoomToAndShowPortal(\''+guid+'\', ['+latlng+']);return false';
|
||||||
|
var perma = '/intel?latE6='+portal.options.details.locationE6.latE6+'&lngE6='+portal.options.details.locationE6.lngE6+'&z=17&pguid='+guid;
|
||||||
|
var a = $('<a>',{
|
||||||
|
"class": 'help',
|
||||||
|
text: portal.options.details.portalV2.descriptiveText.TITLE,
|
||||||
|
title: portal.options.details.portalV2.descriptiveText.ADDRESS,
|
||||||
|
href: perma,
|
||||||
|
onClick: zoomPortal
|
||||||
|
})[0].outerHTML;
|
||||||
|
s += a + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (s) {
|
||||||
|
// Showing the playername as a "fake" link to avoid the auto-mouseover effect on the first portal
|
||||||
|
fakeLinkPlayer = '<a href="#" onClick="return false;">' + effectiveNick + '</a>'
|
||||||
|
s = fakeLinkPlayer + " has resonators on these portals:\n\n" + s;
|
||||||
|
} else {
|
||||||
|
s = playername + " has no resonators in this range\n";
|
||||||
|
}
|
||||||
|
alert(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
var content = '<input id="playerReso" placeholder="Type player name to find resonators..." type="text">';
|
||||||
|
$('#sidebar').append(content);
|
||||||
|
$('#toolbox').append(' <a onclick=$("#playerReso").focus() title="Find all portals with resonators of a certain player">Player\'s Reso</a>');
|
||||||
|
$("#playerReso").keypress(function(e) {
|
||||||
|
if((e.keyCode ? e.keyCode : e.which) !== 13) return;
|
||||||
|
var data = $(this).val();
|
||||||
|
window.plugin.playersResonators.findReso(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|