Merge branch 'omnipod_eros_dev' into omnipod_eros_dev_upstream_merge
This commit is contained in:
commit
abb380b219
|
@ -116,7 +116,12 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
startLeDeviceScan();
|
startLeDeviceScan();
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonStopScan.setOnClickListener(view -> stopLeDeviceScan());
|
buttonStopScan.setOnClickListener(view -> {
|
||||||
|
if (scanning) {
|
||||||
|
stopLeDeviceScan();
|
||||||
|
rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkNewAddressSet, this); // Reconnect current RL
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
buttonRemoveRileyLink.setOnClickListener(view -> new AlertDialog.Builder(this)
|
buttonRemoveRileyLink.setOnClickListener(view -> new AlertDialog.Builder(this)
|
||||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
|
@ -125,6 +130,7 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
.setPositiveButton(getString(R.string.riley_link_common_yes), (dialog, which) -> {
|
.setPositiveButton(getString(R.string.riley_link_common_yes), (dialog, which) -> {
|
||||||
rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnect, RileyLinkBLEConfigActivity.this);
|
rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnect, RileyLinkBLEConfigActivity.this);
|
||||||
sp.remove(RileyLinkConst.Prefs.RileyLinkAddress);
|
sp.remove(RileyLinkConst.Prefs.RileyLinkAddress);
|
||||||
|
sp.remove(RileyLinkConst.Prefs.RileyLinkName);
|
||||||
updateCurrentlySelectedRileyLink();
|
updateCurrentlySelectedRileyLink();
|
||||||
})
|
})
|
||||||
.setNegativeButton(getString(R.string.riley_link_common_no), null)
|
.setNegativeButton(getString(R.string.riley_link_common_no), null)
|
||||||
|
@ -153,17 +159,12 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
updateCurrentlySelectedRileyLink();
|
updateCurrentlySelectedRileyLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onBackPressed() {
|
|
||||||
super.onBackPressed();
|
|
||||||
if (rlDisconnected) {
|
|
||||||
// Reconnect RL if it was disconnected for the scan
|
|
||||||
rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkNewAddressSet, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override protected void onDestroy() {
|
@Override protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
stopLeDeviceScan();
|
if (scanning) {
|
||||||
|
stopLeDeviceScan();
|
||||||
|
rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkNewAddressSet, this); // Reconnect current RL
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareForScanning() {
|
private void prepareForScanning() {
|
||||||
|
@ -246,7 +247,12 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
deviceListAdapter.notifyDataSetChanged();
|
deviceListAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
// Stops scanning after a pre-defined scan period.
|
// Stops scanning after a pre-defined scan period.
|
||||||
handler.postDelayed(this::stopLeDeviceScan, SCAN_PERIOD_MILLIS);
|
handler.postDelayed(() -> {
|
||||||
|
if (scanning) {
|
||||||
|
stopLeDeviceScan();
|
||||||
|
rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkNewAddressSet, this); // Reconnect current RL
|
||||||
|
}
|
||||||
|
}, SCAN_PERIOD_MILLIS);
|
||||||
|
|
||||||
buttonStartScan.setEnabled(false);
|
buttonStartScan.setEnabled(false);
|
||||||
buttonStopScan.setVisibility(View.VISIBLE);
|
buttonStopScan.setVisibility(View.VISIBLE);
|
||||||
|
@ -260,6 +266,7 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
private void stopLeDeviceScan() {
|
private void stopLeDeviceScan() {
|
||||||
if (scanning) {
|
if (scanning) {
|
||||||
scanning = false;
|
scanning = false;
|
||||||
|
|
||||||
bleScanner.stopScan(bleScanCallback);
|
bleScanner.stopScan(bleScanCallback);
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "stopLeDeviceScan: Scanning Stop");
|
aapsLogger.debug(LTag.PUMPBTCOMM, "stopLeDeviceScan: Scanning Stop");
|
||||||
|
|
Loading…
Reference in a new issue