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

Multi selction chip group #8

Merged
merged 72 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
f42bc32
#Singal Selection - Radio Group , MultiRow Radio group
MalaRuparel2023 Apr 17, 2024
b806733
#Singal Selection - radio group row item implimented and refactor
MalaRuparel2023 Apr 18, 2024
4e9181d
#Singal Selection - refactor for radio group
MalaRuparel2023 Apr 19, 2024
b551bcf
#Singal Selection - refactor for radio group
MalaRuparel2023 Apr 19, 2024
b275fb1
#Singal Selection - refactor for radio group
MalaRuparel2023 Apr 19, 2024
ef9bffd
#Singal Selection - refactor for radio group
MalaRuparel2023 Apr 20, 2024
dd7fb78
#Singal Selection -Single line modified
MalaRuparel2023 Apr 21, 2024
911775c
#Singal Selection - refactor for radio group
MalaRuparel2023 Apr 22, 2024
c3ff9af
#Singal Selection - refactor for radio group
MalaRuparel2023 Apr 22, 2024
75cbdd2
#Singal Selection - refactor code
MalaRuparel2023 Apr 22, 2024
b773ad5
#Singal Selection - refactor code
MalaRuparel2023 Apr 22, 2024
539ba0b
#Update README.md
MalaRuparel2023 Apr 22, 2024
ed31a24
#Single selectoin change
MalaRuparel2023 Apr 23, 2024
332ea4f
#Single selectoin change
MalaRuparel2023 Apr 23, 2024
421b9e7
#Single selectoin - Chip Group added
MalaRuparel2023 Apr 23, 2024
db141f0
#Single Selection - chip group added
MalaRuparel2023 Apr 23, 2024
9d2ccea
#Single Selection - solve sonar error
MalaRuparel2023 Apr 23, 2024
0075266
#Single Selection - solve sonar error
MalaRuparel2023 Apr 23, 2024
96057a9
Merge branch 'development' into singal_selction_radio_group
MalaRuparel2023 Apr 23, 2024
365f54e
Merge branch 'singal_selction_radio_group' into singal_selction_chip_…
MalaRuparel2023 Apr 23, 2024
3c8e1bd
#Single Selection - Chip group implementation
MalaRuparel2023 Apr 24, 2024
4a7e92c
#Single Selection - chip group reformat
MalaRuparel2023 Apr 25, 2024
6f168ba
Update README.md
MalaRuparel2023 Apr 25, 2024
b8b1c5a
#Single Selection - chip group reformat
MalaRuparel2023 Apr 26, 2024
8eef7d9
#multi selection - chip group
MalaRuparel2023 Apr 29, 2024
39440f5
#multi selection - chip group
MalaRuparel2023 Apr 29, 2024
c98cdd9
#multi selection - chip group
MalaRuparel2023 Apr 29, 2024
8691166
#multi selection - chip group
MalaRuparel2023 Apr 29, 2024
74aec38
#multi selection - chip group
MalaRuparel2023 Apr 29, 2024
fbe0546
#multi selection - chip group
MalaRuparel2023 Apr 29, 2024
4b933ee
#multi selection - chip group
MalaRuparel2023 Apr 29, 2024
9269499
#Update README.md
MalaRuparel2023 Apr 29, 2024
afbed90
#Update Resolve Pull Request Comments issue
MalaRuparel2023 Apr 29, 2024
b434ef8
#Update Resolve Pull Request Comments issue
MalaRuparel2023 Apr 29, 2024
fe11eb2
Merge remote-tracking branch 'origin/singal_selction_radio_group' int…
MalaRuparel2023 Apr 29, 2024
081462a
#Update Resolve Pull Request Comments issue
MalaRuparel2023 Apr 29, 2024
e1d4d13
#Update Resolve Pull Request Comments issue
MalaRuparel2023 Apr 29, 2024
bd99b5c
#Update Resolve Pull Request Comments issue
MalaRuparel2023 Apr 29, 2024
86d071a
#Update Resolve Pull Request Comments issue
MalaRuparel2023 Apr 30, 2024
f9a799a
Merge branch 'singal_selction_radio_group' into singal_selction_chip_…
MalaRuparel2023 Apr 30, 2024
3225ad0
#single radio group - row item, multi raw basic changes
MalaRuparel2023 Apr 30, 2024
629a9c4
Merge branch 'singal_selction_radio_group' into singal_selction_chip_…
MalaRuparel2023 Apr 30, 2024
7e18e96
#resolve git-merge issue
MalaRuparel2023 Apr 30, 2024
14532bf
#resolve git-merge issue
MalaRuparel2023 Apr 30, 2024
a00a0bc
Merge branch 'singal_selction_radio_group' into singal_selction_chip_…
MalaRuparel2023 Apr 30, 2024
daf0a93
#resolve git-merge issue
MalaRuparel2023 Apr 30, 2024
abcc761
Merge branch 'singal_selction_chip_group' into multi_selction_chip_group
MalaRuparel2023 Apr 30, 2024
5c233a5
#resolve git-merge issue
MalaRuparel2023 Apr 30, 2024
d50e654
#Single Selection Chip group implementation
MalaRuparel2023 May 1, 2024
064dc0c
Merge branch 'singal_selction_chip_group' into multi_selction_chip_group
MalaRuparel2023 May 1, 2024
69fbc1e
#Multi Selection Chip group implementation
MalaRuparel2023 May 1, 2024
ad6b3df
#correct the name ic_rg to ic_rb_unchecked.xml
MalaRuparel2023 May 8, 2024
58149cb
#add ext function for toast in Context.kt
MalaRuparel2023 May 8, 2024
8ec3670
#corrected file name
MalaRuparel2023 May 8, 2024
64d5989
#corrected file name
MalaRuparel2023 May 8, 2024
f102b4f
#replace with lamda function
MalaRuparel2023 May 8, 2024
e67a9bd
#corrected file name
MalaRuparel2023 May 8, 2024
f286d05
#handle nullable data
MalaRuparel2023 May 8, 2024
a22f5df
#corrected file name
MalaRuparel2023 May 8, 2024
5c975e5
#implemented lamda and sealed class
MalaRuparel2023 May 8, 2024
dceb522
Update README.md
MalaRuparel2023 May 9, 2024
e519b51
Update README.md
MalaRuparel2023 May 9, 2024
58c9a42
#corrected read me
MalaRuparel2023 May 9, 2024
6904c59
#implement lamda
MalaRuparel2023 May 9, 2024
cc29803
#correct array name
MalaRuparel2023 May 9, 2024
94c98e5
#correct data
MalaRuparel2023 May 9, 2024
fffb3a9
#correct file name
MalaRuparel2023 May 9, 2024
4be4dea
#correct style name change
MalaRuparel2023 May 9, 2024
10e6567
#change
MalaRuparel2023 May 9, 2024
28947fd
#change gitignore
MalaRuparel2023 May 9, 2024
ed4ec96
Merge branch 'development' into multi_selction_chip_group
MalaRuparel2023 May 9, 2024
ed9b593
#merge conflit resolve
MalaRuparel2023 May 9, 2024
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
25 changes: 0 additions & 25 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,4 @@
.externalNativeBuild
.cxx
local.properties
/.idea/sonarlint/issuestore/0/7/0712df971a99ac4d2fccb8e0fb19f377f3374cca
/.idea/sonarlint/issuestore/2/a/2afbb999f001938c88fa43fc2ef52abf0f8213e4
/.idea/sonarlint/issuestore/5/6/5611303df8abe4fb3eb845a27bdaf399c3d59608
/.idea/sonarlint/issuestore/7/4/749edfcc96398253e5b3416184e95c46621da850
/.idea/sonarlint/issuestore/8/e/8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d
/.idea/sonarlint/issuestore/9/f/9f833c3a85ee282687284d1fc882e84c0c069ed7
/.idea/sonarlint/issuestore/a/5/a5cc2925ca8258af241be7e5b0381edf30266302
/.idea/sonarlint/issuestore/f/c/fce2f069a95d69fe32b497ed827ae77430c69169
/.idea/sonarlint/issuestore/index.pb
/.idea/sonarlint/securityhotspotstore/0/7/0712df971a99ac4d2fccb8e0fb19f377f3374cca
/.idea/sonarlint/securityhotspotstore/2/a/2afbb999f001938c88fa43fc2ef52abf0f8213e4
/.idea/sonarlint/securityhotspotstore/5/6/5611303df8abe4fb3eb845a27bdaf399c3d59608
/.idea/sonarlint/securityhotspotstore/7/4/749edfcc96398253e5b3416184e95c46621da850
/.idea/sonarlint/securityhotspotstore/8/e/8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d
/.idea/sonarlint/securityhotspotstore/9/f/9f833c3a85ee282687284d1fc882e84c0c069ed7
/.idea/sonarlint/securityhotspotstore/a/5/a5cc2925ca8258af241be7e5b0381edf30266302
/.idea/sonarlint/securityhotspotstore/f/c/fce2f069a95d69fe32b497ed827ae77430c69169
/.idea/sonarlint/securityhotspotstore/index.pb
/.idea/compiler.xml
/.idea/deploymentTargetDropDown.xml
/.idea/gradle.xml
/.idea/kotlinc.xml
/.idea/migrations.xml
/.idea/misc.xml
/.idea/vcs.xml
/.idea
20 changes: 0 additions & 20 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 108 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,124 @@
# Smart Filter Library

