mirror of https://github.com/m2049r/xmrwallet.git
fix some crashing if bluetooth pemissions are not given (#965)
* show error instead of crashing * ignore if fragement is no longer * bump version
This commit is contained in:
parent
84ce392192
commit
758b042680
|
@ -8,8 +8,8 @@ android {
|
||||||
compileSdk 35
|
compileSdk 35
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 35
|
targetSdkVersion 35
|
||||||
versionCode 4102
|
versionCode 4103
|
||||||
versionName "4.1.2 'Exolix'"
|
versionName "4.1.3 'Exolix'"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
|
|
|
@ -1411,7 +1411,7 @@ public class LoginActivity extends BaseActivity
|
||||||
Timber.d("onDeviceConnected: %s", connectedDeviceName);
|
Timber.d("onDeviceConnected: %s", connectedDeviceName);
|
||||||
try {
|
try {
|
||||||
SidekickConnectFragment f = (SidekickConnectFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
SidekickConnectFragment f = (SidekickConnectFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
||||||
assert f != null;
|
if (f == null) return;
|
||||||
f.allowClick();
|
f.allowClick();
|
||||||
} catch (ClassCastException ex) {
|
} catch (ClassCastException ex) {
|
||||||
// ignore it
|
// ignore it
|
||||||
|
|
|
@ -27,6 +27,7 @@ import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
@ -116,8 +117,10 @@ public class SidekickConnectFragment extends Fragment
|
||||||
|
|
||||||
private void populateList() {
|
private void populateList() {
|
||||||
List<BluetoothInfo> items = new ArrayList<>();
|
List<BluetoothInfo> items = new ArrayList<>();
|
||||||
if (ActivityCompat.checkSelfPermission(requireContext(), android.Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED)
|
if (ActivityCompat.checkSelfPermission(requireContext(), android.Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED) {
|
||||||
throw new IllegalStateException("Bluetooth permission not granted");
|
Toast.makeText(requireContext(), "Bluetooth permission not granted", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (BluetoothDevice device : bluetoothAdapter.getBondedDevices()) {
|
for (BluetoothDevice device : bluetoothAdapter.getBondedDevices()) {
|
||||||
final int deviceCLass = device.getBluetoothClass().getDeviceClass();
|
final int deviceCLass = device.getBluetoothClass().getDeviceClass();
|
||||||
switch (deviceCLass) {
|
switch (deviceCLass) {
|
||||||
|
|
Loading…
Reference in New Issue