mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-15 21:24:10 +02:00
catch illegal state argument if context is lost
This commit is contained in:
@@ -160,21 +160,25 @@ public class BluetoothSettingsFragment extends Fragment {
|
|||||||
new Handler().post(new Runnable() {
|
new Handler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
BluetoothDeviceView notSupported = new BluetoothDeviceView(requireContext());
|
try {
|
||||||
notSupported.setDeviceName(requireContext().getString(R.string.label_scale_not_supported));
|
BluetoothDeviceView notSupported = new BluetoothDeviceView(requireContext());
|
||||||
notSupported.setSummaryText(requireContext().getString(R.string.label_click_to_help_add_support));
|
notSupported.setDeviceName(requireContext().getString(R.string.label_scale_not_supported));
|
||||||
notSupported.setOnClickListener(new View.OnClickListener() {
|
notSupported.setSummaryText(requireContext().getString(R.string.label_click_to_help_add_support));
|
||||||
@Override
|
notSupported.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View view) {
|
@Override
|
||||||
Intent notSupportedIntent = new Intent(Intent.ACTION_VIEW);
|
public void onClick(View view) {
|
||||||
notSupportedIntent.setData(
|
Intent notSupportedIntent = new Intent(Intent.ACTION_VIEW);
|
||||||
Uri.parse("https://github.com/oliexdev/openScale/wiki/Supported-scales-in-openScale"));
|
notSupportedIntent.setData(
|
||||||
|
Uri.parse("https://github.com/oliexdev/openScale/wiki/Supported-scales-in-openScale"));
|
||||||
|
|
||||||
startActivity(notSupportedIntent);
|
startActivity(notSupportedIntent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
deviceListView.addView(notSupported);
|
deviceListView.addView(notSupported);
|
||||||
}
|
} catch(IllegalStateException ex) {
|
||||||
|
Timber.e(ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, 20 * 1000);
|
}, 20 * 1000);
|
||||||
|
Reference in New Issue
Block a user