This is a library for creating and managing radio groups in Android. It provides support for single line, multi line and row item radio groups.
This is a library for creating and managing ....

## Features

- Single Line Radio Group: A radio group that displays its items in a single line.
- Multi Line Radio Group: A radio group that displays its items in multiple lines.
- Row Item Radio Group: A radio group that displays its items in a row.

- Single Line Radio Group(Verticle/Horizontal)
- Multi Line Radio Group
- Row Item Radio Group(Verticle/Horizontal)
- Range Selection
- Chip Group Single Selection(Verticle/Horizontal)
- Chip Group Multi Selection(Verticle/Horizontal)
- Checked Single Selection(Verticle/Horizontal)
- Checked multi Selection(Verticle/Horizontal)

## Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
These instructions will get you a copy of the project up and running on your local machine

## Prerequisites



## Installing

- **Clone the repository: `git clone https://github.com/smartSenseSolutions/smart-filter-library.git`**
- **Open the project in Android Studio.**
- **Build and run the project on an emulator or device.**


## SingleSelection

### SingleSelectionRadioGroup(Verticle/Horizontal)

- **Verticle**


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

<img src="media/single_selection_vertical.png" width="250" />


- **Horizontal**


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


<img src="media/single_selection_horizontal.png" width="250" />


### SingleSelectionMultiLine(MultiRaw)

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


