aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorne Wuff <torne@wolfpuppy.org.uk>2014-10-17 21:21:44 +0100
committerTorne Wuff <torne@wolfpuppy.org.uk>2014-10-17 21:21:44 +0100
commite6b5e402059489a19f9967e50ab3745ebe746d65 (patch)
tree91eec3cc77a03e2c10efae2da371250e6ffb0156
parentd64786d9197090c74072b648e487e3d34817bb57 (diff)
downloadconnectbot-e6b5e402059489a19f9967e50ab3745ebe746d65.tar.gz
connectbot-e6b5e402059489a19f9967e50ab3745ebe746d65.tar.bz2
connectbot-e6b5e402059489a19f9967e50ab3745ebe746d65.zip
Add preference to control action bar autohide.
Disabled by default so that people will be able to find the menu.
-rw-r--r--res/values-v11/styles.xml1
-rw-r--r--res/values-v14/styles.xml1
-rw-r--r--res/values/strings.xml5
-rw-r--r--res/xml/preferences.xml7
-rw-r--r--src/org/connectbot/ConsoleActivity.java23
-rw-r--r--src/org/connectbot/util/PreferenceConstants.java1
6 files changed, 31 insertions, 7 deletions
diff --git a/res/values-v11/styles.xml b/res/values-v11/styles.xml
index 0b509ab..9a0c22b 100644
--- a/res/values-v11/styles.xml
+++ b/res/values-v11/styles.xml
@@ -20,7 +20,6 @@
<resources>
<style name="NoTitle" parent="android:Theme.Holo">
<item name="android:windowContentOverlay">@null</item>
- <item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarStyle">@style/SolidActionBar</item>
</style>
diff --git a/res/values-v14/styles.xml b/res/values-v14/styles.xml
index 90131d1..3969010 100644
--- a/res/values-v14/styles.xml
+++ b/res/values-v14/styles.xml
@@ -20,7 +20,6 @@
<resources>
<style name="NoTitle" parent="android:Theme.DeviceDefault">
<item name="android:windowContentOverlay">@null</item>
- <item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarStyle">@style/SolidActionBar</item>
</style>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f8f8f89..e4f2aa5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -153,6 +153,11 @@
<!-- Summary for the rotation mode preference -->
<string name="pref_rotation_summary">"How to change rotation when keyboard popped in/out"</string>
+ <!-- Name for the titlebar hide preference -->
+ <string name="pref_titlebarhide_title">"Autohide title bar"</string>
+ <!-- Summary for the titlebar hide preference -->
+ <string name="pref_titlebarhide_summary">"Tap console to show title bar and access menu"</string>
+
<!-- Name for the full screen preference -->
<string name="pref_fullscreen_title">"Full screen"</string>
<!-- Summary for the full screen preference -->
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index 5fb836b..6d64ce2 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -78,6 +78,13 @@
/>
<CheckBoxPreference
+ android:key="titlebarhide"
+ android:title="@string/pref_titlebarhide_title"
+ android:summary="@string/pref_titlebarhide_summary"
+ android:defaultValue="false"
+ />
+
+ <CheckBoxPreference
android:key="fullscreen"
android:title="@string/pref_fullscreen_title"
android:summary="@string/pref_fullscreen_summary"
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java
index 2359bea..7aca08c 100644
--- a/src/org/connectbot/ConsoleActivity.java
+++ b/src/org/connectbot/ConsoleActivity.java
@@ -55,6 +55,7 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
+import android.view.Window;
import android.view.WindowManager;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View.OnClickListener;
@@ -136,6 +137,7 @@ public class ConsoleActivity extends Activity {
private ActionBarWrapper actionBar;
private boolean inActionBarMenu = false;
+ private boolean titleBarHide;
private ServiceConnection connection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
@@ -277,7 +279,9 @@ public class ConsoleActivity extends Activity {
keyboardGroup.startAnimation(keyboard_fade_out);
keyboardGroup.setVisibility(View.GONE);
- actionBar.hide();
+ if (titleBarHide) {
+ actionBar.hide();
+ }
keyboardGroupHider = null;
}
};
@@ -288,7 +292,9 @@ public class ConsoleActivity extends Activity {
if (keyboardGroupHider != null)
handler.removeCallbacks(keyboardGroupHider);
keyboardGroup.setVisibility(View.GONE);
- actionBar.hide();
+ if (titleBarHide) {
+ actionBar.hide();
+ }
}
// more like configureLaxMode -- enable network IO on UI thread
@@ -306,11 +312,16 @@ public class ConsoleActivity extends Activity {
hardKeyboard = getResources().getConfiguration().keyboard ==
Configuration.KEYBOARD_QWERTY;
- this.setContentView(R.layout.act_console);
-
clipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ titleBarHide = prefs.getBoolean(PreferenceConstants.TITLEBARHIDE, false);
+ if (titleBarHide) {
+ getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
+ }
+
+ this.setContentView(R.layout.act_console);
+
// hide status bar if requested by user
if (prefs.getBoolean(PreferenceConstants.FULLSCREEN, false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
@@ -431,7 +442,9 @@ public class ConsoleActivity extends Activity {
actionBar = ActionBarWrapper.getActionBar(this);
actionBar.setDisplayHomeAsUpEnabled(true);
- actionBar.hide();
+ if (titleBarHide) {
+ actionBar.hide();
+ }
actionBar.addOnMenuVisibilityListener(new ActionBarWrapper.OnMenuVisibilityListener() {
public void onMenuVisibilityChanged(boolean isVisible) {
inActionBarMenu = isVisible;
diff --git a/src/org/connectbot/util/PreferenceConstants.java b/src/org/connectbot/util/PreferenceConstants.java
index e9fb06c..ad29c39 100644
--- a/src/org/connectbot/util/PreferenceConstants.java
+++ b/src/org/connectbot/util/PreferenceConstants.java
@@ -50,6 +50,7 @@ public class PreferenceConstants {
public static final String ROTATION_AUTOMATIC = "Automatic";
public static final String FULLSCREEN = "fullscreen";
+ public static final String TITLEBARHIDE = "titlebarhide";
public static final String KEYMODE = "keymode";