mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-11 01:21:56 +01:00
Renamed removeBroadcastReceivers to a more correct name
This commit is contained in:
parent
ab306b1352
commit
09eb470b64
@ -279,7 +279,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
||||
deviceCandidatesView.setOnItemClickListener(this);
|
||||
deviceCandidatesView.setOnItemLongClickListener(this);
|
||||
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
|
||||
checkAndRequestLocationPermission();
|
||||
|
||||
@ -340,7 +340,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@ -785,7 +785,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
||||
AndroidUtils.safeUnregisterBroadcastReceiver(this, bluetoothReceiver);
|
||||
}
|
||||
|
||||
public void removeBroadcastReceivers() {
|
||||
public void registerBroadcastReceivers() {
|
||||
IntentFilter bluetoothIntents = new IntentFilter();
|
||||
bluetoothIntents.addAction(BluetoothDevice.ACTION_FOUND);
|
||||
bluetoothIntents.addAction(BluetoothDevice.ACTION_UUID);
|
||||
|
@ -94,7 +94,7 @@ public class LenovoWatchPairingActivity extends AbstractGBActivity implements Bo
|
||||
private void startPairing(GBDeviceCandidate deviceCandidate) {
|
||||
message.setText(getString(R.string.pairing, deviceCandidate));
|
||||
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
|
||||
BondingUtil.connectThenComplete(this, deviceCandidate);
|
||||
}
|
||||
@ -112,13 +112,13 @@ public class LenovoWatchPairingActivity extends AbstractGBActivity implements Bo
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ public class LenovoWatchPairingActivity extends AbstractGBActivity implements Bo
|
||||
AndroidUtils.safeUnregisterBroadcastReceiver(LocalBroadcastManager.getInstance(this), pairingReceiver);
|
||||
}
|
||||
|
||||
public void removeBroadcastReceivers() {
|
||||
public void registerBroadcastReceivers() {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||
}
|
||||
|
||||
|
@ -183,13 +183,13 @@ public class MiBandPairingActivity extends AbstractGBActivity implements Bonding
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ public class MiBandPairingActivity extends AbstractGBActivity implements Bonding
|
||||
AndroidUtils.safeUnregisterBroadcastReceiver(this, bondingReceiver);
|
||||
}
|
||||
|
||||
public void removeBroadcastReceivers() {
|
||||
public void registerBroadcastReceivers() {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||
registerReceiver(bondingReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class PebblePairingActivity extends AbstractGBActivity implements Bonding
|
||||
return;
|
||||
}
|
||||
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
BondingUtil.connectThenComplete(this, device);
|
||||
return;
|
||||
}
|
||||
@ -205,13 +205,13 @@ public class PebblePairingActivity extends AbstractGBActivity implements Bonding
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ public class PebblePairingActivity extends AbstractGBActivity implements Bonding
|
||||
AndroidUtils.safeUnregisterBroadcastReceiver(this, bondingReceiver);
|
||||
}
|
||||
|
||||
public void removeBroadcastReceivers() {
|
||||
public void registerBroadcastReceivers() {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||
registerReceiver(bondingReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class Watch9PairingActivity extends AbstractGBActivity implements Bonding
|
||||
private void startConnecting(GBDeviceCandidate deviceCandidate) {
|
||||
message.setText(getString(R.string.pairing, deviceCandidate));
|
||||
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
BondingUtil.connectThenComplete(this, deviceCandidate);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public class Watch9PairingActivity extends AbstractGBActivity implements Bonding
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBroadcastReceivers() {
|
||||
public void registerBroadcastReceivers() {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||
}
|
||||
|
||||
@ -125,13 +125,13 @@ public class Watch9PairingActivity extends AbstractGBActivity implements Bonding
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
removeBroadcastReceivers();
|
||||
registerBroadcastReceivers();
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public interface BondingInterface {
|
||||
* This forces bonding activities to handle the addition
|
||||
* of all broadcast receivers in the same place
|
||||
**/
|
||||
void removeBroadcastReceivers();
|
||||
void registerBroadcastReceivers();
|
||||
|
||||
/**
|
||||
* Just returns the Context
|
||||
|
@ -324,7 +324,7 @@ public class BondingUtil {
|
||||
* Use this function to initiate bonding to a GBDeviceCandidate
|
||||
*/
|
||||
public static void tryBondThenComplete(BondingInterface bondingInterface, GBDeviceCandidate deviceCandidate) {
|
||||
bondingInterface.removeBroadcastReceivers();
|
||||
bondingInterface.registerBroadcastReceivers();
|
||||
BluetoothDevice device = deviceCandidate.getDevice();
|
||||
|
||||
int bondState = device.getBondState();
|
||||
|
Loading…
Reference in New Issue
Block a user