Search in sources :

Example 1 with ItemWithDetails

use of nodomain.freeyourgadget.gadgetbridge.model.ItemWithDetails in project Gadgetbridge by Freeyourgadget.

the class ItemWithDetailsAdapter method getView.

@Override
public View getView(int position, View view, ViewGroup parent) {
    ItemWithDetails item = getItem(position);
    if (view == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if (horizontalAlignment) {
            view = inflater.inflate(R.layout.item_with_details_horizontal, parent, false);
        } else {
            switch(size) {
                case SIZE_SMALL:
                    view = inflater.inflate(R.layout.item_with_details_small, parent, false);
                    break;
                default:
                    view = inflater.inflate(R.layout.item_with_details, parent, false);
                    break;
            }
        }
    }
    ImageView iconView = (ImageView) view.findViewById(R.id.item_image);
    TextView nameView = (TextView) view.findViewById(R.id.item_name);
    TextView detailsView = (TextView) view.findViewById(R.id.item_details);
    nameView.setText(item.getName());
    detailsView.setText(item.getDetails());
    iconView.setImageResource(item.getIcon());
    return view;
}
Also used : ItemWithDetails(nodomain.freeyourgadget.gadgetbridge.model.ItemWithDetails) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 2 with ItemWithDetails

use of nodomain.freeyourgadget.gadgetbridge.model.ItemWithDetails in project Gadgetbridge by Freeyourgadget.

the class GBDevice method getDeviceInfos.

public List<ItemWithDetails> getDeviceInfos() {
    List<ItemWithDetails> result = new ArrayList<>();
    if (mDeviceInfos != null) {
        result.addAll(mDeviceInfos);
    }
    if (mModel != null) {
        result.add(new GenericItem(DEVINFO_HW_VER, mModel));
    }
    if (mFirmwareVersion != null) {
        result.add(new GenericItem(DEVINFO_FW_VER, mFirmwareVersion));
    }
    if (mFirmwareVersion2 != null) {
        result.add(new GenericItem(DEVINFO_HR_VER, mFirmwareVersion2));
    }
    if (mAddress != null) {
        result.add(new GenericItem(DEVINFO_ADDR, mAddress));
    }
    if (mVolatileAddress != null) {
        result.add(new GenericItem(DEVINFO_ADDR2, mVolatileAddress));
    }
    Collections.sort(result);
    return result;
}
Also used : ItemWithDetails(nodomain.freeyourgadget.gadgetbridge.model.ItemWithDetails) GenericItem(nodomain.freeyourgadget.gadgetbridge.model.GenericItem) ArrayList(java.util.ArrayList)

Aggregations

ItemWithDetails (nodomain.freeyourgadget.gadgetbridge.model.ItemWithDetails)2 LayoutInflater (android.view.LayoutInflater)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 ArrayList (java.util.ArrayList)1 GenericItem (nodomain.freeyourgadget.gadgetbridge.model.GenericItem)1