mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-29 11:10:35 +02:00
Specify where, if at all, in the list that date/time should be
This commit is contained in:
@@ -94,7 +94,8 @@ public class DataEntryActivity extends AppCompatActivity {
|
||||
|
||||
tableLayoutDataEntry = (TableLayout) findViewById(R.id.tableLayoutDataEntry);
|
||||
|
||||
dataEntryMeasurements = MeasurementView.getMeasurementList(context);
|
||||
dataEntryMeasurements = MeasurementView.getMeasurementList(
|
||||
context, MeasurementView.DateTimeOrder.LAST);
|
||||
|
||||
txtDataNr = (TextView) findViewById(R.id.txtDataNr);
|
||||
btnLeft = (Button) findViewById(R.id.btnLeft);
|
||||
|
@@ -174,7 +174,8 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
||||
}
|
||||
});
|
||||
|
||||
measurementViews = MeasurementView.getMeasurementList(getContext());
|
||||
measurementViews = MeasurementView.getMeasurementList(
|
||||
getContext(), MeasurementView.DateTimeOrder.NONE);
|
||||
|
||||
popup = new PopupMenu(getContext(), optionMenu);
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
|
@@ -38,10 +38,8 @@ import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
import com.health.openscale.core.utils.DateTimeHelpers;
|
||||
import com.health.openscale.gui.views.DateMeasurementView;
|
||||
import com.health.openscale.gui.views.FloatMeasurementView;
|
||||
import com.health.openscale.gui.views.MeasurementView;
|
||||
import com.health.openscale.gui.views.TimeMeasurementView;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -120,13 +118,10 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
pieChartLast.setOnValueTouchListener(new PieChartLastTouchListener());
|
||||
pieChartLast.setChartRotationEnabled(false);
|
||||
|
||||
measurementViews = MeasurementView.getMeasurementList(getContext());
|
||||
measurementViews = MeasurementView.getMeasurementList(
|
||||
getContext(), MeasurementView.DateTimeOrder.NONE);
|
||||
|
||||
for (MeasurementView measurement : measurementViews) {
|
||||
if (measurement instanceof DateMeasurementView || measurement instanceof TimeMeasurementView) {
|
||||
continue;
|
||||
}
|
||||
|
||||
tableOverviewLayout.addView(measurement);
|
||||
}
|
||||
|
||||
@@ -171,10 +166,6 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
updateLastLineChart(scaleMeasurementList);
|
||||
|
||||
for (MeasurementView measurement : measurementViews) {
|
||||
if (measurement instanceof DateMeasurementView || measurement instanceof TimeMeasurementView) {
|
||||
continue;
|
||||
}
|
||||
|
||||
measurement.updatePreferences(prefs);
|
||||
measurement.loadFrom(lastScaleMeasurement, prevScaleMeasurement);
|
||||
}
|
||||
|
@@ -112,7 +112,8 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
selectedSubpageNr = savedInstanceState.getInt(SELECTED_SUBPAGE_NR_KEY);
|
||||
}
|
||||
|
||||
measurementViews = MeasurementView.getMeasurementList(getContext());
|
||||
measurementViews = MeasurementView.getMeasurementList(
|
||||
getContext(), MeasurementView.DateTimeOrder.FIRST);
|
||||
|
||||
for (MeasurementView measurement : measurementViews) {
|
||||
measurement.setUpdateViews(false);
|
||||
|
@@ -80,11 +80,15 @@ public abstract class MeasurementView extends TableLayout {
|
||||
iconView.setImageDrawable(icon);
|
||||
}
|
||||
|
||||
public static final List<MeasurementView> getMeasurementList(Context context) {
|
||||
public enum DateTimeOrder { FIRST, LAST, NONE }
|
||||
|
||||
public static final List<MeasurementView> getMeasurementList(Context context, DateTimeOrder order) {
|
||||
final List<MeasurementView> measurementViews = new ArrayList<>();
|
||||
|
||||
measurementViews.add(new DateMeasurementView(context));
|
||||
measurementViews.add(new TimeMeasurementView(context));
|
||||
if (order == DateTimeOrder.FIRST) {
|
||||
measurementViews.add(new DateMeasurementView(context));
|
||||
measurementViews.add(new TimeMeasurementView(context));
|
||||
}
|
||||
measurementViews.add(new WeightMeasurementView(context));
|
||||
measurementViews.add(new BMIMeasurementView(context));
|
||||
measurementViews.add(new WaterMeasurementView(context));
|
||||
@@ -98,6 +102,10 @@ public abstract class MeasurementView extends TableLayout {
|
||||
measurementViews.add(new WHRMeasurementView(context));
|
||||
measurementViews.add(new BMRMeasurementView(context));
|
||||
measurementViews.add(new CommentMeasurementView(context));
|
||||
if (order == DateTimeOrder.LAST) {
|
||||
measurementViews.add(new DateMeasurementView(context));
|
||||
measurementViews.add(new TimeMeasurementView(context));
|
||||
}
|
||||
|
||||
return measurementViews;
|
||||
}
|
||||
|
Reference in New Issue
Block a user