# HG changeset patch # User Carl Byington # Date 1405352766 25200 # Node ID f9b1a07c0e96bd723c034e1f1c401955d8632d21 # Parent 35ed530366d98a7f588281d78a2701c6e2b76c5b configurable hardware buttons can now change font size diff -r 35ed530366d9 -r f9b1a07c0e96 res/values/arrays.xml --- a/res/values/arrays.xml Sun Jul 13 12:35:52 2014 -0700 +++ b/res/values/arrays.xml Mon Jul 14 08:46:06 2014 -0700 @@ -58,6 +58,8 @@ @string/list_hwbutton_esc_a @string/list_hwbutton_monitor @string/list_hwbutton_soft_function_keys + @string/list_hwbutton_increase_fontsize + @string/list_hwbutton_decrease_fontsize @string/list_hwbutton_none @@ -72,6 +74,8 @@ Esc+A Monitor Key Soft Function Keypad + Increase Font Size + Decrease Font Size None diff -r 35ed530366d9 -r f9b1a07c0e96 res/values/strings.xml --- a/res/values/strings.xml Sun Jul 13 12:35:52 2014 -0700 +++ b/res/values/strings.xml Mon Jul 14 08:46:06 2014 -0700 @@ -475,6 +475,10 @@ "Monitor Key" "Soft Function Keypad" + + "Increase Font Size" + + "Decrease Font Size" "None" diff -r 35ed530366d9 -r f9b1a07c0e96 src/com/five_ten_sg/connectbot/service/TerminalKeyListener.java --- a/src/com/five_ten_sg/connectbot/service/TerminalKeyListener.java Sun Jul 13 12:35:52 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalKeyListener.java Mon Jul 14 08:46:06 2014 -0700 @@ -568,40 +568,41 @@ } private boolean handleShortcuts(View v, int keyCode, KeyEvent event, int repeat, boolean down) { + String hwbuttonShortcut; switch (keyCode) { case KeyEvent.KEYCODE_CAMERA: // check to see which shortcut the camera button triggers - String hwbuttonShortcut = manager.prefs.getString( - PreferenceConstants.CAMERA, - PreferenceConstants.HWBUTTON_SCREEN_CAPTURE); + hwbuttonShortcut = manager.prefs.getString( + PreferenceConstants.CAMERA, + PreferenceConstants.HWBUTTON_SCREEN_CAPTURE); return (handleShortcut(v, hwbuttonShortcut, repeat, down)); case KeyEvent.KEYCODE_VOLUME_UP: // check to see which shortcut the volume button triggers hwbuttonShortcut = manager.prefs.getString( - PreferenceConstants.VOLUP, - PreferenceConstants.HWBUTTON_FUNCTION_KEYS); + PreferenceConstants.VOLUP, + PreferenceConstants.HWBUTTON_FUNCTION_KEYS); return (handleShortcut(v, hwbuttonShortcut, repeat, down)); case KeyEvent.KEYCODE_VOLUME_DOWN: // check to see which shortcut the camera button triggers hwbuttonShortcut = manager.prefs.getString( - PreferenceConstants.VOLDN, - PreferenceConstants.HWBUTTON_TAB); + PreferenceConstants.VOLDN, + PreferenceConstants.HWBUTTON_TAB); return (handleShortcut(v, hwbuttonShortcut, repeat, down)); case KeyEvent.KEYCODE_SEARCH: // check to see which shortcut the search button triggers hwbuttonShortcut = manager.prefs.getString( - PreferenceConstants.SEARCH, - PreferenceConstants.HWBUTTON_ESC); + PreferenceConstants.SEARCH, + PreferenceConstants.HWBUTTON_ESC); return (handleShortcut(v, hwbuttonShortcut, repeat, down)); case KeyEvent.KEYCODE_BUTTON_L2: // check to see which shortcut the ptt button triggers hwbuttonShortcut = manager.prefs.getString( - PreferenceConstants.PTT, - PreferenceConstants.HWBUTTON_MONITOR); + PreferenceConstants.PTT, + PreferenceConstants.HWBUTTON_MONITOR); return (handleShortcut(v, hwbuttonShortcut, repeat, down)); default: return false; @@ -609,20 +610,28 @@ } private boolean handleShortcut(View v, String shortcut, int repeat, boolean down) { - if (PreferenceConstants.HWBUTTON_FUNCTION_KEYS.equals(shortcut)) { + if (PreferenceConstants.HWBUTTON_DECREASE_FONTSIZE.equals(shortcut)) { + if (!down) return false; + bridge.decreaseFontSize(); + } + else if (PreferenceConstants.HWBUTTON_INCREASE_FONTSIZE.equals(shortcut)) { + if (!down) return false; + bridge.increaseFontSize(); + } + else if (PreferenceConstants.HWBUTTON_FUNCTION_KEYS.equals(shortcut)) { if (repeat > 0) return false; if (!down) return false; bridge.showFKeysDialog(); } + else if (PreferenceConstants.HWBUTTON_MONITOR.equals(shortcut)) { + if (repeat > 0) return false; + buffer.monitorKey(down); + } else if (PreferenceConstants.HWBUTTON_SCREEN_CAPTURE.equals(shortcut)) { if (repeat > 0) return false; if (!down) return false; bridge.captureScreen(); } - else if (PreferenceConstants.HWBUTTON_MONITOR.equals(shortcut)) { - if (repeat > 0) return false; - buffer.monitorKey(down); - } else if (PreferenceConstants.HWBUTTON_CTRL.equals(shortcut)) { if (!down) return false; showMetakeyToast(v, PreferenceConstants.HWBUTTON_CTRL); diff -r 35ed530366d9 -r f9b1a07c0e96 src/com/five_ten_sg/connectbot/util/PreferenceConstants.java --- a/src/com/five_ten_sg/connectbot/util/PreferenceConstants.java Sun Jul 13 12:35:52 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/util/PreferenceConstants.java Mon Jul 14 08:46:06 2014 -0700 @@ -62,6 +62,8 @@ public static final String HWBUTTON_ESC_A = "Esc+A"; public static final String HWBUTTON_MONITOR = "Monitor Key"; public static final String HWBUTTON_FUNCTION_KEYS = "Soft Function Keypad"; + public static final String HWBUTTON_INCREASE_FONTSIZE = "Increase Font Size"; + public static final String HWBUTTON_DECREASE_FONTSIZE = "Decrease Font Size"; public static final String HWBUTTON_NONE = "None"; public static final String KEEP_ALIVE = "keepalive";