Skip to content

Latest commit

 

History

History
372 lines (271 loc) · 14.3 KB

README.md

File metadata and controls

372 lines (271 loc) · 14.3 KB

SmartFilter

Android Arsenal API Platform Licence

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.

Demo


Setup

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'

Usage

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.

Features

  • 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)

SingleSelection

SingleSelectionRadioGroup(Verticle/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"/>

SingleSelectionMultiLine(MultiRaw)

                 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"/>

SingleSelectionRowItem(Verticle/Horizontal)

  • 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"/>

SingleSelectionChipGroup((Verticle/Horizontal))

                   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" />

MultiSelectionChipGroup(MultiRaw - (Verticle/Horizontal))

  • 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" />

SingleSelectionListView((Verticle/Horizontal))

  • 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" />

MultiSelectionListView((Verticle/Horizontal))

  • 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" />

Attributes

Following are the various attributes available to customize the look and feel of the smartFilter.

SingleLineRadioGroup:

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.

MultiLineRadioGroup:

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.

RowItemRadioGroup:

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.

SingleLineChipGroup:

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.

SingleSelectionView:

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.

MAD (Modern Android Development) Scorecard

License

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.