From 09a244d88de95a91091bd98867a624acad19acc1 Mon Sep 17 00:00:00 2001 From: niushuai233 Date: Fri, 28 Oct 2022 13:32:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cc/niushuai/project/devcontrol/base/util/Keys.java | 1 + .../devcontrol/ui/nav/setup/KeepDayDialogFragment.java | 5 +++-- .../devcontrol/ui/nav/setup/NavSetUpFragment.java | 10 ++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/base/util/Keys.java b/app/src/main/java/cc/niushuai/project/devcontrol/base/util/Keys.java index 12e1569..a687228 100644 --- a/app/src/main/java/cc/niushuai/project/devcontrol/base/util/Keys.java +++ b/app/src/main/java/cc/niushuai/project/devcontrol/base/util/Keys.java @@ -21,5 +21,6 @@ public interface Keys { String APP_INIT = "AppInit"; String KEEP_DAY_SELECT = "KeepDaySelect"; + String APP_SETUP = "AppSetup"; } } diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/setup/KeepDayDialogFragment.java b/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/setup/KeepDayDialogFragment.java index ce0fe67..8ec8b4d 100644 --- a/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/setup/KeepDayDialogFragment.java +++ b/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/setup/KeepDayDialogFragment.java @@ -45,10 +45,11 @@ public class KeepDayDialogFragment extends DialogFragment { private void addListener() { binding.layoutLogKeepDayConfirm.setOnClickListener(v -> { int value = binding.keepDayPicker.getValue(); - XLog.KEEP_DAY = value; String keepDayPickerValue = value + ""; DBHelper.configDeal(Keys.SETUP_LOG_KEEP_DAY, keepDayPickerValue); - XLog.v(Keys.Tag.KEEP_DAY_SELECT, "更新日志存储天数为: {}", keepDayPickerValue); + + XLog.KEEP_DAY = value; + XLog.i(Keys.Tag.KEEP_DAY_SELECT, "更新日志存储天数为: {}", keepDayPickerValue); ((TextView)getActivity().findViewById(R.id.setup_log_keep_day_display)).setText(keepDayPickerValue); this.dismiss(); diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/setup/NavSetUpFragment.java b/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/setup/NavSetUpFragment.java index 3c3275e..d27fc58 100644 --- a/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/setup/NavSetUpFragment.java +++ b/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/setup/NavSetUpFragment.java @@ -79,9 +79,12 @@ public class NavSetUpFragment extends BaseFragment { binding.setupLogLevelSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { - String level = ((Spinner) parent.findViewById(R.id.setup_log_level_spinner)).getSelectedItem().toString(); + String levelName = ((Spinner) parent.findViewById(R.id.setup_log_level_spinner)).getSelectedItem().toString(); + DBHelper.configDeal(Keys.SETUP_LOG_LEVEL, levelName); - DBHelper.configDeal(Keys.SETUP_LOG_LEVEL, level); + XLog.ROOT_LEVEL = XLog.Level.transform(levelName); + XLog.ROOT_LEVEL_NAME = levelName; + XLog.i(Keys.Tag.APP_SETUP, "修改日志级别为: {}", XLog.ROOT_LEVEL_NAME); } @Override @@ -110,9 +113,8 @@ public class NavSetUpFragment extends BaseFragment { */ private void setupLogSwitchClickListener(View view) { Boolean checked = binding.setupLogSwitchSwitch.isChecked(); - XLog.SWITCH = checked; - DBHelper.configDeal(Keys.SETUP_LOG_SWITCH, checked.toString()); + XLog.SWITCH = checked; } private void setupKeepDayClickListener(View view) {