use of com.health.openscale.gui.views.LBWMeasurementView in project openScale by oliexdev.
the class StatisticsFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
statisticsView = inflater.inflate(R.layout.fragment_statistics, container, false);
// Set android:tint="?attr/editTextColor" programmatically as setting it in xml layout
// throws an exception on API 19.
int color = new EditText(getContext()).getCurrentTextColor();
for (int id : new int[] { R.id.imageGoalWeight, R.id.imageGoalDiff, R.id.imageDayLeft }) {
ImageView image = statisticsView.findViewById(id);
image.setColorFilter(color);
}
txtGoalWeight = (TextView) statisticsView.findViewById(R.id.txtGoalWeight);
txtGoalDiff = (TextView) statisticsView.findViewById(R.id.txtGoalDiff);
txtGoalDayLeft = (TextView) statisticsView.findViewById(R.id.txtGoalDayLeft);
txtLabelGoalWeight = (TextView) statisticsView.findViewById(R.id.txtLabelGoalWeight);
txtLabelGoalDiff = (TextView) statisticsView.findViewById(R.id.txtLabelGoalDiff);
txtLabelDayLeft = (TextView) statisticsView.findViewById(R.id.txtLabelDayLeft);
tableWeekAveragesLayoutColumnA = (TableLayout) statisticsView.findViewById(R.id.tableWeekAveragesLayoutColumnA);
tableWeekAveragesLayoutColumnB = (TableLayout) statisticsView.findViewById(R.id.tableWeekAveragesLayoutColumnB);
tableMonthAveragesLayoutColumnA = (TableLayout) statisticsView.findViewById(R.id.tableMonthAveragesLayoutColumnA);
tableMonthAveragesLayoutColumnB = (TableLayout) statisticsView.findViewById(R.id.tableMonthAveragesLayoutColumnB);
viewMeasurementsListWeek = new ArrayList<>();
viewMeasurementsListWeek.add(new WeightMeasurementView(statisticsView.getContext()));
viewMeasurementsListWeek.add(new WaterMeasurementView(statisticsView.getContext()));
viewMeasurementsListWeek.add(new MuscleMeasurementView(statisticsView.getContext()));
viewMeasurementsListWeek.add(new LBWMeasurementView(statisticsView.getContext()));
viewMeasurementsListWeek.add(new FatMeasurementView(statisticsView.getContext()));
viewMeasurementsListWeek.add(new BoneMeasurementView(statisticsView.getContext()));
viewMeasurementsListWeek.add(new WaistMeasurementView(statisticsView.getContext()));
viewMeasurementsListWeek.add(new HipMeasurementView(statisticsView.getContext()));
final int paddingBottom = 10;
int i = 0;
for (MeasurementView measurement : viewMeasurementsListWeek) {
measurement.setEditMode(STATISTIC);
if (measurement.getSettings().isEnabled()) {
measurement.setVisible(true);
measurement.setPadding(-1, -1, -1, paddingBottom);
if ((i % 2) == 0) {
tableWeekAveragesLayoutColumnA.addView(measurement);
} else {
tableWeekAveragesLayoutColumnB.addView(measurement);
}
i++;
}
}
viewMeasurementsListMonth = new ArrayList<>();
viewMeasurementsListMonth.add(new WeightMeasurementView(statisticsView.getContext()));
viewMeasurementsListMonth.add(new WaterMeasurementView(statisticsView.getContext()));
viewMeasurementsListMonth.add(new MuscleMeasurementView(statisticsView.getContext()));
viewMeasurementsListMonth.add(new LBWMeasurementView(statisticsView.getContext()));
viewMeasurementsListMonth.add(new FatMeasurementView(statisticsView.getContext()));
viewMeasurementsListMonth.add(new BoneMeasurementView(statisticsView.getContext()));
viewMeasurementsListMonth.add(new WaistMeasurementView(statisticsView.getContext()));
viewMeasurementsListMonth.add(new HipMeasurementView(statisticsView.getContext()));
i = 0;
for (MeasurementView measurement : viewMeasurementsListMonth) {
measurement.setEditMode(STATISTIC);
if (measurement.getSettings().isEnabled()) {
measurement.setVisible(true);
measurement.setPadding(-1, -1, -1, paddingBottom);
if ((i % 2) == 0) {
tableMonthAveragesLayoutColumnA.addView(measurement);
} else {
tableMonthAveragesLayoutColumnB.addView(measurement);
}
i++;
}
}
OpenScale.getInstance(getContext()).registerFragment(this);
return statisticsView;
}
Aggregations