mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-29 19:20:36 +02:00
Load preferences only when creating measurement views
This commit is contained in:
@@ -261,12 +261,6 @@ public class DataEntryActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateOnView() {
|
private void updateOnView() {
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
|
|
||||||
for (MeasurementView measurement : dataEntryMeasurements) {
|
|
||||||
measurement.updatePreferences(prefs);
|
|
||||||
}
|
|
||||||
|
|
||||||
int id = 0;
|
int id = 0;
|
||||||
if (getIntent().hasExtra(EXTRA_ID)) {
|
if (getIntent().hasExtra(EXTRA_ID)) {
|
||||||
id = getIntent().getExtras().getInt(EXTRA_ID);
|
id = getIntent().getExtras().getInt(EXTRA_ID);
|
||||||
|
@@ -315,7 +315,6 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
measurementView.updatePreferences(prefs);
|
|
||||||
Stack<PointValue> valuesStack = new Stack<PointValue>();
|
Stack<PointValue> valuesStack = new Stack<PointValue>();
|
||||||
|
|
||||||
for (ScaleMeasurement measurement : scaleMeasurementList) {
|
for (ScaleMeasurement measurement : scaleMeasurementList) {
|
||||||
|
@@ -166,7 +166,6 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
updateLastLineChart(scaleMeasurementList);
|
updateLastLineChart(scaleMeasurementList);
|
||||||
|
|
||||||
for (MeasurementView measurement : measurementViews) {
|
for (MeasurementView measurement : measurementViews) {
|
||||||
measurement.updatePreferences(prefs);
|
|
||||||
measurement.loadFrom(lastScaleMeasurement, prevScaleMeasurement);
|
measurement.loadFrom(lastScaleMeasurement, prevScaleMeasurement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,8 +220,6 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
measurementView.updatePreferences(prefs);
|
|
||||||
|
|
||||||
Stack<PointValue> valuesStack = new Stack<PointValue>();
|
Stack<PointValue> valuesStack = new Stack<PointValue>();
|
||||||
|
|
||||||
scaleMeasurementLastDays = new ArrayList<>();
|
scaleMeasurementLastDays = new ArrayList<>();
|
||||||
@@ -283,7 +280,6 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
measurementView.updatePreferences(prefs);
|
|
||||||
measurementView.loadFrom(lastScaleMeasurement, null);
|
measurementView.loadFrom(lastScaleMeasurement, null);
|
||||||
|
|
||||||
if (measurementView.getValue() != 0) {
|
if (measurementView.getValue() != 0) {
|
||||||
|
@@ -219,7 +219,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
|
|
||||||
ArrayList<MeasurementView> visibleMeasurements = new ArrayList<>();
|
ArrayList<MeasurementView> visibleMeasurements = new ArrayList<>();
|
||||||
for (MeasurementView measurement : measurementViews) {
|
for (MeasurementView measurement : measurementViews) {
|
||||||
measurement.updatePreferences(prefs);
|
|
||||||
|
|
||||||
if (measurement.isVisible()) {
|
if (measurement.isVisible()) {
|
||||||
ImageView headerIcon = new ImageView(tableView.getContext());
|
ImageView headerIcon = new ImageView(tableView.getContext());
|
||||||
|
@@ -22,6 +22,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
@@ -107,6 +108,12 @@ public abstract class MeasurementView extends TableLayout {
|
|||||||
measurementViews.add(new TimeMeasurementView(context));
|
measurementViews.add(new TimeMeasurementView(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
|
||||||
|
for (MeasurementView measurement : measurementViews) {
|
||||||
|
measurement.updatePreferences(prefs);
|
||||||
|
}
|
||||||
|
|
||||||
return measurementViews;
|
return measurementViews;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user