<img src="media/single_selection_multiline.png" width="250" />


### SingleSelectionRowItem(Verticle/Horizontal)

- **Verticle**

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


<img src="media/single_selection_row_item_vertical.png" width="250" />

- **Horizontal**

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


<img src="media/single_selection_row_item_horizontal.png" width="250" />

### SingleSelectionChipGroup((Verticle/Horizontal))

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


<img src="media/single_selection_chip.png" width="250" />

### MultiSelectionChipGroup(MultiRaw)

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


<img src="media/multiselect_chip.png" width="250" />

### Prerequisites

- Android Studio Iguana | 2023.2.1 Patch 2 or later
- JDK 8
- Android SDK 24 or later
### Attribute

### Installing
| Attribute | Description | Type | Default Value |
| --- | --- | --- | --- |
| rootView | The root view of the radio group. | ViewGroup | - |
| singleGroupSubType | The type of the radio group. | SingleGroupSubType | - |
| orientation | The orientation of the radio group. | Orientation | VERTICAL |
| mData | The list of radio group items. | List<RadioGroupData> | - |
| callbacks | The event listener for the radio group. | BaseEventListener | - |
| bgSelector | The background selector for the radio group items. | Int | - |
| textSelector | The text color selector for the radio group items. | Int | - |

1. Clone the repository: `git clone https://github.com/smartSenseSolutions/smart-filter-library.git`
2. Open the project in Android Studio.
3. Build and run the project on an emulator or device.
### Usage

