mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-16 15:02:48 +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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue