package fuzion24.device.vulnerability.test;


import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import fuzion24.vulnerability.checker.R;

public class VulnerabilityListAdapter extends BaseAdapter {
    private final Activity mActivity;
    private List<VulnerabilityTestResult> mResults;

    public VulnerabilityListAdapter(Activity act, List<VulnerabilityTestResult> results){
        mResults = results;
        mActivity = act;
    }

    @Override
    public int getCount() {
        return mResults.size();
    }

    @Override
    public Object getItem(int position) {
        return mResults.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        VulnerabilityTestResult testResult = mResults.get(position);
        View view = mActivity.getLayoutInflater().inflate(R.layout.vulnerability_layout, null);
        TextView textview = (TextView) view.findViewById(R.id.vulnerabity_name);
        textview.setText(testResult.getName() + " - " + testResult.getResult());

        return view;
    }
}
package fuzion24.device.vulnerability.test;


import android.app.Activity;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import fuzion24.vulnerability.checker.R;

public class VulnerabilityListAdapter extends BaseAdapter {
    private final Activity mActivity;
    private List<VulnerabilityTestResult> mResults;

    public VulnerabilityListAdapter(Activity act, List<VulnerabilityTestResult> results){
        mResults = results;
        mActivity = act;
    }

    @Override
    public int getCount() {
        return mResults.size();
    }

    @Override
    public Object getItem(int position) {
        return mResults.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        VulnerabilityTestResult testResult = mResults.get(position);
        View view = mActivity.getLayoutInflater().inflate(R.layout.vulnerability_layout, null);
        TextView textview = (TextView) view.findViewById(R.id.vulnerabity_name);
        textview.setText(testResult.getName());

        if(testResult.isVulnerable()){
            view.setBackgroundColor(Color.RED);
        }else{
            view.setBackgroundColor(Color.GREEN);
        }

        return view;
    }
}
Change the background color based on if the vuln is present or not
Change the background color based on if the vuln is present or not