## Usage
- **To use the Smart Filter library in your Android application, you need to include it in your project's dependencies. Add the following line to your `build.gradle` file:**

To use the Smart Filter library in your Android application, you need to include it in your project's dependencies. Add the following line to your `build.gradle` file:
### Dependency

### Default Drawable for SingleSelectionRadioGroup

Expand Down
16 changes: 7 additions & 9 deletions app/src/main/java/com/ss/smartfilter/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import com.ss.smartfilter.databinding.ActivityMainBinding
import com.ss.smartfilterlib.SmartFilter
import com.ss.smartfilterlib.data.RadioGroupData
import com.ss.smartfilterlib.utils.Params
import com.ss.smartfilterlib.utils.toast

import com.ss.smartfilterlib.singlechoice.radiogroup.data.RadioGroupData

class MainActivity : ComponentActivity() {
private lateinit var binding: ActivityMainBinding
Expand All @@ -15,15 +17,11 @@ class MainActivity : ComponentActivity() {
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

SmartFilter.addSingleSelection {
addRadioGroupRowItem(binding.root) { radioGroupData ->
onSingleLineSelected(radioGroupData)
}
}
}

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

private fun onSingleLineSelected( radioGroupData: RadioGroupData) {
showToast(radioGroupData.name, this)
}

}
125 changes: 96 additions & 29 deletions app/src/main/java/com/ss/smartfilter/Utils.kt
Original file line number Diff line number Diff line change
@@ -1,59 +1,126 @@
package com.ss.smartfilter

import android.content.Context
import android.view.ViewGroup
import android.widget.Toast
import com.ss.smartfilterlib.R
import com.ss.smartfilterlib.singlechoice.radiogroup.data.RadioGroupData
import com.ss.smartfilterlib.singlechoice.radiogroup.data.mRadioGroupData
import com.ss.smartfilterlib.singlechoice.util.ChipType
import com.ss.smartfilterlib.singlechoice.util.Orientation
import com.ss.smartfilterlib.singlechoice.util.SingleGroupSubType
import com.ss.smartfilterlib.singlechoice.util.SingleSelectionParams
import com.ss.smartfilterlib.data.MultiSelectionParams
import com.ss.smartfilterlib.data.RadioGroupData
import com.ss.smartfilterlib.data.SingleChipSelectionParams
import com.ss.smartfilterlib.data.SingleSelectionMultiRawParams
import com.ss.smartfilterlib.data.SingleSelectionParams
import com.ss.smartfilterlib.data.mRadioGroupData
import com.ss.smartfilterlib.utils.MultiChipType
import com.ss.smartfilterlib.utils.Orientation
import com.ss.smartfilterlib.utils.Params
import com.ss.smartfilterlib.utils.SingleChipType
import com.ss.smartfilterlib.utils.SingleGroupSubType

