mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 01:38:36 +00:00
ANDROID: Fix softkeyboard button for Chromebooks
On a Chromebook, the keyboard may be present but hidden (not available for use) because the device is flipped around in Tablet mode. In this case we want the soft keyboard to be available. This change also hides the soft keyboard button if the hardware keyboard is available, since it doesn't do anything. Fixes #13138.
This commit is contained in:
parent
eada851a4d
commit
53c22e4f9a
@ -62,6 +62,7 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import static android.content.res.Configuration.HARDKEYBOARDHIDDEN_NO;
|
||||
import static android.content.res.Configuration.KEYBOARD_QWERTY;
|
||||
|
||||
public class ScummVMActivity extends Activity implements OnKeyboardVisibilityListener {
|
||||
@ -136,13 +137,18 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
|
||||
@Override
|
||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
if (isHWKeyboardConnected()) {
|
||||
|
||||
final boolean hwKeyboard = isHWKeyboardConnected();
|
||||
_toggleKeyboardBtnIcon.setVisibility(hwKeyboard ? View.GONE : View.VISIBLE);
|
||||
if (hwKeyboard) {
|
||||
hideScreenKeyboard();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isHWKeyboardConnected() {
|
||||
return getResources().getConfiguration().keyboard == KEYBOARD_QWERTY;
|
||||
final Configuration config = getResources().getConfiguration();
|
||||
return config.keyboard == KEYBOARD_QWERTY
|
||||
&& config.hardKeyboardHidden == HARDKEYBOARDHIDDEN_NO;
|
||||
}
|
||||
|
||||
public boolean isKeyboardOverlayShown() {
|
||||
@ -1326,7 +1332,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
|
||||
private void showToggleKeyboardBtnIcon(boolean show) {
|
||||
//ImageView keyboardBtn = findViewById(R.id.show_keyboard);
|
||||
if (_toggleKeyboardBtnIcon != null ) {
|
||||
if (show) {
|
||||
if (show && !isHWKeyboardConnected()) {
|
||||
_toggleKeyboardBtnIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
_toggleKeyboardBtnIcon.setVisibility(View.GONE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user