/** * Return a Filter that matches any {@link Attribute} data with the * specified name. * * @param name The name for all the Attributes to have (these can be in any * Namespace). * @return a Filter that matches any {@link Attribute} data with the * specified name. */ public static final Filter<Attribute> attribute(String name) { return new AttributeFilter(name); }
/** * Return a Filter that matches any {@link Attribute} data with the * specified name and namespace. * * @param name The name for all the Attributes to have. * @param ns The Namespace for all the Attributes to have. * @return a Filter that matches any {@link Attribute} data with the * specified name and namespace. */ public static final Filter<Attribute> attribute(String name, Namespace ns) { return new AttributeFilter(name, ns); }
/** * Return a Filter that matches any {@link Attribute} data with the * specified namespace. * * @param ns The Namespace for all the Attributes to have. * @return a Filter that matches any {@link Attribute} data with the * specified namespace. */ public static final Filter<Attribute> attribute(Namespace ns) { return new AttributeFilter(ns); }
ArrayList<AttributeFilter> arrayParents = new ArrayList<AttributeFilter>();//Initialize of the parents array that will be provided to the adapter. //Preparation of the first group (AttributeFilter is a custom type I created holding the `SparseArray` with the children and the group title) AttributeFilter categoriesFilter = new AttributeFilter(); categoriesFilter.setTitle(getResources().getString(R.string.categories)); categoriesFilter.setDetails(Tools.getLabelsStringFromSparseArray(categoriesSparseArray, prefs.getCategories())); categoriesSparseArray = Tools.initializeSparseArray(categoriesSparseArray, prefs.getCategories()); categoriesFilter.setArrayChildren(categoriesSparseArray); //Preparation of the second group AttributeFilter emotionsFilter = new AttributeFilter(); emotionsFilter.setTitle(getResources().getString(R.string.emotions)); emotionsFilter.setDetails(Tools.getLabelsStringFromSparseArray(emotionsSparseArray, prefs.getEmotions())); emotionsSparseArray = Tools.initializeSparseArray(emotionsSparseArray, prefs.getEmotions()); emotionsFilter.setArrayChildren(emotionsSparseArray); //Preparation of the third group AttributeFilter ratingsFilter = new AttributeFilter(); ratingsFilter.setTitle(getResources().getString(R.string.ratings)); ratingsFilter.setDetails(Tools.getLabelsStringFromSparseArray(ratingsSparseArray, prefs.getRatings())); ratingsSparseArray = Tools.initializeSparseArray(ratingsSparseArray, prefs.getRatings()); ratingsFilter.setArrayChildren(ratingsSparseArray); //in this array we add the Parent object. We will use the arrayParents at the setAdapter arrayParents.add(categoriesFilter); arrayParents.add(emotionsFilter); arrayParents.add(ratingsFilter); //sets the adapter that provides data to the list. filtersELV.setAdapter(new CustomELVAdapter(this,arrayParents));//the adapter is applied on my `ExpandableListView`.