/**
* created by Mala Ruparel ON 23/04/24
*/
fun addRadioGroupSingleLineVertical(rootView: ViewGroup,radioGroupCallback: (RadioGroupData) -> Unit) =
SingleSelectionParams(
rootView = rootView,
singleGroupSubType = SingleGroupSubType.SINGLE_LINE,
chipType = ChipType.NONE,
orientation = Orientation.VERTICAL,
mData = mRadioGroupData(),
callbacks = radioGroupCallback,
bgSelector = R.drawable.singleline_rb_selector,
textSelector = R.color.single_text_color_selector
fun addRadioGroupSingleLineVertical(
rootView: ViewGroup,
radioGroupCallback: (RadioGroupData) -> Unit
) =
Params.SingleSelection(
SingleSelectionParams(
rootView = rootView,
singleGroupSubType = SingleGroupSubType.SINGLE_LINE,
chipType = SingleChipType.NONE,
orientation = Orientation.VERTICAL,
mData = mRadioGroupData(),
callbacks = radioGroupCallback,
bgSelector = R.drawable.singleline_rb_selector,
textSelector = R.color.single_text_color_selector
)
)

fun addRadioGroupSingleLineHorizontal(
rootView: ViewGroup,
radioGroupCallback: (RadioGroupData) -> Unit
) =
Params.SingleSelection(
SingleSelectionParams(
rootView = rootView,
singleGroupSubType = SingleGroupSubType.SINGLE_LINE,
chipType = SingleChipType.NONE,
orientation = Orientation.HORIZONTAL,
mData = mRadioGroupData(),
callbacks = radioGroupCallback,
bgSelector = R.drawable.singleline_rb_selector,
textSelector = R.color.single_text_color_selector
)
)

fun addRadioMultiRow(rootView: ViewGroup, radioGroupCallback: (RadioGroupData) -> Unit) =
Params.SingleSelectionMultiRaw(
SingleSelectionMultiRawParams(
rootView = rootView,
singleGroupSubType = SingleGroupSubType.MULTI_LINE,
chipType = SingleChipType.NONE,
orientation = Orientation.VERTICAL,
mData = mRadioGroupData(),
callbacks = radioGroupCallback,
bgSelector = R.drawable.multiline_bg_selector,
textSelector = R.color.multiline_text_selector
)
)


fun addRadioGroupMultiRow(rootView: ViewGroup,radioGroupCallback: (RadioGroupData) -> Unit) =
fun addRadioGroupRowItemHorizontal(
rootView: ViewGroup,
radioGroupCallback: (RadioGroupData) -> Unit
) = Params.SingleSelection(
SingleSelectionParams(
rootView = rootView,
singleGroupSubType = SingleGroupSubType.MULTI_LINE,
chipType = ChipType.NONE,
orientation = Orientation.VERTICAL,
singleGroupSubType = SingleGroupSubType.ROW_ITEM,
chipType = SingleChipType.NONE,
orientation = Orientation.HORIZONTAL,
mData = mRadioGroupData(),
callbacks = radioGroupCallback,
bgSelector = R.drawable.multiline_selector,
textSelector = R.color.multiline_text_selector
bgSelector = R.drawable.row_item_selector,
textSelector = R.color.single_text_color_selector

)
fun addRadioGroupRowItem(rootView: ViewGroup,radioGroupCallback: (RadioGroupData) -> Unit) =
)
fun addRadioGroupRowItemVertical(
rootView: ViewGroup,
radioGroupCallback: (RadioGroupData) -> Unit
) = Params.SingleSelection(
SingleSelectionParams(
rootView = rootView,
singleGroupSubType = SingleGroupSubType.ROW_ITEM,
chipType = ChipType.NONE,
chipType = SingleChipType.NONE,
orientation = Orientation.VERTICAL,
mData = mRadioGroupData(),
callbacks = radioGroupCallback,
bgSelector = R.drawable.row_item_selector,
textSelector = R.color.single_text_color_selector

)
fun showToast(message: String, context: Context) {
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
}
)
fun addSingleSelectionChipGroup(rootView: ViewGroup, radioGroupCallback: (RadioGroupData) -> Unit) =

SingleChipSelectionParams(
rootView = rootView,
singleGroupSubType = SingleGroupSubType.CHIP_GROUP,
chipType = SingleChipType.CHOICE_CHIP,
orientation = Orientation.VERTICAL,
mData = mRadioGroupData(),
callbacks = radioGroupCallback,
bgSelector = R.color.chip_bg_selector,
textSelector = R.color.chip_text_selector
)

fun addMultiSelectionChipGroup(rootView: ViewGroup, radioGroupCallback: (List<Int>) -> Unit) =
MultiSelectionParams(
rootView = rootView,
chipType = MultiChipType.FILTER_CHIP,
orientation = Orientation.VERTICAL,
mData = mRadioGroupData(),
callbacks = radioGroupCallback,
bgSelector = R.color.chip_bg_selector,
textSelector = R.color.chip_text_selector
)



Expand Down
Binary file added media/multiselect_chip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/single_selection_chip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/single_selection_horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/single_selection_multiline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/single_selection_row_item_horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/single_selection_row_item_vertical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/single_selection_vertical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading