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;
    }
}
@@ -68,16 +68,47 @@
 tivity;%0A
+import android.graphics.Color;%0A
 import a
@@ -1247,43 +1247,173 @@
 me()
- + %22 - %22 + testResult.getResult());
+);%0A%0A        if(testResult.isVulnerable())%7B%0A            view.setBackgroundColor(Color.RED);%0A        %7Delse%7B%0A            view.setBackgroundColor(Color.GREEN);%0A        %7D
 %0A%0A  

Change the background color based on if the vuln is present or not