From 3b8428e79565493ad4d8611a14cf16ee1a60e95b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Tue, 16 Jan 2024 20:52:10 +0000 Subject: [PATCH] Redmi Smart Band Pro: Fix password digits --- .../capabilities/password/PasswordCapabilityImpl.java | 9 +++++++++ .../redmismartbandpro/RedmiSmartBandProCoordinator.java | 6 ++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 16 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/capabilities/password/PasswordCapabilityImpl.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/capabilities/password/PasswordCapabilityImpl.java index 5ef94ed0f..9e4aab92e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/capabilities/password/PasswordCapabilityImpl.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/capabilities/password/PasswordCapabilityImpl.java @@ -39,6 +39,7 @@ public class PasswordCapabilityImpl { public enum Mode { NONE, + NUMBERS_4_DIGITS_0_TO_9, NUMBERS_4_DIGITS_1_TO_4, NUMBERS_6, } @@ -60,6 +61,9 @@ public class PasswordCapabilityImpl { case NUMBERS_6: password.setSummary(R.string.prefs_password_6_digits_0_to_9_summary); break; + case NUMBERS_4_DIGITS_0_TO_9: + password.setSummary(R.string.prefs_password_4_digits_0_to_9_summary); + break; case NUMBERS_4_DIGITS_1_TO_4: password.setSummary(R.string.prefs_password_4_digits_1_to_4_summary); break; @@ -79,6 +83,11 @@ public class PasswordCapabilityImpl { editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD); expectedLength = 6; break; + case NUMBERS_4_DIGITS_0_TO_9: + password.setSummary(R.string.prefs_password_4_digits_0_to_9_summary); + editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD); + expectedLength = 4; + break; case NUMBERS_4_DIGITS_1_TO_4: password.setSummary(R.string.prefs_password_4_digits_1_to_4_summary); editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmismartbandpro/RedmiSmartBandProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmismartbandpro/RedmiSmartBandProCoordinator.java index f6f81ae7a..4ee78b490 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmismartbandpro/RedmiSmartBandProCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmismartbandpro/RedmiSmartBandProCoordinator.java @@ -24,6 +24,7 @@ import androidx.annotation.Nullable; import java.util.regex.Pattern; import nodomain.freeyourgadget.gadgetbridge.R; +import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiInstallHandler; @@ -60,4 +61,9 @@ public class RedmiSmartBandProCoordinator extends XiaomiCoordinator { public int getDisabledIconResource() { return R.drawable.ic_device_default_disabled; } + + @Override + public PasswordCapabilityImpl.Mode getPasswordCapability() { + return PasswordCapabilityImpl.Mode.NUMBERS_4_DIGITS_0_TO_9; + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9d59456ae..7b7e164b4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -985,6 +985,7 @@ Lock the band with a password when removed from the wrist Password Enabled The password must have 4 digits, using numbers 1 to 4 + The password must have 4 digits, using only numbers The password must have 6 digits, using only numbers Configure heart rate monitoring and alert thresholds Start time