Build a simple filter view with customizable controls.
- Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
} - Add the dependency
dependencies {
compile 'com.github.FranciscoJavierPRamos:Android-FilterView:1.0.4'
}
- Create a section
SingleSectionsingleSection = newSingleSection.Builder("Category", 1)
.setSectionNameColor(R.color.colorAccent)
.addOption(newSingleOption("CUSTOMER", R.color.colorAccent,
R.drawable.ic_account_black_24dp, R.color.colorBackground,
R.color.colorAccent, 2, R.color.colorAccent))
.addOption(newSingleOption("ORGANIZATION", R.color.colorAccent,
R.drawable.ic_layers_black_24dp, R.color.colorBackground,
R.color.colorAccent, 2, R.color.colorAccent))
.build().setOnSingleOptionListener(newOnSingleOptionListener() {
@OverridepublicvoidonClick(SingleOptionoption) {
}
});- Create FilterView instance and add section
newFilterView.Builder(this)
.withTitle("Aplicar")
.setToolbarVisible(true)
.withTitleColor(R.color.colorAccent)
.withDivisorColor(R.color.colorAccent)
.setCloseIconColor(R.color.colorAccent)
.addSection(singleSection)
.build()
.setOnFilterViewResultListener(newOnFilterViewResultListener() {
@OverridepublicvoidonResult(JSONArraydata) {
System.out.println(data.toString());
}
}).show();Call to show(); method to display FilterView and setOnFilterViewResultListener(...) to return JSONArray with data filtered.
- SingleSection with SingleOption control.
- SliderSection with SliderOption control.
- TagSection with String tags.
- ExtraSection with:
- ExtraBoolean
- ExtraCurrencyEditText
- ExtraDate
- ExtraHSM
- ExtraList
- ExtraEditText
LicensedundertheApacheLicense, Version2.0 (the "License");
youmaynotusethisfileexceptincompliancewiththeLicense.
YoumayobtainacopyoftheLicenseathttp://www.apache.org/licenses/LICENSE-2.0Unlessrequiredbyapplicablelaworagreedtoinwriting, softwaredistributedundertheLicenseisdistributedonan"AS IS"BASIS,
WITHOUTWARRANTIESORCONDITIONSOFANYKIND, eitherexpressorimplied.
SeetheLicenseforthespecificlanguagegoverningpermissionsandlimitationsundertheLicense.```
