mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-29 19:20:36 +02:00
catch error if polygon degree of regression line is empty (fixed bug #306)
This commit is contained in:
@@ -37,6 +37,7 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.PopupMenu;
|
import android.widget.PopupMenu;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.health.openscale.R;
|
import com.health.openscale.R;
|
||||||
import com.health.openscale.core.OpenScale;
|
import com.health.openscale.core.OpenScale;
|
||||||
@@ -321,9 +322,16 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
|
|
||||||
floatingActionBar.removeAllViews();
|
floatingActionBar.removeAllViews();
|
||||||
|
|
||||||
PolynomialFitter polyFitter = new PolynomialFitter(
|
int regressLineOrder = 1;
|
||||||
Math.min(Integer.parseInt(prefs.getString("regressionLineOrder", "1")),
|
|
||||||
100));
|
try {
|
||||||
|
regressLineOrder = Integer.parseInt(prefs.getString("regressionLineOrder", "1"));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Toast.makeText(getContext(), getString(R.string.error_value_required) + ":" + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
|
prefs.edit().putString("regressionLineOrder", "1").commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
PolynomialFitter polyFitter = new PolynomialFitter(Math.min(regressLineOrder, 100));
|
||||||
|
|
||||||
for (MeasurementView view : measurementViews) {
|
for (MeasurementView view : measurementViews) {
|
||||||
if (view instanceof FloatMeasurementView) {
|
if (view instanceof FloatMeasurementView) {
|
||||||
|
Reference in New Issue
Block a user