From 6d28af1132739752f6f2c0c2be22eff7478d4bb8 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 2 May 2019 22:40:28 +0200 Subject: [PATCH] Mi Band 2: enable per-device pairing keys Now enabled for all Huami devices --- .../devices/huami/HuamiCoordinator.java | 12 ++++++++++++ .../huami/amazfitbip/AmazfitBipCoordinator.java | 17 ++--------------- .../huami/amazfitcor/AmazfitCorCoordinator.java | 16 ++-------------- .../huami/miband2/MiBand2Coordinator.java | 3 ++- .../huami/miband3/MiBand3Coordinator.java | 12 ------------ 5 files changed, 18 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiCoordinator.java index 6e674ca70..9083bacb6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiCoordinator.java @@ -40,6 +40,8 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity; +import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsFragment; +import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.HuamiSettingsFragment; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.miband.DateTimeDisplay; @@ -119,6 +121,16 @@ public abstract class HuamiCoordinator extends AbstractDeviceCoordinator { return true; } + @Override + public boolean supportsDeviceSpecificSettings(GBDevice device) { + return true; + } + + @Override + public DeviceSpecificSettingsFragment getDeviceSpecificSettingsFragment(GBDevice device) { + return HuamiSettingsFragment.newInstance(device.getAddress()); + } + @Override public SampleProvider getSampleProvider(GBDevice device, DaoSession session) { return new MiBand2SampleProvider(device, session); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipCoordinator.java index 83dc46687..41e1f7c23 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipCoordinator.java @@ -21,13 +21,11 @@ import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; +import androidx.annotation.NonNull; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import androidx.annotation.NonNull; - -import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.HuamiSettingsFragment; -import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsFragment; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; @@ -77,15 +75,4 @@ public class AmazfitBipCoordinator extends HuamiCoordinator { public boolean supportsWeather() { return true; } - - - @Override - public boolean supportsDeviceSpecificSettings(GBDevice device) { - return true; - } - - @Override - public DeviceSpecificSettingsFragment getDeviceSpecificSettingsFragment(GBDevice device) { - return HuamiSettingsFragment.newInstance(device.getAddress()); - } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor/AmazfitCorCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor/AmazfitCorCoordinator.java index 8000baa21..f7eb4f1d3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor/AmazfitCorCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor/AmazfitCorCoordinator.java @@ -21,13 +21,11 @@ import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; +import androidx.annotation.NonNull; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import androidx.annotation.NonNull; - -import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.HuamiSettingsFragment; -import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsFragment; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; @@ -81,14 +79,4 @@ public class AmazfitCorCoordinator extends HuamiCoordinator { @Override public boolean supportsUnicodeEmojis() { return true; } - - @Override - public boolean supportsDeviceSpecificSettings(GBDevice device) { - return true; - } - - @Override - public DeviceSpecificSettingsFragment getDeviceSpecificSettingsFragment(GBDevice device) { - return HuamiSettingsFragment.newInstance(device.getAddress()); - } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java index 42cb30f00..0002749c1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java @@ -21,10 +21,11 @@ import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; +import androidx.annotation.NonNull; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import androidx.annotation.NonNull; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband3/MiBand3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband3/MiBand3Coordinator.java index acff60b7b..1919a1c17 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband3/MiBand3Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband3/MiBand3Coordinator.java @@ -29,8 +29,6 @@ import org.slf4j.LoggerFactory; import java.util.Date; import nodomain.freeyourgadget.gadgetbridge.GBApplication; -import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsFragment; -import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.HuamiSettingsFragment; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; @@ -85,16 +83,6 @@ public class MiBand3Coordinator extends HuamiCoordinator { return true; } - @Override - public boolean supportsDeviceSpecificSettings(GBDevice device) { - return true; - } - - @Override - public DeviceSpecificSettingsFragment getDeviceSpecificSettingsFragment(GBDevice device) { - return HuamiSettingsFragment.newInstance(device.getAddress()); - } - public static boolean getBandScreenUnlock() { Prefs prefs = GBApplication.getPrefs(); return prefs.getBoolean(MiBandConst.PREF_MI3_BAND_SCREEN_UNLOCK, false);