Search in sources :

Example 1 with UserMeasurementView

use of com.health.openscale.gui.measurement.UserMeasurementView in project openScale by oliexdev.

the class TableFragment method updateOnView.

public void updateOnView(List<ScaleMeasurement> scaleMeasurementList) {
    tableHeaderView.removeAllViews();
    final int iconHeight = pxImageDp(20);
    ArrayList<MeasurementView> visibleMeasurements = new ArrayList<>();
    for (MeasurementView measurement : measurementViews) {
        if (!measurement.isVisible() || measurement instanceof UserMeasurementView) {
            continue;
        }
        ImageView headerIcon = new ImageView(tableView.getContext());
        headerIcon.setImageDrawable(measurement.getIcon());
        headerIcon.setColorFilter(ColorUtil.getTintColor(tableView.getContext()));
        headerIcon.setLayoutParams(new TableRow.LayoutParams(0, iconHeight, 1));
        headerIcon.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        tableHeaderView.addView(headerIcon);
        visibleMeasurements.add(measurement);
    }
    adapter.setMeasurements(visibleMeasurements, scaleMeasurementList);
}
Also used : UserMeasurementView(com.health.openscale.gui.measurement.UserMeasurementView) UserMeasurementView(com.health.openscale.gui.measurement.UserMeasurementView) MeasurementView(com.health.openscale.gui.measurement.MeasurementView) TableRow(android.widget.TableRow) ArrayList(java.util.ArrayList) ImageView(android.widget.ImageView)

Aggregations

ImageView (android.widget.ImageView)1 TableRow (android.widget.TableRow)1 MeasurementView (com.health.openscale.gui.measurement.MeasurementView)1 UserMeasurementView (com.health.openscale.gui.measurement.UserMeasurementView)1 ArrayList (java.util.ArrayList)1