From 8d1eb6e0b77fd8ee4687ad27beeaa69801a8b1a3 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Mon, 28 Oct 2013 20:14:25 +0100 Subject: [PATCH] first version of custom fullscreen preference (fix for #594) --- mobile/res/values/strings.xml | 22 +++- mobile/res/xml/preferences.xml | 11 +- .../com/cradle/iitc_mobile/IITC_Mobile.java | 38 +++--- .../iitc_mobile/IITC_NavigationHelper.java | 34 ++---- .../com/cradle/iitc_mobile/IITC_WebView.java | 111 ++++++++++++++++-- 5 files changed, 153 insertions(+), 63 deletions(-) diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index 5980c01b..1babb023 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -79,14 +79,16 @@ 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 can still be controlled via the Navigation Drawers + Hide in fullscreen mode + Which elements should be hidden in fullscreen mode. + Note: IITCm can still be controlled via the Navigation Drawers Force desktop mode Nice for tablets, looks awful on smartphones Force https Disabling may improve performance Move cache to external storage - Restart required! Write cache to sdCard. Saves internal storage. External storage has to be mounted. + Restart required! Write cache to sdCard. Saves internal storage. + External storage has to be mounted. Press back button twice to exit Avoids accidental exits Advanced settings @@ -106,6 +108,20 @@ Aggressive Caching Prefer cached values even if they are expired…saves traffic but may result in login issues + + + System Bar + Action Bar + IITC Status Bar + Navigation Bar + + + 2 + 4 + 8 + 16 + + Always Mobile data only (default) diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml index 8a137c51..ab91e41b 100644 --- a/mobile/res/xml/preferences.xml +++ b/mobile/res/xml/preferences.xml @@ -24,11 +24,12 @@ android:key="pref_user_zoom" android:summary="@string/pref_user_zoom_sum" android:title="@string/pref_user_zoom"/> - + entries = mSharedPrefs.getStringSet("pref_fullscreen", new HashSet()); + mFullscreenStatus &= FS_ENABLED; + + // default values...android has no nice way to add default values to multiSelectListPreferences + if (entries.isEmpty()) { + mFullscreenStatus += FS_ACTIONBAR | FS_SYSBAR; + } + for (String entry : entries) { + mFullscreenStatus += Integer.parseInt(entry); + } + } + + int getFullscreenStatus() { + return mFullscreenStatus; + } + + public boolean isInFullscreen() { + return (mFullscreenStatus & FS_ENABLED) != 0; + } + public IITC_WebViewClient getWebViewClient() { return mIitcWebViewClient; } @@ -210,5 +306,4 @@ public class IITC_WebView extends WebView { Log.d("iitcm", "setting user agent to: " + ua); mSettings.setUserAgentString(ua); } - }