@@ -41,39 +41,39 @@ class MonitorFragment : BaseFragment(), BtMonitorTarget {
4141 if (bluetoothIsEnabled()) {
4242 @Suppress(" ConstantConditionIf" )
4343 if (BuildConfig .API_IMPL == " DEVICE_BT" ) {
44- if (btIsEnabled()) {
45- val btDevices = getBtDevices()
46- if (btDevices.isNotEmpty()) {
47- btMonitor = DeviceBtMonitor (this )
48- showDevicesList(btDevices)
49- } else {
50- showBtDevicesNotFoundWarning()
51- }
44+ val btDevices = getBtDevices()
45+ if (btDevices.isNotEmpty()) {
46+ btMonitor = DeviceBtMonitor (this )
47+ showDevicesList(btDevices)
5248 } else {
53- showBtDisabledWarning ()
49+ showBtDevicesNotFoundWarning ()
5450 }
5551 } else {
5652 startInDebugMode()
5753 initializeButtons()
5854 }
5955 } else {
60- AppDialog .show(
61- context!! ,
62- R .string.bluetooth_error_dialog_title,
63- R .string.bluetooth_error_dialog_message,
64- R .string.bluetooth_error_dialog_button_text,
65- DialogInterface .OnClickListener { dialog, _ ->
66- dialog.cancel()
67- activity!! .finish()
68- }
69- )
56+ showBluetoothErrorDialog()
7057 }
7158 }
7259
7360 private fun bluetoothIsEnabled (): Boolean {
7461 return btAdapter!! .isEnabled
7562 }
7663
64+ private fun showBluetoothErrorDialog () {
65+ AppDialog .show(
66+ context!! ,
67+ R .string.bluetooth_error_dialog_title,
68+ R .string.bluetooth_error_dialog_message,
69+ R .string.bluetooth_error_dialog_button_text,
70+ DialogInterface .OnClickListener { dialog, _ ->
71+ dialog.cancel()
72+ activity!! .finish()
73+ }
74+ )
75+ }
76+
7777 @SuppressLint(" SetTextI18n" )
7878 private fun startInDebugMode () {
7979 btMonitor = DebugBtMonitor (this )
@@ -92,8 +92,6 @@ class MonitorFragment : BaseFragment(), BtMonitorTarget {
9292 }.start()
9393 }
9494
95- private fun btIsEnabled () = true
96-
9795 private fun showDevicesList (btDevices : List <BtDevice >) {
9896 val devicesBottomSheet = BtDevicesBottomSheet ()
9997 devicesBottomSheet.setBtDevices(btDevices)
@@ -180,18 +178,6 @@ class MonitorFragment : BaseFragment(), BtMonitorTarget {
180178 tv_connected_device_info.text = name
181179 }
182180
183- private fun showBtDisabledWarning () {
184- AppDialog .show(
185- context!! ,
186- R .string.title_warning,
187- R .string.message_bt_is_disabled,
188- R .string.action_exit,
189- DialogInterface .OnClickListener { _, _ ->
190- activity!! .finish()
191- }
192- )
193- }
194-
195181 private fun showBtDevicesNotFoundWarning () {
196182 AppDialog .show(
197183 context!! ,
0 commit comments