diff --git a/app/src/main/java/com/bingce/controlnetwork/activity/SettingsActivity.java b/app/src/main/java/com/bingce/controlnetwork/activity/SettingsActivity.java index 14ff5fd..25c0ea2 100644 --- a/app/src/main/java/com/bingce/controlnetwork/activity/SettingsActivity.java +++ b/app/src/main/java/com/bingce/controlnetwork/activity/SettingsActivity.java @@ -2,7 +2,6 @@ package com.bingce.controlnetwork.activity; import android.annotation.SuppressLint; -import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ActivityInfo; import android.os.Bundle; @@ -16,13 +15,11 @@ import androidx.preference.ListPreference; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.SwitchPreferenceCompat; -import com.bingce.AppChannel; import com.bingce.controlapphelper.surveyor.surveyor.ISurveyorConstants; import com.bingce.controlnetwork.App; import com.bingce.controlnetwork.R; import com.bingce.controlnetwork.controller.KeyEventAction; -import org.polaric.colorful.ColorPickerPreference; import org.polaric.colorful.Colorful; import org.polaric.colorful.ColorfulActivity; @@ -72,7 +69,7 @@ public class SettingsActivity extends ColorfulActivity { public static class SettingsFragment extends PreferenceFragmentCompat { private SwitchPreferenceCompat nightModePrefs; private SwitchPreferenceCompat isOpenAtr; - private ColorPickerPreference themePrimaryColor, themeAccentColor; +// private ColorPickerPreference themePrimaryColor, themeAccentColor; private ListPreference volume_plus_prefs, volume_minus_prefs; @@ -81,8 +78,8 @@ public class SettingsActivity extends ColorfulActivity { setPreferencesFromResource(R.xml.prefs, rootKey); nightModePrefs = findPreference("key_is_night_mode"); - themePrimaryColor = findPreference("key_theme_primary_color"); - themeAccentColor = findPreference("key_theme_accent_color"); +// themePrimaryColor = findPreference("key_theme_primary_color"); +// themeAccentColor = findPreference("key_theme_accent_color"); volume_plus_prefs = findPreference("key_volume_plus_function"); @@ -108,38 +105,38 @@ public class SettingsActivity extends ColorfulActivity { }); - //主色 - themePrimaryColor.setOnPreferenceChangeListener((preference, newValue) -> { - new AlertDialog.Builder(getActivity()) - .setMessage(R.string.please_restart_to_apply_new_theme) - .setPositiveButton(R.string.confirm, null) - .setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialogInterface) { - Intent intent = new Intent(); - intent.putExtra("isThemeChanged", true); - getActivity().setResult(RESULT_OK, intent); - getActivity().finish(); - } - }).show(); - return true; - }); - //配色 - themeAccentColor.setOnPreferenceChangeListener((preference, newValue) -> { - new AlertDialog.Builder(getActivity()) - .setMessage(R.string.please_restart_to_apply_new_theme) - .setPositiveButton(R.string.confirm, null) - .setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialogInterface) { - Intent intent = new Intent(); - intent.putExtra("isThemeChanged", true); - getActivity().setResult(RESULT_OK, intent); - getActivity().finish(); - } - }).show(); - return true; - }); +// //主色 +// themePrimaryColor.setOnPreferenceChangeListener((preference, newValue) -> { +// new AlertDialog.Builder(getActivity()) +// .setMessage(R.string.please_restart_to_apply_new_theme) +// .setPositiveButton(R.string.confirm, null) +// .setOnDismissListener(new DialogInterface.OnDismissListener() { +// @Override +// public void onDismiss(DialogInterface dialogInterface) { +// Intent intent = new Intent(); +// intent.putExtra("isThemeChanged", true); +// getActivity().setResult(RESULT_OK, intent); +// getActivity().finish(); +// } +// }).show(); +// return true; +// }); +// //配色 +// themeAccentColor.setOnPreferenceChangeListener((preference, newValue) -> { +// new AlertDialog.Builder(getActivity()) +// .setMessage(R.string.please_restart_to_apply_new_theme) +// .setPositiveButton(R.string.confirm, null) +// .setOnDismissListener(new DialogInterface.OnDismissListener() { +// @Override +// public void onDismiss(DialogInterface dialogInterface) { +// Intent intent = new Intent(); +// intent.putExtra("isThemeChanged", true); +// getActivity().setResult(RESULT_OK, intent); +// getActivity().finish(); +// } +// }).show(); +// return true; +// }); volume_plus_prefs.setOnPreferenceChangeListener((preference, newValue) -> { setKeyEvent(newValue, volume_plus_prefs); @@ -155,11 +152,11 @@ public class SettingsActivity extends ColorfulActivity { return true; }); - if (AppChannel.customChannel != AppChannel.CUSTOM_CONTROL_PUBLIC) { - //主配色隐藏 - themePrimaryColor.setVisible(false); - themeAccentColor.setVisible(false); - } +// if (AppChannel.customChannel != AppChannel.CUSTOM_CONTROL_PUBLIC) { +// //主配色隐藏 +// themePrimaryColor.setVisible(false); +// themeAccentColor.setVisible(false); +// } } diff --git a/app/src/main/res/xml/prefs.xml b/app/src/main/res/xml/prefs.xml index c7bc036..0b18972 100644 --- a/app/src/main/res/xml/prefs.xml +++ b/app/src/main/res/xml/prefs.xml @@ -9,16 +9,16 @@ android:summaryOff="@string/daytime_mode" android:summaryOn="@string/night_mode" android:title="@string/is_open_night_mode" /> - - + + + + + + + + + +