mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
enable debug settings in debug mode
This commit is contained in:
parent
f992fa9ffd
commit
6c0f1361d9
5 changed files with 75 additions and 16 deletions
58
app/src/debug/res/xml/prefs.xml
Normal file
58
app/src/debug/res/xml/prefs.xml
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2008 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:key="english_ime_settings">
|
||||||
|
<PreferenceScreen
|
||||||
|
android:fragment="org.dslul.openboard.inputmethod.latin.settings.LanguageFakeSettingsFragment"
|
||||||
|
android:title="@string/language_selection_title"
|
||||||
|
android:key="screen_languages"
|
||||||
|
android:icon="@drawable/ic_settings_languages"/>
|
||||||
|
<PreferenceScreen
|
||||||
|
android:fragment="org.dslul.openboard.inputmethod.latin.settings.PreferencesSettingsFragment"
|
||||||
|
android:title="@string/settings_screen_preferences"
|
||||||
|
android:key="screen_preferences"
|
||||||
|
android:icon="@drawable/ic_settings_preferences"/>
|
||||||
|
<PreferenceScreen
|
||||||
|
android:fragment="org.dslul.openboard.inputmethod.latin.settings.AppearanceSettingsFragment"
|
||||||
|
android:title="@string/settings_screen_appearance"
|
||||||
|
android:key="screen_appearance"
|
||||||
|
android:icon="@drawable/ic_settings_appearance"/>
|
||||||
|
<PreferenceScreen
|
||||||
|
android:fragment="org.dslul.openboard.inputmethod.latin.settings.GestureSettingsFragment"
|
||||||
|
android:title="@string/settings_screen_gesture"
|
||||||
|
android:key="screen_gesture"
|
||||||
|
android:icon="@drawable/ic_settings_gesture"/>
|
||||||
|
<PreferenceScreen
|
||||||
|
android:fragment="org.dslul.openboard.inputmethod.latin.settings.CorrectionSettingsFragment"
|
||||||
|
android:title="@string/settings_screen_correction"
|
||||||
|
android:key="screen_correction"
|
||||||
|
android:icon="@drawable/ic_settings_correction"/>
|
||||||
|
<PreferenceScreen
|
||||||
|
android:fragment="org.dslul.openboard.inputmethod.latin.settings.AdvancedSettingsFragment"
|
||||||
|
android:title="@string/settings_screen_advanced"
|
||||||
|
android:key="screen_advanced"
|
||||||
|
android:icon="@drawable/ic_settings_advanced"/>
|
||||||
|
<PreferenceScreen
|
||||||
|
android:fragment="org.dslul.openboard.inputmethod.latin.settings.AboutFragment"
|
||||||
|
android:title="@string/settings_screen_about"
|
||||||
|
android:key="screen_about"
|
||||||
|
android:icon="@drawable/ic_settings_about"/>
|
||||||
|
<PreferenceScreen
|
||||||
|
android:fragment="org.dslul.openboard.inputmethod.latin.settings.DebugSettingsFragment"
|
||||||
|
android:title="Debug Settings"
|
||||||
|
android:key="screen_debug"/>
|
||||||
|
</PreferenceScreen>
|
|
@ -1,9 +1,15 @@
|
||||||
package org.dslul.openboard.inputmethod.latin.define
|
package org.dslul.openboard.inputmethod.latin.define
|
||||||
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import org.dslul.openboard.inputmethod.latin.BuildConfig
|
||||||
|
import org.dslul.openboard.inputmethod.latin.settings.DebugSettings
|
||||||
|
|
||||||
object DebugFlags {
|
object DebugFlags {
|
||||||
const val DEBUG_ENABLED = false
|
@JvmField
|
||||||
|
var DEBUG_ENABLED = false
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun init(prefs: SharedPreferences?) {}
|
fun init(prefs: SharedPreferences) {
|
||||||
|
DEBUG_ENABLED = BuildConfig.DEBUG && prefs.getBoolean(DebugSettings.PREF_DEBUG_MODE, false)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -23,6 +23,7 @@ import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceGroup;
|
import androidx.preference.PreferenceGroup;
|
||||||
import androidx.preference.TwoStatePreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
@ -57,8 +58,7 @@ public final class DebugSettingsFragment extends SubScreenFragment
|
||||||
removePreference(DebugSettings.PREF_SHOULD_SHOW_LXX_SUGGESTION_UI);
|
removePreference(DebugSettings.PREF_SHOULD_SHOW_LXX_SUGGESTION_UI);
|
||||||
}
|
}
|
||||||
|
|
||||||
final PreferenceGroup dictDumpPreferenceGroup =
|
final PreferenceGroup dictDumpPreferenceGroup = (PreferenceGroup)findPreference(PREF_KEY_DUMP_DICTS);
|
||||||
(PreferenceGroup)findPreference(PREF_KEY_DUMP_DICTS);
|
|
||||||
for (final String dictName : DictionaryFacilitatorImpl.DICT_TYPE_TO_CLASS.keySet()) {
|
for (final String dictName : DictionaryFacilitatorImpl.DICT_TYPE_TO_CLASS.keySet()) {
|
||||||
final Preference pref = new DictDumpPreference(getActivity(), dictName);
|
final Preference pref = new DictDumpPreference(getActivity(), dictName);
|
||||||
pref.setOnPreferenceClickListener(this);
|
pref.setOnPreferenceClickListener(this);
|
||||||
|
@ -99,15 +99,14 @@ public final class DebugSettingsFragment extends SubScreenFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(final Preference pref) {
|
public boolean onPreferenceClick(@NonNull final Preference pref) {
|
||||||
final Context context = getActivity();
|
|
||||||
if (pref instanceof DictDumpPreference) {
|
if (pref instanceof DictDumpPreference) {
|
||||||
final DictDumpPreference dictDumpPref = (DictDumpPreference)pref;
|
final DictDumpPreference dictDumpPref = (DictDumpPreference)pref;
|
||||||
final String dictName = dictDumpPref.mDictName;
|
final String dictName = dictDumpPref.mDictName;
|
||||||
final Intent intent = new Intent(
|
final Intent intent = new Intent(
|
||||||
DictionaryDumpBroadcastReceiver.DICTIONARY_DUMP_INTENT_ACTION);
|
DictionaryDumpBroadcastReceiver.DICTIONARY_DUMP_INTENT_ACTION);
|
||||||
intent.putExtra(DictionaryDumpBroadcastReceiver.DICTIONARY_NAME_KEY, dictName);
|
intent.putExtra(DictionaryDumpBroadcastReceiver.DICTIONARY_NAME_KEY, dictName);
|
||||||
context.sendBroadcast(intent);
|
pref.getContext().sendBroadcast(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -127,11 +126,8 @@ public final class DebugSettingsFragment extends SubScreenFragment
|
||||||
mDebugMode.setChecked(prefs.getBoolean(DebugSettings.PREF_DEBUG_MODE, false));
|
mDebugMode.setChecked(prefs.getBoolean(DebugSettings.PREF_DEBUG_MODE, false));
|
||||||
updateDebugMode();
|
updateDebugMode();
|
||||||
mServiceNeedsRestart = true;
|
mServiceNeedsRestart = true;
|
||||||
return;
|
} else if (key.equals(DebugSettings.PREF_FORCE_NON_DISTINCT_MULTITOUCH)) {
|
||||||
}
|
|
||||||
if (key.equals(DebugSettings.PREF_FORCE_NON_DISTINCT_MULTITOUCH)) {
|
|
||||||
mServiceNeedsRestart = true;
|
mServiceNeedsRestart = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +226,7 @@ public final class DebugSettingsFragment extends SubScreenFragment
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValueText(final int value) {
|
public String getValueText(final int value) {
|
||||||
return res.getString(R.string.abbreviation_unit_milliseconds, value);
|
return res.getString(R.string.abbreviation_unit_milliseconds, Integer.toString(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -84,7 +84,6 @@
|
||||||
<string name="main_dict_description">"মুখ্য অভিধান"</string>
|
<string name="main_dict_description">"মুখ্য অভিধান"</string>
|
||||||
<string name="go_to_settings">"ছেটিংসমূহ"</string>
|
<string name="go_to_settings">"ছেটিংসমূহ"</string>
|
||||||
<string name="delete_dict">"মচক"</string>
|
<string name="delete_dict">"মচক"</string>
|
||||||
<string name="version_text">"সংস্কৰণ </string>
|
|
||||||
<string name="user_dict_settings_add_menu_title">"যোগ কৰক"</string>
|
<string name="user_dict_settings_add_menu_title">"যোগ কৰক"</string>
|
||||||
<string name="user_dict_settings_add_dialog_title">"অভিধানত যোগ কৰক"</string>
|
<string name="user_dict_settings_add_dialog_title">"অভিধানত যোগ কৰক"</string>
|
||||||
<string name="user_dict_settings_add_screen_title">"বাক্যাংশ"</string>
|
<string name="user_dict_settings_add_screen_title">"বাক্যাংশ"</string>
|
||||||
|
|
|
@ -76,8 +76,8 @@
|
||||||
android:key="pref_key_preview_dismiss_duration"
|
android:key="pref_key_preview_dismiss_duration"
|
||||||
android:title="@string/prefs_key_popup_dismiss_duration_settings"
|
android:title="@string/prefs_key_popup_dismiss_duration_settings"
|
||||||
latin:maxValue="100" /> <!-- milliseconds -->
|
latin:maxValue="100" /> <!-- milliseconds -->
|
||||||
<SwitchPreferenceCompat
|
<PreferenceCategory
|
||||||
android:key="pref_key_dump_dictionaries"
|
android:key="pref_key_dump_dictionaries"
|
||||||
android:title="@string/prefs_dump_dynamic_dicts">
|
android:title="@string/prefs_dump_dynamic_dicts">
|
||||||
</SwitchPreferenceCompat>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue