mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-27 10:15:00 +02:00
run on ui thread for ui interactions, see issue #619
This commit is contained in:
@@ -126,8 +126,13 @@ public class BluetoothSettingsFragment extends Fragment {
|
|||||||
private final BluetoothCentralCallback bluetoothCentralCallback = new BluetoothCentralCallback() {
|
private final BluetoothCentralCallback bluetoothCentralCallback = new BluetoothCentralCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onDiscoveredPeripheral(BluetoothPeripheral peripheral, ScanResult scanResult) {
|
public void onDiscoveredPeripheral(BluetoothPeripheral peripheral, ScanResult scanResult) {
|
||||||
|
new Handler().post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
onDeviceFound(scanResult);
|
onDeviceFound(scanResult);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private void startBluetoothDiscovery() {
|
private void startBluetoothDiscovery() {
|
||||||
@@ -152,6 +157,9 @@ public class BluetoothSettingsFragment extends Fragment {
|
|||||||
txtSearching.setText(R.string.label_bluetooth_searching_finished);
|
txtSearching.setText(R.string.label_bluetooth_searching_finished);
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
new Handler().post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
BluetoothDeviceView notSupported = new BluetoothDeviceView(requireContext());
|
BluetoothDeviceView notSupported = new BluetoothDeviceView(requireContext());
|
||||||
notSupported.setDeviceName(requireContext().getString(R.string.label_scale_not_supported));
|
notSupported.setDeviceName(requireContext().getString(R.string.label_scale_not_supported));
|
||||||
notSupported.setSummaryText(requireContext().getString(R.string.label_click_to_help_add_support));
|
notSupported.setSummaryText(requireContext().getString(R.string.label_click_to_help_add_support));
|
||||||
@@ -167,6 +175,8 @@ public class BluetoothSettingsFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
deviceListView.addView(notSupported);
|
deviceListView.addView(notSupported);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}, 20 * 1000);
|
}, 20 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user