Search in sources :

Example 1 with PoliciesAdapter

use of org.flyve.mdm.agent.adapter.PoliciesAdapter in project android-mdm-agent by flyve-mdm.

the class FragmentPolicies method loadData.

private void loadData(ListView lst) {
    List<Policies> arrPolicies = new PoliciesData(FragmentPolicies.this.getContext()).getAllPolicies();
    ArrayList arr = new ArrayList<HashMap<String, Boolean>>();
    if (arrPolicies.isEmpty()) {
        HashMap<String, String> map = new HashMap<>();
        map.put("description", "0 policies");
        map.put("value", "");
        map.put("taskId", "");
        arr.add(map);
    } else {
        for (int i = 0; i < arrPolicies.size(); i++) {
            HashMap<String, String> map = new HashMap<>();
            map.put("description", Helpers.splitCapitalized(arrPolicies.get(i).policyName));
            map.put("value", String.valueOf(arrPolicies.get(i).value));
            map.put("taskId", String.valueOf(arrPolicies.get(i).taskId));
            arr.add(map);
        }
    }
    lst.setAdapter(new PoliciesAdapter(FragmentPolicies.this.getActivity(), arr));
}
Also used : PoliciesData(org.flyve.mdm.agent.data.database.PoliciesData) Policies(org.flyve.mdm.agent.data.database.entity.Policies) PoliciesAdapter(org.flyve.mdm.agent.adapter.PoliciesAdapter) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 PoliciesAdapter (org.flyve.mdm.agent.adapter.PoliciesAdapter)1 PoliciesData (org.flyve.mdm.agent.data.database.PoliciesData)1 Policies (org.flyve.mdm.agent.data.database.entity.Policies)1