Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes data from app and refactoring #13

Merged
merged 6 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 159 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Smart Filter Library

<img src="media/test.gif" width="250" />
<img src="media/Smartfilter.gif.gif" width="250" />

This library provides a set of customizable filter components for Android applications. It supports both single and multi-selection filters in various formats such as radio groups, chip groups, and list views. The filters can be displayed either vertically or horizontally.

Expand Down Expand Up @@ -50,116 +50,223 @@ The library depends on the following libraries:
- **Verticle**


SmartFilter.addRadioGroupSingleSelection {
addRadioGroupSingleLineVertical(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") }}
SmartFilter.addRadioGroupSingleSelection {
addRadioGroupSingleLineVertical(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") }}

Or

<com.ss.smartfilterlib.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 {
SmartFilter.addRadioGroupSingleSelection {
addRadioGroupSingleLineHorizontal(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }
toast("name: ${radioGroupData.name} ") } }

Or

<com.ss.smartfilterlib.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 {
addRadioMultiRow(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }
### SingleSelectionMultiLine(MultiRaw)

SmartFilter.addRadioMultiRawSingleSelection {
addRadioButtonMultiRow(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }

OR

<com.ss.smartfilterlib.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)

- **Verticle**

SmartFilter.addRadioRawItemSingleSelection {
addRadioGroupRowItemVertical(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }


SmartFilter.addRadioRawItemSingleSelection {
addRadioGroupRowItemVertical(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }

- **Horizontal**
Or

SmartFilter.addRadioRawItemSingleSelection {
addRadioGroupRowItemHorizontal(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }
<com.ss.smartfilterlib.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} ") } }

Or

<com.ss.smartfilterlib.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} ") } }
SmartFilter.addChipGroupSingleSelection {
addSingleSelectionChipGroupVertical(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }

Or

<com.ss.smartfilterlib.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 ->
SmartFilter.addChipGroupSingleSelection {
addSingleSelectionChipGroupHorizontal(binding.root) { radioGroupData ->
toast("name: ${radioGroupData.name} ") } }



Or

<com.ss.smartfilterlib.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))

- **Verticle**

SmartFilter.addChipGroupMultiSelection {
addMultiSelectionChipGroupVertical(binding.root) { radioGroupData ->
toast("Checked IDs: ${radioGroupData.joinToString(", ")}") } }
- **Horizontal**
SmartFilter.addChipGroupMultiSelection {
addMultiSelectionChipGroupVertical(binding.root) { radioGroupData ->
toast("Checked IDs: ${radioGroupData.joinToString(", ")}") } }

Or

<com.ss.smartfilterlib.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" />

SmartFilter.addChipGroupMultiSelection {
addMultiSelectionChipGroupHorizontal(binding.root) { radioGroupData ->
toast("Checked IDs: ${radioGroupData.joinToString(", ")}")}}

- **Horizontal**

SmartFilter.addChipGroupMultiSelection {
addMultiSelectionChipGroupHorizontal(binding.root) { radioGroupData ->
toast("Checked IDs: ${radioGroupData.joinToString(", ")}")}}

Or

<com.ss.smartfilterlib.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))

- **Verticle**

SmartFilter.addListViewSingleSelection {
addSingleSelectionListVertical(binding.root) { radioGroupData ->
toast("name: " + radioGroupData.name) } }

- **Horizontal**

SmartFilter.addListViewSingleSelection {
addSingleSelectionListHorizontal(binding.root) { radioGroupData ->
SmartFilter.addListViewSingleSelection {
addSingleSelectionListVertical(binding.root) { radioGroupData ->
toast("name: " + radioGroupData.name) } }

OR

<com.ss.smartfilterlib.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) } }

OR

<com.ss.smartfilterlib.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))

- **Verticle**

SmartFilter.addListViewMultiSelection{
addMultiSelectionListVertical(binding.root) { radioGroupData ->
toast("name: " + radioGroupData) } }


SmartFilter.addListViewMultiSelection{
addMultiSelectionListVertical(binding.root) { radioGroupData ->
toast("name: " + radioGroupData) } }

OR

<com.ss.smartfilterlib.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) } }
SmartFilter.addListViewMultiSelection{
addMultiSelectionListHorizontal(binding.root) { radioGroupData ->
toast("name: " + radioGroupData) } }

OR

<com.ss.smartfilterlib.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" />


<img src="media/test1.png" width="250" /> <img src="media/test2.png" width="250" />
<img src="media/test3.png" width="250" /> <img src="media/test4.png" width="250" />
<img src="media/Screenshot1.png" width="250" /> <img src="media/Screenshot2.png" width="250" />
<img src="media/Screenshot3.png" width="250" /> <img src="media/Screenshot4.png" width="250" />



Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/ss/smartfilter/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ package com.ss.smartfilter
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import com.ss.smartfilter.databinding.ActivityMainBinding
import com.ss.smartfilter.screens.FilterScreen
import com.ss.smartfilterlib.SmartFilter
import com.ss.smartfilterlib.utils.toast


class MainActivity : ComponentActivity() {

private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
Loading
Loading