diff options
author | Kenny Root <kenny@the-b.org> | 2015-11-06 09:07:01 -0800 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2015-11-06 09:07:01 -0800 |
commit | ad6d5bb18bfba975386210f2114d15a9d49d4a73 (patch) | |
tree | 5f30db0aa6effc4663bb1f694f9cdc12b09c0fca | |
parent | 9bcc1233fba2a81a0f60cee25b34a7350a49dd0b (diff) | |
parent | a60d7944928b03c8426a1b1d2c0c8b036b1535c8 (diff) | |
download | connectbot-ad6d5bb18bfba975386210f2114d15a9d49d4a73.tar.gz connectbot-ad6d5bb18bfba975386210f2114d15a9d49d4a73.tar.bz2 connectbot-ad6d5bb18bfba975386210f2114d15a9d49d4a73.zip |
Merge pull request #330 from alescdb/keyboard-always-visible
Add an option to always show the virtual keyboard (special keys)
-rw-r--r-- | app/src/main/java/org/connectbot/ConsoleActivity.java | 29 | ||||
-rw-r--r-- | app/src/main/java/org/connectbot/util/PreferenceConstants.java | 1 | ||||
-rw-r--r-- | app/src/main/res/values-fr/strings.xml | 1 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 4 | ||||
-rw-r--r-- | app/src/main/res/xml-v14/preferences.xml | 6 | ||||
-rw-r--r-- | app/src/main/res/xml/preferences.xml | 6 |
6 files changed, 40 insertions, 7 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java index f15174c..40f608d 100644 --- a/app/src/main/java/org/connectbot/ConsoleActivity.java +++ b/app/src/main/java/org/connectbot/ConsoleActivity.java @@ -145,6 +145,7 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne @Nullable private ActionBar actionBar; private boolean inActionBarMenu = false; private boolean titleBarHide; + private boolean keyboardAlwaysVisible = false; private ServiceConnection connection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { @@ -435,8 +436,10 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne if (keyboardGroup.getVisibility() == View.GONE || inActionBarMenu) return; - keyboardGroup.startAnimation(keyboard_fade_out); - keyboardGroup.setVisibility(View.GONE); + if (keyboardAlwaysVisible == false) { + keyboardGroup.startAnimation(keyboard_fade_out); + keyboardGroup.setVisibility(View.GONE); + } hideActionBarIfRequested(); keyboardGroupHider = null; } @@ -445,9 +448,11 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne } private void hideEmulatedKeys() { - if (keyboardGroupHider != null) - handler.removeCallbacks(keyboardGroupHider); - keyboardGroup.setVisibility(View.GONE); + if (keyboardAlwaysVisible == false) { + if (keyboardGroupHider != null) + handler.removeCallbacks(keyboardGroupHider); + keyboardGroup.setVisibility(View.GONE); + } hideActionBarIfRequested(); } @@ -503,7 +508,6 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne toolbar = (Toolbar) findViewById(R.id.toolbar); pager = (TerminalViewPager) findViewById(R.id.console_flip); - pager.addOnPageChangeListener( new TerminalViewPager.SimpleOnPageChangeListener() { @Override @@ -573,6 +577,19 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne keyboardGroup = (LinearLayout) findViewById(R.id.keyboard_group); + keyboardAlwaysVisible = prefs.getBoolean(PreferenceConstants.KEY_ALWAYS_VISIVLE, false); + if (keyboardAlwaysVisible) { + // equivalent to android:layout_above=keyboard_group + RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT); + layoutParams.addRule(RelativeLayout.ABOVE, R.id.keyboard_group); + pager.setLayoutParams(layoutParams); + + // Show virtual keyboard + keyboardGroup.setVisibility(View.VISIBLE); + } + mKeyboardButton = (ImageView) findViewById(R.id.button_keyboard); mKeyboardButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { diff --git a/app/src/main/java/org/connectbot/util/PreferenceConstants.java b/app/src/main/java/org/connectbot/util/PreferenceConstants.java index fe80f24..3dd9aa5 100644 --- a/app/src/main/java/org/connectbot/util/PreferenceConstants.java +++ b/app/src/main/java/org/connectbot/util/PreferenceConstants.java @@ -49,6 +49,7 @@ public class PreferenceConstants { public static final String PG_UPDN_GESTURE = "pgupdngesture"; public static final String KEYMODE = "keymode"; + public static final String KEY_ALWAYS_VISIVLE = "alwaysvisible"; public static final String KEYMODE_RIGHT = "Use right-side keys"; public static final String KEYMODE_LEFT = "Use left-side keys"; diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index b615b2b..d09ab89 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -78,6 +78,7 @@ <string name="pref_rotation_summary">Comment changer l\'orientation de l\'écran suivant si le clavier est déplié</string> <string name="pref_titlebarhide_title">Masquer automatiquement la barre de titre</string> <string name="pref_titlebarhide_summary">Appuyez sur console pour montrer la barre de titre et accèder au menu</string> + <string name="pref_alwaysvisible_title">Toujours afficher les touches spéciales</string> <string name="pref_fullscreen_title">Plein écran</string> <string name="pref_fullscreen_summary">Cacher la barre de notifications lorsque la console est active</string> <string name="pref_keyboard_category">Clavier</string> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 34dcb64..45ef38c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -219,6 +219,9 @@ <!-- Summary for the titlebar hide preference --> <string name="pref_titlebarhide_summary">"Tap console to show title bar and access menu"</string> + <!-- Title for special keys always visible preference --> + <string name="pref_alwaysvisible_title">Special keys always visible</string> + <!-- Name for the page up/down gesture preference --> <string name="pref_pg_updn_gesture_title">"Page up/down gesture"</string> <!-- Summary for the full screen preference --> @@ -636,5 +639,4 @@ <string name="discard_host_button">Discard</string> <!-- Text for button which does not discard changes and keeps editing. --> <string name="discard_host_cancel_button">Keep editing</string> - </resources> diff --git a/app/src/main/res/xml-v14/preferences.xml b/app/src/main/res/xml-v14/preferences.xml index 9e76c36..7c495b1 100644 --- a/app/src/main/res/xml-v14/preferences.xml +++ b/app/src/main/res/xml-v14/preferences.xml @@ -115,6 +115,12 @@ android:title="@string/pref_keyboard_category"> <SwitchPreference + android:key="alwaysvisible" + android:title="@string/pref_alwaysvisible_title" + android:defaultValue="false" + /> + + <SwitchPreference android:key="shiftfkeys" android:title="@string/pref_shiftfkeys_title" android:summary="@string/pref_shiftfkeys_summary" diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index e87b263..2774834 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -115,6 +115,12 @@ android:title="@string/pref_keyboard_category"> <org.connectbot.util.SwitchCompatPreference + android:key="alwaysvisible" + android:title="@string/pref_alwaysvisible_title" + android:defaultValue="false" + /> + + <org.connectbot.util.SwitchCompatPreference android:key="shiftfkeys" android:title="@string/pref_shiftfkeys_title" android:summary="@string/pref_shiftfkeys_summary" |