Merge branch 'master' of https://github.com/jonatkins/ingress-intel-total-conversion
This commit is contained in:
commit
4f020a48ba
@ -6,19 +6,37 @@ window._highlighters = null;
|
|||||||
window._current_highlighter = localStorage.portal_highlighter;
|
window._current_highlighter = localStorage.portal_highlighter;
|
||||||
window._no_highlighter = 'No Highlights';
|
window._no_highlighter = 'No Highlights';
|
||||||
|
|
||||||
|
if(window._current_highlighter !== undefined) {
|
||||||
|
if (typeof android !== 'undefined' && android && android.setActiveHighlighter)
|
||||||
|
android.setActiveHighlighter(window._current_highlighter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
window.addPortalHighlighter = function(name, callback) {
|
window.addPortalHighlighter = function(name, callback) {
|
||||||
if(_highlighters === null) {
|
if(_highlighters === null) {
|
||||||
_highlighters = {};
|
_highlighters = {};
|
||||||
}
|
}
|
||||||
_highlighters[name] = callback;
|
_highlighters[name] = callback;
|
||||||
|
|
||||||
|
if (typeof android !== 'undefined' && android && android.addPortalHighlighter)
|
||||||
|
android.addPortalHighlighter(name);
|
||||||
|
|
||||||
if(localStorage.portal_highlighter === undefined) {
|
if(localStorage.portal_highlighter === undefined) {
|
||||||
_current_highlighter = name;
|
_current_highlighter = name;
|
||||||
|
if (typeof android !== 'undefined' && android && android.setActiveHighlighter)
|
||||||
|
android.setActiveHighlighter(name);
|
||||||
|
|
||||||
localStorage.portal_highlighter = name;
|
localStorage.portal_highlighter = name;
|
||||||
}
|
}
|
||||||
portalHighlighterControl();
|
portalHighlighterControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.portalHighlighterControl = function() {
|
window.portalHighlighterControl = function() {
|
||||||
|
if (typeof android !== 'undefined' && android && android.addPortalHighlighter) {
|
||||||
|
$('#portal_highlight_select').remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(_highlighters !== null) {
|
if(_highlighters !== null) {
|
||||||
if($('#portal_highlight_select').length === 0) {
|
if($('#portal_highlight_select').length === 0) {
|
||||||
$("body").append("<select id='portal_highlight_select'></select>");
|
$("body").append("<select id='portal_highlight_select'></select>");
|
||||||
@ -32,13 +50,6 @@ window.portalHighlighterControl = function() {
|
|||||||
});
|
});
|
||||||
$("#portal_highlight_select").val(_current_highlighter);
|
$("#portal_highlight_select").val(_current_highlighter);
|
||||||
$("#portal_highlight_select").change(function(){ changePortalHighlights($(this).val());});
|
$("#portal_highlight_select").change(function(){ changePortalHighlights($(this).val());});
|
||||||
// notify android that the select spinner is enabled.
|
|
||||||
// this disables javascript injection on android side.
|
|
||||||
// if android is not notified, the spinner closes on the next JS call
|
|
||||||
if (typeof android !== 'undefined' && android && android.spinnerEnabled) {
|
|
||||||
$("#portal_highlight_select").click(function(){ android.spinnerEnabled(true);});
|
|
||||||
$("#portal_highlight_select").focus(function(){ android.spinnerEnabled(false);});
|
|
||||||
}
|
|
||||||
$(".leaflet-top.leaflet-left").css('padding-top', '20px');
|
$(".leaflet-top.leaflet-left").css('padding-top', '20px');
|
||||||
$(".leaflet-control-scale-line").css('margin-top','25px');
|
$(".leaflet-control-scale-line").css('margin-top','25px');
|
||||||
}
|
}
|
||||||
@ -46,6 +57,8 @@ window.portalHighlighterControl = function() {
|
|||||||
|
|
||||||
window.changePortalHighlights = function(name) {
|
window.changePortalHighlights = function(name) {
|
||||||
_current_highlighter = name;
|
_current_highlighter = name;
|
||||||
|
if (typeof android !== 'undefined' && android && android.setActiveHighlighter)
|
||||||
|
android.setActiveHighlighter(name);
|
||||||
resetHighlightedPortals();
|
resetHighlightedPortals();
|
||||||
localStorage.portal_highlighter = name;
|
localStorage.portal_highlighter = name;
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,18 @@ window.runOnSmartphonesAfterBoot = function() {
|
|||||||
var l = $('#chatcontrols a:visible');
|
var l = $('#chatcontrols a:visible');
|
||||||
l.css('width', 100/l.length + '%');
|
l.css('width', 100/l.length + '%');
|
||||||
|
|
||||||
|
// notify android that a select spinner is enabled.
|
||||||
|
// this disables javascript injection on android side.
|
||||||
|
// if android is not notified, the spinner closes on the next JS call
|
||||||
|
if (typeof android !== 'undefined' && android && android.spinnerEnabled) {
|
||||||
|
$("body").on("click", "select", function() {
|
||||||
|
android.spinnerEnabled(true);
|
||||||
|
});
|
||||||
|
$("body").on("focus", "select", function() {
|
||||||
|
android.spinnerEnabled(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// add event to portals that allows long press to switch to sidebar
|
// add event to portals that allows long press to switch to sidebar
|
||||||
window.addHook('portalAdded', function(data) {
|
window.addHook('portalAdded', function(data) {
|
||||||
data.portal.on('add', function() {
|
data.portal.on('add', function() {
|
||||||
|
@ -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="47"
|
android:versionCode="48"
|
||||||
android:versionName="0.6.3">
|
android:versionName="0.6.4">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="14"
|
android:minSdkVersion="14"
|
||||||
@ -22,10 +22,10 @@
|
|||||||
android:uiOptions="splitActionBarWhenNarrow">
|
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:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize">
|
android:theme="@style/AppBaseTheme">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
|
||||||
@ -37,7 +37,7 @@
|
|||||||
<!-- Receives the search request. -->
|
<!-- Receives the search request. -->
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEARCH"/>
|
<action android:name="android.intent.action.SEARCH"/>
|
||||||
<!-- No category needed, because the Intent will specify this class component-->
|
<!-- No category needed, because the Intent will specify this class component -->
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<!-- Handles the implicit intent to VIEW the www.ingress.com/intel URI -->
|
<!-- Handles the implicit intent to VIEW the www.ingress.com/intel URI -->
|
||||||
@ -49,12 +49,12 @@
|
|||||||
|
|
||||||
<data
|
<data
|
||||||
android:host="www.ingress.com"
|
android:host="www.ingress.com"
|
||||||
android:scheme="https"
|
android:pathPrefix="/intel"
|
||||||
android:pathPrefix="/intel"/>
|
android:scheme="https"/>
|
||||||
<data
|
<data
|
||||||
android:host="www.ingress.com"
|
android:host="www.ingress.com"
|
||||||
android:scheme="http"
|
android:pathPrefix="/intel"
|
||||||
android:pathPrefix="/intel"/>
|
android:scheme="http"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<!-- Handles geo: URIs -->
|
<!-- Handles geo: URIs -->
|
||||||
@ -68,24 +68,24 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<!-- Points to searchable meta data. -->
|
<!-- Points to searchable meta data. -->
|
||||||
<meta-data android:name="android.app.searchable"
|
<meta-data
|
||||||
android:resource="@xml/searchable" />
|
android:name="android.app.searchable"
|
||||||
|
android:resource="@xml/searchable"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".IITC_PreferenceActivity"
|
android:name=".IITC_PreferenceActivity"
|
||||||
android:theme="@style/AppBaseTheme"
|
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||||
android:label="@string/app_name"
|
android:label="@string/activity_settings"
|
||||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"/>
|
android:theme="@style/AppBaseTheme"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".IITC_PluginPreferenceActivity"
|
android:name=".IITC_PluginPreferenceActivity"
|
||||||
android:theme="@style/AppBaseTheme"
|
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||||
android:label="@string/app_name"
|
android:label="@string/activity_plugins"
|
||||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"/>
|
android:theme="@style/AppBaseTheme"/>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".share.ShareActivity"
|
android:name=".share.ShareActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/activity_share"
|
||||||
android:noHistory="true"
|
android:noHistory="true"
|
||||||
android:parentActivityName="com.cradle.iitc_mobile.IITC_Mobile"
|
android:parentActivityName="com.cradle.iitc_mobile.IITC_Mobile"
|
||||||
android:theme="@android:style/Theme.Holo.Light.DarkActionBar">
|
android:theme="@android:style/Theme.Holo.Light.DarkActionBar">
|
||||||
@ -100,7 +100,7 @@
|
|||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:icon="@drawable/copy"
|
android:icon="@drawable/copy"
|
||||||
android:label="Copy to clipboard"
|
android:label="@string/activity_share_to_clipboard"
|
||||||
android:noHistory="false">
|
android:noHistory="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEND"/>
|
<action android:name="android.intent.action.SEND"/>
|
||||||
@ -137,4 +137,4 @@
|
|||||||
android:value="com.cradle.iitc_mobile.IITC_Mobile"/>
|
android:value="com.cradle.iitc_mobile.IITC_Mobile"/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -9,7 +9,7 @@ The Android App behaves like the desktop version, but uses the mobile view, whic
|
|||||||
|
|
||||||
- show users current location
|
- show users current location
|
||||||
|
|
||||||
- a geo intent is sent, when a portals Map link is clicked (lets you navigate to portals)
|
- share interface for portal links, portal navigation etc.
|
||||||
|
|
||||||
- a geolocate button (you have to enable GPS satellites + location access to use this feature)
|
- a geolocate button (you have to enable GPS satellites + location access to use this feature)
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ The Android App behaves like the desktop version, but uses the mobile view, whic
|
|||||||
|
|
||||||
- in-app search
|
- in-app search
|
||||||
|
|
||||||
- support for unofficial plugins. Just copy the *.user.js files to ```<storage_path>/IITC_Mobile/plugins/``` and they should appear at the end of the plugin list. Note: For every option a new persistent database entry is created. If you want to remove a plugin from your external storage you want to ensure that it is disabled in the settings, otherwise IITCM will always try to load it on start-up. If you messed this up you can wipe app data or add the plugin back to storage, disable it and remove it. Another option would be: Do nothing...it should work even so.
|
- support for unofficial plugins. Just copy the *.user.js files to ```<storage_path>/IITC_Mobile/plugins/``` and they should appear at the top of the plugin list. Note: For every option a new persistent database entry is created. If you want to remove a plugin from your external storage you want to ensure that it is disabled in the settings, otherwise IITCM will always try to load it on start-up. If you messed this up you can wipe app data or add the plugin back to storage, disable it and remove it. Another option would be: Do nothing...it should work even so.
|
||||||
|
|
||||||
- developer mode: all script source will be loaded from ```<storage_path>/IITC_Mobile/dev/```
|
- developer mode: all script source will be loaded from ```<storage_path>/IITC_Mobile/dev/```
|
||||||
|
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">IITC Mobile</string>
|
<string name="app_name">IITC Mobile</string>
|
||||||
|
<string name="activity_settings">IITC Mobile Settings</string>
|
||||||
|
<string name="activity_plugins">IITC Plugins</string>
|
||||||
|
<string name="activity_share">Share using…</string>
|
||||||
|
<string name="activity_share_to_clipboard">Copy to clipboard</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="reload">Reload IITC</string>
|
<string name="reload">Reload IITC</string>
|
||||||
<string name="version">Print Version</string>
|
<string name="version">Print Version</string>
|
||||||
@ -67,9 +71,9 @@
|
|||||||
<string name="pref_press_twice_to_exit">Press back button twice to exit</string>
|
<string name="pref_press_twice_to_exit">Press back button twice to exit</string>
|
||||||
<string name="pref_press_twice_to_exit_sum">Avoids accidental exits</string>
|
<string name="pref_press_twice_to_exit_sum">Avoids accidental exits</string>
|
||||||
<string name="pref_developer_options">Developer options</string>
|
<string name="pref_developer_options">Developer options</string>
|
||||||
<string name="pref_enable_dev_mode">Enable developer mode</string>
|
<string name="pref_enable_dev_mode">Enable developer mode</string>
|
||||||
<string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device.
|
<string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device.
|
||||||
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_advanced_menu">Display advanced menu</string>
|
<string name="pref_advanced_menu">Display advanced menu</string>
|
||||||
<string name="pref_advanced_menu_sum">In addition to the default IITC buttons the advanced menu
|
<string name="pref_advanced_menu_sum">In addition to the default IITC buttons the advanced menu
|
||||||
contains a debug pane plus an option to clear cookies</string>
|
contains a debug pane plus an option to clear cookies</string>
|
||||||
@ -99,4 +103,5 @@
|
|||||||
<string name="base_layers">Base Layers</string>
|
<string name="base_layers">Base Layers</string>
|
||||||
<string name="overlay_layers">Overlay Layers</string>
|
<string name="overlay_layers">Overlay Layers</string>
|
||||||
<string name="toggle_layer_selection">Deselect/Select all</string>
|
<string name="toggle_layer_selection">Deselect/Select all</string>
|
||||||
</resources>
|
|
||||||
|
</resources>
|
@ -185,12 +185,6 @@ body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#portal_highlight_select{
|
|
||||||
top:0px !important;
|
|
||||||
left:0px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for some reason leaflet popups on mobile are colored white on white
|
* for some reason leaflet popups on mobile are colored white on white
|
||||||
* so force the popup msg color to black
|
* so force the popup msg color to black
|
||||||
|
158
mobile/src/com/cradle/iitc_mobile/IITC_ActionBarHelper.java
Normal file
158
mobile/src/com/cradle/iitc_mobile/IITC_ActionBarHelper.java
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
package com.cradle.iitc_mobile;
|
||||||
|
|
||||||
|
import android.app.ActionBar;
|
||||||
|
import android.app.ActionBar.OnNavigationListener;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class IITC_ActionBarHelper implements OnNavigationListener {
|
||||||
|
// Show/hide the up arrow on the very left
|
||||||
|
// getActionBar().setDisplayHomeAsUpEnabled(enabled);
|
||||||
|
|
||||||
|
// Show/hide the activity icon/logo
|
||||||
|
// getActionBar().setDisplayShowHomeEnabled(enabled);
|
||||||
|
|
||||||
|
// Show/hide the activity title
|
||||||
|
// getActionBar().setDisplayShowTitleEnabled(enabled);
|
||||||
|
|
||||||
|
// Makes the icon/title clickable
|
||||||
|
// getActionBar().setHomeButtonEnabled(enabled);
|
||||||
|
|
||||||
|
private class HighlighterAdapter extends ArrayAdapter<String> {
|
||||||
|
public HighlighterAdapter() {
|
||||||
|
super(mIitc, android.R.layout.simple_list_item_1);
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add(String object) {
|
||||||
|
super.remove(object); // to avoid duplicates
|
||||||
|
super.add(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
super.clear();
|
||||||
|
add("No Highlights");// Probably must be the same as window._no_highlighter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IITC_Mobile mIitc;
|
||||||
|
private ActionBar mActionBar;
|
||||||
|
private SharedPreferences mPrefs;
|
||||||
|
private HighlighterAdapter mHighlighters;
|
||||||
|
|
||||||
|
private String mActiveHighlighter = null;
|
||||||
|
private boolean mDesktopMode = false;
|
||||||
|
private boolean mFullscreen = false;
|
||||||
|
private boolean mHideInFullscreen = false;
|
||||||
|
private int mPane = android.R.id.home;
|
||||||
|
|
||||||
|
public IITC_ActionBarHelper(IITC_Mobile activity, ActionBar bar) {
|
||||||
|
mIitc = activity;
|
||||||
|
mActionBar = bar;
|
||||||
|
mPrefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
|
mHighlighters = new HighlighterAdapter();
|
||||||
|
|
||||||
|
mActionBar.setDisplayShowHomeEnabled(true); // show icon
|
||||||
|
mActionBar.setListNavigationCallbacks(mHighlighters, this);
|
||||||
|
|
||||||
|
onPrefChanged(); // also calls updateActionBar()
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateActionBar() {
|
||||||
|
boolean showHighlighter = true;
|
||||||
|
|
||||||
|
if (mDesktopMode) {
|
||||||
|
mActionBar.setDisplayHomeAsUpEnabled(false); // Hide "up" indicator
|
||||||
|
mActionBar.setHomeButtonEnabled(false); // Make icon unclickable
|
||||||
|
mActionBar.setTitle(mIitc.getString(R.string.app_name));
|
||||||
|
} else {
|
||||||
|
if (mPane != android.R.id.home) {
|
||||||
|
mActionBar.setDisplayHomeAsUpEnabled(true); // Show "up" indicator
|
||||||
|
mActionBar.setHomeButtonEnabled(true);// Make icon clickable
|
||||||
|
showHighlighter = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mActionBar.setDisplayHomeAsUpEnabled(false); // Hide "up" indicator
|
||||||
|
mActionBar.setHomeButtonEnabled(false); // Make icon unclickable
|
||||||
|
}
|
||||||
|
mActionBar.setTitle(IITC_Mobile.PANE_TITLES.get(mPane, mIitc.getString(R.string.app_name)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mHighlighters.getCount() < 2) // there should always be "No Highlights"
|
||||||
|
showHighlighter = false;
|
||||||
|
|
||||||
|
if (showHighlighter) {
|
||||||
|
mActionBar.setDisplayShowTitleEnabled(false); // Hide title
|
||||||
|
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
||||||
|
setActiveHighlighter(mActiveHighlighter);
|
||||||
|
} else {
|
||||||
|
mActionBar.setDisplayShowTitleEnabled(true); // Show title
|
||||||
|
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||||
|
}
|
||||||
|
if (mFullscreen && mHideInFullscreen)
|
||||||
|
mActionBar.hide();
|
||||||
|
else
|
||||||
|
mActionBar.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPortalHighlighter(String name) {
|
||||||
|
mHighlighters.add(name);
|
||||||
|
|
||||||
|
if (name.equals(mActiveHighlighter))
|
||||||
|
setActiveHighlighter(name);
|
||||||
|
|
||||||
|
updateActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hideInFullscreen() {
|
||||||
|
return mHideInFullscreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onNavigationItemSelected(int position, long itemId) {
|
||||||
|
String name = mHighlighters.getItem(position);
|
||||||
|
mIitc.getWebView().loadUrl("javascript: window.changePortalHighlights('" + name + "')");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPrefChanged() {
|
||||||
|
mDesktopMode = mPrefs.getBoolean("pref_force_desktop", false);
|
||||||
|
mHideInFullscreen = mPrefs.getBoolean("pref_fullscreen_actionbar", false);
|
||||||
|
updateActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
mHighlighters.clear();
|
||||||
|
mPane = android.R.id.home;
|
||||||
|
updateActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActiveHighlighter(String name) {
|
||||||
|
mActiveHighlighter = name;
|
||||||
|
|
||||||
|
if (mActionBar.getNavigationMode() == ActionBar.NAVIGATION_MODE_LIST) {
|
||||||
|
int position = mHighlighters.getPosition(mActiveHighlighter);
|
||||||
|
if (position >= 0 && position < mActionBar.getNavigationItemCount())
|
||||||
|
mActionBar.setSelectedNavigationItem(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFullscreen(boolean fullscreen) {
|
||||||
|
mFullscreen = fullscreen;
|
||||||
|
if (mFullscreen && mHideInFullscreen) {
|
||||||
|
// show a toast with instructions to exit the fullscreen mode again
|
||||||
|
Toast.makeText(mIitc, "Press back button to exit fullscreen", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void switchTo(int button) {
|
||||||
|
mPane = button;
|
||||||
|
updateActionBar();
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,5 @@
|
|||||||
package com.cradle.iitc_mobile;
|
package com.cradle.iitc_mobile;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
@ -25,6 +20,11 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.cradle.iitc_mobile.share.ShareActivity;
|
import com.cradle.iitc_mobile.share.ShareActivity;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
// provide communication between IITC script and android app
|
// provide communication between IITC script and android app
|
||||||
public class IITC_JSInterface {
|
public class IITC_JSInterface {
|
||||||
|
|
||||||
@ -96,46 +96,20 @@ public class IITC_JSInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void switchToPane(String id) {
|
public void switchToPane(final String id) {
|
||||||
|
|
||||||
final IITC_Mobile iitcm = (IITC_Mobile) mContext;
|
final IITC_Mobile iitcm = (IITC_Mobile) mContext;
|
||||||
final int button_id;
|
|
||||||
final String title;
|
|
||||||
|
|
||||||
if (id.equals("map")) {
|
|
||||||
button_id = android.R.id.home;
|
|
||||||
title = iitcm.getString(R.string.app_name);
|
|
||||||
} else if (id.equals("info")) {
|
|
||||||
button_id = R.id.menu_info;
|
|
||||||
title = "Info";
|
|
||||||
} else if (id.equals("full")) {
|
|
||||||
button_id = R.id.menu_full;
|
|
||||||
title = "Full";
|
|
||||||
} else if (id.equals("compact")) {
|
|
||||||
button_id = R.id.menu_compact;
|
|
||||||
title = "Compact";
|
|
||||||
} else if (id.equals("public")) {
|
|
||||||
button_id = R.id.menu_public;
|
|
||||||
title = "Public";
|
|
||||||
} else if (id.equals("faction")) {
|
|
||||||
button_id = R.id.menu_faction;
|
|
||||||
title = "Faction";
|
|
||||||
} else if (id.equals("debug")) {
|
|
||||||
button_id = R.id.menu_debug;
|
|
||||||
title = "Debug";
|
|
||||||
}
|
|
||||||
// default
|
|
||||||
else {
|
|
||||||
button_id = android.R.id.home;
|
|
||||||
title = iitcm.getString(R.string.app_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.d("iitcm", "switch to pane " + id);
|
|
||||||
iitcm.runOnUiThread(new Runnable() {
|
iitcm.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
iitcm.getActionBar().setTitle(title);
|
IITC_ActionBarHelper actionbar = iitcm.getActionBarHelper();
|
||||||
iitcm.backStackUpdate(button_id);
|
Integer button = IITC_Mobile.PANES.get(id);
|
||||||
|
|
||||||
|
if (button == null)
|
||||||
|
button = android.R.id.home;
|
||||||
|
|
||||||
|
actionbar.switchTo(button);
|
||||||
|
iitcm.backStackUpdate(button);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -169,10 +143,10 @@ public class IITC_JSInterface {
|
|||||||
public void setLayers(String base_layer, String overlay_layer) {
|
public void setLayers(String base_layer, String overlay_layer) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the layer strings have a form like:
|
* the layer strings have a form like:
|
||||||
* [{"layerId":27,"name":"MapQuest OSM","active":true},
|
* [{"layerId":27,"name":"MapQuest OSM","active":true},
|
||||||
* {"layerId":28,"name":"Default Ingress Map","active":false}]
|
* {"layerId":28,"name":"Default Ingress Map","active":false}]
|
||||||
* Put it in a JSONArray and parse it
|
* Put it in a JSONArray and parse it
|
||||||
*/
|
*/
|
||||||
JSONArray base_layersJSON = null;
|
JSONArray base_layersJSON = null;
|
||||||
JSONArray overlay_layersJSON = null;
|
JSONArray overlay_layersJSON = null;
|
||||||
@ -256,6 +230,28 @@ public class IITC_JSInterface {
|
|||||||
showMultiSelection();
|
showMultiSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void addPortalHighlighter(final String name) {
|
||||||
|
final IITC_Mobile iitc = ((IITC_Mobile) mContext);
|
||||||
|
iitc.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
iitc.getActionBarHelper().addPortalHighlighter(name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void setActiveHighlighter(final String name) {
|
||||||
|
final IITC_Mobile iitc = ((IITC_Mobile) mContext);
|
||||||
|
iitc.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
iitc.getActionBarHelper().setActiveHighlighter(name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// show all overlay layers in a multi selection list dialog
|
// show all overlay layers in a multi selection list dialog
|
||||||
private void showMultiSelection() {
|
private void showMultiSelection() {
|
||||||
// build the layer chooser dialog
|
// build the layer chooser dialog
|
||||||
@ -287,6 +283,7 @@ public class IITC_JSInterface {
|
|||||||
final ListView list = dialog.getListView();
|
final ListView list = dialog.getListView();
|
||||||
list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||||
boolean disable = false;
|
boolean disable = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
|
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
@ -13,14 +13,12 @@ import android.content.res.Configuration;
|
|||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.location.LocationListener;
|
import android.location.LocationListener;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.SparseArray;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -35,6 +33,7 @@ import android.widget.Toast;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class IITC_Mobile extends Activity {
|
public class IITC_Mobile extends Activity {
|
||||||
|
|
||||||
@ -48,8 +47,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
private LocationManager mLocMngr = null;
|
private LocationManager mLocMngr = null;
|
||||||
private LocationListener mLocListener = null;
|
private LocationListener mLocListener = null;
|
||||||
private boolean mFullscreenMode = false;
|
private boolean mFullscreenMode = false;
|
||||||
private boolean mFullscreenActionbar = false;
|
|
||||||
private ActionBar mActionBar;
|
|
||||||
private IITC_DeviceAccountLogin mLogin;
|
private IITC_DeviceAccountLogin mLogin;
|
||||||
private MenuItem mSearchMenuItem;
|
private MenuItem mSearchMenuItem;
|
||||||
private boolean mDesktopMode = false;
|
private boolean mDesktopMode = false;
|
||||||
@ -57,6 +54,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
private boolean mReloadNeeded = false;
|
private boolean mReloadNeeded = false;
|
||||||
private final ArrayList<String> mDialogStack = new ArrayList<String>();
|
private final ArrayList<String> mDialogStack = new ArrayList<String>();
|
||||||
private SharedPreferences mSharedPrefs;
|
private SharedPreferences mSharedPrefs;
|
||||||
|
private IITC_ActionBarHelper mActionBarHelper;
|
||||||
|
|
||||||
// Used for custom back stack handling
|
// Used for custom back stack handling
|
||||||
private final ArrayList<Integer> mBackStack = new ArrayList<Integer>();
|
private final ArrayList<Integer> mBackStack = new ArrayList<Integer>();
|
||||||
@ -64,6 +62,27 @@ public class IITC_Mobile extends Activity {
|
|||||||
private int mCurrentPane = android.R.id.home;
|
private int mCurrentPane = android.R.id.home;
|
||||||
private boolean mBackButtonPressed = false;
|
private boolean mBackButtonPressed = false;
|
||||||
|
|
||||||
|
public static final SparseArray<String> PANE_TITLES = new SparseArray<String>();
|
||||||
|
public static final HashMap<String, Integer> PANES = new HashMap<String, Integer>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
PANES.put("map", android.R.id.home);
|
||||||
|
PANES.put("info", R.id.menu_info);
|
||||||
|
PANES.put("full", R.id.menu_full);
|
||||||
|
PANES.put("compact", R.id.menu_compact);
|
||||||
|
PANES.put("public", R.id.menu_public);
|
||||||
|
PANES.put("faction", R.id.menu_faction);
|
||||||
|
PANES.put("debug", R.id.menu_debug);
|
||||||
|
|
||||||
|
// No need to declare android.R.id.home - that title is default
|
||||||
|
PANE_TITLES.append(R.id.menu_info, "Info");
|
||||||
|
PANE_TITLES.append(R.id.menu_full, "Full");
|
||||||
|
PANE_TITLES.append(R.id.menu_compact, "Compact");
|
||||||
|
PANE_TITLES.append(R.id.menu_public, "Public");
|
||||||
|
PANE_TITLES.append(R.id.menu_faction, "Faction");
|
||||||
|
PANE_TITLES.append(R.id.menu_debug, "Debug");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -74,38 +93,25 @@ public class IITC_Mobile extends Activity {
|
|||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
mIitcWebView = (IITC_WebView) findViewById(R.id.iitc_webview);
|
mIitcWebView = (IITC_WebView) findViewById(R.id.iitc_webview);
|
||||||
|
|
||||||
// fetch actionbar, set display flags, title and enable home button
|
// pass ActionBar to helper because we deprecated getActionBar
|
||||||
mActionBar = this.getActionBar();
|
mActionBarHelper = new IITC_ActionBarHelper(this, super.getActionBar());
|
||||||
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME
|
|
||||||
| ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
|
|
||||||
mActionBar.setTitle(getString(R.string.app_name));
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
|
||||||
mActionBar.setHomeButtonEnabled(true);
|
|
||||||
|
|
||||||
// do something if user changed something in the settings
|
// do something if user changed something in the settings
|
||||||
mSharedPrefs = PreferenceManager
|
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
.getDefaultSharedPreferences(this);
|
|
||||||
mSharedPrefChangeListener = new OnSharedPreferenceChangeListener() {
|
mSharedPrefChangeListener = new OnSharedPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(
|
public void onSharedPreferenceChanged(
|
||||||
SharedPreferences sharedPreferences, String key) {
|
SharedPreferences sharedPreferences, String key) {
|
||||||
if (key.equals("pref_force_desktop")) {
|
if (key.equals("pref_force_desktop")) {
|
||||||
mDesktopMode = sharedPreferences.getBoolean("pref_force_desktop", false);
|
mDesktopMode = sharedPreferences.getBoolean("pref_force_desktop", false);
|
||||||
if (mDesktopMode) {
|
mActionBarHelper.onPrefChanged();
|
||||||
setActionBarHomeEnabledWithUp(false);
|
|
||||||
mActionBar.setTitle(getString(R.string.app_name));
|
|
||||||
} else mActionBar.setHomeButtonEnabled(true);
|
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
if (key.equals("pref_user_loc"))
|
if (key.equals("pref_user_loc"))
|
||||||
mIsLocEnabled = sharedPreferences.getBoolean("pref_user_loc",
|
mIsLocEnabled = sharedPreferences.getBoolean("pref_user_loc",
|
||||||
false);
|
false);
|
||||||
if (key.equals("pref_fullscreen_actionbar")) {
|
if (key.equals("pref_fullscreen_actionbar")) {
|
||||||
mFullscreenActionbar = sharedPreferences.getBoolean("pref_fullscreen_actionbar",
|
mActionBarHelper.onPrefChanged();
|
||||||
false);
|
|
||||||
if (mFullscreenMode)
|
|
||||||
IITC_Mobile.this.getActionBar().hide();
|
|
||||||
// no iitc reload needed here
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (key.equals("pref_advanced_menu")) {
|
if (key.equals("pref_advanced_menu")) {
|
||||||
@ -142,8 +148,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
mLastLocation = location;
|
mLastLocation = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStatusChanged(String provider, int status,
|
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||||
Bundle extras) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onProviderEnabled(String provider) {
|
public void onProviderEnabled(String provider) {
|
||||||
@ -163,11 +168,8 @@ public class IITC_Mobile extends Activity {
|
|||||||
mLocListener);
|
mLocListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
mFullscreenActionbar = mSharedPrefs.getBoolean("pref_fullscreen_actionbar", false);
|
|
||||||
|
|
||||||
// Clear the back stack
|
// Clear the back stack
|
||||||
mBackStack.clear();
|
mBackStack.clear();
|
||||||
setActionBarHomeEnabledWithUp(false);
|
|
||||||
|
|
||||||
handleIntent(getIntent(), true);
|
handleIntent(getIntent(), true);
|
||||||
}
|
}
|
||||||
@ -222,7 +224,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
(SearchView) mSearchMenuItem.getActionView();
|
(SearchView) mSearchMenuItem.getActionView();
|
||||||
searchView.setQuery(query, false);
|
searchView.setQuery(query, false);
|
||||||
searchView.clearFocus();
|
searchView.clearFocus();
|
||||||
mActionBar.setTitle(getString(R.string.app_name));
|
mActionBarHelper.switchTo(android.R.id.home);
|
||||||
backStackUpdate(android.R.id.home);
|
backStackUpdate(android.R.id.home);
|
||||||
mIitcWebView.loadUrl("javascript:search('" + query + "');");
|
mIitcWebView.loadUrl("javascript:search('" + query + "');");
|
||||||
return;
|
return;
|
||||||
@ -252,17 +254,13 @@ public class IITC_Mobile extends Activity {
|
|||||||
throw use;
|
throw use;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parts.length > 1) // query string present
|
if (parts.length > 1) { // query string present
|
||||||
{
|
|
||||||
// search for z=
|
// search for z=
|
||||||
for (String param : parts[1].split("&")) {
|
for (String param : parts[1].split("&")) {
|
||||||
if (param.startsWith("z="))
|
if (param.startsWith("z=")) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
z = Integer.valueOf(param.substring(2));
|
z = Integer.valueOf(param.substring(2));
|
||||||
} catch (NumberFormatException e)
|
} catch (NumberFormatException e) {
|
||||||
{
|
|
||||||
URISyntaxException use = new URISyntaxException(uri.toString(), "could not parse zoom level");
|
URISyntaxException use = new URISyntaxException(uri.toString(), "could not parse zoom level");
|
||||||
use.initCause(e);
|
use.initCause(e);
|
||||||
throw use;
|
throw use;
|
||||||
@ -283,61 +281,32 @@ public class IITC_Mobile extends Activity {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
// enough idle...let's do some work
|
// enough idle...let's do some work
|
||||||
Log.d("iitcm", "resuming...setting reset idleTimer");
|
Log.d("iitcm", "resuming...reset idleTimer");
|
||||||
mIitcWebView.loadUrl("javascript: window.idleTime = 0");
|
|
||||||
mIitcWebView.updateCaching();
|
mIitcWebView.updateCaching();
|
||||||
|
|
||||||
if (mIsLocEnabled) {
|
if (mIsLocEnabled) {
|
||||||
// Register the mSharedPrefChangeListener with the Location Manager to receive
|
// Register the mSharedPrefChangeListener with the Location Manager to receive
|
||||||
// location updates
|
// location updates
|
||||||
mLocMngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
|
mLocMngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mLocListener);
|
||||||
0, 0, mLocListener);
|
mLocMngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mLocListener);
|
||||||
mLocMngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
|
|
||||||
mLocListener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mReloadNeeded) {
|
if (mReloadNeeded) {
|
||||||
Log.d("iitcm", "preference had changed...reload needed");
|
Log.d("iitcm", "preference had changed...reload needed");
|
||||||
this.loadUrl(mIntelUrl);
|
reloadIITC();
|
||||||
mReloadNeeded = false;
|
}
|
||||||
|
else {
|
||||||
|
// iitc is not fully booted...timer will be reset by the script itself
|
||||||
|
if (findViewById(R.id.imageLoading).getVisibility() == View.GONE) {
|
||||||
|
mIitcWebView.loadUrl("javascript: window.idleReset();");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
ConnectivityManager conMan =
|
|
||||||
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
|
|
||||||
NetworkInfo mobile = conMan
|
|
||||||
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
|
||||||
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
|
||||||
|
|
||||||
// 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
|
|
||||||
if (mobile != null) {
|
|
||||||
Log.d("iitcm", "mobile internet module detected...check states");
|
|
||||||
if (mobile.getState() == NetworkInfo.State.CONNECTED
|
|
||||||
|| mobile.getState() == NetworkInfo.State.CONNECTING) {
|
|
||||||
Log.d("iitcm",
|
|
||||||
"connected to mobile net...abort all running requests");
|
|
||||||
// cancel all current requests
|
|
||||||
mIitcWebView.loadUrl("javascript: window.requests.abort()");
|
|
||||||
// set idletime to maximum...no need for more
|
|
||||||
mIitcWebView.loadUrl("javascript: window.idleTime = 999");
|
|
||||||
} else if (wifi.getState() == NetworkInfo.State.CONNECTED
|
|
||||||
|| wifi.getState() == NetworkInfo.State.CONNECTING) {
|
|
||||||
mIitcWebView.loadUrl("javascript: window.idleTime = 999");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.d("iitcm",
|
|
||||||
"no mobile internet module detected...check wifi state");
|
|
||||||
if (wifi.getState() == NetworkInfo.State.CONNECTED
|
|
||||||
|| wifi.getState() == NetworkInfo.State.CONNECTING) {
|
|
||||||
mIitcWebView.loadUrl("javascript: window.idleTime = 999");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Log.d("iitcm", "stopping iitcm");
|
Log.d("iitcm", "stopping iitcm");
|
||||||
|
mIitcWebView.loadUrl("javascript: window.idleSet();");
|
||||||
|
|
||||||
if (mIsLocEnabled)
|
if (mIsLocEnabled)
|
||||||
mLocMngr.removeUpdates(mLocListener);
|
mLocMngr.removeUpdates(mLocListener);
|
||||||
@ -369,7 +338,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
}
|
}
|
||||||
// exit fullscreen mode if it is enabled and action bar is disabled
|
// exit fullscreen mode if it is enabled and action bar is disabled
|
||||||
// or the back stack is empty
|
// or the back stack is empty
|
||||||
if (mFullscreenMode && (mBackStack.isEmpty() || mFullscreenActionbar)) {
|
if (mFullscreenMode && (mBackStack.isEmpty() || mActionBarHelper.hideInFullscreen())) {
|
||||||
this.toggleFullscreen();
|
this.toggleFullscreen();
|
||||||
} else if (!mBackStack.isEmpty()) {
|
} else if (!mBackStack.isEmpty()) {
|
||||||
// Pop last item from backstack and pretend the relevant menu item was clicked
|
// Pop last item from backstack and pretend the relevant menu item was clicked
|
||||||
@ -391,19 +360,12 @@ public class IITC_Mobile extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setActionBarHomeEnabledWithUp(boolean enabled) {
|
|
||||||
mActionBar.setDisplayHomeAsUpEnabled(enabled);
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
|
||||||
mActionBar.setHomeButtonEnabled(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void backStackPop() {
|
public void backStackPop() {
|
||||||
// shouldn't be called when back stack is empty
|
// shouldn't be called when back stack is empty
|
||||||
// catch wrong usage
|
// catch wrong usage
|
||||||
if (mBackStack.isEmpty()) {
|
if (mBackStack.isEmpty()) {
|
||||||
// Empty back stack means we should be at home (ie map) screen
|
// Empty back stack means we should be at home (ie map) screen
|
||||||
setActionBarHomeEnabledWithUp(false);
|
mActionBarHelper.switchTo(android.R.id.home);
|
||||||
mActionBar.setTitle(getString(R.string.app_name));
|
|
||||||
mIitcWebView.loadUrl("javascript: window.show('map');");
|
mIitcWebView.loadUrl("javascript: window.show('map');");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -427,13 +389,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mCurrentPane = itemId;
|
mCurrentPane = itemId;
|
||||||
if (mBackStack.size() >= 1) {
|
|
||||||
setActionBarHomeEnabledWithUp(true);
|
|
||||||
} else {
|
|
||||||
// if we popped our last item from stack...illustrate it on home button
|
|
||||||
// Empty back stack means we should be at home (ie map) screen
|
|
||||||
setActionBarHomeEnabledWithUp(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -480,14 +435,13 @@ public class IITC_Mobile extends Activity {
|
|||||||
// the getLayers function calls the setLayers method of IITC_JSInterface
|
// the getLayers function calls the setLayers method of IITC_JSInterface
|
||||||
mIitcWebView.loadUrl("javascript: window.layerChooser.getLayers()");
|
mIitcWebView.loadUrl("javascript: window.layerChooser.getLayers()");
|
||||||
return true;
|
return true;
|
||||||
// get the users current location and focus it on map
|
case R.id.locate: // get the users current location and focus it on map
|
||||||
case R.id.locate:
|
|
||||||
mIitcWebView.loadUrl("javascript: window.show('map');");
|
mIitcWebView.loadUrl("javascript: window.show('map');");
|
||||||
// get location from network by default
|
// get location from network by default
|
||||||
if (!mIsLocEnabled) {
|
if (!mIsLocEnabled) {
|
||||||
mIitcWebView.loadUrl("javascript: " +
|
mIitcWebView.loadUrl("javascript: " +
|
||||||
"window.map.locate({setView : true, maxZoom: 15});");
|
"window.map.locate({setView : true, maxZoom: 15});");
|
||||||
// if gps location is displayed we can use a better location without any costs
|
// if gps location is displayed we can use a better location without any costs
|
||||||
} else {
|
} else {
|
||||||
if (mLastLocation != null)
|
if (mLastLocation != null)
|
||||||
mIitcWebView.loadUrl("javascript: window.map.setView(new L.LatLng(" +
|
mIitcWebView.loadUrl("javascript: window.map.setView(new L.LatLng(" +
|
||||||
@ -495,8 +449,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
mLastLocation.getLongitude() + "), 15);");
|
mLastLocation.getLongitude() + "), 15);");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
// start settings activity
|
case R.id.action_settings: // start settings activity
|
||||||
case R.id.action_settings:
|
|
||||||
Intent intent = new Intent(this, IITC_PreferenceActivity.class);
|
Intent intent = new Intent(this, IITC_PreferenceActivity.class);
|
||||||
intent.putExtra("iitc_version", mIitcWebView.getWebViewClient()
|
intent.putExtra("iitc_version", mIitcWebView.getWebViewClient()
|
||||||
.getIITCVersion());
|
.getIITCVersion());
|
||||||
@ -530,12 +483,12 @@ public class IITC_Mobile extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reloadIITC() {
|
public void reloadIITC() {
|
||||||
mActionBar.setTitle(getString(R.string.app_name));
|
mActionBarHelper.reset();
|
||||||
mBackStack.clear();
|
mBackStack.clear();
|
||||||
setActionBarHomeEnabledWithUp(false);
|
|
||||||
// iitc starts on map after reload
|
// iitc starts on map after reload
|
||||||
mCurrentPane = android.R.id.home;
|
mCurrentPane = android.R.id.home;
|
||||||
this.loadUrl(mIntelUrl);
|
loadUrl(mIntelUrl);
|
||||||
|
mReloadNeeded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadIITC() {
|
private void loadIITC() {
|
||||||
@ -580,19 +533,9 @@ public class IITC_Mobile extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void toggleFullscreen() {
|
public void toggleFullscreen() {
|
||||||
if (mFullscreenMode) {
|
mFullscreenMode = !mFullscreenMode;
|
||||||
if (mFullscreenActionbar)
|
mActionBarHelper.setFullscreen(mFullscreenMode);
|
||||||
this.getActionBar().show();
|
|
||||||
this.mFullscreenMode = false;
|
|
||||||
} else {
|
|
||||||
if (mFullscreenActionbar) {
|
|
||||||
this.getActionBar().hide();
|
|
||||||
// show a toast with instructions to exit the fc mode again
|
|
||||||
Toast.makeText(this, "Press back button to exit fullscreen",
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
this.mFullscreenMode = true;
|
|
||||||
}
|
|
||||||
// toggle notification bar
|
// toggle notification bar
|
||||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||||
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
@ -628,7 +571,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
* called by IITC_WebViewClient when the Google login form is opened.
|
* called by IITC_WebViewClient when the Google login form is opened.
|
||||||
*/
|
*/
|
||||||
public void onReceivedLoginRequest(IITC_WebViewClient client, WebView view,
|
public void onReceivedLoginRequest(IITC_WebViewClient client, WebView view,
|
||||||
String realm, String account, String args) {
|
String realm, String account, String args) {
|
||||||
Log.d("iitcm", "logging in...set caching mode to default");
|
Log.d("iitcm", "logging in...set caching mode to default");
|
||||||
mIitcWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
mIitcWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||||
mLogin = new IITC_DeviceAccountLogin(this, view, client);
|
mLogin = new IITC_DeviceAccountLogin(this, view, client);
|
||||||
@ -689,4 +632,17 @@ public class IITC_Mobile extends Activity {
|
|||||||
item = menu.findItem(R.id.menu_clear_cookies);
|
item = menu.findItem(R.id.menu_clear_cookies);
|
||||||
item.setVisible(mAdvancedMenu);
|
item.setVisible(mAdvancedMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated ActionBar related stuff should be handled by ActionBarHelper
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public ActionBar getActionBar() {
|
||||||
|
return super.getActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IITC_ActionBarHelper getActionBarHelper() {
|
||||||
|
return mActionBarHelper;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.cradle.iitc_mobile;
|
package com.cradle.iitc_mobile;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -43,9 +42,8 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBuildHeaders(List<Header> target) {
|
public void onBuildHeaders(List<Header> target) {
|
||||||
ActionBar bar = getActionBar();
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
bar.setTitle("IITC Plugins");
|
|
||||||
bar.setDisplayHomeAsUpEnabled(true);
|
|
||||||
mHeaders = target;
|
mHeaders = target;
|
||||||
// since the plugins container is static,
|
// since the plugins container is static,
|
||||||
// it is enough to parse the plugin only on first start.
|
// it is enough to parse the plugin only on first start.
|
||||||
@ -62,8 +60,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
// exit settings when home button (iitc icon) is pressed
|
case android.R.id.home: // exit settings when home button (iitc icon) is pressed
|
||||||
case android.R.id.home:
|
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@ -157,8 +154,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPluginPreference(String src, String plugin_key,
|
void addPluginPreference(String src, String plugin_key, boolean user) {
|
||||||
boolean user) {
|
|
||||||
|
|
||||||
// now parse plugin name, description and category
|
// now parse plugin name, description and category
|
||||||
String header = src.substring(src.indexOf("==UserScript=="),
|
String header = src.substring(src.indexOf("==UserScript=="),
|
||||||
@ -186,8 +182,14 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
plugin_name = plugin_name.replace("IITC plugin: ", "");
|
plugin_name = plugin_name.replace("IITC plugin: ", "");
|
||||||
|
|
||||||
// add [User] tag to user plugins
|
// add [User] tag to user plugins
|
||||||
if (user)
|
if (user) {
|
||||||
plugin_cat = USER_PLUGIN + plugin_cat;
|
plugin_cat = USER_PLUGIN + plugin_cat;
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not add deleted plugins
|
||||||
|
if (plugin_cat.equals("Deleted")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// now we have all stuff together and can build the preference
|
// now we have all stuff together and can build the preference
|
||||||
// first check if we need a new category
|
// first check if we need a new category
|
||||||
@ -306,20 +308,20 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
holder = new HeaderViewHolder();
|
holder = new HeaderViewHolder();
|
||||||
switch (headerType) {
|
switch (headerType) {
|
||||||
case HEADER_TYPE_CATEGORY:
|
case HEADER_TYPE_CATEGORY:
|
||||||
view = new TextView(getContext(), null,
|
view = new TextView(getContext(), null,
|
||||||
android.R.attr.listSeparatorTextViewStyle);
|
android.R.attr.listSeparatorTextViewStyle);
|
||||||
holder.title = (TextView) view;
|
holder.title = (TextView) view;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_TYPE_NORMAL:
|
case HEADER_TYPE_NORMAL:
|
||||||
view = mInflater.inflate(R.layout.preference_header_item,
|
view = mInflater.inflate(R.layout.preference_header_item,
|
||||||
parent, false);
|
parent, false);
|
||||||
holder.title = (TextView) view
|
holder.title = (TextView) view
|
||||||
.findViewById(R.id.plug_pref_title);
|
.findViewById(R.id.plug_pref_title);
|
||||||
holder.summary = (TextView) view
|
holder.summary = (TextView) view
|
||||||
.findViewById(R.id.plug_pref_summary);
|
.findViewById(R.id.plug_pref_summary);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
view.setTag(holder);
|
view.setTag(holder);
|
||||||
} else {
|
} else {
|
||||||
@ -330,22 +332,22 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
// All view fields must be updated every time, because the view may
|
// All view fields must be updated every time, because the view may
|
||||||
// be recycled
|
// be recycled
|
||||||
switch (headerType) {
|
switch (headerType) {
|
||||||
case HEADER_TYPE_CATEGORY:
|
case HEADER_TYPE_CATEGORY:
|
||||||
holder.title.setText(header.getTitle(getContext()
|
holder.title.setText(header.getTitle(getContext()
|
||||||
.getResources()));
|
.getResources()));
|
||||||
break;
|
break;
|
||||||
case HEADER_TYPE_NORMAL:
|
case HEADER_TYPE_NORMAL:
|
||||||
holder.title.setText(header.getTitle(getContext()
|
holder.title.setText(header.getTitle(getContext()
|
||||||
.getResources()));
|
.getResources()));
|
||||||
CharSequence summary = header.getSummary(getContext()
|
CharSequence summary = header.getSummary(getContext()
|
||||||
.getResources());
|
.getResources());
|
||||||
if (!TextUtils.isEmpty(summary)) {
|
if (!TextUtils.isEmpty(summary)) {
|
||||||
holder.summary.setVisibility(View.VISIBLE);
|
holder.summary.setVisibility(View.VISIBLE);
|
||||||
holder.summary.setText(summary);
|
holder.summary.setText(summary);
|
||||||
} else {
|
} else {
|
||||||
holder.summary.setVisibility(View.GONE);
|
holder.summary.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
@ -14,8 +14,6 @@ public class IITC_PreferenceActivity extends Activity {
|
|||||||
|
|
||||||
MainSettings settings = new MainSettings();
|
MainSettings settings = new MainSettings();
|
||||||
|
|
||||||
// set action bar title
|
|
||||||
getActionBar().setTitle("IITC Mobile Settings");
|
|
||||||
getActionBar().setHomeButtonEnabled(true);
|
getActionBar().setHomeButtonEnabled(true);
|
||||||
|
|
||||||
// iitc version
|
// iitc version
|
||||||
@ -23,15 +21,16 @@ public class IITC_PreferenceActivity extends Activity {
|
|||||||
settings.setArguments(bundle);
|
settings.setArguments(bundle);
|
||||||
|
|
||||||
// Display the fragment as the main content.
|
// Display the fragment as the main content.
|
||||||
getFragmentManager().beginTransaction()
|
getFragmentManager()
|
||||||
.replace(android.R.id.content, settings).commit();
|
.beginTransaction()
|
||||||
|
.replace(android.R.id.content, settings)
|
||||||
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
// exit settings when home button (iitc icon) is pressed
|
case android.R.id.home: // exit settings when home button (iitc icon) is pressed
|
||||||
case android.R.id.home:
|
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
@ -8,7 +8,6 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.cradle.iitc_mobile.IITC_JSInterface;
|
import com.cradle.iitc_mobile.IITC_JSInterface;
|
||||||
import com.cradle.iitc_mobile.IITC_Mobile;
|
import com.cradle.iitc_mobile.IITC_Mobile;
|
||||||
import com.cradle.iitc_mobile.IITC_WebView;
|
|
||||||
|
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
|
@ -42,8 +42,7 @@ public class IntentFragment extends Fragment implements OnScrollListener, OnItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
{
|
|
||||||
Intent intent = mListView.getTargetIntent(position);
|
Intent intent = mListView.getTargetIntent(position);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.cradle.iitc_mobile.share;
|
package com.cradle.iitc_mobile.share;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentPagerAdapter;
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class IntentFragmentAdapter extends FragmentPagerAdapter {
|
public class IntentFragmentAdapter extends FragmentPagerAdapter {
|
||||||
private List<IntentFragment> mTabs;
|
private List<IntentFragment> mTabs;
|
||||||
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package com.cradle.iitc_mobile.share;
|
package com.cradle.iitc_mobile.share;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -24,6 +19,11 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.cradle.iitc_mobile.R;
|
import com.cradle.iitc_mobile.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class IntentListView extends ListView {
|
public class IntentListView extends ListView {
|
||||||
private static class CopyHandler extends Pair<String, String> {
|
private static class CopyHandler extends Pair<String, String> {
|
||||||
public CopyHandler(ResolveInfo resolveInfo) {
|
public CopyHandler(ResolveInfo resolveInfo) {
|
||||||
@ -35,10 +35,8 @@ public class IntentListView extends ListView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class IntentAdapter extends ArrayAdapter<ResolveInfo>
|
private class IntentAdapter extends ArrayAdapter<ResolveInfo> {
|
||||||
{
|
private IntentAdapter() {
|
||||||
private IntentAdapter()
|
|
||||||
{
|
|
||||||
super(IntentListView.this.getContext(), android.R.layout.simple_list_item_1);
|
super(IntentListView.this.getContext(), android.R.layout.simple_list_item_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,8 +124,7 @@ public class IntentListView extends ListView {
|
|||||||
setIntents(intentList);
|
setIntents(intentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIntents(ArrayList<Intent> intents)
|
public void setIntents(ArrayList<Intent> intents) {
|
||||||
{
|
|
||||||
mAdapter.setNotifyOnChange(false);
|
mAdapter.setNotifyOnChange(false);
|
||||||
mAdapter.clear();
|
mAdapter.clear();
|
||||||
|
|
||||||
@ -154,10 +151,8 @@ public class IntentListView extends ListView {
|
|||||||
ActivityInfo activity = info.activityInfo;
|
ActivityInfo activity = info.activityInfo;
|
||||||
|
|
||||||
// remove all IITCm intents, except for SendToClipboard in case Drive is not installed
|
// remove all IITCm intents, except for SendToClipboard in case Drive is not installed
|
||||||
if (activity.packageName.equals(packageName))
|
if (activity.packageName.equals(packageName)) {
|
||||||
{
|
if (hasCopyIntent || !activity.name.equals(SendToClipboard.class.getCanonicalName())) {
|
||||||
if (hasCopyIntent || !activity.name.equals(SendToClipboard.class.getCanonicalName()))
|
|
||||||
{
|
|
||||||
activityList.remove(i);
|
activityList.remove(i);
|
||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
|
@ -7,6 +7,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.cradle.iitc_mobile.R;
|
import com.cradle.iitc_mobile.R;
|
||||||
|
|
||||||
public class SendToClipboard extends Activity {
|
public class SendToClipboard extends Activity {
|
||||||
|
@ -16,7 +16,6 @@ import com.cradle.iitc_mobile.R;
|
|||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.text.DecimalFormatSymbols;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ShareActivity extends FragmentActivity implements ActionBar.TabListener {
|
public class ShareActivity extends FragmentActivity implements ActionBar.TabListener {
|
||||||
@ -28,15 +27,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
|||||||
IntentFragmentAdapter mFragmentAdapter;
|
IntentFragmentAdapter mFragmentAdapter;
|
||||||
ViewPager mViewPager;
|
ViewPager mViewPager;
|
||||||
|
|
||||||
private void addTab(Intent intent, int label, int icon)
|
private void addTab(ArrayList<Intent> intents, int label, int icon) {
|
||||||
{
|
|
||||||
ArrayList<Intent> intents = new ArrayList<Intent>(1);
|
|
||||||
intents.add(intent);
|
|
||||||
addTab(intents, label, icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addTab(ArrayList<Intent> intents, int label, int icon)
|
|
||||||
{
|
|
||||||
IntentFragment fragment = new IntentFragment();
|
IntentFragment fragment = new IntentFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putParcelableArrayList("intents", intents);
|
args.putParcelableArrayList("intents", intents);
|
||||||
@ -46,6 +37,12 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
|||||||
mFragmentAdapter.add(fragment);
|
mFragmentAdapter.add(fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addTab(Intent intent, int label, int icon) {
|
||||||
|
ArrayList<Intent> intents = new ArrayList<Intent>(1);
|
||||||
|
intents.add(intent);
|
||||||
|
addTab(intents, label, icon);
|
||||||
|
}
|
||||||
|
|
||||||
private String getUrl() {
|
private String getUrl() {
|
||||||
String url = "http://www.ingress.com/intel?ll=" + mLl + "&z=" + mZoom;
|
String url = "http://www.ingress.com/intel?ll=" + mLl + "&z=" + mZoom;
|
||||||
if (mIsPortal)
|
if (mIsPortal)
|
||||||
@ -64,15 +61,6 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
|||||||
.apply();
|
.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupShareIntent(String str) {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
||||||
intent.setType("text/plain");
|
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, str);
|
|
||||||
intent.putExtra(Intent.EXTRA_SUBJECT, mTitle);
|
|
||||||
addTab(intent, R.string.tab_share, R.drawable.share);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupIntents() {
|
private void setupIntents() {
|
||||||
setupShareIntent(getUrl());
|
setupShareIntent(getUrl());
|
||||||
|
|
||||||
@ -98,6 +86,15 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
|||||||
addTab(intent, R.string.tab_browser, R.drawable.browser);
|
addTab(intent, R.string.tab_browser, R.drawable.browser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupShareIntent(String str) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||||
|
intent.setType("text/plain");
|
||||||
|
intent.putExtra(Intent.EXTRA_TEXT, str);
|
||||||
|
intent.putExtra(Intent.EXTRA_SUBJECT, mTitle);
|
||||||
|
addTab(intent, R.string.tab_share, R.drawable.share);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -146,8 +143,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
|||||||
|
|
||||||
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
int selected = mSharedPrefs.getInt("pref_share_selected_tab", 0);
|
int selected = mSharedPrefs.getInt("pref_share_selected_tab", 0);
|
||||||
if (selected < mFragmentAdapter.getCount())
|
if (selected < mFragmentAdapter.getCount()) {
|
||||||
{
|
|
||||||
mViewPager.setCurrentItem(selected);
|
mViewPager.setCurrentItem(selected);
|
||||||
actionBar.setSelectedNavigationItem(selected);
|
actionBar.setSelectedNavigationItem(selected);
|
||||||
}
|
}
|
||||||
|
@ -340,13 +340,6 @@ var setup = function() {
|
|||||||
possibleFarmPortals = [];
|
possibleFarmPortals = [];
|
||||||
window.plugin.farmFind.levelLayerGroup = new L.LayerGroup();
|
window.plugin.farmFind.levelLayerGroup = new L.LayerGroup();
|
||||||
$('body').append('<select onchange="window.plugin.farmFind.changeLevel()" id="farm_level_select"><option value=1>Farm level 1</option><option value=2>Farm level 2</option><option value=3>Farm level 3</option><option value=4>Farm level 4</option><option value=5>Farm level 5</option><option value=6>Farm level 6</option><option value=7>Farm level 7</option><option value=8>Farm level 8</option></select>');
|
$('body').append('<select onchange="window.plugin.farmFind.changeLevel()" id="farm_level_select"><option value=1>Farm level 1</option><option value=2>Farm level 2</option><option value=3>Farm level 3</option><option value=4>Farm level 4</option><option value=5>Farm level 5</option><option value=6>Farm level 6</option><option value=7>Farm level 7</option><option value=8>Farm level 8</option></select>');
|
||||||
// notify android that the select spinner is enabled.
|
|
||||||
// this disables javascript injection on android side.
|
|
||||||
// if android is not notified, the spinner closes on the next JS call
|
|
||||||
if (typeof android !== 'undefined' && android && android.spinnerEnabled) {
|
|
||||||
$("#farm_level_select").click(function(){ android.spinnerEnabled(true);});
|
|
||||||
$("#farm_level_select").focus(function(){ android.spinnerEnabled(false);});
|
|
||||||
}
|
|
||||||
var myselect = document.getElementById("farm_level_select");
|
var myselect = document.getElementById("farm_level_select");
|
||||||
myselect.options.selectedIndex = 6;
|
myselect.options.selectedIndex = 6;
|
||||||
window.addLayerGroup('Farms', window.plugin.farmFind.levelLayerGroup, true);
|
window.addLayerGroup('Farms', window.plugin.farmFind.levelLayerGroup, true);
|
||||||
|
@ -64,6 +64,24 @@ This depends on your browser.
|
|||||||
From here you can remove/disable individual plugins or IITC itself.
|
From here you can remove/disable individual plugins or IITC itself.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<h4 id="mobile-plugins">Is it possible to add external plugins to IITC Mobile?</h4>
|
||||||
|
Yes it is!
|
||||||
|
<ul>
|
||||||
|
<li>Create a folder named "IITC Mobile" in your home directory.</li>
|
||||||
|
<li>Inside this folder, create a new folder named "plugins".</li>
|
||||||
|
<li>Copy all your additional plugins to this folder.</li>
|
||||||
|
<li>You should see your plugins listed above the official plugins.</li>
|
||||||
|
</ul>
|
||||||
|
Note:
|
||||||
|
<ul>
|
||||||
|
<li>The plugins wrapper function has to be identical to all other IITC plugins (IITCm removes it via search and replace).
|
||||||
|
Alternatively, you can use the @@PLUGINSTART@@ / @@PLUGINEND@@ macros or remove the wrapper by hand.</li>
|
||||||
|
<li>The filename has to end with *.user.js.</li>
|
||||||
|
<li>If you don't know where to find your home directory: Enable dev-mode in the settings and follow the hint.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<h4 id="debug-data-tiles">What do the colours mean in 'DEBUG Data Tiles'</h4>
|
<h4 id="debug-data-tiles">What do the colours mean in 'DEBUG Data Tiles'</h4>
|
||||||
The data from the Niantic server is download in square tiles. Sometimes requests fail. The colours show this status
|
The data from the Niantic server is download in square tiles. Sometimes requests fail. The colours show this status
|
||||||
|
Loading…
x
Reference in New Issue
Block a user