Add an option to control auto capitalisation

This commit is contained in:
Jules Aguillon 2022-07-24 23:44:37 +02:00
parent bfde31da6e
commit 081e9a6e53
5 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,8 @@
<string name="pref_accents_e_all_installed">Afficher les accents pour les langues installées</string>
<string name="pref_accents_e_selected">Afficher les accents pour la langue sélectionnée</string>
<string name="pref_accents_e_none">Cacher les accents</string>
<string name="pref_autocapitalisation_title">Majuscule automatique</string>
<string name="pref_autocapitalisation_summary">Active Shift au début des phrases</string>
<string name="pref_category_typing">Saisie</string>
<string name="pref_swipe_dist_title">Distance de swipe</string>
<string name="pref_swipe_dist_summary">La distance des caractères dans les coins (%s)</string>

View File

@ -10,6 +10,8 @@
<string name="pref_accents_e_all_installed">Show accents for all installed languages</string>
<string name="pref_accents_e_selected">Only show accents for the selected language</string>
<string name="pref_accents_e_none">Hide accents</string>
<string name="pref_autocapitalisation_title">Automatic capitalisation</string>
<string name="pref_autocapitalisation_summary">Press Shift at the beginning of a sentence</string>
<string name="pref_programming_layout_title">Keyboard layout for programming</string>
<string name="pref_programming_layout_none">None</string>
<string name="pref_category_typing">Typing</string>

View File

@ -6,6 +6,7 @@
<ListPreference android:key="programming_layout" android:title="@string/pref_programming_layout_title" android:summary="%s" android:defaultValue="none" android:entries="@array/pref_programming_layout_entries" android:entryValues="@array/pref_programming_layout_values"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_category_typing">
<CheckBoxPreference android:key="autocapitalisation" android:title="@string/pref_autocapitalisation_title" android:summary="@string/pref_autocapitalisation_summary" android:defaultValue="true"/>
<ListPreference android:key="swipe_dist" android:title="@string/pref_swipe_dist_title" android:summary="@string/pref_swipe_dist_summary" android:defaultValue="15" android:entries="@array/pref_swipe_dist_entries" android:entryValues="@array/pref_swipe_dist_values"/>
<juloo.common.IntSlideBarPreference android:key="longpress_timeout" android:title="@string/pref_long_timeout_title" android:summary="%sms" android:defaultValue="600" min="50" max="2000"/>
<juloo.common.IntSlideBarPreference android:key="longpress_interval" android:title="@string/pref_long_interval_title" android:summary="%sms" android:defaultValue="25" min="5" max="100"/>

View File

@ -25,7 +25,8 @@ final class Autocapitalisation
isn't stored. */
public void started(EditorInfo info, InputConnection ic)
{
if ((info.inputType & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES) == 0)
if (!Config.globalConfig().autocapitalisation
|| (info.inputType & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES) == 0)
{
_enabled = false;
return;

View File

@ -39,6 +39,7 @@ final class Config
public float characterSize; // Ratio
public int accents; // Values are R.values.pref_accents_v_*
public int theme; // Values are R.style.*
public boolean autocapitalisation;
// Dynamically set
public boolean shouldOfferSwitchingToNextInputMethod;
@ -146,6 +147,7 @@ final class Config
* characterSizeScale;
accents = Integer.valueOf(prefs.getString("accents", "1"));
theme = getThemeId(res, prefs.getString("theme", ""));
autocapitalisation = prefs.getBoolean("autocapitalisation", true);
}
/** Update the layout according to the configuration.