1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Redmi Smart Band Pro: Fix password digits

This commit is contained in:
José Rebelo 2024-01-16 20:52:10 +00:00
parent 3a2b02df2a
commit 3b8428e795
3 changed files with 16 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}
}

View File

@ -985,6 +985,7 @@
<string name="prefs_password_summary">Lock the band with a password when removed from the wrist</string>
<string name="prefs_password_enabled">Password Enabled</string>
<string name="prefs_password_4_digits_1_to_4_summary">The password must have 4 digits, using numbers 1 to 4</string>
<string name="prefs_password_4_digits_0_to_9_summary">The password must have 4 digits, using only numbers</string>
<string name="prefs_password_6_digits_0_to_9_summary">The password must have 6 digits, using only numbers</string>
<string name="mi2_prefs_heart_rate_monitoring_alerts_summary">Configure heart rate monitoring and alert thresholds</string>
<string name="mi2_prefs_do_not_disturb_start">Start time</string>