mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-01 20:15:52 +02:00
Pebble: No pairing activity, just call createBond() and finish discovery activity
This commit is contained in:
parent
a70426d84d
commit
f101926186
@ -294,8 +294,20 @@ public class DiscoveryActivity extends Activity implements AdapterView.OnItemCli
|
|||||||
}
|
}
|
||||||
|
|
||||||
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(deviceCandidate);
|
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(deviceCandidate);
|
||||||
Intent intent = new Intent(this, coordinator.getPairingActivity());
|
Class<? extends Activity> pairingActivity = coordinator.getPairingActivity();
|
||||||
|
if (pairingActivity != null) {
|
||||||
|
Intent intent = new Intent(this, pairingActivity);
|
||||||
intent.putExtra(DeviceCoordinator.EXTRA_DEVICE_MAC_ADDRESS, deviceCandidate.getMacAddress());
|
intent.putExtra(DeviceCoordinator.EXTRA_DEVICE_MAC_ADDRESS, deviceCandidate.getMacAddress());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
BluetoothDevice btDevice = adapter.getRemoteDevice(deviceCandidate.getMacAddress());
|
||||||
|
btDevice.createBond();
|
||||||
|
finish();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package nodomain.freeyourgadget.gadgetbridge.pebble;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.ControlCenter;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.DeviceCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.DeviceCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.DeviceType;
|
import nodomain.freeyourgadget.gadgetbridge.DeviceType;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.GBDevice;
|
||||||
@ -26,6 +25,6 @@ public class PebbleCoordinator implements DeviceCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends Activity> getPairingActivity() {
|
public Class<? extends Activity> getPairingActivity() {
|
||||||
return ControlCenter.class;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user