From f9d04e38a018be2c6bea43b61b3c5eaecdaf316e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Mon, 22 Oct 2018 14:04:50 +0200 Subject: [PATCH] ColorPicker --- android/app/build.gradle | 1 + .../view/SettingsFragment.java | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index ac9a41b..7c3bc44 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -50,6 +50,7 @@ dependencies { implementation 'com.squareup.okhttp3:okhttp:3.10.0' implementation 'com.github.kenglxn.QRGen:android:2.5.0' implementation "com.github.DeweyReed:UltimateMusicPicker:2.0.0" + implementation 'com.github.duanhong169:colorpicker:1.1.5' } apply plugin: 'com.google.gms.google-services' diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java index 1227c58..4dffd31 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java @@ -22,6 +22,7 @@ import org.jetbrains.annotations.NotNull; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; +import top.defaults.colorpicker.ColorPickerPopup; import xyz.aprildown.ultimatemusicpicker.MusicPickerListener; import xyz.aprildown.ultimatemusicpicker.UltimateMusicPicker; @@ -221,7 +222,25 @@ public class SettingsFragment extends Fragment implements MusicPickerListener private void chooseLEDColorLow() { - // + new ColorPickerPopup.Builder(getContext()) + .initialColor(SCNSettings.inst().PriorityLow.LEDColor) // Set initial color + .enableBrightness(true) // Enable brightness slider or not + .okTitle("Choose") + .cancelTitle("Cancel") + .showIndicator(true) + .showValue(false) + .build() + .show(getView(), new ColorPickerPopup.ColorPickerObserver() + { + @Override + public void onColorPicked(int color) { + SCNSettings.inst().PriorityLow.LEDColor = color; + saveAndUpdate(); + } + + @Override + public void onColor(int color, boolean fromUser) { } + }); } @Override