diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java
index 1d134d257..f80bf891b 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java
@@ -396,4 +396,6 @@ public class DeviceSettingsPreferenceConst {
public static final String PREF_DEVICE_ACTION_WOKE_UP_BROADCAST = "prefs_events_forwarding_wokeup_broadcast";
public static final String PREF_DEVICE_ACTION_START_NON_WEAR_SELECTIONS = "events_forwarding_startnonwear_action_selections";
public static final String PREF_DEVICE_ACTION_START_NON_WEAR_BROADCAST = "prefs_events_forwarding_startnonwear_broadcast";
+ public static final String PREF_CLAP_HANDS_TO_WAKEUP_DEVICE = "pref_key_clap_hands_to_wakeup_device";
+ public static final String PREF_POWER_SAVING = "pref_key_power_saving";
}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java
index 9e28287c5..f4eadc410 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java
@@ -144,10 +144,10 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
ListPreference languageListPreference = findPreference("language");
CharSequence[] entries = languageListPreference.getEntries();
CharSequence[] values = languageListPreference.getEntryValues();
- for (int i=entries.length-1;i>=0;i--) {
- if (!ArrayUtils.contains(supportedLanguages,values[i])) {
- entries = ArrayUtils.remove(entries,i);
- values = ArrayUtils.remove(values,i);
+ for (int i = entries.length - 1; i >= 0; i--) {
+ if (!ArrayUtils.contains(supportedLanguages, values[i])) {
+ entries = ArrayUtils.remove(entries, i);
+ values = ArrayUtils.remove(values, i);
}
}
languageListPreference.setEntries(entries);
@@ -324,7 +324,6 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
}
-
addPreferenceHandlerFor(PREF_SWIPE_UNLOCK);
addPreferenceHandlerFor(PREF_MI2_DATEFORMAT);
addPreferenceHandlerFor(PREF_DATEFORMAT);
@@ -566,6 +565,9 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
addPreferenceHandlerFor(PREF_SLEEP_MODE_SCHEDULE_START);
addPreferenceHandlerFor(PREF_SLEEP_MODE_SCHEDULE_END);
+ addPreferenceHandlerFor(PREF_CLAP_HANDS_TO_WAKEUP_DEVICE);
+ addPreferenceHandlerFor(PREF_POWER_SAVING);
+
addPreferenceHandlerFor("lock");
String sleepTimeState = prefs.getString(PREF_SLEEP_TIME, PREF_DO_NOT_DISTURB_OFF);
@@ -981,7 +983,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
}
final Preference notificationSettings = findPreference(PREFS_PER_APP_NOTIFICATION_SETTINGS);
- if(notificationSettings != null) {
+ if (notificationSettings != null) {
notificationSettings.setOnPreferenceClickListener(preference -> {
final Intent intent = new Intent(getContext(), AppSpecificNotificationSettingsActivity.class);
intent.putExtra(GBDevice.EXTRA_DEVICE, getDevice());
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/divoom/PixooCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/divoom/PixooCoordinator.java
index ac7893521..5b8e877fb 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/divoom/PixooCoordinator.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/divoom/PixooCoordinator.java
@@ -79,6 +79,7 @@ public class PixooCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
+ R.xml.devicesettings_pixoo,
R.xml.devicesettings_screen_brightness,
R.xml.devicesettings_timeformat,
};
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/divoom/PixooProtocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/divoom/PixooProtocol.java
index b3a2af975..53ce5b2c6 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/divoom/PixooProtocol.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/divoom/PixooProtocol.java
@@ -174,6 +174,20 @@ public class PixooProtocol extends GBDeviceProtocol {
0x2d,
(byte) (is24hour ? 1 : 0),
});
+ case DeviceSettingsPreferenceConst.PREF_CLAP_HANDS_TO_WAKEUP_DEVICE:
+ boolean clap = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_CLAP_HANDS_TO_WAKEUP_DEVICE, false);
+
+ return encodeProtocol(new byte[]{
+ (byte) 0xa7,
+ (byte) (clap ? 1 : 0),
+ });
+ case DeviceSettingsPreferenceConst.PREF_POWER_SAVING:
+ boolean power_saving = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_POWER_SAVING, false);
+
+ return encodeProtocol(new byte[]{
+ (byte) 0xb2,
+ (byte) (power_saving ? 1 : 0),
+ });
}
@@ -363,7 +377,7 @@ public class PixooProtocol extends GBDeviceProtocol {
msgBuf.put(payload);
short crc = (short) (((payload.length + 2) & 0xff) + ((payload.length + 2) >> 8));
for (byte b : payload) {
- crc += b;
+ crc += (b & 0xff);
}
msgBuf.putShort(crc);
msgBuf.put((byte) 0x02);
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c0857fced..47754acd3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -493,6 +493,10 @@
Beep once
Beep twice
Vibrate and beep once
+
+ Clap hands to turn up screen"
+ Clapping again will turn off the screen"
+ The screen will turn off after the microphone has detected silence for a while
Device specific settings
Auth Key