fixed the debug log setting not being applied on startup
This commit is contained in:
parent
c7045b79af
commit
312a6734d5
7 changed files with 12 additions and 11 deletions
|
|
@ -2,11 +2,13 @@
|
|||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto" app:orderingFromXml="true">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="false"
|
||||
app:key="pref_enable_debug_logs"
|
||||
app:layout="@layout/pref_switch"
|
||||
app:title="@string/pref_debug_logs" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="false"
|
||||
app:key="pref_enable_system_logs"
|
||||
app:layout="@layout/pref_switch"
|
||||
app:title="@string/pref_system_logs" />
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@
|
|||
app:singleLineTitle="true">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="false"
|
||||
app:key="pref_alternative_suggestion_scrolling"
|
||||
app:layout="@layout/pref_switch"
|
||||
app:title="@string/pref_alternative_suggestion_scrolling"
|
||||
app:summary="@string/pref_alternative_suggestion_scrolling_summary"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="false"
|
||||
app:key="pref_hack_fb_messenger"
|
||||
app:layout="@layout/pref_switch"
|
||||
app:title="@string/pref_hack_fb_messenger"
|
||||
|
|
|
|||
|
|
@ -10,12 +10,8 @@ public class Logger {
|
|||
return LEVEL == Log.DEBUG;
|
||||
}
|
||||
|
||||
public static void setDebugLevel() {
|
||||
LEVEL = Log.DEBUG;
|
||||
}
|
||||
|
||||
public static void setDefaultLevel() {
|
||||
LEVEL = Log.ERROR;
|
||||
public static void enableDebugLevel(boolean yes) {
|
||||
LEVEL = yes ? Log.DEBUG : Log.ERROR;
|
||||
}
|
||||
|
||||
static public void v(String tag, String msg) {
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ public class TraditionalT9 extends KeyPadHandler {
|
|||
|
||||
initTyping();
|
||||
initUi();
|
||||
Logger.enableDebugLevel(settings.getDebugLogsEnabled());
|
||||
|
||||
isActive = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import androidx.fragment.app.FragmentTransaction;
|
|||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
import io.github.sspanak.tt9.Logger;
|
||||
import io.github.sspanak.tt9.R;
|
||||
import io.github.sspanak.tt9.db.DictionaryDb;
|
||||
import io.github.sspanak.tt9.db.DictionaryLoader;
|
||||
|
|
@ -38,6 +39,7 @@ public class PreferencesActivity extends AppCompatActivity implements Preference
|
|||
globalKeyboardSettings = new GlobalKeyboardSettings(this, (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE));
|
||||
settings = new SettingsStore(this);
|
||||
applyTheme();
|
||||
Logger.enableDebugLevel(settings.getDebugLogsEnabled());
|
||||
|
||||
DictionaryDb.init(this);
|
||||
DictionaryDb.normalizeWordFrequencies(settings);
|
||||
|
|
|
|||
|
|
@ -265,6 +265,8 @@ public class SettingsStore {
|
|||
|
||||
/************* internal settings *************/
|
||||
|
||||
public boolean getDebugLogsEnabled() { return prefs.getBoolean("pref_enable_debug_logs", Logger.isDebugLevel()); }
|
||||
|
||||
public int getDictionaryImportProgressUpdateInterval() { return 250; /* ms */ }
|
||||
public int getDictionaryImportWordChunkSize() { return 1000; /* words */ }
|
||||
|
||||
|
|
|
|||
|
|
@ -41,11 +41,7 @@ public class DebugScreen extends BaseScreenFragment {
|
|||
|
||||
msgSwitch.setChecked(Logger.isDebugLevel());
|
||||
msgSwitch.setOnPreferenceChangeListener((Preference p, Object newValue) -> {
|
||||
if ((boolean) newValue) {
|
||||
Logger.setDebugLevel();
|
||||
} else {
|
||||
Logger.setDefaultLevel();
|
||||
}
|
||||
Logger.enableDebugLevel((boolean) newValue);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue