mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-24 08:36:26 +00:00
allow fullscreen mode again, but limit to cases where the keyboard blocks more than 60% of the screen
This commit is contained in:
parent
0b55a92e02
commit
62bff1e68a
7 changed files with 16 additions and 9 deletions
|
@ -1320,14 +1320,21 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
return false;
|
||||
}
|
||||
// Reread resource value here, because this method is called by the framework as needed.
|
||||
final boolean isFullscreenModeAllowed = Settings.readUseFullscreenMode(getResources());
|
||||
final boolean isFullscreenModeAllowed = Settings.readFullscreenModeAllowed(getResources());
|
||||
if (super.onEvaluateFullscreenMode() && isFullscreenModeAllowed) {
|
||||
// TODO: Remove this hack. Actually we should not really assume NO_EXTRACT_UI
|
||||
// implies NO_FULLSCREEN. However, the framework mistakenly does. i.e. NO_EXTRACT_UI
|
||||
// without NO_FULLSCREEN doesn't work as expected. Because of this we need this
|
||||
// hack for now. Let's get rid of this once the framework gets fixed.
|
||||
final EditorInfo ei = getCurrentInputEditorInfo();
|
||||
return !(ei != null && ((ei.imeOptions & EditorInfo.IME_FLAG_NO_EXTRACT_UI) != 0));
|
||||
if (ei == null) return false;
|
||||
final boolean noExtractUi = (ei.imeOptions & EditorInfo.IME_FLAG_NO_EXTRACT_UI) != 0;
|
||||
final boolean noFullscreen = (ei.imeOptions & EditorInfo.IME_FLAG_NO_FULLSCREEN) != 0;
|
||||
if (noExtractUi || noFullscreen) return false;
|
||||
if (mKeyboardSwitcher.getVisibleKeyboardView() == null || mSuggestionStripView == null) return false;
|
||||
final int usedHeight = mKeyboardSwitcher.getVisibleKeyboardView().getHeight() + mSuggestionStripView.getHeight();
|
||||
final int availableHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
return usedHeight > availableHeight * 0.6; // if we have less than 40% available, use fullscreen mode
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -378,8 +378,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
return prefs.getBoolean(PREF_AUTOSPACE_AFTER_PUNCTUATION, false);
|
||||
}
|
||||
|
||||
public static boolean readUseFullscreenMode(final Resources res) {
|
||||
return res.getBoolean(R.bool.config_use_fullscreen_mode);
|
||||
public static boolean readFullscreenModeAllowed(final Resources res) {
|
||||
return res.getBoolean(R.bool.config_fullscreen_mode_allowed);
|
||||
}
|
||||
|
||||
public static boolean readShowSetupWizardIcon(final SharedPreferences prefs,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<!-- Configuration values for Small Phone Landscape. -->
|
||||
<resources>
|
||||
<bool name="config_use_fullscreen_mode">false</bool>
|
||||
<bool name="config_fullscreen_mode_allowed">true</bool>
|
||||
|
||||
<!-- Preferable keyboard height in absolute scale: 1.100in -->
|
||||
<!-- This config_default_keyboard_height value should match with keyboard-heights.xml -->
|
||||
|
|
|
@ -15,5 +15,5 @@
|
|||
<!-- Showing more keys keyboard, just above the touched point if true, aligned to the key if
|
||||
false -->
|
||||
<bool name="config_show_more_keys_keyboard_at_touched_point">false</bool>
|
||||
<bool name="config_use_fullscreen_mode">false</bool>
|
||||
<bool name="config_fullscreen_mode_allowed">false</bool>
|
||||
</resources>
|
||||
|
|
|
@ -15,5 +15,5 @@
|
|||
<!-- Showing more keys keyboard, just above the touched point if true, aligned to the key if
|
||||
false -->
|
||||
<bool name="config_show_more_keys_keyboard_at_touched_point">false</bool>
|
||||
<bool name="config_use_fullscreen_mode">false</bool>
|
||||
<bool name="config_fullscreen_mode_allowed">false</bool>
|
||||
</resources>
|
||||
|
|
|
@ -15,5 +15,5 @@
|
|||
<!-- Showing more keys keyboard, just above the touched point if true, aligned to the key if
|
||||
false -->
|
||||
<bool name="config_show_more_keys_keyboard_at_touched_point">true</bool>
|
||||
<bool name="config_use_fullscreen_mode">false</bool>
|
||||
<bool name="config_fullscreen_mode_allowed">false</bool>
|
||||
</resources>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<!-- Configuration values for Small Phone Portrait. -->
|
||||
<resources>
|
||||
<bool name="config_use_fullscreen_mode">false</bool>
|
||||
<bool name="config_fullscreen_mode_allowed">false</bool>
|
||||
|
||||
<dimen name="config_key_hysteresis_distance">8.0dp</dimen>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue