From 77a773b9cd344808e366d6a11bbd9392ff3c4084 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 18 Sep 2013 11:23:16 +0200 Subject: [PATCH 01/16] use new idleSet/idleReset functions onStop/onResume --- .../com/cradle/iitc_mobile/IITC_Mobile.java | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 93c246cc..63278c8b 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -283,8 +283,8 @@ public class IITC_Mobile extends Activity { super.onResume(); // enough idle...let's do some work - Log.d("iitcm", "resuming...setting reset idleTimer"); - mIitcWebView.loadUrl("javascript: window.idleTime = 0"); + Log.d("iitcm", "resuming...reset idleTimer"); + mIitcWebView.loadUrl("javascript: window.idleReset();"); mIitcWebView.updateCaching(); if (mIsLocEnabled) { @@ -312,32 +312,8 @@ public class IITC_Mobile extends Activity { .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"); + mIitcWebView.loadUrl("javascript: window.idleSet();"); if (mIsLocEnabled) mLocMngr.removeUpdates(mLocListener); From cdc98de35069b9f324abe41fde86b2e0d2064dea Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 18 Sep 2013 12:59:40 +0200 Subject: [PATCH 02/16] Move activity labels to strings.xml (and some code formatting) --- mobile/AndroidManifest.xml | 44 +++++----- mobile/res/values/strings.xml | 15 ++-- .../IITC_PluginPreferenceActivity.java | 88 +++++++++---------- .../iitc_mobile/IITC_PreferenceActivity.java | 11 ++- 4 files changed, 79 insertions(+), 79 deletions(-) diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml index f5659971..d369b1e9 100644 --- a/mobile/AndroidManifest.xml +++ b/mobile/AndroidManifest.xml @@ -1,8 +1,8 @@ + package="com.cradle.iitc_mobile" + android:versionCode="47" + android:versionName="0.6.3"> + android:theme="@style/AppBaseTheme"> @@ -37,7 +37,7 @@ - + @@ -49,12 +49,12 @@ + android:pathPrefix="/intel" + android:scheme="https"/> + android:pathPrefix="/intel" + android:scheme="http"/> @@ -68,24 +68,24 @@ - + + android:configChanges="orientation|keyboard|keyboardHidden|screenSize" + android:label="@string/activity_settings" + android:theme="@style/AppBaseTheme"/> - + android:configChanges="orientation|keyboard|keyboardHidden|screenSize" + android:label="@string/activity_plugins" + android:theme="@style/AppBaseTheme"/> @@ -100,7 +100,7 @@ android:excludeFromRecents="true" android:exported="false" android:icon="@drawable/copy" - android:label="Copy to clipboard" + android:label="@string/activity_share_to_clipboard" android:noHistory="false"> @@ -137,4 +137,4 @@ android:value="com.cradle.iitc_mobile.IITC_Mobile"/> - + \ No newline at end of file diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index c1265866..d4696eee 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -2,6 +2,10 @@ IITC Mobile + IITC Mobile Settings + IITC Plugins + Share using… + Copy to clipboard Settings Reload IITC Print Version @@ -17,7 +21,7 @@ About IITC Mobile - Ingress Intel Total Conversion Mobile

+Ingress Intel Total Conversion Mobile

by cradle and contributors

Icon by Giuseppe Lucido

IITC Mobile is an optimized mobile browser for the @@ -67,9 +71,9 @@ Press back button twice to exit Avoids accidental exits Developer options - Enable developer mode - 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/. + Enable developer mode + 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/. Display advanced menu In addition to the default IITC buttons the advanced menu contains a debug pane plus an option to clear cookies @@ -99,4 +103,5 @@ Base Layers Overlay Layers Deselect/Select all -
+ + \ No newline at end of file diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java index d05562cc..701ae608 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java @@ -1,6 +1,14 @@ package com.cradle.iitc_mobile; -import android.app.ActionBar; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Scanner; +import java.util.TreeMap; + import android.content.Context; import android.content.res.AssetManager; import android.os.Bundle; @@ -16,15 +24,6 @@ import android.widget.ArrayAdapter; import android.widget.ListAdapter; import android.widget.TextView; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Scanner; -import java.util.TreeMap; - public class IITC_PluginPreferenceActivity extends PreferenceActivity { private List
mHeaders; @@ -43,9 +42,8 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity { @Override public void onBuildHeaders(List
target) { - ActionBar bar = getActionBar(); - bar.setTitle("IITC Plugins"); - bar.setDisplayHomeAsUpEnabled(true); + getActionBar().setDisplayHomeAsUpEnabled(true); + mHeaders = target; // since the plugins container is static, // it is enough to parse the plugin only on first start. @@ -62,8 +60,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - // exit settings when home button (iitc icon) is pressed - case android.R.id.home: + case android.R.id.home: // exit settings when home button (iitc icon) is pressed onBackPressed(); return true; default: @@ -157,8 +154,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity { } } - void addPluginPreference(String src, String plugin_key, - boolean user) { + void addPluginPreference(String src, String plugin_key, boolean user) { // now parse plugin name, description and category String header = src.substring(src.indexOf("==UserScript=="), @@ -306,20 +302,20 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity { if (convertView == null) { holder = new HeaderViewHolder(); switch (headerType) { - case HEADER_TYPE_CATEGORY: - view = new TextView(getContext(), null, - android.R.attr.listSeparatorTextViewStyle); - holder.title = (TextView) view; - break; + case HEADER_TYPE_CATEGORY: + view = new TextView(getContext(), null, + android.R.attr.listSeparatorTextViewStyle); + holder.title = (TextView) view; + break; - case HEADER_TYPE_NORMAL: - view = mInflater.inflate(R.layout.preference_header_item, - parent, false); - holder.title = (TextView) view - .findViewById(R.id.plug_pref_title); - holder.summary = (TextView) view - .findViewById(R.id.plug_pref_summary); - break; + case HEADER_TYPE_NORMAL: + view = mInflater.inflate(R.layout.preference_header_item, + parent, false); + holder.title = (TextView) view + .findViewById(R.id.plug_pref_title); + holder.summary = (TextView) view + .findViewById(R.id.plug_pref_summary); + break; } view.setTag(holder); } else { @@ -330,22 +326,22 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity { // All view fields must be updated every time, because the view may // be recycled switch (headerType) { - case HEADER_TYPE_CATEGORY: - holder.title.setText(header.getTitle(getContext() - .getResources())); - break; - case HEADER_TYPE_NORMAL: - holder.title.setText(header.getTitle(getContext() - .getResources())); - CharSequence summary = header.getSummary(getContext() - .getResources()); - if (!TextUtils.isEmpty(summary)) { - holder.summary.setVisibility(View.VISIBLE); - holder.summary.setText(summary); - } else { - holder.summary.setVisibility(View.GONE); - } - break; + case HEADER_TYPE_CATEGORY: + holder.title.setText(header.getTitle(getContext() + .getResources())); + break; + case HEADER_TYPE_NORMAL: + holder.title.setText(header.getTitle(getContext() + .getResources())); + CharSequence summary = header.getSummary(getContext() + .getResources()); + if (!TextUtils.isEmpty(summary)) { + holder.summary.setVisibility(View.VISIBLE); + holder.summary.setText(summary); + } else { + holder.summary.setVisibility(View.GONE); + } + break; } return view; diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_PreferenceActivity.java b/mobile/src/com/cradle/iitc_mobile/IITC_PreferenceActivity.java index ad222eff..2595d41b 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_PreferenceActivity.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_PreferenceActivity.java @@ -14,8 +14,6 @@ public class IITC_PreferenceActivity extends Activity { MainSettings settings = new MainSettings(); - // set action bar title - getActionBar().setTitle("IITC Mobile Settings"); getActionBar().setHomeButtonEnabled(true); // iitc version @@ -23,15 +21,16 @@ public class IITC_PreferenceActivity extends Activity { settings.setArguments(bundle); // Display the fragment as the main content. - getFragmentManager().beginTransaction() - .replace(android.R.id.content, settings).commit(); + getFragmentManager() + .beginTransaction() + .replace(android.R.id.content, settings) + .commit(); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - // exit settings when home button (iitc icon) is pressed - case android.R.id.home: + case android.R.id.home: // exit settings when home button (iitc icon) is pressed onBackPressed(); return true; default: From ee4980e5ae4d3bb67f77ebb7e18fe89dd396f715 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 18 Sep 2013 14:30:44 +0200 Subject: [PATCH 03/16] added iitc mobile user plugins to FAQ --- website/page/faq.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/website/page/faq.php b/website/page/faq.php index 3f63258e..f32d4843 100644 --- a/website/page/faq.php +++ b/website/page/faq.php @@ -64,6 +64,24 @@ This depends on your browser. From here you can remove/disable individual plugins or IITC itself. +
  • +

    Is it possible to add external plugins to IITC Mobile?

    +Yes it is! +
      +
    • Create a folder named "IITC Mobile" in your home directory.
    • +
    • Inside this folder, create a new folder named "plugins".
    • +
    • Copy all your additional plugins to this folder.
    • +
    • You should see your plugins listed above the official plugins.
    • +
    +Note: +
      +
    • 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.
    • +
    • The filename has to end with *.user.js.
    • +
    • If you don't know where to find your home directory: Enable dev-mode in the settings and follow the hint.
    • +
    +
  • +
  • What do the colours mean in 'DEBUG Data Tiles'

    The data from the Niantic server is download in square tiles. Sometimes requests fail. The colours show this status From 704a6f7bc3af29690c406cb1ed5226bcdc3ffe84 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 18 Sep 2013 14:32:44 +0200 Subject: [PATCH 04/16] updated mobile readme --- mobile/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/README.md b/mobile/README.md index 8fdf2f40..6d4b7e21 100644 --- a/mobile/README.md +++ b/mobile/README.md @@ -9,7 +9,7 @@ The Android App behaves like the desktop version, but uses the mobile view, whic - 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) @@ -23,7 +23,7 @@ The Android App behaves like the desktop version, but uses the mobile view, whic - in-app search -- support for unofficial plugins. Just copy the *.user.js files to ```/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 ```/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 ```/IITC_Mobile/dev/``` From eee9ce78e014629fdac65735a02519a0fb997cf7 Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 18 Sep 2013 15:31:50 +0200 Subject: [PATCH 05/16] But ActionBar related stuff into new class ActionBarHelper --- .../cradle/iitc_mobile/ActionBarHelper.java | 102 ++++++++++++++ .../cradle/iitc_mobile/IITC_JSInterface.java | 53 ++------ .../com/cradle/iitc_mobile/IITC_Mobile.java | 124 ++++++++---------- 3 files changed, 174 insertions(+), 105 deletions(-) create mode 100644 mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java diff --git a/mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java b/mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java new file mode 100644 index 00000000..912957e8 --- /dev/null +++ b/mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java @@ -0,0 +1,102 @@ +package com.cradle.iitc_mobile; + +import android.app.ActionBar; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; +import android.widget.Toast; + +public class ActionBarHelper { + /* + * Show/hide the up arrow on the left end + * 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 ActionBar mActionBar; + private IITC_Mobile mIitc; + private SharedPreferences mPrefs; + + private boolean mDesktopMode = false; + private boolean mFullscreen = false; + private boolean mHideInFullscreen = false; + private int mPane = android.R.id.home; + + public ActionBarHelper(IITC_Mobile activity, ActionBar bar) { + mIitc = activity; + mActionBar = bar; + mPrefs = PreferenceManager.getDefaultSharedPreferences(activity); + + mActionBar.setDisplayShowHomeEnabled(true); // show icon + + onPrefChanged(); // also calls updateActionBar() + } + + private void updateActionBar() { + 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 + } + 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 (mFullscreen && mHideInFullscreen) + mActionBar.hide(); + else + mActionBar.show(); + } + + @Deprecated + public void goHome() { + switchTo(android.R.id.home); + } + + public boolean hideInFullscreen() { + return mHideInFullscreen; + } + + public void onPrefChanged() { + mDesktopMode = mPrefs.getBoolean("pref_force_desktop", false); + mHideInFullscreen = mPrefs.getBoolean("pref_fullscreen_actionbar", false); + updateActionBar(); + } + + public void reset() + { + mPane = android.R.id.home; + updateActionBar(); + } + + 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(); + } +} diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java index e6a84364..66eecbad 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java @@ -96,46 +96,20 @@ public class IITC_JSInterface { } @JavascriptInterface - public void switchToPane(String id) { - + public void switchToPane(final String id) { 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() { @Override public void run() { - iitcm.getActionBar().setTitle(title); - iitcm.backStackUpdate(button_id); + ActionBarHelper actionbar = iitcm.getActionBarHelper(); + 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) { /* - * the layer strings have a form like: - * [{"layerId":27,"name":"MapQuest OSM","active":true}, - * {"layerId":28,"name":"Default Ingress Map","active":false}] - * Put it in a JSONArray and parse it + * the layer strings have a form like: + * [{"layerId":27,"name":"MapQuest OSM","active":true}, + * {"layerId":28,"name":"Default Ingress Map","active":false}] + * Put it in a JSONArray and parse it */ JSONArray base_layersJSON = null; JSONArray overlay_layersJSON = null; @@ -287,6 +261,7 @@ public class IITC_JSInterface { final ListView list = dialog.getListView(); list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { boolean disable = false; + @Override public boolean onItemLongClick(AdapterView adapterView, View view, int i, long l) { int j = 0; diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 63278c8b..42794353 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -1,5 +1,10 @@ package com.cradle.iitc_mobile; +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; + import android.app.ActionBar; import android.app.Activity; import android.app.AlertDialog; @@ -16,11 +21,11 @@ import android.location.LocationManager; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; -import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; import android.util.Log; +import android.util.SparseArray; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -32,10 +37,6 @@ import android.webkit.WebView; import android.widget.SearchView; import android.widget.Toast; -import java.io.IOException; -import java.net.URISyntaxException; -import java.util.ArrayList; - public class IITC_Mobile extends Activity { private static final int REQUEST_LOGIN = 1; @@ -48,8 +49,6 @@ public class IITC_Mobile extends Activity { private LocationManager mLocMngr = null; private LocationListener mLocListener = null; private boolean mFullscreenMode = false; - private boolean mFullscreenActionbar = false; - private ActionBar mActionBar; private IITC_DeviceAccountLogin mLogin; private MenuItem mSearchMenuItem; private boolean mDesktopMode = false; @@ -57,6 +56,7 @@ public class IITC_Mobile extends Activity { private boolean mReloadNeeded = false; private final ArrayList mDialogStack = new ArrayList(); private SharedPreferences mSharedPrefs; + private ActionBarHelper mActionBarHelper; // Used for custom back stack handling private final ArrayList mBackStack = new ArrayList(); @@ -64,6 +64,27 @@ public class IITC_Mobile extends Activity { private int mCurrentPane = android.R.id.home; private boolean mBackButtonPressed = false; + public static final SparseArray PANE_TITLES = new SparseArray(); + public static final HashMap PANES = new HashMap(); + + 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 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -74,13 +95,8 @@ public class IITC_Mobile extends Activity { setContentView(R.layout.activity_main); mIitcWebView = (IITC_WebView) findViewById(R.id.iitc_webview); - // fetch actionbar, set display flags, title and enable home button - mActionBar = this.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); + // pass ActionBar to helper because we deprecated getActionBar + mActionBarHelper = new ActionBarHelper(this, super.getActionBar()); // do something if user changed something in the settings mSharedPrefs = PreferenceManager @@ -91,21 +107,14 @@ public class IITC_Mobile extends Activity { SharedPreferences sharedPreferences, String key) { if (key.equals("pref_force_desktop")) { mDesktopMode = sharedPreferences.getBoolean("pref_force_desktop", false); - if (mDesktopMode) { - setActionBarHomeEnabledWithUp(false); - mActionBar.setTitle(getString(R.string.app_name)); - } else mActionBar.setHomeButtonEnabled(true); + mActionBarHelper.onPrefChanged(); invalidateOptionsMenu(); } if (key.equals("pref_user_loc")) mIsLocEnabled = sharedPreferences.getBoolean("pref_user_loc", false); if (key.equals("pref_fullscreen_actionbar")) { - mFullscreenActionbar = sharedPreferences.getBoolean("pref_fullscreen_actionbar", - false); - if (mFullscreenMode) - IITC_Mobile.this.getActionBar().hide(); - // no iitc reload needed here + mActionBarHelper.onPrefChanged(); return; } if (key.equals("pref_advanced_menu")) { @@ -142,8 +151,7 @@ public class IITC_Mobile extends Activity { mLastLocation = location; } - public void onStatusChanged(String provider, int status, - Bundle extras) { + public void onStatusChanged(String provider, int status, Bundle extras) { } public void onProviderEnabled(String provider) { @@ -163,11 +171,8 @@ public class IITC_Mobile extends Activity { mLocListener); } - mFullscreenActionbar = mSharedPrefs.getBoolean("pref_fullscreen_actionbar", false); - // Clear the back stack mBackStack.clear(); - setActionBarHomeEnabledWithUp(false); handleIntent(getIntent(), true); } @@ -222,7 +227,7 @@ public class IITC_Mobile extends Activity { (SearchView) mSearchMenuItem.getActionView(); searchView.setQuery(query, false); searchView.clearFocus(); - mActionBar.setTitle(getString(R.string.app_name)); + mActionBarHelper.switchTo(android.R.id.home); backStackUpdate(android.R.id.home); mIitcWebView.loadUrl("javascript:search('" + query + "');"); return; @@ -345,7 +350,7 @@ public class IITC_Mobile extends Activity { } // exit fullscreen mode if it is enabled and action bar is disabled // or the back stack is empty - if (mFullscreenMode && (mBackStack.isEmpty() || mFullscreenActionbar)) { + if (mFullscreenMode && (mBackStack.isEmpty() || mActionBarHelper.hideInFullscreen())) { this.toggleFullscreen(); } else if (!mBackStack.isEmpty()) { // Pop last item from backstack and pretend the relevant menu item was clicked @@ -367,19 +372,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() { // shouldn't be called when back stack is empty // catch wrong usage if (mBackStack.isEmpty()) { // Empty back stack means we should be at home (ie map) screen - setActionBarHomeEnabledWithUp(false); - mActionBar.setTitle(getString(R.string.app_name)); + mActionBarHelper.switchTo(android.R.id.home); mIitcWebView.loadUrl("javascript: window.show('map');"); return; } @@ -403,13 +401,6 @@ public class IITC_Mobile extends Activity { } 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 @@ -456,14 +447,13 @@ public class IITC_Mobile extends Activity { // the getLayers function calls the setLayers method of IITC_JSInterface mIitcWebView.loadUrl("javascript: window.layerChooser.getLayers()"); return true; - // get the users current location and focus it on map - case R.id.locate: + case R.id.locate: // get the users current location and focus it on map mIitcWebView.loadUrl("javascript: window.show('map');"); // get location from network by default if (!mIsLocEnabled) { mIitcWebView.loadUrl("javascript: " + "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 { if (mLastLocation != null) mIitcWebView.loadUrl("javascript: window.map.setView(new L.LatLng(" + @@ -471,8 +461,7 @@ public class IITC_Mobile extends Activity { mLastLocation.getLongitude() + "), 15);"); } return true; - // start settings activity - case R.id.action_settings: + case R.id.action_settings: // start settings activity Intent intent = new Intent(this, IITC_PreferenceActivity.class); intent.putExtra("iitc_version", mIitcWebView.getWebViewClient() .getIITCVersion()); @@ -506,9 +495,8 @@ public class IITC_Mobile extends Activity { } public void reloadIITC() { - mActionBar.setTitle(getString(R.string.app_name)); + mActionBarHelper.reset(); mBackStack.clear(); - setActionBarHomeEnabledWithUp(false); // iitc starts on map after reload mCurrentPane = android.R.id.home; this.loadUrl(mIntelUrl); @@ -556,19 +544,9 @@ public class IITC_Mobile extends Activity { } public void toggleFullscreen() { - if (mFullscreenMode) { - if (mFullscreenActionbar) - 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; - } + mFullscreenMode = !mFullscreenMode; + mActionBarHelper.setFullscreen(mFullscreenMode); + // toggle notification bar WindowManager.LayoutParams attrs = getWindow().getAttributes(); attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN; @@ -604,7 +582,7 @@ public class IITC_Mobile extends Activity { * called by IITC_WebViewClient when the Google login form is opened. */ 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"); mIitcWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); mLogin = new IITC_DeviceAccountLogin(this, view, client); @@ -665,4 +643,18 @@ public class IITC_Mobile extends Activity { item = menu.findItem(R.id.menu_clear_cookies); item.setVisible(mAdvancedMenu); } + + /** + * @deprecated ActionBar related stuff should be handled by ActionBarHelper + */ + @Deprecated + @Override + public ActionBar getActionBar() { + return super.getActionBar(); + } + + public ActionBarHelper getActionBarHelper() + { + return mActionBarHelper; + } } From 6290ef56aa54ef1749cdc77a749ee28d1094a13e Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 18 Sep 2013 16:29:10 +0200 Subject: [PATCH 06/16] Use reloadIITC() if mReloadNeeded == true --- .../com/cradle/iitc_mobile/IITC_Mobile.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 42794353..e5eac879 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -99,8 +99,7 @@ public class IITC_Mobile extends Activity { mActionBarHelper = new ActionBarHelper(this, super.getActionBar()); // do something if user changed something in the settings - mSharedPrefs = PreferenceManager - .getDefaultSharedPreferences(this); + mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); mSharedPrefChangeListener = new OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged( @@ -289,23 +288,21 @@ public class IITC_Mobile extends Activity { // enough idle...let's do some work Log.d("iitcm", "resuming...reset idleTimer"); - mIitcWebView.loadUrl("javascript: window.idleReset();"); mIitcWebView.updateCaching(); if (mIsLocEnabled) { // Register the mSharedPrefChangeListener with the Location Manager to receive // location updates - mLocMngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, - 0, 0, mLocListener); - mLocMngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, - mLocListener); + mLocMngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mLocListener); + mLocMngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mLocListener); } if (mReloadNeeded) { Log.d("iitcm", "preference had changed...reload needed"); - this.loadUrl(mIntelUrl); - mReloadNeeded = false; + reloadIITC(); } + else + mIitcWebView.loadUrl("javascript: window.idleReset();"); } @Override @@ -499,7 +496,8 @@ public class IITC_Mobile extends Activity { mBackStack.clear(); // iitc starts on map after reload mCurrentPane = android.R.id.home; - this.loadUrl(mIntelUrl); + loadUrl(mIntelUrl); + mReloadNeeded = false; } private void loadIITC() { From daaef1575ea5e0d677ba7a27edee1c1f716bf9a3 Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 18 Sep 2013 16:43:12 +0200 Subject: [PATCH 07/16] Show portal highlighters in action bar --- code/portal_highlighter.js | 14 ++++ .../cradle/iitc_mobile/ActionBarHelper.java | 81 ++++++++++++++++--- .../cradle/iitc_mobile/IITC_JSInterface.java | 22 +++++ 3 files changed, 104 insertions(+), 13 deletions(-) diff --git a/code/portal_highlighter.js b/code/portal_highlighter.js index e9de1edc..ee03a883 100644 --- a/code/portal_highlighter.js +++ b/code/portal_highlighter.js @@ -11,14 +11,26 @@ window.addPortalHighlighter = function(name, callback) { _highlighters = {}; } _highlighters[name] = callback; + + if (typeof android !== 'undefined' && android && android.addPortalHighlighter) + android.addPortalHighlighter(name); + if(localStorage.portal_highlighter === undefined) { _current_highlighter = name; + if (typeof android !== 'undefined' && android && android.setActiveHighlighter) + android.setActiveHighlighter(name); + localStorage.portal_highlighter = name; } portalHighlighterControl(); } window.portalHighlighterControl = function() { + if (typeof android !== 'undefined' && android && android.addPortalHighlighter) { + $('#portal_highlight_select').remove(); + return; + } + if(_highlighters !== null) { if($('#portal_highlight_select').length === 0) { $("body").append(""); @@ -46,6 +58,8 @@ window.portalHighlighterControl = function() { window.changePortalHighlights = function(name) { _current_highlighter = name; + if (typeof android !== 'undefined' && android && android.setActiveHighlighter) + android.setActiveHighlighter(name); resetHighlightedPortals(); localStorage.portal_highlighter = name; } diff --git a/mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java b/mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java index 912957e8..c8499b8e 100644 --- a/mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java +++ b/mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java @@ -1,11 +1,13 @@ 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 ActionBarHelper { +public class ActionBarHelper implements OnNavigationListener { /* * Show/hide the up arrow on the left end * getActionBar().setDisplayHomeAsUpEnabled(enabled); @@ -20,10 +22,31 @@ public class ActionBarHelper { * getActionBar().setHomeButtonEnabled(enabled); */ - private ActionBar mActionBar; - private IITC_Mobile mIitc; - private SharedPreferences mPrefs; + private class HighlighterAdapter extends ArrayAdapter { + 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; @@ -33,58 +56,90 @@ public class ActionBarHelper { 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) - { + if (mPane != android.R.id.home) { mActionBar.setDisplayHomeAsUpEnabled(true); // Show "up" indicator mActionBar.setHomeButtonEnabled(true);// Make icon clickable + showHighlighter = false; } - else - { + 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); + } else { + mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + mActionBar.setDisplayShowTitleEnabled(true); // Show title + } if (mFullscreen && mHideInFullscreen) mActionBar.hide(); else mActionBar.show(); } - @Deprecated - public void goHome() { - switchTo(android.R.id.home); + 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() - { + public void reset() { + mHighlighters.clear(); mPane = android.R.id.home; updateActionBar(); } + public void setActiveHighlighter(String name) { + int position = mHighlighters.getPosition(name); + if (position >= 0) + mActionBar.setSelectedNavigationItem(position); + + mActiveHighlighter = name; + } + public void setFullscreen(boolean fullscreen) { mFullscreen = fullscreen; if (mFullscreen && mHideInFullscreen) { diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java index 66eecbad..99dc95bb 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java @@ -230,6 +230,28 @@ public class IITC_JSInterface { 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 private void showMultiSelection() { // build the layer chooser dialog From 1a1008c70e9714a9712af4bb6ac036c8fa7cd035 Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 18 Sep 2013 16:48:30 +0200 Subject: [PATCH 08/16] Code formatting, removed dead code, fixed warning --- .../com/cradle/iitc_mobile/IITC_Mobile.java | 24 ++-------- .../iitc_mobile/async/CheckHttpResponse.java | 17 ++++--- .../iitc_mobile/share/IntentFragment.java | 3 +- .../iitc_mobile/share/IntentListView.java | 15 ++---- .../iitc_mobile/share/ShareActivity.java | 46 +++++++++---------- 5 files changed, 40 insertions(+), 65 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index e5eac879..40ed984b 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -18,8 +18,6 @@ import android.content.res.Configuration; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -256,17 +254,13 @@ public class IITC_Mobile extends Activity { throw use; } - if (parts.length > 1) // query string present - { + if (parts.length > 1) { // query string present // search for z= for (String param : parts[1].split("&")) { - if (param.startsWith("z=")) - { - try - { + if (param.startsWith("z=")) { + try { z = Integer.valueOf(param.substring(2)); - } catch (NumberFormatException e) - { + } catch (NumberFormatException e) { URISyntaxException use = new URISyntaxException(uri.toString(), "could not parse zoom level"); use.initCause(e); throw use; @@ -307,13 +301,6 @@ public class IITC_Mobile extends Activity { @Override protected void onStop() { - ConnectivityManager conMan = - (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); - - NetworkInfo mobile = conMan - .getNetworkInfo(ConnectivityManager.TYPE_MOBILE); - NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI); - Log.d("iitcm", "stopping iitcm"); mIitcWebView.loadUrl("javascript: window.idleSet();"); @@ -651,8 +638,7 @@ public class IITC_Mobile extends Activity { return super.getActionBar(); } - public ActionBarHelper getActionBarHelper() - { + public ActionBarHelper getActionBarHelper() { return mActionBarHelper; } } diff --git a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java index 861677c3..ff64d42f 100644 --- a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java +++ b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java @@ -1,5 +1,13 @@ package com.cradle.iitc_mobile.async; +import java.io.IOException; + +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; + import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; @@ -8,15 +16,6 @@ import android.util.Log; import com.cradle.iitc_mobile.IITC_JSInterface; import com.cradle.iitc_mobile.IITC_Mobile; -import com.cradle.iitc_mobile.IITC_WebView; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.DefaultHttpClient; - -import java.io.IOException; /* * this class parses the http response of a web page. diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentFragment.java b/mobile/src/com/cradle/iitc_mobile/share/IntentFragment.java index 2d8b3780..b1b15682 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/IntentFragment.java +++ b/mobile/src/com/cradle/iitc_mobile/share/IntentFragment.java @@ -42,8 +42,7 @@ public class IntentFragment extends Fragment implements OnScrollListener, OnItem } @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); startActivity(intent); } diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java b/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java index 669e8fa3..435edc6c 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java +++ b/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java @@ -35,10 +35,8 @@ public class IntentListView extends ListView { } } - private class IntentAdapter extends ArrayAdapter - { - private IntentAdapter() - { + private class IntentAdapter extends ArrayAdapter { + private IntentAdapter() { super(IntentListView.this.getContext(), android.R.layout.simple_list_item_1); } @@ -126,8 +124,7 @@ public class IntentListView extends ListView { setIntents(intentList); } - public void setIntents(ArrayList intents) - { + public void setIntents(ArrayList intents) { mAdapter.setNotifyOnChange(false); mAdapter.clear(); @@ -154,10 +151,8 @@ public class IntentListView extends ListView { ActivityInfo activity = info.activityInfo; // remove all IITCm intents, except for SendToClipboard in case Drive is not installed - if (activity.packageName.equals(packageName)) - { - if (hasCopyIntent || !activity.name.equals(SendToClipboard.class.getCanonicalName())) - { + if (activity.packageName.equals(packageName)) { + if (hasCopyIntent || !activity.name.equals(SendToClipboard.class.getCanonicalName())) { activityList.remove(i); i--; continue; diff --git a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java index fdf6eb4f..4a442ab6 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java +++ b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java @@ -1,5 +1,9 @@ package com.cradle.iitc_mobile.share; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; + import android.app.ActionBar; import android.app.FragmentTransaction; import android.content.Intent; @@ -14,11 +18,6 @@ import android.view.MenuItem; import com.cradle.iitc_mobile.R; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.text.DecimalFormatSymbols; -import java.util.ArrayList; - public class ShareActivity extends FragmentActivity implements ActionBar.TabListener { private boolean mIsPortal; private String mLl; @@ -28,15 +27,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList IntentFragmentAdapter mFragmentAdapter; ViewPager mViewPager; - private void addTab(Intent intent, int label, int icon) - { - ArrayList intents = new ArrayList(1); - intents.add(intent); - addTab(intents, label, icon); - } - - private void addTab(ArrayList intents, int label, int icon) - { + private void addTab(ArrayList intents, int label, int icon) { IntentFragment fragment = new IntentFragment(); Bundle args = new Bundle(); args.putParcelableArrayList("intents", intents); @@ -46,6 +37,12 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList mFragmentAdapter.add(fragment); } + private void addTab(Intent intent, int label, int icon) { + ArrayList intents = new ArrayList(1); + intents.add(intent); + addTab(intents, label, icon); + } + private String getUrl() { String url = "http://www.ingress.com/intel?ll=" + mLl + "&z=" + mZoom; if (mIsPortal) @@ -64,15 +61,6 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList .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() { setupShareIntent(getUrl()); @@ -98,6 +86,15 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList 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 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -146,8 +143,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); int selected = mSharedPrefs.getInt("pref_share_selected_tab", 0); - if (selected < mFragmentAdapter.getCount()) - { + if (selected < mFragmentAdapter.getCount()) { mViewPager.setCurrentItem(selected); actionBar.setSelectedNavigationItem(selected); } From 2e78b58678231a406fe2e8b116964945d95f69c5 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 18 Sep 2013 17:06:22 +0200 Subject: [PATCH 09/16] event for select boxes to disable androids JS calls --- code/portal_highlighter.js | 7 ------- code/smartphone.js | 12 ++++++++++++ plugins/layer-farms-find.user.js | 7 ------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/code/portal_highlighter.js b/code/portal_highlighter.js index e9de1edc..4554416e 100644 --- a/code/portal_highlighter.js +++ b/code/portal_highlighter.js @@ -32,13 +32,6 @@ window.portalHighlighterControl = function() { }); $("#portal_highlight_select").val(_current_highlighter); $("#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-control-scale-line").css('margin-top','25px'); } diff --git a/code/smartphone.js b/code/smartphone.js index f8cf7d4b..edaa1d8b 100644 --- a/code/smartphone.js +++ b/code/smartphone.js @@ -125,6 +125,18 @@ window.runOnSmartphonesAfterBoot = function() { var l = $('#chatcontrols a:visible'); 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 window.addHook('portalAdded', function(data) { data.portal.on('add', function() { diff --git a/plugins/layer-farms-find.user.js b/plugins/layer-farms-find.user.js index d2b80044..bd1ec897 100644 --- a/plugins/layer-farms-find.user.js +++ b/plugins/layer-farms-find.user.js @@ -340,13 +340,6 @@ var setup = function() { possibleFarmPortals = []; window.plugin.farmFind.levelLayerGroup = new L.LayerGroup(); $('body').append(''); - // 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"); myselect.options.selectedIndex = 6; window.addLayerGroup('Farms', window.plugin.farmFind.levelLayerGroup, true); From bf229f7f05c7b70732f7e4a99b5d26c051d0a014 Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 18 Sep 2013 17:40:05 +0200 Subject: [PATCH 10/16] Code formatting --- mobile/res/values/strings.xml | 2 +- ...arHelper.java => IITC_ActionBarHelper.java} | 10 +++++----- .../cradle/iitc_mobile/IITC_JSInterface.java | 12 ++++++------ .../com/cradle/iitc_mobile/IITC_Mobile.java | 16 ++++++++-------- .../IITC_PluginPreferenceActivity.java | 18 +++++++++--------- .../iitc_mobile/async/CheckHttpResponse.java | 16 ++++++++-------- .../share/IntentFragmentAdapter.java | 6 +++--- .../iitc_mobile/share/IntentListView.java | 10 +++++----- .../iitc_mobile/share/SendToClipboard.java | 1 + .../iitc_mobile/share/ShareActivity.java | 8 ++++---- 10 files changed, 50 insertions(+), 49 deletions(-) rename mobile/src/com/cradle/iitc_mobile/{ActionBarHelper.java => IITC_ActionBarHelper.java} (96%) diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index d4696eee..2e067082 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -21,7 +21,7 @@ About IITC Mobile -Ingress Intel Total Conversion Mobile

    + Ingress Intel Total Conversion Mobile

    by cradle and contributors

    Icon by Giuseppe Lucido

    IITC Mobile is an optimized mobile browser for the diff --git a/mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java b/mobile/src/com/cradle/iitc_mobile/IITC_ActionBarHelper.java similarity index 96% rename from mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java rename to mobile/src/com/cradle/iitc_mobile/IITC_ActionBarHelper.java index c8499b8e..fe9f8bbe 100644 --- a/mobile/src/com/cradle/iitc_mobile/ActionBarHelper.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_ActionBarHelper.java @@ -7,17 +7,17 @@ import android.preference.PreferenceManager; import android.widget.ArrayAdapter; import android.widget.Toast; -public class ActionBarHelper implements OnNavigationListener { +public class IITC_ActionBarHelper implements OnNavigationListener { /* * Show/hide the up arrow on the left end * 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); */ @@ -52,7 +52,7 @@ public class ActionBarHelper implements OnNavigationListener { private boolean mHideInFullscreen = false; private int mPane = android.R.id.home; - public ActionBarHelper(IITC_Mobile activity, ActionBar bar) { + public IITC_ActionBarHelper(IITC_Mobile activity, ActionBar bar) { mIitc = activity; mActionBar = bar; mPrefs = PreferenceManager.getDefaultSharedPreferences(activity); diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java index 99dc95bb..cd3cbf94 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java @@ -1,10 +1,5 @@ package com.cradle.iitc_mobile; -import java.util.HashMap; - -import org.json.JSONArray; -import org.json.JSONException; - import android.app.Activity; import android.app.AlertDialog; import android.content.ClipData; @@ -25,6 +20,11 @@ import android.widget.Toast; 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 public class IITC_JSInterface { @@ -102,7 +102,7 @@ public class IITC_JSInterface { iitcm.runOnUiThread(new Runnable() { @Override public void run() { - ActionBarHelper actionbar = iitcm.getActionBarHelper(); + IITC_ActionBarHelper actionbar = iitcm.getActionBarHelper(); Integer button = IITC_Mobile.PANES.get(id); if (button == null) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 40ed984b..9678ce6c 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -1,10 +1,5 @@ package com.cradle.iitc_mobile; -import java.io.IOException; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.HashMap; - import android.app.ActionBar; import android.app.Activity; import android.app.AlertDialog; @@ -35,6 +30,11 @@ import android.webkit.WebView; import android.widget.SearchView; import android.widget.Toast; +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; + public class IITC_Mobile extends Activity { private static final int REQUEST_LOGIN = 1; @@ -54,7 +54,7 @@ public class IITC_Mobile extends Activity { private boolean mReloadNeeded = false; private final ArrayList mDialogStack = new ArrayList(); private SharedPreferences mSharedPrefs; - private ActionBarHelper mActionBarHelper; + private IITC_ActionBarHelper mActionBarHelper; // Used for custom back stack handling private final ArrayList mBackStack = new ArrayList(); @@ -94,7 +94,7 @@ public class IITC_Mobile extends Activity { mIitcWebView = (IITC_WebView) findViewById(R.id.iitc_webview); // pass ActionBar to helper because we deprecated getActionBar - mActionBarHelper = new ActionBarHelper(this, super.getActionBar()); + mActionBarHelper = new IITC_ActionBarHelper(this, super.getActionBar()); // do something if user changed something in the settings mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); @@ -638,7 +638,7 @@ public class IITC_Mobile extends Activity { return super.getActionBar(); } - public ActionBarHelper getActionBarHelper() { + public IITC_ActionBarHelper getActionBarHelper() { return mActionBarHelper; } } diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java index 701ae608..0f4ff502 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java @@ -1,14 +1,5 @@ package com.cradle.iitc_mobile; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Scanner; -import java.util.TreeMap; - import android.content.Context; import android.content.res.AssetManager; import android.os.Bundle; @@ -24,6 +15,15 @@ import android.widget.ArrayAdapter; import android.widget.ListAdapter; import android.widget.TextView; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Scanner; +import java.util.TreeMap; + public class IITC_PluginPreferenceActivity extends PreferenceActivity { private List
    mHeaders; diff --git a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java index ff64d42f..e7df6056 100644 --- a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java +++ b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java @@ -1,13 +1,5 @@ package com.cradle.iitc_mobile.async; -import java.io.IOException; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.DefaultHttpClient; - import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; @@ -17,6 +9,14 @@ import android.util.Log; import com.cradle.iitc_mobile.IITC_JSInterface; import com.cradle.iitc_mobile.IITC_Mobile; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; + +import java.io.IOException; + /* * this class parses the http response of a web page. * since network operations shouldn't be done on main UI thread diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentFragmentAdapter.java b/mobile/src/com/cradle/iitc_mobile/share/IntentFragmentAdapter.java index 1460348c..68743a08 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/IntentFragmentAdapter.java +++ b/mobile/src/com/cradle/iitc_mobile/share/IntentFragmentAdapter.java @@ -1,12 +1,12 @@ 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.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; +import java.util.ArrayList; +import java.util.List; + public class IntentFragmentAdapter extends FragmentPagerAdapter { private List mTabs; diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java b/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java index 435edc6c..d0a72cc6 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java +++ b/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java @@ -1,10 +1,5 @@ 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.content.ComponentName; import android.content.Context; @@ -24,6 +19,11 @@ import android.widget.TextView; 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 { private static class CopyHandler extends Pair { public CopyHandler(ResolveInfo resolveInfo) { diff --git a/mobile/src/com/cradle/iitc_mobile/share/SendToClipboard.java b/mobile/src/com/cradle/iitc_mobile/share/SendToClipboard.java index 2f9b332f..3134452e 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/SendToClipboard.java +++ b/mobile/src/com/cradle/iitc_mobile/share/SendToClipboard.java @@ -7,6 +7,7 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.Toast; + import com.cradle.iitc_mobile.R; public class SendToClipboard extends Activity { diff --git a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java index 4a442ab6..71200af3 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java +++ b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java @@ -1,9 +1,5 @@ package com.cradle.iitc_mobile.share; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; - import android.app.ActionBar; import android.app.FragmentTransaction; import android.content.Intent; @@ -18,6 +14,10 @@ import android.view.MenuItem; import com.cradle.iitc_mobile.R; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; + public class ShareActivity extends FragmentActivity implements ActionBar.TabListener { private boolean mIsPortal; private String mLl; From def3dd698cde5fb5c052e59c3a45cc796c68f5c7 Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 18 Sep 2013 18:08:29 +0200 Subject: [PATCH 11/16] Fix: Highlighter was not remembered after IITC restart --- code/portal_highlighter.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/portal_highlighter.js b/code/portal_highlighter.js index ee03a883..cd2333db 100644 --- a/code/portal_highlighter.js +++ b/code/portal_highlighter.js @@ -6,6 +6,12 @@ window._highlighters = null; window._current_highlighter = localStorage.portal_highlighter; 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) { if(_highlighters === null) { _highlighters = {}; From e8b730d078208c1e1f446d8726243b17d646750b Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 18 Sep 2013 18:32:08 +0200 Subject: [PATCH 12/16] And another bugfix (Exception thrown when listview hidden) - thanks @leCradle --- .../iitc_mobile/IITC_ActionBarHelper.java | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_ActionBarHelper.java b/mobile/src/com/cradle/iitc_mobile/IITC_ActionBarHelper.java index fe9f8bbe..01b6ebe7 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_ActionBarHelper.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_ActionBarHelper.java @@ -8,19 +8,17 @@ import android.widget.ArrayAdapter; import android.widget.Toast; public class IITC_ActionBarHelper implements OnNavigationListener { - /* - * Show/hide the up arrow on the left end - * 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); - */ + // 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 { public HighlighterAdapter() { @@ -90,9 +88,10 @@ public class IITC_ActionBarHelper implements OnNavigationListener { if (showHighlighter) { mActionBar.setDisplayShowTitleEnabled(false); // Hide title mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); + setActiveHighlighter(mActiveHighlighter); } else { - mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); mActionBar.setDisplayShowTitleEnabled(true); // Show title + mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); } if (mFullscreen && mHideInFullscreen) mActionBar.hide(); @@ -133,11 +132,13 @@ public class IITC_ActionBarHelper implements OnNavigationListener { } public void setActiveHighlighter(String name) { - int position = mHighlighters.getPosition(name); - if (position >= 0) - mActionBar.setSelectedNavigationItem(position); - 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) { From 46a2a83ff9960cb565c8872330850cd5d7824e36 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 18 Sep 2013 21:16:19 +0200 Subject: [PATCH 13/16] don't show deleted plugins in plugins list --- .../cradle/iitc_mobile/IITC_PluginPreferenceActivity.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java index d05562cc..0f80da2f 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java @@ -186,8 +186,14 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity { plugin_name = plugin_name.replace("IITC plugin: ", ""); // add [User] tag to user plugins - if (user) + if (user) { 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 // first check if we need a new category From 04b878dd1fd446f4b18ba9954170fa648915ddbd Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 18 Sep 2013 21:25:07 +0200 Subject: [PATCH 14/16] bump iitcm version --- mobile/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml index d369b1e9..2dc57bbc 100644 --- a/mobile/AndroidManifest.xml +++ b/mobile/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="48" + android:versionName="0.6.4"> Date: Wed, 18 Sep 2013 21:43:27 +0200 Subject: [PATCH 15/16] don't reset idle timer on boot --- mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 9678ce6c..b8d84c83 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -295,8 +295,12 @@ public class IITC_Mobile extends Activity { Log.d("iitcm", "preference had changed...reload needed"); reloadIITC(); } - else - mIitcWebView.loadUrl("javascript: window.idleReset();"); + 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 From 592699f2df57b37e2a4455819e9f946ee772580c Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 18 Sep 2013 22:13:31 +0200 Subject: [PATCH 16/16] removed portal_highlight_select from smartphone.css...not needed anymore --- mobile/smartphone.css | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mobile/smartphone.css b/mobile/smartphone.css index 1a7f7076..bec0a5e8 100644 --- a/mobile/smartphone.css +++ b/mobile/smartphone.css @@ -185,12 +185,6 @@ body { width: 100%; } - -#portal_highlight_select{ - top:0px !important; - left:0px !important; -} - /* * for some reason leaflet popups on mobile are colored white on white * so force the popup msg color to black