mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
set the reason to enable or disable bluetooth
This commit is contained in:
@@ -37,6 +37,7 @@ import org.briarproject.bramble.api.keyagreement.event.KeyAgreementWaitingEvent;
|
||||
import org.briarproject.bramble.api.lifecycle.IoExecutor;
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.BluetoothEnableDisableReason;
|
||||
import org.briarproject.bramble.api.plugin.event.DisableBluetoothEvent;
|
||||
import org.briarproject.bramble.api.plugin.event.EnableBluetoothEvent;
|
||||
import org.briarproject.briar.R;
|
||||
@@ -162,7 +163,8 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
BluetoothAdapter.getDefaultAdapter();
|
||||
if (adapter != null && !adapter.isEnabled()) {
|
||||
waitingForBluetooth = true;
|
||||
eventBus.broadcast(new EnableBluetoothEvent());
|
||||
eventBus.broadcast(new EnableBluetoothEvent(
|
||||
BluetoothEnableDisableReason.ADD_CONTACT));
|
||||
} else {
|
||||
startListening();
|
||||
}
|
||||
@@ -175,7 +177,8 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
//Disable BT adapter if we enabled it
|
||||
final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if(adapter != null && adapter.isEnabled()){
|
||||
eventBus.broadcast(new DisableBluetoothEvent());
|
||||
eventBus.broadcast(new DisableBluetoothEvent(
|
||||
BluetoothEnableDisableReason.ADD_CONTACT));
|
||||
}
|
||||
|
||||
stopListening();
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.briarproject.bramble.api.event.EventListener;
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.BluetoothConstants;
|
||||
import org.briarproject.bramble.api.plugin.BluetoothEnableDisableReason;
|
||||
import org.briarproject.bramble.api.plugin.TorConstants;
|
||||
import org.briarproject.bramble.api.plugin.event.DisableBluetoothEvent;
|
||||
import org.briarproject.bramble.api.plugin.event.EnableBluetoothEvent;
|
||||
@@ -326,8 +327,10 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
||||
}
|
||||
|
||||
private void enableOrDisableBluetooth(boolean enable) {
|
||||
if (enable) eventBus.broadcast(new EnableBluetoothEvent(true));
|
||||
else eventBus.broadcast(new DisableBluetoothEvent(true));
|
||||
if (enable) eventBus.broadcast(new EnableBluetoothEvent(
|
||||
BluetoothEnableDisableReason.COMMUNICATION));
|
||||
else eventBus.broadcast(new DisableBluetoothEvent(
|
||||
BluetoothEnableDisableReason.COMMUNICATION));
|
||||
}
|
||||
|
||||
private void storeTorSettings(final int torSetting) {
|
||||
|
||||
Reference in New Issue
Block a user