From 0eaf076a750f621d3c408d454df788d1a6d65578 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Tue, 7 May 2013 19:41:37 +0200 Subject: [PATCH 1/3] made action bar optional in fullscreen mode (see #216) --- mobile/res/values/strings.xml | 6 ++++-- mobile/res/xml/preferences.xml | 11 ++++++++--- mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index d1fd5f71..9316a1f0 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -34,10 +34,12 @@ Misc Plugins Available plugins - Show zoom control - Shows +/- buttons even on multitouch capable devices. Display user location Show users position on map + Show zoom control + Shows +/- buttons even on multitouch capable devices. + Hide Action Bar in fullscreen mode + Nice for screenshots. Note: IITCM cannot be controlled without Action Bar. Force https Disabling may improve performance Developer options diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml index 5cd6e03d..f986bc1e 100644 --- a/mobile/res/xml/preferences.xml +++ b/mobile/res/xml/preferences.xml @@ -12,15 +12,20 @@ + diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 0ab3510b..03f8cdf4 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -39,6 +39,7 @@ public class IITC_Mobile extends Activity { private LocationListener loc_listener = null; private boolean keyboad_open = false; private boolean fullscreen_mode = false; + private boolean fullscreen_actionbar = false; private ActionBar actionBar; @Override @@ -58,6 +59,7 @@ public class IITC_Mobile extends Activity { actionBar.setTitle(getString(R.string.menu_map)); actionBar.setHomeButtonEnabled(true); + // do something if user changed something in the settings SharedPreferences sharedPref = PreferenceManager .getDefaultSharedPreferences(this); listener = new OnSharedPreferenceChangeListener() { @@ -67,6 +69,12 @@ public class IITC_Mobile extends Activity { if (key.equals("pref_user_loc")) user_loc = sharedPreferences.getBoolean("pref_user_loc", false); + if (key.equals("pref_fullscreen_actionbar")) { + fullscreen_actionbar =sharedPreferences.getBoolean("pref_fullscreen_actionbar", + false); + if (fullscreen_mode) + IITC_Mobile.this.getActionBar().hide(); + } IITC_Mobile.this.loadUrl(intel_url); } }; @@ -222,6 +230,8 @@ public class IITC_Mobile extends Activity { public void onBackPressed() { // leave fullscreen mode if it is enabled if (fullscreen_mode) { + if (fullscreen_actionbar) + this.getActionBar().show(); // show notification bar again WindowManager.LayoutParams attrs = getWindow().getAttributes(); attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN; @@ -280,6 +290,8 @@ public class IITC_Mobile extends Activity { // toggle fullscreen case R.id.toggle_fullscreen : if (!this.fullscreen_mode) { + if (fullscreen_actionbar) + this.getActionBar().hide(); // hide notification bar WindowManager.LayoutParams attrs = getWindow() .getAttributes(); @@ -291,6 +303,8 @@ public class IITC_Mobile extends Activity { "Press back button to exit fullscreen", Toast.LENGTH_SHORT).show(); } else { + if (fullscreen_actionbar) + this.getActionBar().show(); // show notification bar again WindowManager.LayoutParams attrs = getWindow() .getAttributes(); From f3fae16fe668b88bc8a0b642830f2e1fb3fa1353 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Tue, 7 May 2013 20:28:17 +0200 Subject: [PATCH 2/3] set fetch dev-mode default value to false --- mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java index 9a32366f..f606d5ac 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java @@ -142,7 +142,7 @@ public class IITC_WebViewClient extends WebViewClient { SharedPreferences sharedPref = PreferenceManager .getDefaultSharedPreferences(context); Set plugin_list = sharedPref.getStringSet("pref_plugins", null); - boolean dev_enabled = sharedPref.getBoolean("pref_dev_checkbox", true); + boolean dev_enabled = sharedPref.getBoolean("pref_dev_checkbox", false); // iterate through all enabled plugins and load them if (plugin_list != null) { From 6e72f516e6d808e667079ccc2e19fecde9cae1f5 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Tue, 7 May 2013 22:04:34 +0200 Subject: [PATCH 3/3] load actionbar setting onCreate too (see #216) --- mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 03f8cdf4..47deeccc 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -137,6 +137,8 @@ public class IITC_Mobile extends Activity { loc_listener); } + fullscreen_actionbar = sharedPref.getBoolean("pref_fullscreen_actionbar", false); + // load new iitc web view with ingress intel page Intent intent = getIntent(); String action = intent.getAction();