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