diff --git a/README.md b/README.md index 8ce44e4..7cf2be6 100644 --- a/README.md +++ b/README.md @@ -113,23 +113,43 @@ This is a library for creating and managing .... -### Attribute +### SingleSelectionListView((Verticle/Horizontal)) - | 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 | - | - | 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 | - | +- **Verticle** + + SmartFilter.addListViewSingleSelection { + addSingleSelectionListVertical(binding.root) { radioGroupData -> + toast("id: " + radioGroupData) } } -### Usage + +- **Horizontal** + + SmartFilter.addListViewSingleSelection { + addSingleSelectionListHorizontal(binding.root) { radioGroupData -> + toast("id: " + radioGroupData) } } + + + + +### MultiSelectionListView((Verticle/Horizontal)) + +- **Verticle** + + SmartFilter.addListViewMultiSelection{ + addMultiSelectionList(binding.root) { radioGroupData -> + toast("id: " + radioGroupData) } } + + + + - **Horizontal** + + SmartFilter.addListViewMultiSelection{ + addMultiSelectionListHorizontal(binding.root) { radioGroupData -> + toast("id: " + radioGroupData) } } + + -- **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 @@ -156,5 +176,6 @@ This is a library for creating and managing .... textSelector = R.color.multiline_text_selector +### Dependency ```kotlin implementation 'com.ss:smartfilterlib:1.0.0' diff --git a/app/src/main/java/com/ss/smartfilter/MainActivity.kt b/app/src/main/java/com/ss/smartfilter/MainActivity.kt index 8fd2b08..af603e3 100644 --- a/app/src/main/java/com/ss/smartfilter/MainActivity.kt +++ b/app/src/main/java/com/ss/smartfilter/MainActivity.kt @@ -4,8 +4,6 @@ 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 diff --git a/app/src/main/java/com/ss/smartfilter/Utils.kt b/app/src/main/java/com/ss/smartfilter/Utils.kt index 290a137..e41fd10 100644 --- a/app/src/main/java/com/ss/smartfilter/Utils.kt +++ b/app/src/main/java/com/ss/smartfilter/Utils.kt @@ -2,12 +2,10 @@ package com.ss.smartfilter import android.view.ViewGroup import com.ss.smartfilterlib.R +import com.ss.smartfilterlib.data.Data 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.data.mData import com.ss.smartfilterlib.utils.MultiChipType import com.ss.smartfilterlib.utils.Orientation import com.ss.smartfilterlib.utils.Params @@ -17,152 +15,166 @@ import com.ss.smartfilterlib.utils.SingleGroupSubType /** * created by Mala Ruparel ON 23/04/24 */ -fun addRadioGroupSingleLineVertical( - rootView: ViewGroup, - radioGroupCallback: (RadioGroupData) -> Unit -) = - Params.SingleSelection( +fun addRadioGroupSingleLineVertical(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, singleGroupSubType = SingleGroupSubType.SINGLE_LINE, chipType = SingleChipType.NONE, orientation = Orientation.VERTICAL, - mData = mRadioGroupData(), - callbacks = radioGroupCallback, + mData = mData(), + onItemSelected = onItemSelected, bgSelector = R.drawable.singleline_rb_selector, textSelector = R.color.single_text_color_selector ) ) -fun addRadioGroupSingleLineHorizontal( - rootView: ViewGroup, - radioGroupCallback: (RadioGroupData) -> Unit -) = - Params.SingleSelection( +fun addRadioGroupSingleLineHorizontal(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, singleGroupSubType = SingleGroupSubType.SINGLE_LINE, chipType = SingleChipType.NONE, orientation = Orientation.HORIZONTAL, - mData = mRadioGroupData(), - callbacks = radioGroupCallback, + mData = mData(), + onItemSelected = onItemSelected, bgSelector = R.drawable.singleline_rb_selector, textSelector = R.color.single_text_color_selector ) ) -fun addRadioMultiRow(rootView: ViewGroup, radioGroupCallback: (RadioGroupData) -> Unit) = - Params.SingleSelectionMultiRaw( - SingleSelectionMultiRawParams( +fun addRadioMultiRow(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( + SingleSelectionParams( rootView = rootView, singleGroupSubType = SingleGroupSubType.MULTI_LINE, chipType = SingleChipType.NONE, orientation = Orientation.VERTICAL, - mData = mRadioGroupData(), - callbacks = radioGroupCallback, + mData = mData(), + onItemSelected = onItemSelected, bgSelector = R.drawable.multiline_bg_selector, textSelector = R.color.multiline_text_selector ) ) -fun addRadioGroupRowItemHorizontal( - rootView: ViewGroup, - radioGroupCallback: (RadioGroupData) -> Unit -) = Params.SingleSelection( +fun addRadioGroupRowItemHorizontal(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, singleGroupSubType = SingleGroupSubType.ROW_ITEM, chipType = SingleChipType.NONE, orientation = Orientation.HORIZONTAL, - mData = mRadioGroupData(), - callbacks = radioGroupCallback, + mData = mData(), + onItemSelected = onItemSelected, bgSelector = R.drawable.row_item_selector, textSelector = R.color.single_text_color_selector ) ) -fun addRadioGroupRowItemVertical( - rootView: ViewGroup, - radioGroupCallback: (RadioGroupData) -> Unit -) = Params.SingleSelection( +fun addRadioGroupRowItemVertical(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, singleGroupSubType = SingleGroupSubType.ROW_ITEM, chipType = SingleChipType.NONE, orientation = Orientation.VERTICAL, - mData = mRadioGroupData(), - callbacks = radioGroupCallback, + mData = mData(), + onItemSelected = onItemSelected, bgSelector = R.drawable.row_item_selector, textSelector = R.color.single_text_color_selector ) ) -fun addSingleSelectionChipGroupVertical(rootView: ViewGroup, radioGroupCallback: (RadioGroupData) -> Unit) = - Params.SingleChipSelection( - SingleChipSelectionParams( +fun addSingleSelectionChipGroupVertical(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( + SingleSelectionParams( rootView = rootView, singleGroupSubType = SingleGroupSubType.CHIP_GROUP, chipType = SingleChipType.ENTRY_CHIP, orientation = Orientation.VERTICAL, - mData = mRadioGroupData(), - callbacks = radioGroupCallback, + mData = mData(), + onItemSelected = onItemSelected, bgSelector = R.color.chip_bg_selector, - textSelector = R.color.chip_text_selector + textSelector = R.color.multiline_text_selector ) ) -fun addSingleSelectionChipGroupHorizontal(rootView: ViewGroup, radioGroupCallback: (RadioGroupData) -> Unit) = - Params.SingleChipSelection( - SingleChipSelectionParams( +fun addSingleSelectionChipGroupHorizontal(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( + SingleSelectionParams( rootView = rootView, singleGroupSubType = SingleGroupSubType.CHIP_GROUP, chipType = SingleChipType.ENTRY_CHIP, orientation = Orientation.HORIZONTAL, - mData = mRadioGroupData(), - callbacks = radioGroupCallback, + mData = mData(), + onItemSelected = onItemSelected, bgSelector = R.color.chip_bg_selector, textSelector = R.color.chip_text_selector ) ) -fun addMultiSelectionChipGroupVertical(rootView: ViewGroup, radioGroupCallback: (List) -> Unit) = - Params.MultiChipSelection( +fun addMultiSelectionChipGroupVertical(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = Params.MultiSelection( MultiSelectionParams( rootView = rootView, chipType = MultiChipType.FILTER_CHIP, orientation = Orientation.VERTICAL, - mData = mRadioGroupData(), - callbacks = radioGroupCallback, + mData = mData(), + onItemsSelected = onItemsSelected, bgSelector = R.color.chip_bg_selector, textSelector = R.color.chip_text_selector ) ) -fun addMultiSelectionChipGroupHorizontal(rootView: ViewGroup, radioGroupCallback: (List) -> Unit) = - Params.MultiChipSelection( +fun addMultiSelectionChipGroupHorizontal(rootView: ViewGroup, onItemsSelected: (List) -> Unit) =Params.MultiSelection( MultiSelectionParams( rootView = rootView, chipType = MultiChipType.FILTER_CHIP, orientation = Orientation.HORIZONTAL, - mData = mRadioGroupData(), - callbacks = radioGroupCallback, + mData = mData(), + onItemsSelected = onItemsSelected, bgSelector = R.color.chip_bg_selector, textSelector = R.color.chip_text_selector ) ) -fun addSingleSelectionListVertical(rootView: ViewGroup, radioGroupCallback: (RadioGroupData) -> Unit) = - Params.SingleSelection( +fun addSingleSelectionListHorizontal(rootView: ViewGroup, onItemselected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, singleGroupSubType = SingleGroupSubType.SINGLE_LINE, chipType = SingleChipType.NONE, - orientation = Orientation.VERTICAL, - mData = mRadioGroupData(), - callbacks = radioGroupCallback, + orientation = Orientation.HORIZONTAL, + mData = mData(), + onItemSelected = onItemselected, bgSelector = R.drawable.ic_check_selector, textSelector = R.color.chip_text_selector ) ) - - +fun addSingleSelectionListVertical(rootView: ViewGroup, onItemselected: (Data) -> Unit) = Params.SingleSelection( + SingleSelectionParams( + rootView = rootView, + singleGroupSubType = SingleGroupSubType.SINGLE_LINE, + chipType = SingleChipType.NONE, + orientation = Orientation.VERTICAL, + mData = mData(), + onItemSelected = onItemselected, + bgSelector = R.drawable.ic_check_selector, + textSelector = R.color.chip_text_selector + ) +) +fun addMultiSelectionListVertical(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = Params.MultiSelection( + MultiSelectionParams( + rootView = rootView, + singleGroupSubType = SingleGroupSubType.SINGLE_LINE, + chipType = MultiChipType.NONE, + orientation = Orientation.VERTICAL, + mData = mData(), + onItemsSelected = onItemsSelected, + bgSelector = R.color.chip_bg_selector, + textSelector = R.color.chip_text_selector + ) + ) +fun addMultiSelectionListHorizontal(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = Params.MultiSelection( + MultiSelectionParams( + rootView = rootView, + singleGroupSubType = SingleGroupSubType.SINGLE_LINE, + chipType = MultiChipType.NONE, + orientation = Orientation.HORIZONTAL, + mData = mData(), + onItemsSelected = onItemsSelected, + bgSelector = R.color.chip_bg_selector, + textSelector = R.color.chip_text_selector + ) +) diff --git a/media/multi_selection_horizontal.png b/media/multi_selection_horizontal.png new file mode 100644 index 0000000..21658a7 Binary files /dev/null and b/media/multi_selection_horizontal.png differ diff --git a/media/multi_selection_vertical.png b/media/multi_selection_vertical.png new file mode 100644 index 0000000..77492f8 Binary files /dev/null and b/media/multi_selection_vertical.png differ diff --git a/media/single_selection_horizental.png b/media/single_selection_horizental.png new file mode 100644 index 0000000..3dac664 Binary files /dev/null and b/media/single_selection_horizental.png differ diff --git a/media/single_selection_vertical.png b/media/single_selection_vertical.png index 5981a95..973eaab 100644 Binary files a/media/single_selection_vertical.png and b/media/single_selection_vertical.png differ diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/SmartFilter.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/SmartFilter.kt index a1aab95..f4efd0a 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/SmartFilter.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/SmartFilter.kt @@ -1,5 +1,6 @@ package com.ss.smartfilterlib +import com.ss.smartfilterlib.multiselection.MultiSelectionListView import com.ss.smartfilterlib.multiselection.MultiselectionChipGroup import com.ss.smartfilterlib.singleselection.SingleSelectionChipGroup import com.ss.smartfilterlib.singleselection.SingleSelectionItemRadioGroup @@ -10,6 +11,7 @@ import com.ss.smartfilterlib.utils.Params object SmartFilter { + fun addRadioGroupSingleSelection(singleSelectionParams: () -> Params.SingleSelection) { val param = singleSelectionParams().data val singleLineRadioGroup = SingleSelectionRadioGroup(param.rootView.context) @@ -18,19 +20,19 @@ object SmartFilter { param.orientation, param.bgSelector, param.textSelector, - param.callbacks + param.onItemSelected ) param.rootView.addView(singleLineRadioGroup) } - fun addRadioMultiRawSingleSelection(singleSelectionMultiRawParams: () -> Params.SingleSelectionMultiRaw) { - val param = singleSelectionMultiRawParams().data + fun addRadioMultiRawSingleSelection(singleSelectionParams: () -> Params.SingleSelection) { + val param = singleSelectionParams().data val multiLineRadioGroup = SingleSelectionMultiLineRadioButton(param.rootView.context) - multiLineRadioGroup.configureRadioButton( + multiLineRadioGroup.configureRadioButton( param.mData, param.bgSelector, param.textSelector, - param.callbacks + param.onItemSelected ) param.rootView.addView(multiLineRadioGroup) @@ -44,53 +46,66 @@ object SmartFilter { param.orientation, param.bgSelector, param.textSelector, - param.callbacks + param.onItemSelected ) param.rootView.addView(rowItemRadioGroup) } - fun addChipGroupSingleSelection(singleChipSelectionParams: () -> Params.SingleChipSelection) { - val param = singleChipSelectionParams().data - val singleChipgroup = SingleSelectionChipGroup(param.rootView.context) - singleChipgroup.configureView( + fun addChipGroupSingleSelection(singleSelectionParams: () -> Params.SingleSelection) { + val param = singleSelectionParams().data + val singleSelectionChipGroup = SingleSelectionChipGroup(param.rootView.context) + singleSelectionChipGroup.configureView( param.mData, param.chipType, param.orientation, param.bgSelector, param.textSelector, - param.callbacks + param.onItemSelected ) - param.rootView.addView(singleChipgroup) + param.rootView.addView(singleSelectionChipGroup) } - fun addChipGroupMultiSelection(multiselectionChipGroup: () -> Params.MultiChipSelection) { - val param = multiselectionChipGroup().data - val multiselectionChipGroup = MultiselectionChipGroup(param.rootView.context) - multiselectionChipGroup.configureView( + fun addChipGroupMultiSelection(multiselection: () -> Params.MultiSelection) { + val param = multiselection().data + val multiSelectionChipGroup = MultiselectionChipGroup(param.rootView.context) + multiSelectionChipGroup.configureView( param.mData, param.chipType, param.orientation, param.bgSelector, param.textSelector, - param.callbacks + param.onItemsSelected ) - param.rootView.addView(multiselectionChipGroup) + param.rootView.addView(multiSelectionChipGroup) } - fun addListViewSingleSelection(singleSelectionParams: () -> Params.SingleSelection) { - val param = singleSelectionParams().data + fun addListViewSingleSelection(singleSelectionListView: () -> Params.SingleSelection) { + val param = singleSelectionListView().data val singleSelectionListView = SingleSelectionListView(param.rootView.context) singleSelectionListView.configureView( param.mData, param.orientation, param.bgSelector, param.textSelector, - param.callbacks + param.onItemSelected ) param.rootView.addView(singleSelectionListView) } + fun addListViewMultiSelection(singleSelectionParams: () -> Params.MultiSelection) { + val param = singleSelectionParams().data + val multiSelectionListView = MultiSelectionListView(param.rootView.context) + multiSelectionListView.configureView( + param.mData, + param.orientation, + param.bgSelector, + param.textSelector, + param.onItemsSelected + ) + param.rootView.addView(multiSelectionListView) + + } } diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/adapter/MultiSelectionListAdapter.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/adapter/MultiSelectionListAdapter.kt index 43c1d93..ce7e103 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/adapter/MultiSelectionListAdapter.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/adapter/MultiSelectionListAdapter.kt @@ -6,7 +6,7 @@ import android.view.LayoutInflater import android.view.ViewGroup import android.widget.CheckedTextView import androidx.recyclerview.widget.RecyclerView -import com.ss.smartfilterlib.data.RadioGroupData +import com.ss.smartfilterlib.data.Data import com.ss.smartfilterlib.databinding.RowItemCheckableBinding /** @@ -16,12 +16,12 @@ class MultiSelectionListAdapter( private val checkSelector: Int, private val primaryTextColor: ColorStateList?, private val selectedItemsPositions: MutableList, - private val onMultiSelectionClicked: ((List) -> Unit)? + private val onMultiSelectionClicked: ((List) -> Unit)? ) : RecyclerView.Adapter() { private var selectedItemPosition: Int = RecyclerView.NO_POSITION - var data: List = emptyList() + var data: List = emptyList() set(value) { field = value notifyDataSetChanged() @@ -48,8 +48,8 @@ class MultiSelectionListAdapter( } } - fun bind(data: RadioGroupData, isSelected: Boolean) { - binding.text1.apply { + fun bind(data: Data, isSelected: Boolean) { + binding.ctv.apply { isChecked = selectedItemsPositions.contains(adapterPosition) text = data.name applySelector(this) @@ -76,10 +76,11 @@ class MultiSelectionListAdapter( selectedItemsPositions.add(position) } notifyItemChanged(position) - onMultiSelectionClicked?.invoke(data.filterIndexed { index, _ -> selectedItemsPositions.contains(index) }) + onMultiSelectionClicked?.invoke(selectedItemsPositions) } - protected fun setData(data: RadioGroupData) = data.name + + protected fun setData(data: Data) = data.name private fun applySelector(textView: CheckedTextView) { textView.setTextColor(primaryTextColor) diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/adapter/SingleSelectionAdapter.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/adapter/SingleSelectionAdapter.kt index fb44be6..705583f 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/adapter/SingleSelectionAdapter.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/adapter/SingleSelectionAdapter.kt @@ -1,10 +1,11 @@ package com.ss.smartfilterlib.adapter +import android.content.res.ColorStateList import android.view.LayoutInflater import android.view.ViewGroup import android.widget.CheckedTextView import androidx.recyclerview.widget.RecyclerView -import com.ss.smartfilterlib.data.RadioGroupData +import com.ss.smartfilterlib.data.Data import com.ss.smartfilterlib.databinding.RowItemCheckableBinding /** @@ -12,12 +13,12 @@ import com.ss.smartfilterlib.databinding.RowItemCheckableBinding */ class SingleSelectionListAdapter( private val checkSelector: Int, - private val primaryTextColor: Int, - private val onItemSelectionChanged: ((RadioGroupData) -> Unit)? + private val viewTextColor: ColorStateList?, + private val onItemSelectionChanged: ((Data) -> Unit)? ) : RecyclerView.Adapter() { private var selectedItemPosition: Int = RecyclerView.NO_POSITION - var data: List = emptyList() + var data: List = emptyList() set(value) { field = value notifyDataSetChanged() @@ -44,9 +45,9 @@ class SingleSelectionListAdapter( } } - fun bind(data: RadioGroupData, isSelected: Boolean) { + fun bind(data: Data, isSelected: Boolean) { binding.apply { - text1.apply { + ctv.apply { isChecked = isSelected text = data.name applySelector(this) @@ -55,7 +56,7 @@ class SingleSelectionListAdapter( } private fun applySelector(textView: CheckedTextView) { - textView.setTextColor(primaryTextColor) + textView.setTextColor(viewTextColor) textView.setCheckMarkDrawable(checkSelector) } } diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/callback/RadioGroupCallback.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/callback/RadioGroupCallback.kt deleted file mode 100644 index 73719c4..0000000 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/callback/RadioGroupCallback.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.ss.smartfilterlib.callback -import com.ss.smartfilterlib.data.RadioGroupData - - -/** - * created by Mala Ruparel ON 19/04/24 - */ - - -fun interface RadioGroupCallback{ - fun onSingleSelection(radioGroupData: RadioGroupData) -} -fun interface ChipGroupCallback{ - fun onMultiChipCheckedChanged( checkedChipIds: List) -} - diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/Data.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/Data.kt new file mode 100644 index 0000000..0186d0c --- /dev/null +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/Data.kt @@ -0,0 +1,47 @@ +package com.ss.smartfilterlib.data + + +import com.ss.smartfilterlib.R + +/** + * created by Mala Ruparel ON 19/04/24 + */ +data class Data( + val id: Int = 0, + val name: String, + val description: String = "", + var isSelected : Boolean = false, + val image: Int = R.drawable.ic_documents +) + + +fun getNamesFromDataList(): ArrayList { + return mData().map { it.name } as ArrayList +} + + +fun mData(): ArrayList { + return arrayListOf( + Data(id=1, name="KitKat", description ="Smart Filter Description 1" , image = R.drawable.ic_documents), + Data(id=2, name="Lollipop", description ="Smart Filter Description 2",image = R.drawable.ic_documents), + Data(id=3, name="Marshmallow", description ="Smart Filter Description 3", image = R.drawable.ic_documents), + Data(id=4, name="Nougat", description ="Smart Filter Description 4", image = R.drawable.ic_documents), + Data(id=5, name="Oreo", description ="Smart Filter Description 5",image = R.drawable.ic_documents), + Data(id=6, name="Pie", description ="Smart Filter Description 6", image = R.drawable.ic_documents), + Data(id=7, name="Quince Tart", description ="Smart Filter Description 7",image = R.drawable.ic_documents), + Data(id=8, name="Red Velvet Cake", description ="Smart Filter 8", image = R.drawable.ic_documents), + Data(id=9, name="Snow Cone ", description ="Smart Filter Description 9",image = R.drawable.ic_documents), + Data(id=10, name="KitKat ", description ="Smart Filter Description 10",image = R.drawable.ic_documents), + Data(id=11, name="Lollipop", description ="Smart Filter Description 11", image = R.drawable.ic_documents), + Data(id=12, name="Marshmallow", description ="Smart Filter Description 12", image = R.drawable.ic_documents), + Data(id=13, name="Nougat", description ="Smart Filter Description 13", image = R.drawable.ic_documents), + Data(id=14, name="Oreo", description ="Smart Filter Description 14", image = R.drawable.ic_documents), + Data(id=15, name="Pie", description ="Smart Filter Description 15",image = R.drawable.ic_documents), + Data(id=16, name="Quince Tart", description ="Smart Filter Description16", image = R.drawable.ic_documents), + Data(id=17, name="Red Velvet Cake", description ="Smart Filter Description 17", image = R.drawable.ic_documents), + Data(id=18, name="Snow Cone", description ="Smart Filter Description 17",image = R.drawable.ic_documents), + Data(id=19, name="KitKat", description ="Smart Filter Description 18",image = R.drawable.ic_documents), + Data(id=20, name="Lollipop", description ="Smart Filter Description 19", image = R.drawable.ic_documents), + + ) +} diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/MultiSelectionParams.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/MultiSelectionParams.kt index 201a2f3..c53e1c4 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/MultiSelectionParams.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/MultiSelectionParams.kt @@ -14,8 +14,8 @@ data class MultiSelectionParams( val singleGroupSubType: SingleGroupSubType = SingleGroupSubType.NONE, val chipType: MultiChipType = MultiChipType.NONE, val orientation: Int = Orientation.HORIZONTAL, - val mData: ArrayList, - val callbacks: (List) -> Unit, + val mData: ArrayList, + val onItemsSelected: (List) -> Unit, @ColorRes val bgSelector: Int = android.R.color.darker_gray, @ColorRes val textSelector: Int = android.R.color.black ) \ No newline at end of file diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/RadioGroupData.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/RadioGroupData.kt deleted file mode 100644 index ecb9a43..0000000 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/RadioGroupData.kt +++ /dev/null @@ -1,47 +0,0 @@ -package com.ss.smartfilterlib.data - - -import com.ss.smartfilterlib.R - -/** - * created by Mala Ruparel ON 19/04/24 - */ -data class RadioGroupData( - val id: Int = 0, - val name: String, - val description: String = "", - var isSelected : Boolean = false, - val image: Int = R.drawable.ic_documents -) - - -fun getNamesFromRadioGroupDataList(data: List): List { - return data.map { it.name } -} - - -fun mRadioGroupData(): ArrayList { - return arrayListOf( - RadioGroupData(id=1, name="KitKat", description ="Smart Filter Description 1" , image = R.drawable.ic_documents), - RadioGroupData(id=2, name="Lollipop", description ="Smart Filter Description 2",image = R.drawable.ic_documents), - RadioGroupData(id=3, name="Marshmallow", description ="Smart Filter Description 3", image = R.drawable.ic_documents), - RadioGroupData(id=4, name="Nougat", description ="Smart Filter Description 4", image = R.drawable.ic_documents), - RadioGroupData(id=5, name="Oreo", description ="Smart Filter Description 5",image = R.drawable.ic_documents), - RadioGroupData(id=6, name="Pie", description ="Smart Filter Description 6", image = R.drawable.ic_documents), - RadioGroupData(id=7, name="Quince Tart", description ="Smart Filter Description 7",image = R.drawable.ic_documents), - RadioGroupData(id=8, name="Red Velvet Cake", description ="Smart Filter 8", image = R.drawable.ic_documents), - RadioGroupData(id=9, name="Snow Cone ", description ="Smart Filter Description 9",image = R.drawable.ic_documents), - RadioGroupData(id=10, name="KitKat ", description ="Smart Filter Description 10",image = R.drawable.ic_documents), - RadioGroupData(id=11, name="Lollipop", description ="Smart Filter Description 11", image = R.drawable.ic_documents), - RadioGroupData(id=12, name="Marshmallow", description ="Smart Filter Description 12", image = R.drawable.ic_documents), - RadioGroupData(id=13, name="Nougat", description ="Smart Filter Description 13", image = R.drawable.ic_documents), - RadioGroupData(id=14, name="Oreo", description ="Smart Filter Description 14", image = R.drawable.ic_documents), - RadioGroupData(id=15, name="Pie", description ="Smart Filter Description 15",image = R.drawable.ic_documents), - RadioGroupData(id=16, name="Quince Tart", description ="Smart Filter Description16", image = R.drawable.ic_documents), - RadioGroupData(id=17, name="Red Velvet Cake", description ="Smart Filter Description 17", image = R.drawable.ic_documents), - RadioGroupData(id=18, name="Snow Cone", description ="Smart Filter Description 17",image = R.drawable.ic_documents), - RadioGroupData(id=19, name="KitKat", description ="Smart Filter Description 18",image = R.drawable.ic_documents), - RadioGroupData(id=20, name="Lollipop", description ="Smart Filter Description 19", image = R.drawable.ic_documents), - - ) -} diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/SingleChipSelectionParams.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/SingleChipSelectionParams.kt deleted file mode 100644 index e9652e2..0000000 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/SingleChipSelectionParams.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.ss.smartfilterlib.data - -import android.view.ViewGroup -import androidx.annotation.ColorRes -import com.ss.smartfilterlib.utils.SingleChipType -import com.ss.smartfilterlib.utils.SingleGroupSubType - -/** - * created by Mala Ruparel ON 08/05/24 - */ -data class SingleChipSelectionParams( - val rootView: ViewGroup, - val singleGroupSubType: SingleGroupSubType, - val chipType: SingleChipType, - val orientation: Int, - val mData: ArrayList, - val callbacks: (RadioGroupData) -> Unit, - @ColorRes val bgSelector: Int = android.R.color.darker_gray, - @ColorRes val textSelector: Int = android.R.color.black - -) \ No newline at end of file diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/SingleSelectionMultiRawParams.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/SingleSelectionMultiRawParams.kt deleted file mode 100644 index 6afcd61..0000000 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/SingleSelectionMultiRawParams.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.ss.smartfilterlib.data - -import android.view.ViewGroup -import androidx.annotation.ColorRes -import androidx.annotation.DrawableRes -import com.ss.smartfilterlib.utils.SingleChipType -import com.ss.smartfilterlib.utils.SingleGroupSubType - -/** - * created by Mala Ruparel ON 08/05/24 - */ -data class SingleSelectionMultiRawParams( - val rootView: ViewGroup, - val singleGroupSubType: SingleGroupSubType, - val chipType: SingleChipType, - val orientation: Int, - val mData: ArrayList, - val callbacks: (RadioGroupData) -> Unit, - @DrawableRes val bgSelector: Int = com.ss.smartfilterlib.R.drawable.multiline_default, - @ColorRes val textSelector: Int = com.ss.smartfilterlib.R.color.black - -) \ No newline at end of file diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/SingleSelectionParams.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/SingleSelectionParams.kt index 20f1e30..091ac73 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/SingleSelectionParams.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/data/SingleSelectionParams.kt @@ -15,9 +15,15 @@ data class SingleSelectionParams( val singleGroupSubType: SingleGroupSubType, val chipType: SingleChipType, val orientation: Int, - val mData: ArrayList, - val callbacks: (RadioGroupData) -> Unit, - @DrawableRes val bgSelector: Int = R.drawable.abc_btn_radio_material, + val mData: ArrayList, + val onItemSelected: (Data) -> Unit, + @DrawableRes val bgSelector: Int =android.R.color.darker_gray, @ColorRes val textSelector: Int = android.R.color.black -) \ No newline at end of file +) +/* +@DrawableRes val bgSelector: Int = com.ss.smartfilterlib.R.drawable.multiline_default, +@ColorRes val textSelector: Int = com.ss.smartfilterlib.R.color.black*/ +/* +@ColorRes val bgSelector: Int = android.R.color.darker_gray, +@ColorRes val textSelector: Int = android.R.color.black*/ diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/multiselection/MultiSelectionListView.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/multiselection/MultiSelectionListView.kt index eec17e8..8810484 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/multiselection/MultiSelectionListView.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/multiselection/MultiSelectionListView.kt @@ -1,21 +1,21 @@ package com.ss.smartfilterlib.multiselection import android.content.Context +import android.content.res.ColorStateList import android.util.AttributeSet +import androidx.core.content.ContextCompat import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import com.ss.smartfilterlib.utils.BaseRecycleView import com.ss.smartfilterlib.R import com.ss.smartfilterlib.adapter.MultiSelectionListAdapter +import com.ss.smartfilterlib.data.Data import com.ss.smartfilterlib.singleselection.SmartOrientation -import com.ss.smartfilterlib.data.RadioGroupData - +import com.ss.smartfilterlib.utils.BaseRecycleView /** * created by Mala Ruparel ON 02/05/24 */ -class MultiSelectionListView @JvmOverloads constructor( context: Context,attrs: AttributeSet? = null,defStyle: Int = 0) : BaseRecycleView(context, attrs, defStyle){ +class MultiSelectionListView @JvmOverloads constructor( context: Context,attrs: AttributeSet? = null,defStyle: Int = 0) : BaseRecycleView(context, attrs, defStyle){ init { @@ -24,18 +24,7 @@ class MultiSelectionListView @JvmOverloads constructor( context: Context,attrs: populateDataFromAttributes() } - private fun populateDataFromAttributes() { - val mData = resources.getStringArray(dataFromXml); - val data = mData.map { RadioGroupData(name = it) } as ArrayList - configureView( - data = data, - orientation = smartOrientation, - checkSelector = checkSelector, - primaryTextColor = primaryTextColor, - onCheckedChangeListener = onMultiSelectionClicked - ) - } override fun initializeView() { layoutManager = when (smartOrientation) { @@ -46,39 +35,51 @@ class MultiSelectionListView @JvmOverloads constructor( context: Context,attrs: override fun initAttributes(attrs: AttributeSet?) { val typedArray = context.obtainStyledAttributes(attrs, R.styleable.SingleSelectionView) - try { - primaryTextColor = typedArray.getColor(R.styleable.SingleSelectionView_ss_text_selector, primaryTextColor) - smartOrientation = typedArray.getInt(R.styleable.SingleSelectionView_ss_orientation,RecyclerView.VERTICAL) - checkSelector = typedArray.getResourceId( - R.styleable.SingleSelectionView_ss_check_drawable_selector, - R.drawable.ic_check_selector - ) - dataFromXml = typedArray.getResourceId(R.styleable.SingleSelectionView_ss_list_item, 0) - } finally { - typedArray.recycle() + with(typedArray) { + try { + viewTextSelector = getColorStateList(R.styleable.SingleSelectionView_ss_text_selector) ?: setDefaultTextColor() + smartOrientation = getInt(R.styleable.SingleSelectionView_ss_orientation, VERTICAL) + checkSelector = getResourceId(R.styleable.SingleSelectionView_ss_checked_selector,R.drawable.ic_check_selector) + dataFromXml = getResourceId(R.styleable.SingleSelectionView_ss_list_item, 0) + } finally { + typedArray.recycle() + } } } + private fun populateDataFromAttributes() { + if (dataFromXml != 0) { + val mData = resources.getStringArray(dataFromXml); + mData.forEach { + val data = Data(name = it) + mList.add(data) + } + setItems(mList) + } + + } - private fun configureView(data: ArrayList, orientation: Int, checkSelector: Int, primaryTextColor: Int, onCheckedChangeListener: ((List) -> Unit)?) { + fun configureView(data: ArrayList, orientation: Int, checkSelector: Int, primaryTextColor: Int, onCheckedChangeListener: ((List) -> Unit)?) { updateValue(orientation, checkSelector, primaryTextColor, onCheckedChangeListener) initializeView() setItems(data) } - private fun updateValue(orientation: Int,checkSelector: Int, primaryTextColor: Int,onCheckedChangeListener: ((List) -> Unit)?) { + private fun updateValue(orientation: Int,checkSelector: Int, primaryTextColor: Int,onCheckedChangeListener: ((List) -> Unit)?) { this.onMultiSelectionClicked = onCheckedChangeListener this.smartOrientation = orientation this.checkSelector = checkSelector - this.primaryTextColor = primaryTextColor + this.viewTextSelector = primaryTextColor.let { ContextCompat.getColorStateList(context, it) } } - private fun setItems(items: List) { + private fun setItems(items: List) { adapter = MultiSelectionListAdapter(checkSelector,viewTextSelector,selectedItemsPositions,onMultiSelectionClicked).apply { data = items } } - - fun setOnMultiSelection(callback: (List) -> Unit) { + private fun setDefaultTextColor(): ColorStateList? { + return ContextCompat.getColorStateList(context, R.color.black) + } + fun setOnMultiSelection(callback: (List) -> Unit) { onMultiSelectionClicked = callback } } diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/multiselection/MultiselectionChipGroup.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/multiselection/MultiselectionChipGroup.kt index c1a8361..4f17087 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/multiselection/MultiselectionChipGroup.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/multiselection/MultiselectionChipGroup.kt @@ -8,15 +8,15 @@ import androidx.core.content.ContextCompat import com.google.android.material.chip.Chip import com.google.android.material.chip.ChipGroup import com.ss.smartfilterlib.R -import com.ss.smartfilterlib.data.RadioGroupData -import com.ss.smartfilterlib.singleselection.BaseLinearLayout +import com.ss.smartfilterlib.data.Data +import com.ss.smartfilterlib.utils.BaseLinearLayout import com.ss.smartfilterlib.utils.MultiChipType import com.ss.smartfilterlib.utils.Orientation /** * created by Mala Ruparel ON 25/04/24 */ -class MultiselectionChipGroup @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : BaseLinearLayout(context, attrs, defStyle) { +class MultiselectionChipGroup @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : BaseLinearLayout(context, attrs, defStyle) { init { initAttributes(attrs=attrs) @@ -39,8 +39,8 @@ class MultiselectionChipGroup @JvmOverloads constructor(context: Context, attrs: } private fun populateDataFromAttributes() { if (dataFromXml != 0) { - val mData = resources.getStringArray(dataFromXml); - val data = mData.map { RadioGroupData(name = it) } as ArrayList + val mData = resources.getStringArray(dataFromXml) + val data = mData.map { Data(name = it) } as ArrayList setOrientation() setItems(data, MultiChipType.ENTRY_CHIP) } @@ -56,7 +56,7 @@ class MultiselectionChipGroup @JvmOverloads constructor(context: Context, attrs: chipGroup = ChipGroup(context) } - fun configureView(chipData: List,chipType: MultiChipType,orientation: Int,bgSelector: Int,textSelector: Int, checkedChangedListener: ( List) -> Unit ) { + fun configureView(chipData: List,chipType: MultiChipType,orientation: Int,bgSelector: Int,textSelector: Int, checkedChangedListener: ( List) -> Unit ) { updateValue(orientation, bgSelector, textSelector, checkedChangedListener) setOrientation() @@ -73,7 +73,7 @@ class MultiselectionChipGroup @JvmOverloads constructor(context: Context, attrs: chipGroup.isSelectionRequired = true } - private fun setItems(mData: List, chipType: MultiChipType) { + private fun setItems(mData: List, chipType: MultiChipType) { val chipIds = mData.map { it.id } mData.forEachIndexed {index, data -> val chip = createChip(chipType) @@ -160,14 +160,8 @@ class MultiselectionChipGroup @JvmOverloads constructor(context: Context, attrs: } } - private fun setChipEvents(chip: Chip,data: RadioGroupData) { + private fun setChipEvents(chip: Chip,data: Data) { chip.setOnCheckedChangeListener { _, isChecked -> - data.isSelected = isChecked - if (isChecked) { - checkedChipIds += chip.id - } else { - checkedChipIds -= chip.id - } data.isSelected = isChecked if (isChecked) { if (!checkedChipIds.contains(chip.id)) { diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionChipGroup.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionChipGroup.kt index 050de67..c3fe865 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionChipGroup.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionChipGroup.kt @@ -11,7 +11,8 @@ import androidx.core.content.ContextCompat import com.google.android.material.chip.Chip import com.google.android.material.chip.ChipGroup import com.ss.smartfilterlib.R -import com.ss.smartfilterlib.data.RadioGroupData +import com.ss.smartfilterlib.data.Data +import com.ss.smartfilterlib.utils.BaseLinearLayout import com.ss.smartfilterlib.utils.Orientation import com.ss.smartfilterlib.utils.SingleChipType @@ -19,7 +20,7 @@ import com.ss.smartfilterlib.utils.SingleChipType /** * created by Mala Ruparel ON 24/04/24 */ -class SingleSelectionChipGroup @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : BaseLinearLayout(context, attrs, defStyle) { +class SingleSelectionChipGroup @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : BaseLinearLayout(context, attrs, defStyle) { init { @@ -57,18 +58,18 @@ class SingleSelectionChipGroup @JvmOverloads constructor(context: Context, attrs private fun populateDataFromAttributes() { if (dataFromXml != 0) { val mData = resources.getStringArray(dataFromXml); - val data = mData.map { RadioGroupData(name = it) } as ArrayList + val data = mData.map { Data(name = it) } as ArrayList setOrientation() setItems(data, SingleChipType.ENTRY_CHIP) } } - fun configureView(chipData: List,chipType: SingleChipType,orientation: Int,bgSelector: Int, textSelector: Int, checkedChangedListener: ( RadioGroupData) -> Unit,) { + fun configureView(chipData: List,chipType: SingleChipType,orientation: Int,bgSelector: Int, textSelector: Int, checkedChangedListener: ( Data) -> Unit,) { updateValue(orientation, bgSelector, textSelector, checkedChangedListener) setOrientation() setItems(chipData,chipType) } - private fun updateValue(orientation: Int,bgSelector: Int, primaryTextColor: Int,onCheckedChangeListener: ((RadioGroupData) -> Unit)?) { + private fun updateValue(orientation: Int,bgSelector: Int, primaryTextColor: Int,onCheckedChangeListener: ((Data) -> Unit)?) { chipGroup.isSingleSelection = true chipGroup.isSelectionRequired=true chipGroup.isSingleLine = orientation == Orientation.HORIZONTAL @@ -76,7 +77,7 @@ class SingleSelectionChipGroup @JvmOverloads constructor(context: Context, attrs this.viewTextSelector = primaryTextColor.let { ContextCompat.getColorStateList(context, it) } this.singleCheckedChangeListener = onCheckedChangeListener } - private fun setItems(mData: List, chipType: SingleChipType) { + private fun setItems(mData: List, chipType: SingleChipType) { mData.forEach { data -> val chip = createChip(chipType) with(chip) { @@ -168,14 +169,14 @@ class SingleSelectionChipGroup @JvmOverloads constructor(context: Context, attrs private fun setChipEvents(chip: Chip) { chip.setOnCheckedChangeListener { _, _ -> - singleCheckedChangeListener?.invoke(chip.tag as RadioGroupData) + singleCheckedChangeListener?.invoke(chip.tag as Data) } } - private fun generateViewWithId(radioButton: Chip, data: RadioGroupData) { + private fun generateViewWithId(radioButton: Chip, data: Data) { radioButton.id = View.generateViewId() radioButton.tag = data } - fun setonCheckedChangeListener(onCheckedChangeListener: (RadioGroupData) -> Unit) { + fun setonCheckedChangeListener(onCheckedChangeListener: (Data) -> Unit) { this.singleCheckedChangeListener = onCheckedChangeListener } } diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionItemRadioGroup.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionItemRadioGroup.kt index 96de25a..ea3d53b 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionItemRadioGroup.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionItemRadioGroup.kt @@ -12,13 +12,14 @@ import android.widget.RelativeLayout import android.widget.ScrollView import androidx.core.content.ContextCompat import com.ss.smartfilterlib.R -import com.ss.smartfilterlib.data.RadioGroupData +import com.ss.smartfilterlib.data.Data import com.ss.smartfilterlib.databinding.RowItemBinding +import com.ss.smartfilterlib.utils.BaseLinearLayout /** * created by Mala Ruparel ON 19/04/24 */ -class SingleSelectionItemRadioGroup(context: Context, attrs: AttributeSet? =null,defStyle: Int = 0) : BaseLinearLayout(context, attrs, defStyle) { +class SingleSelectionItemRadioGroup(context: Context, attrs: AttributeSet? =null,defStyle: Int = 0) : BaseLinearLayout(context, attrs, defStyle) { init { @@ -45,7 +46,7 @@ class SingleSelectionItemRadioGroup(context: Context, attrs: AttributeSet? =null val mData = resources.getStringArray(dataFromXml); setOrientation() mData.forEach { - val data = RadioGroupData(name = it) + val data = Data(name = it) addRadioButtonView(data) } } @@ -89,25 +90,25 @@ class SingleSelectionItemRadioGroup(context: Context, attrs: AttributeSet? =null } - fun configureRadioButton(mData: ArrayList,orientation: Int,bgSelector: Int,textSelector: Int,checkedChangedListener: ( RadioGroupData) -> Unit) { + fun configureRadioButton(mData: ArrayList,orientation: Int,bgSelector: Int,textSelector: Int,checkedChangedListener: ( Data) -> Unit) { updateValue(orientation, bgSelector, textSelector, checkedChangedListener) setOrientation() setItems(mData) } - private fun setItems(mData: ArrayList) { + private fun setItems(mData: ArrayList) { mData.forEach { data -> addRadioButtonView( data ) } } - private fun updateValue(orientation: Int,checkSelector: Int, primaryTextColor: Int,onCheckedChangeListener: ((RadioGroupData) -> Unit)?) { + private fun updateValue(orientation: Int,checkSelector: Int, primaryTextColor: Int,onCheckedChangeListener: ((Data) -> Unit)?) { this.smartOrientation = orientation this.viewBgSelector = checkSelector.let { ContextCompat.getDrawable(context, it) } this.viewTextSelector = primaryTextColor.let { ContextCompat.getColorStateList(context, it) } this.singleCheckedChangeListener = onCheckedChangeListener } - private fun addRadioButtonView(data: RadioGroupData) { + private fun addRadioButtonView(data: Data) { val binding = RowItemBinding.inflate(LayoutInflater.from(context), this, false) binding.apply { tvName.text = data.name diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionListView.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionListView.kt index 0025e7b..eb887ad 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionListView.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionListView.kt @@ -8,20 +8,20 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.ss.smartfilterlib.R import com.ss.smartfilterlib.adapter.SingleSelectionListAdapter -import com.ss.smartfilterlib.data.RadioGroupData +import com.ss.smartfilterlib.data.Data import com.ss.smartfilterlib.utils.BaseRecycleView typealias SmartOrientation = com.ss.smartfilterlib.utils.Orientation /** * created by Mala Ruparel ON 02/05/24 */ -class SingleSelectionListView @JvmOverloads constructor( context: Context,attrs: AttributeSet? = null,defStyle: Int = 0) : BaseRecycleView(context, attrs, defStyle){ +class SingleSelectionListView @JvmOverloads constructor( context: Context,attrs: AttributeSet? = null,defStyle: Int = 0) : BaseRecycleView(context, attrs, defStyle){ init { initAttributes(attrs=attrs) initializeView() - + populateDataFromAttributes() } @@ -39,35 +39,46 @@ class SingleSelectionListView @JvmOverloads constructor( context: Context,attrs: try { viewTextSelector =getColorStateList(R.styleable.SingleSelectionView_ss_text_selector) ?: setDefaultTextColor() smartOrientation = getInt(R.styleable.SingleSelectionView_ss_orientation, RecyclerView.VERTICAL) - checkSelector = getResourceId(R.styleable.SingleSelectionView_ss_check_drawable_selector,R.drawable.ic_check_selector) + checkSelector = getResourceId(R.styleable.SingleSelectionView_ss_checked_selector,R.drawable.ic_check_selector) dataFromXml = typedArray.getResourceId(R.styleable.SingleSelectionView_ss_list_item, 0) } finally { typedArray.recycle() } } } + private fun populateDataFromAttributes() { + if (dataFromXml != 0) { + val mData = resources.getStringArray(dataFromXml); + initializeView() + mData.forEach { + val data = Data(name = it) + mList.add(data) + } + setItems(mList) + } + } - fun configureView(data: ArrayList, orientation: Int, checkSelector: Int, textSelector: Int, onCheckedChangeListener: ((RadioGroupData) -> Unit)?){ + fun configureView(data: ArrayList, orientation: Int, checkSelector: Int, textSelector: Int, onCheckedChangeListener: ((Data) -> Unit)?){ updateValue(orientation, checkSelector, textSelector, onCheckedChangeListener) initializeView() setItems(data) } - private fun updateValue(orientation: Int,checkSelector: Int,textSelector: Int,checkedChangedListener: ((RadioGroupData) -> Unit)?) { + private fun updateValue(orientation: Int,checkSelector: Int,textSelector: Int,checkedChangedListener: ((Data) -> Unit)?) { this.onSingleSelectionClicked = checkedChangedListener this.smartOrientation = orientation this.checkSelector = checkSelector this.viewTextSelector =textSelector.let { ContextCompat.getColorStateList(context, it) } } - private fun setItems(items: List) { - adapter = SingleSelectionListAdapter(checkSelector,primaryTextColor,onSingleSelectionClicked).apply { data = items } + private fun setItems(items: List) { + adapter = SingleSelectionListAdapter(checkSelector,viewTextSelector,onSingleSelectionClicked).apply { data = items } } private fun setDefaultTextColor(): ColorStateList? { return ContextCompat.getColorStateList(context, R.color.black) } - fun setOnSingleSelection(callback: (RadioGroupData) -> Unit) { - onSingleSelectionClicked = callback + fun setOnSingleSelection(onItemSelected: (Data) -> Unit) { + onSingleSelectionClicked = onItemSelected } } diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionMultiLineRadioButton.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionMultiLineRadioButton.kt index ab7ee44..097ffd4 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionMultiLineRadioButton.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionMultiLineRadioButton.kt @@ -13,8 +13,7 @@ import androidx.core.content.ContextCompat import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.GridLayoutManager import com.ss.smartfilterlib.R -import com.ss.smartfilterlib.callback.RadioGroupCallback -import com.ss.smartfilterlib.data.RadioGroupData +import com.ss.smartfilterlib.data.Data import com.ss.smartfilterlib.databinding.RowItemMultiLineBinding import com.ss.smartfilterlib.utils.BaseRecycleView import com.ss.smartfilterlib.utils.Constant.DEFAULT_SPACING @@ -22,7 +21,7 @@ import com.ss.smartfilterlib.utils.Constant.DEFAULT_SPAN_COUNT import com.ss.smartfilterlib.utils.GridSpacingItemDecoration import com.ss.smartfilterlib.utils.SingleChangeDiffUtil -class SingleSelectionMultiLineRadioButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : BaseRecycleView(context, attrs, defStyle){ +class SingleSelectionMultiLineRadioButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : BaseRecycleView(context, attrs, defStyle){ init { @@ -54,15 +53,14 @@ class SingleSelectionMultiLineRadioButton @JvmOverloads constructor(context: Con override fun initializeView() { layoutManager = GridLayoutManager(context, spanCount) addItemDecoration(GridSpacingItemDecoration(spanCount, spacing, includeEdge)) + adapter = MultiLineRadioButtonAdapter(context,onSingleSelectionClicked).also { this.mAdapter = it } - adapter = MultiLineRadioButtonAdapter(context).also { this.mAdapter = it } - mAdapter?.onChoseListener = RadioGroupCallback { radioGroupData -> onSingleSelectionClicked?.invoke( radioGroupData) } } private fun populateDataFromAttributes(){ if (dataFromXml != 0) { val mData = resources.getStringArray(dataFromXml); mData.forEach { - val data = RadioGroupData(name = it) + val data = Data(name = it) mList.add(data) } mAdapter?.setData(mList) @@ -70,11 +68,11 @@ class SingleSelectionMultiLineRadioButton @JvmOverloads constructor(context: Con } - fun configureRadioButton(mData: ArrayList, bgSelector: Int, textSelector: Int, checkedChangedListener: (RadioGroupData) -> Unit) { + fun configureRadioButton(mData: ArrayList, bgSelector: Int, textSelector: Int, checkedChangedListener: (Data) -> Unit) { updateValue(bgSelector, textSelector, checkedChangedListener) mAdapter?.setData(mData) } - private fun updateValue(checkSelector: Int, textSelector: Int,onCheckedChangeListener: ((RadioGroupData) -> Unit)?) { + private fun updateValue(checkSelector: Int, textSelector: Int,onCheckedChangeListener: ((Data) -> Unit)?) { this.viewBgSelector = checkSelector.let { ContextCompat.getDrawable(context, it) } this.viewTextSelector = textSelector.let { ContextCompat.getColorStateList(context, it) } this.onSingleSelectionClicked = onCheckedChangeListener @@ -106,20 +104,21 @@ class SingleSelectionMultiLineRadioButton @JvmOverloads constructor(context: Con } } - inner class MultiLineRadioButtonAdapter(private val context: Context) : Adapter() { + + inner class MultiLineRadioButtonAdapter(private val context: Context, var onSingleSelectionClicked: ((Data) -> Unit)?) : Adapter() { var currentSelected: Int? = null - var onChoseListener: RadioGroupCallback? = null + internal inner class GridRadioHolder(itemView: RowItemMultiLineBinding) : ViewHolder(itemView.root) { private val binding = itemView - fun setData(radioGroupData: RadioGroupData, selected: Boolean, function: (Int) -> Unit, position: Int) { + fun setData(data: Data, selected: Boolean, function: (Int) -> Unit, position: Int) { binding.multiLineRadioGroupDefaultRadioButton.apply { - text = setData(radioGroupData) + text = setData(data) applySelector(this) isChecked = selected setOnClickListener { - onChoseListener!!.onSingleSelection( radioGroupData) + onSingleSelectionClicked?.invoke(data) function(position) } } @@ -146,7 +145,7 @@ class SingleSelectionMultiLineRadioButton @JvmOverloads constructor(context: Con return mList.size } - fun setData(newList: ArrayList){ + fun setData(newList: ArrayList){ val diffUtil = SingleChangeDiffUtil(mList, newList) val diffResult = DiffUtil.calculateDiff(diffUtil) mList = newList @@ -175,7 +174,7 @@ class SingleSelectionMultiLineRadioButton @JvmOverloads constructor(context: Con - fun onCheckedChangeListener(onCheckedChangeListener: (RadioGroupData) -> Unit) { + fun onCheckedChangeListener(onCheckedChangeListener: (Data) -> Unit) { this.onSingleSelectionClicked = onCheckedChangeListener } } \ No newline at end of file diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionRadioGroup.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionRadioGroup.kt index 8eb2b95..a0f528d 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionRadioGroup.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/SingleSelectionRadioGroup.kt @@ -14,14 +14,15 @@ import android.widget.RadioGroup import android.widget.ScrollView import androidx.core.content.ContextCompat import com.ss.smartfilterlib.R -import com.ss.smartfilterlib.data.RadioGroupData +import com.ss.smartfilterlib.data.Data +import com.ss.smartfilterlib.utils.BaseLinearLayout import com.ss.smartfilterlib.utils.Orientation /** * created by Mala Ruparel ON 17/04/24 */ -class SingleSelectionRadioGroup @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : BaseLinearLayout(context, attrs, defStyle) { +class SingleSelectionRadioGroup @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : BaseLinearLayout(context, attrs, defStyle) { init { initAttributes(attrs=attrs) @@ -51,7 +52,7 @@ class SingleSelectionRadioGroup @JvmOverloads constructor(context: Context, attr val mData = resources.getStringArray(dataFromXml); setOrientation() mData.forEach { - val data = RadioGroupData(name = it) + val data = Data(name = it) addRadioButtonView(data) } } @@ -95,25 +96,25 @@ class SingleSelectionRadioGroup @JvmOverloads constructor(context: Context, attr } - fun configureRadioButton( mData: ArrayList,orientation: Int,bgSelector: Int,textSelector: Int,checkedChangedListener: ( RadioGroupData) -> Unit) { + fun configureRadioButton(mData: ArrayList, orientation: Int, bgSelector: Int, textSelector: Int, checkedChangedListener: (Data) -> Unit) { updateValue(orientation, bgSelector, textSelector, checkedChangedListener) setOrientation() setItems(mData) } - private fun updateValue(orientation: Int,checkSelector: Int, primaryTextColor: Int,onCheckedChangeListener: ((RadioGroupData) -> Unit)?) { + private fun updateValue(orientation: Int,checkSelector: Int, primaryTextColor: Int,onCheckedChangeListener: ((Data) -> Unit)?) { this.smartOrientation = orientation this.viewBgSelector = checkSelector.let { ContextCompat.getDrawable(context, it) } this.viewTextSelector = primaryTextColor.let { ContextCompat.getColorStateList(context, it) } this.singleCheckedChangeListener = onCheckedChangeListener } - private fun setItems(mData: List) { + private fun setItems(mData: List) { mData.forEach { data -> addRadioButtonView( data ) } } - private fun addRadioButtonView(data: RadioGroupData) { + private fun addRadioButtonView(data: Data) { val radioButton = RadioButton(context) radioButton.apply { @@ -127,7 +128,7 @@ class SingleSelectionRadioGroup @JvmOverloads constructor(context: Context, attr radioGroup.addView(radioButton) radioGroup.setOnCheckedChangeListener { _, checkedId -> val checkedRadioButton: RadioButton = findViewById(checkedId) - val checkedData = checkedRadioButton.tag as RadioGroupData? + val checkedData = checkedRadioButton.tag as Data? checkedData?.let { singleCheckedChangeListener?.invoke(it) } } } @@ -139,7 +140,7 @@ class SingleSelectionRadioGroup @JvmOverloads constructor(context: Context, attr } - private fun generateViewWithId(radioButton: RadioButton, data: RadioGroupData) { + private fun generateViewWithId(radioButton: RadioButton, data: Data) { radioButton.id = View.generateViewId() radioButton.tag = data } @@ -171,7 +172,7 @@ class SingleSelectionRadioGroup @JvmOverloads constructor(context: Context, attr } } - fun onCheckedChangeListener(onCheckedChangeListener: (RadioGroupData) -> Unit) { + fun onCheckedChangeListener(onCheckedChangeListener: (Data) -> Unit) { this.singleCheckedChangeListener = onCheckedChangeListener } } \ No newline at end of file diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/BaseLinearLayout.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/BaseLinearLayout.kt similarity index 83% rename from ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/BaseLinearLayout.kt rename to ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/BaseLinearLayout.kt index f344664..41b1695 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/singleselection/BaseLinearLayout.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/BaseLinearLayout.kt @@ -1,4 +1,4 @@ -package com.ss.smartfilterlib.singleselection +package com.ss.smartfilterlib.utils import android.content.Context import android.content.res.ColorStateList @@ -11,15 +11,12 @@ import android.widget.RadioGroup import android.widget.ScrollView import com.google.android.material.chip.Chip import com.google.android.material.chip.ChipGroup -import com.ss.smartfilterlib.data.RadioGroupData -import com.ss.smartfilterlib.utils.Orientation -import com.ss.smartfilterlib.utils.PaddingAttributes -import com.ss.smartfilterlib.utils.TextAttributes +import com.ss.smartfilterlib.data.Data /** * created by Mala Ruparel ON 10/05/24 */ -abstract class BaseLinearLayout : LinearLayout { +abstract class BaseLinearLayout : LinearLayout { protected var viewTextSelector: ColorStateList? = null protected var chipBgSelector: ColorStateList? = null @@ -27,7 +24,7 @@ abstract class BaseLinearLayout : LinearLayout { protected var smartOrientation: Int = Orientation.VERTICAL protected var dataFromXml: Int = 0 - protected var singleCheckedChangeListener: ((RadioGroupData) -> Unit)? = null + protected var singleCheckedChangeListener: ((Data) -> Unit)? = null protected var multiCheckedChangeListener: ((List) -> Unit)? = null protected var checkedChipIds: ArrayList = arrayListOf() @@ -68,5 +65,5 @@ abstract class BaseLinearLayout : LinearLayout { ) } } - protected fun setData(data: RadioGroupData) = data.name + protected fun setData(data: Data) = data.name } \ No newline at end of file diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/BaseRecycleView.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/BaseRecycleView.kt index 3400cdb..27ddb56 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/BaseRecycleView.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/BaseRecycleView.kt @@ -7,7 +7,7 @@ import android.graphics.drawable.Drawable import android.util.AttributeSet import android.widget.CheckedTextView import androidx.recyclerview.widget.RecyclerView -import com.ss.smartfilterlib.data.RadioGroupData +import com.ss.smartfilterlib.data.Data import com.ss.smartfilterlib.singleselection.SingleSelectionMultiLineRadioButton typealias SmartOrientation = com.ss.smartfilterlib.utils.Orientation @@ -15,22 +15,21 @@ typealias SmartOrientation = com.ss.smartfilterlib.utils.Orientation /** * created by Mala Ruparel ON 08/05/24 */ -abstract class BaseRecycleView : RecyclerView { +abstract class BaseRecycleView : RecyclerView { protected var viewTextSelector: ColorStateList? = null protected var viewBgSelector: Drawable? = null - protected var mList: ArrayList = ArrayList() + protected var mList: ArrayList = ArrayList() protected var mAdapter: SingleSelectionMultiLineRadioButton.MultiLineRadioButtonAdapter? = null protected var spanCount: Int = 0 protected var spacing: Int = 0 protected var includeEdge: Boolean = false - protected var primaryTextColor: Int = Constant.PRIMARY_TEXT_COLOR protected var smartOrientation: Int = SmartOrientation.VERTICAL protected var checkSelector: Int = 0 protected var paddingAttributes: PaddingAttributes = PaddingAttributes() protected var textAttributes: TextAttributes = TextAttributes() - protected var onMultiSelectionClicked: ((List) -> Unit)? = null - protected var onSingleSelectionClicked: ((RadioGroupData) -> Unit)? = null + protected var onMultiSelectionClicked: ((List) -> Unit)? = null + protected var onSingleSelectionClicked: ((Data) -> Unit)? = null protected var dataFromXml: Int = 0 protected val selectedItemsPositions = mutableListOf() constructor(context: Context) : super(context) @@ -59,5 +58,5 @@ abstract class BaseRecycleView : RecyclerView { ) } } - protected fun setData(data: RadioGroupData) = data.name + protected fun setData(data: Data) = data.name } \ No newline at end of file diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Context.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Context.kt index 163e123..998e195 100755 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Context.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Context.kt @@ -4,27 +4,17 @@ import android.content.Context import android.os.Handler import android.os.Looper import android.widget.Toast -import com.ss.smartfilterlib.data.RadioGroupData -fun Context.toast(id: Int, length: Int = Toast.LENGTH_SHORT) { - toast(getString(id), length) +/** + * created by Mala Ruparel ON 08/05/24 + */ +fun Context.toast(message: String, length: Int = Toast.LENGTH_SHORT) { + Handler(Looper.getMainLooper()).post { + Toast.makeText(this, message, length).show() + } } -fun Context.toast(msg: String, length: Int = Toast.LENGTH_SHORT) { - try { - if (isOnMainThread()) { - Toast.makeText(applicationContext, msg, length).show() - } else { - Handler(Looper.getMainLooper()).post { - Toast.makeText(applicationContext, msg, length).show() - } - } - } catch (_: Exception) {} - -} -fun isOnMainThread() = Looper.myLooper() == Looper.getMainLooper() - diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/DiffUtil.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/DiffUtil.kt index 7b19b3a..501b428 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/DiffUtil.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/DiffUtil.kt @@ -1,12 +1,12 @@ package com.ss.smartfilterlib.utils import androidx.recyclerview.widget.DiffUtil -import com.ss.smartfilterlib.data.RadioGroupData +import com.ss.smartfilterlib.data.Data /** * created by Mala Ruparel ON 22/04/24 */ - class SingleChangeDiffUtil(private val oldList: ArrayList, private val newList: ArrayList + class SingleChangeDiffUtil(private val oldList: ArrayList, private val newList: ArrayList ) : DiffUtil.Callback() { override fun getOldListSize(): Int { return oldList.size diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Params.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Params.kt index 2247544..5a5afc7 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Params.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Params.kt @@ -1,18 +1,16 @@ package com.ss.smartfilterlib.utils import com.ss.smartfilterlib.data.MultiSelectionParams -import com.ss.smartfilterlib.data.SingleChipSelectionParams -import com.ss.smartfilterlib.data.SingleSelectionMultiRawParams import com.ss.smartfilterlib.data.SingleSelectionParams sealed class Params { data class SingleSelection(val data: SingleSelectionParams) : Params() - data class SingleSelectionMultiRaw(val data: SingleSelectionMultiRawParams) : Params() - data class SingleChipSelection(val data: SingleChipSelectionParams) : Params() - data class MultiChipSelection(val data: MultiSelectionParams) : Params() + data class MultiSelection(val data: MultiSelectionParams) : Params() + + } diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Utils.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Utils.kt index 1646e85..d60ea78 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Utils.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Utils.kt @@ -12,10 +12,7 @@ enum class SingleGroupSubType { CHIP_GROUP, NONE } -enum class MultiGroupSubType { - CHIP_GROUP, - NONE -} + object Orientation { const val VERTICAL = 1 const val HORIZONTAL = 0 diff --git a/ss-smart-filter/src/main/res/layout/row_item.xml b/ss-smart-filter/src/main/res/layout/row_item.xml index eafd053..f959204 100644 --- a/ss-smart-filter/src/main/res/layout/row_item.xml +++ b/ss-smart-filter/src/main/res/layout/row_item.xml @@ -2,10 +2,10 @@ diff --git a/ss-smart-filter/src/main/res/layout/row_item_checkable.xml b/ss-smart-filter/src/main/res/layout/row_item_checkable.xml index 6ca3e73..7f72bc8 100644 --- a/ss-smart-filter/src/main/res/layout/row_item_checkable.xml +++ b/ss-smart-filter/src/main/res/layout/row_item_checkable.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/ss-smart-filter/src/main/res/layout/row_item_multi_line.xml b/ss-smart-filter/src/main/res/layout/row_item_multi_line.xml index 3bd5f44..3ed19ae 100644 --- a/ss-smart-filter/src/main/res/layout/row_item_multi_line.xml +++ b/ss-smart-filter/src/main/res/layout/row_item_multi_line.xml @@ -7,4 +7,3 @@ android:textAlignment="center" android:textSize="@dimen/_16ssp" /> - \ No newline at end of file diff --git a/ss-smart-filter/src/main/res/values/attrs.xml b/ss-smart-filter/src/main/res/values/attrs.xml index 9c901d2..f87c939 100644 --- a/ss-smart-filter/src/main/res/values/attrs.xml +++ b/ss-smart-filter/src/main/res/values/attrs.xml @@ -36,7 +36,7 @@ - + \ No newline at end of file