It is an Android Filter Component developed in Kotlin, available in Jetpack Compose as well. It offers multiple customization attributes to create a smart filter based on your requirements.
Add the Maven Central repository to your project's root build.gradle
file
allprojects {
repositories {
mavenCentral()
}
}
Add the dependency in your app build.gradle
file:
implementation 'io.github.smartsensesolutions:SmartFilter:1.0.0'
The library provides a set of classes and methods for creating and managing filter components. Each filter type has its own class and configuration methods. The filters can be added to any ViewGroup in your layout.
- Single Line Radio Group (Vertical/Horizontal)
- Multi Line Radio Group (Multi Raw - Horizontal)
- Row Item Radio Group (Vertical/Horizontal)
- Chip Group Single Selection (Vertical/Horizontal)
- Chip Group Multi Selection (Vertical/Horizontal)
- Checked Single Selection (Vertical/Horizontal)
- Checked Multi Selection (Vertical/Horizontal)
- Vertical
SmartFilter.addRadioGroupSingleSelection {
addRadioGroupSingleLineVertical(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") }}
<com.ss.smartfilter.singleselection.SingleSelectionRadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rg_sl_list_item="@array/array_android_version"
app:rg_sl_background="@drawable/rb_selector"
app:rg_sl_text_color="@color/text_selector"
app:rg_sl_orientation="1"/>
- Horizontal
SmartFilter.addRadioGroupSingleSelection {
addRadioGroupSingleLineHorizontal(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }
<com.ss.smartfilter.singleselection.SingleSelectionRadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rg_sl_list_item="@array/array_android_version"
app:rg_sl_background="@drawable/rb_selector"
app:rg_sl_text_color="@color/text_selector"
app:rg_sl_orientation="0"/>
SmartFilter.addRadioMultiRawSingleSelection {
addRadioButtonMultiRow(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }
<com.ss.smartfilter.singleselection.SingleSelectionMultiLineRadioButton
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rg_ml_list_item="@array/array_android_version"
app:rg_ml_background="@drawable/multiline_bg_selector"
app:rg_ml_text_selector="@color/multiline_text_selector"/>
- Vertical
SmartFilter.addRadioRawItemSingleSelection {
addRadioGroupRowItemVertical(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }
<com.ss.smartfilter.singleselection.SingleSelectionItemRadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rg_ri_list_item="@array/array_android_version"
app:rg_ri_orientation="1"
app:rg_ri_text_selector="@color/text_selector"/>
- Horizontal
SmartFilter.addRadioRawItemSingleSelection {
addRadioGroupRowItemHorizontal(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }
<com.ss.smartfilter.singleselection.SingleSelectionItemRadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rg_ri_list_item="@array/array_android_version"
app:rg_ri_orientation="1"
app:rg_ri_text_selector="@color/text_selector"/>
SmartFilter.addChipGroupSingleSelection {
addSingleSelectionChipGroupVertical(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }
<com.ss.smartfilter.singleselection.SingleSelectionChipGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cg_sl_orientation="1"
app:cg_sl_background="@color/chip_bg_selector"
app:cg_sl_list_item="@array/array_android_version"
app:cg_sl_text_selector="@color/chip_text_selector" />
- Horizontal
SmartFilter.addChipGroupSingleSelection {
addSingleSelectionChipGroupHorizontal(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }
<com.ss.smartfilter.singleselection.SingleSelectionChipGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cg_sl_orientation="0"
app:cg_sl_background="@color/chip_bg_selector"
app:cg_sl_list_item="@array/array_android_version"
app:cg_sl_text_selector="@color/chip_text_selector" />
- Vertical
SmartFilter.addChipGroupMultiSelection {
addMultiSelectionChipGroupVertical(binding.root) { radioGroupData ->
toast("Checked IDs: ${radioGroupData.joinToString(", ")}") } }
<com.ss.smartfilter.multiselection.MultiselectionChipGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cg_sl_orientation="1"
app:cg_sl_background="@color/chip_bg_selector"
app:cg_sl_list_item="@array/array_android_version"
app:cg_sl_text_selector="@color/chip_text_selector" />
- Horizontal
SmartFilter.addChipGroupMultiSelection {
addMultiSelectionChipGroupHorizontal(binding.root) { radioGroupData ->
toast("Checked IDs: ${radioGroupData.joinToString(", ")}")}}
<com.ss.smartfilter.multiselection.MultiselectionChipGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cg_sl_orientation="1"
app:cg_sl_background="@color/chip_bg_selector"
app:cg_sl_list_item="@array/array_android_version"
app:cg_sl_text_selector="@color/chip_text_selector" />
- Vertical
SmartFilter.addListViewSingleSelection {
addSingleSelectionListVertical(binding.root) { radioGroupData ->
toast("name: " + radioGroupData.name) } }
<com.ss.smartfilter.singleselection.SingleSelectionListView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:ss_orientation="1"
app:ss_checked_selector="@drawable/multiline_bg_selector"
app:ss_list_item="@array/array_android_version"
app:ss_text_selector="@color/chip_text_selector" />
- Horizontal
SmartFilter.addListViewSingleSelection {
addSingleSelectionListHorizontal(binding.root) { radioGroupData ->
toast("name: " + radioGroupData.name) } }
<com.ss.smartfilter.singleselection.SingleSelectionListView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:ss_orientation="0"
app:ss_checked_selector="@drawable/multiline_bg_selector"
app:ss_list_item="@array/array_android_version"
app:ss_text_selector="@color/chip_text_selector" />
- Vertical
SmartFilter.addListViewMultiSelection{
addMultiSelectionListVertical(binding.root) { radioGroupData ->
toast("name: " + radioGroupData) } }
<com.ss.smartfilter.multiselection.MultiSelectionListView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:ss_orientation="1"
app:ss_checked_selector="@drawable/multiline_bg_selector"
app:ss_list_item="@array/array_android_version"
app:ss_text_selector="@color/chip_text_selector" />
- Horizontal
SmartFilter.addListViewMultiSelection{
addMultiSelectionListHorizontal(binding.root) { radioGroupData ->
toast("name: " + radioGroupData) } }
<com.ss.smartfilter.multiselection.MultiSelectionListView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:ss_orientation="1"
app:ss_checked_selector="@drawable/multiline_bg_selector"
app:ss_list_item="@array/array_android_version"
app:ss_text_selector="@color/chip_text_selector" />
Following are the various attributes available to customize the look and feel of the smartFilter.
rg_sl_orientation: Orientation of the radio group, specified as an integer.
rg_sl_background: Background reference for the radio group.
rg_sl_text_color: Text color for the radio group.
rg_sl_list_item: List item for the radio group, specified as a string.
rg_ml_spancount: Number of columns in the multi-line radio group, specified as an integer.
rg_ml_spacing: Spacing between items in the multi-line radio group, specified as an integer.
rg_ml_background: Background reference for the multi-line radio group.
rg_ml_text_selector: Text color selector for the multi-line radio group.
rg_ml_includeedge: Whether the spacing includes the edges, specified as a boolean.
rg_ml_list_item: List item for the multi-line radio group, specified as a reference.
rg_ri_background: Background reference for the row item radio group.
rg_ri_text_selector: Text color selector for the row item radio group.
rg_ri_orientation: Orientation of the row item radio group, specified as an integer.
rg_ri_list_item: List item for the row item radio group, specified as a reference.
cg_sl_background: Background reference for the single line chip group.
cg_sl_text_selector: Text color selector for the single line chip group.
cg_sl_orientation: Orientation of the single line chip group, specified as an integer.
cg_sl_list_item: List item for the single line chip group, specified as a reference.
ss_text_selector: Text color selector for the single selection view.
ss_orientation: Orientation of the single selection view, specified as an integer.
ss_checked_selector: Checked state background reference for the single selection view.
ss_list_item: List item for the single selection view, specified as a reference.
Copyright 2021 SmartSense Solutions
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.