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) {