1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-16 21:54:05 +02:00

Fixed a crash when selecting a Bluetooth device during the slideshow, see #639

This commit is contained in:
oliexdev
2020-11-25 20:02:43 +01:00
parent 93736af298
commit fb524fe01e
2 changed files with 8 additions and 4 deletions

View File

@@ -523,7 +523,7 @@ public class ChartMeasurementView extends LineChart {
return;
}
PolynomialFitter polyFitter = new PolynomialFitter(3);
PolynomialFitter polyFitter = new PolynomialFitter(lineEntries.size() == 2 ? 2 : 3);
// use only the last 30 values for the polynomial fitter
for (int i=1; i<30; i++) {

View File

@@ -362,9 +362,13 @@ public class BluetoothSettingsFragment extends Fragment {
Timber.d("Saved Bluetooth device " + device.getName() + " with address " + device.getAddress());
stopBluetoothDiscovery();
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).getPreviousBackStackEntry().getSavedStateHandle().set("update", true);
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).navigateUp();
}
if (getActivity().findViewById(R.id.nav_host_fragment) != null){
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).getPreviousBackStackEntry().getSavedStateHandle().set("update", true);
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).navigateUp();
} else
getActivity().finish();
}
}
@Override