From c85d683c62250dde194a0026ebef45d2b3e8969e Mon Sep 17 00:00:00 2001 From: Mala Ruparel Date: Wed, 22 May 2024 19:24:34 +0530 Subject: [PATCH 1/6] changes data from app and refactoring --- README.md | 205 +++++++++++++----- .../java/com/ss/smartfilter/MainActivity.kt | 5 +- app/src/main/java/com/ss/smartfilter/Utils.kt | 74 +++---- .../main/java/com/ss/smartfilter/data/data.kt | 130 +++++++++++ .../screens/ExpandableDepartureType.kt | 5 + .../smartfilter/screens/ExpandableSeatType.kt | 6 +- .../src/main/res/drawable/ic_ac.xml | 0 .../src/main/res/drawable/ic_alert.xml | 0 .../src/main/res/drawable/ic_cyclone.xml | 0 app/src/main/res/drawable/ic_documents.xml | 24 ++ .../src/main/res/drawable/ic_hive.xml | 0 .../src/main/res/drawable/ic_smile.xml | 0 app/src/main/res/drawable/ic_star.xml | 12 + .../src/main/res/drawable/ic_time.xml | 0 app/src/main/res/layout/activity_main.xml | 1 + app/src/main/res/values-night/themes.xml | 4 +- app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/themes.xml | 4 +- .../java/com/ss/smartfilterlib/SmartFilter.kt | 40 +++- .../adapter/SingleSelectionAdapter.kt | 5 +- .../java/com/ss/smartfilterlib/data/Data.kt | 124 ----------- .../data/MultiSelectionParams.kt | 3 +- .../data/SingleSelectionParams.kt | 10 +- .../multiselection/MultiSelectionListView.kt | 2 +- .../multiselection/MultiselectionChipGroup.kt | 15 +- .../SingleSelectionChipGroup.kt | 16 +- .../SingleSelectionItemRadioGroup.kt | 6 +- .../SingleSelectionListView.kt | 4 +- .../SingleSelectionMultiLineRadioButton.kt | 4 +- .../SingleSelectionRadioGroup.kt | 2 +- .../com/ss/smartfilterlib/utils/Constant.kt | 1 + .../java/com/ss/smartfilterlib/utils/Utils.kt | 7 - .../src/main/res/color/chip_bg_selector.xml | 2 +- .../src/main/res/color/chip_text_selector.xml | 6 +- .../res/color/multiline_text_selector.xml | 6 +- .../main/res/color/text_color_selector.xml | 7 - .../src/main/res/color/text_selector.xml | 7 + .../src/main/res/drawable/ic_check.xml | 2 +- .../src/main/res/drawable/ic_check_filled.xml | 2 +- .../src/main/res/drawable/ic_documents.xml | 4 +- .../src/main/res/drawable/ic_rb_checked.xml | 4 +- .../src/main/res/drawable/ic_rb_unchecked.xml | 2 +- .../src/main/res/drawable/ic_star.xml | 2 +- .../src/main/res/drawable/ic_star_filled.xml | 2 +- .../main/res/drawable/multiline_default.xml | 2 +- .../main/res/drawable/multiline_selected.xml | 2 +- .../main/res/drawable/row_item_pressed.xml | 2 +- .../src/main/res/layout/row_item.xml | 4 +- .../src/main/res/values/colors.xml | 4 +- .../src/main/res/values/themes.xml | 8 +- 50 files changed, 473 insertions(+), 306 deletions(-) create mode 100644 app/src/main/java/com/ss/smartfilter/data/data.kt rename {ss-smart-filter => app}/src/main/res/drawable/ic_ac.xml (100%) rename {ss-smart-filter => app}/src/main/res/drawable/ic_alert.xml (100%) rename {ss-smart-filter => app}/src/main/res/drawable/ic_cyclone.xml (100%) create mode 100644 app/src/main/res/drawable/ic_documents.xml rename {ss-smart-filter => app}/src/main/res/drawable/ic_hive.xml (100%) rename {ss-smart-filter => app}/src/main/res/drawable/ic_smile.xml (100%) create mode 100644 app/src/main/res/drawable/ic_star.xml rename {ss-smart-filter => app}/src/main/res/drawable/ic_time.xml (100%) delete mode 100644 ss-smart-filter/src/main/res/color/text_color_selector.xml create mode 100644 ss-smart-filter/src/main/res/color/text_selector.xml diff --git a/README.md b/README.md index d049b59..336f06e 100644 --- a/README.md +++ b/README.md @@ -50,112 +50,219 @@ 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 + - **Horizontal** - SmartFilter.addRadioGroupSingleSelection { + SmartFilter.addRadioGroupSingleSelection { addRadioGroupSingleLineHorizontal(binding.root) { radioGroupData -> - toast("name: ${radioGroupData.name} ") } } + toast("name: ${radioGroupData.name} ") } } + Or + + -### 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 + ### 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} ") } } + + - **Horizontal** + SmartFilter.addRadioRawItemSingleSelection { + addRadioGroupRowItemHorizontal(binding.root) { radioGroupData -> + toast("name: ${radioGroupData.name} ") } } + Or + + ### SingleSelectionChipGroup((Verticle/Horizontal)) - SmartFilter.addChipGroupSingleSelection { - addSingleSelectionChipGroupVertical(binding.root) { radioGroupData -> - toast("name: ${radioGroupData.name} ") } } + SmartFilter.addChipGroupSingleSelection { + addSingleSelectionChipGroupVertical(binding.root) { radioGroupData -> + toast("name: ${radioGroupData.name} ") } } + + Or + + - **Horizontal** - SmartFilter.addChipGroupSingleSelection { - addSingleSelectionChipGroupHorizontal(binding.root) { radioGroupData -> + SmartFilter.addChipGroupSingleSelection { + addSingleSelectionChipGroupHorizontal(binding.root) { radioGroupData -> toast("name: ${radioGroupData.name} ") } } - - + + Or + + ### 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 + + - SmartFilter.addChipGroupMultiSelection { - addMultiSelectionChipGroupHorizontal(binding.root) { radioGroupData -> - toast("Checked IDs: ${radioGroupData.joinToString(", ")}")}} - +- **Horizontal** + SmartFilter.addChipGroupMultiSelection { + addMultiSelectionChipGroupHorizontal(binding.root) { radioGroupData -> + toast("Checked IDs: ${radioGroupData.joinToString(", ")}")}} + Or + + ### 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 + + + + - **Horizontal** + SmartFilter.addListViewSingleSelection { + addSingleSelectionListHorizontal(binding.root) { radioGroupData -> + toast("name: " + radioGroupData.name) } } + OR + + ### MultiSelectionListView((Verticle/Horizontal)) - **Verticle** - SmartFilter.addListViewMultiSelection{ - addMultiSelectionListVertical(binding.root) { radioGroupData -> - toast("name: " + radioGroupData) } } - - + SmartFilter.addListViewMultiSelection{ + addMultiSelectionListVertical(binding.root) { radioGroupData -> + toast("name: " + radioGroupData) } } + + OR + + - **Horizontal** - SmartFilter.addListViewMultiSelection{ - addMultiSelectionListHorizontal(binding.root) { radioGroupData -> - toast("name: " + radioGroupData) } } + SmartFilter.addListViewMultiSelection{ + addMultiSelectionListHorizontal(binding.root) { radioGroupData -> + toast("name: " + radioGroupData) } } + OR + + diff --git a/app/src/main/java/com/ss/smartfilter/MainActivity.kt b/app/src/main/java/com/ss/smartfilter/MainActivity.kt index 59ec027..b3c7405 100644 --- a/app/src/main/java/com/ss/smartfilter/MainActivity.kt +++ b/app/src/main/java/com/ss/smartfilter/MainActivity.kt @@ -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) diff --git a/app/src/main/java/com/ss/smartfilter/Utils.kt b/app/src/main/java/com/ss/smartfilter/Utils.kt index 673a323..4c0c69f 100644 --- a/app/src/main/java/com/ss/smartfilter/Utils.kt +++ b/app/src/main/java/com/ss/smartfilter/Utils.kt @@ -1,23 +1,23 @@ package com.ss.smartfilter import android.view.ViewGroup +import com.ss.smartfilter.data.mAmenties +import com.ss.smartfilter.data.mBusOperatorType +import com.ss.smartfilter.data.mBusType +import com.ss.smartfilter.data.mData +import com.ss.smartfilter.data.mDeal +import com.ss.smartfilter.data.mOperatorType +import com.ss.smartfilter.data.mSeatType +import com.ss.smartfilter.data.mTime import com.ss.smartfilterlib.R import com.ss.smartfilterlib.data.Data import com.ss.smartfilterlib.data.MultiSelectionParams import com.ss.smartfilterlib.data.SingleSelectionParams -import com.ss.smartfilterlib.data.mAmenties -import com.ss.smartfilterlib.data.mBusOperatorType -import com.ss.smartfilterlib.data.mBusType -import com.ss.smartfilterlib.data.mData -import com.ss.smartfilterlib.data.mDeal -import com.ss.smartfilterlib.data.mOperatorType -import com.ss.smartfilterlib.data.mSeatType -import com.ss.smartfilterlib.data.mTime 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 @@ -25,33 +25,30 @@ import com.ss.smartfilterlib.utils.SingleGroupSubType fun addRadioGroupSingleLineVertical(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.rb_selector, - textSelector = R.color.text_color_selector + textSelector = R.color.text_selector ) ) fun addRadioGroupSingleLineHorizontal(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.SINGLE_LINE, chipType = SingleChipType.NONE, orientation = Orientation.HORIZONTAL, mData = mData(), onItemSelected = onItemSelected, bgSelector = R.drawable.rb_selector, - textSelector = R.color.text_color_selector + textSelector = R.color.text_selector ) ) -fun addRadioMultiRow(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( +fun addRadioButtonMultiRow(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.MULTI_LINE, chipType = SingleChipType.NONE, orientation = Orientation.VERTICAL, mData = mData(), @@ -65,26 +62,24 @@ fun addRadioMultiRow(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Para fun addRadioGroupRowItemHorizontal(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.ROW_ITEM, chipType = SingleChipType.NONE, orientation = Orientation.HORIZONTAL, mData = mData(), onItemSelected = onItemSelected, bgSelector = R.drawable.row_item_selector, - textSelector = R.color.text_color_selector + textSelector = R.color.text_selector ) ) fun addRadioGroupRowItemVertical(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.ROW_ITEM, chipType = SingleChipType.NONE, orientation = Orientation.VERTICAL, mData = mData(), onItemSelected = onItemSelected, bgSelector = R.drawable.row_item_selector, - textSelector = R.color.text_color_selector + textSelector = R.color.text_selector ) ) @@ -92,7 +87,6 @@ fun addRadioGroupRowItemVertical(rootView: ViewGroup,onItemSelected: (Data) -> U fun addSingleSelectionChipGroupVertical(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.CHIP_GROUP, chipType = SingleChipType.ACTION_CHIP, orientation = Orientation.VERTICAL, mData = mData(), @@ -104,7 +98,6 @@ fun addSingleSelectionChipGroupVertical(rootView: ViewGroup, onItemSelected: (Da fun addSingleSelectionChipGroupHorizontal(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.CHIP_GROUP, chipType = SingleChipType.ENTRY_CHIP, orientation = Orientation.HORIZONTAL, mData = mData(), @@ -140,43 +133,39 @@ fun addMultiSelectionChipGroupHorizontal(rootView: ViewGroup, onItemsSelected: ( fun addSingleSelectionListHorizontal(rootView: ViewGroup, onItemselected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.SINGLE_LINE, chipType = SingleChipType.NONE, orientation = Orientation.HORIZONTAL, mData = mData(), onItemSelected = onItemselected, - bgSelector = R.drawable.ic_check_selector, - textSelector = R.color.text_color_selector + bgSelector = R.drawable.multiline_bg_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.text_color_selector + bgSelector = R.drawable.multiline_bg_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.drawable.ic_check_selector, - textSelector = R.color.text_color_selector + bgSelector = R.drawable.multiline_bg_selector, + textSelector = R.color.chip_text_selector ) ) fun addMultiSelectionListBus(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = Params.MultiSelection( MultiSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.SINGLE_LINE, chipType = MultiChipType.NONE, orientation = Orientation.HORIZONTAL, mData = mBusType(), @@ -185,14 +174,13 @@ fun addMultiSelectionListBus(rootView: ViewGroup, onItemsSelected: (List) textSelector = R.color.chip_text_selector ) ) -fun addMultiSelectionListSeat(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = Params.MultiSelection( - MultiSelectionParams( +fun addSingleSelectionListSeat(rootView: ViewGroup, onItemsSelected: (Data) -> Unit) = Params.SingleSelection( + SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.SINGLE_LINE, - chipType = MultiChipType.NONE, + chipType = SingleChipType.NONE, orientation = Orientation.HORIZONTAL, mData = mSeatType(), - onItemsSelected = onItemsSelected, + onItemSelected = onItemsSelected, bgSelector = R.drawable.multiline_bg_selector, textSelector = R.color.chip_text_selector ) @@ -200,25 +188,23 @@ fun addMultiSelectionListSeat(rootView: ViewGroup, onItemsSelected: (List) fun addRadioGroupSingleOperator(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.SINGLE_LINE, chipType = SingleChipType.NONE, orientation = Orientation.VERTICAL, mData = mOperatorType(), onItemSelected = onItemSelected, bgSelector = R.drawable.star_selector, - textSelector = R.color.text_color_selector + textSelector = R.color.text_selector ) ) fun addRadioGroupSingleBusOperator(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.SINGLE_LINE, chipType = SingleChipType.NONE, orientation = Orientation.VERTICAL, mData = mBusOperatorType(), onItemSelected = onItemSelected, bgSelector = R.drawable.check_selector, - textSelector = R.color.text_color_selector + textSelector = R.color.text_selector ) ) fun addMultiSelectionChipGroupAmenties(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = Params.MultiSelection( @@ -228,27 +214,25 @@ fun addMultiSelectionChipGroupAmenties(rootView: ViewGroup, onItemsSelected: (Li orientation = Orientation.VERTICAL, mData = mAmenties(), onItemsSelected = onItemsSelected, - bgSelector = R.drawable.ic_check_selector, - textSelector = R.color.text_color_selector + bgSelector = R.color.chip_bg_selector, + textSelector = R.color.chip_text_selector ) ) fun addRadioGroupSingleLineHorizontalDeal(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.SINGLE_LINE, chipType = SingleChipType.NONE, orientation = Orientation.VERTICAL, mData = mDeal(), onItemSelected = onItemSelected, bgSelector = R.drawable.rb_selector, - textSelector = R.color.text_color_selector + textSelector = R.color.text_selector ) ) fun addRadioMultiRowDeparture(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( SingleSelectionParams( rootView = rootView, - singleGroupSubType = SingleGroupSubType.MULTI_LINE, chipType = SingleChipType.NONE, orientation = Orientation.VERTICAL, mData = mTime(), diff --git a/app/src/main/java/com/ss/smartfilter/data/data.kt b/app/src/main/java/com/ss/smartfilter/data/data.kt new file mode 100644 index 0000000..55fa521 --- /dev/null +++ b/app/src/main/java/com/ss/smartfilter/data/data.kt @@ -0,0 +1,130 @@ +package com.ss.smartfilter.data + +import com.ss.smartfilter.R +import com.ss.smartfilterlib.data.Data + + +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_ac + ), + Data( + id = 2, + name = "Lollipop", + description = "Smart Filter Description 2", + image = R.drawable.ic_ac + ), + Data( + id = 3, + name = "Marshmallow", + description = "Smart Filter Description 3", + image = R.drawable.ic_ac + ), + 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_ac + ), + Data( + id = 6, + name = "Pie", + description = "Smart Filter Description 6", + image = R.drawable.ic_ac + ), + Data( + id = 7, + name = "Quince Tart", + description = "Smart Filter Description 7", + image = R.drawable.ic_ac + ), + Data( + id = 8, + name = "Red Velvet Cake", + description = "Smart Filter 8", + image = R.drawable.ic_ac + ), + Data( + id = 9, + name = "Snow Cone ", + description = "Smart Filter Description 9", + image = R.drawable.ic_ac + ), + + ) +} + +fun mBusType(): ArrayList { + return arrayListOf( + Data(id = 1, name = "Ac", image = R.drawable.ic_ac), + Data(id = 2, name = "Non Ac", image = R.drawable.ic_time), + Data(id = 3, name = "Sleeper", image = R.drawable.ic_alert), + Data(id = 4, name = "Seater", image = R.drawable.ic_cyclone), + Data(id = 5, name = "Semi Sleeper", image = R.drawable.ic_smile), + + ) +} + +fun mSeatType(): ArrayList { + return arrayListOf( + Data(id = 1, name = "Single Seat", image = R.drawable.ic_ac), + Data(id = 1, name = "Double Seat", image = R.drawable.ic_smile) + ) +} + +fun mOperatorType(): ArrayList { + return arrayListOf( + Data(id = 1, name = "5"), + Data(id = 2, name = "4.8 & Above"), + Data(id = 3, name = "3.5 & Above"), + Data(id = 4, name = "3 & Above"), + ) +} + +fun mBusOperatorType(): ArrayList { + return arrayListOf( + Data(id = 1, name = "Bluecity Bus"), + Data(id = 2, name = "Western Bus"), + Data(id = 3, name = "Volvo Bus"), + Data(id = 4, name = "VelloCity Bus"), + ) +} + +fun mTime(): ArrayList { + return arrayListOf( + Data(id = 1, name = "Night", image = R.drawable.ic_ac), + Data(id = 2, name = "Morning", image = R.drawable.ic_time), + Data(id = 3, name = "Afternoon", image = R.drawable.ic_alert), + Data(id = 4, name = "Evening", image = R.drawable.ic_cyclone) + ) +} +fun mAmenties(): ArrayList { + return arrayListOf( + Data(id = 1, name = "Live Tracking"), + Data(id = 2, name = "Wifi"), + Data(id = 3, name = "Water Bottle"), + Data(id = 4, name = "Blanket",) + ) +} +fun mDeal(): ArrayList { + return arrayListOf( + Data(id = 1, name = "Extra 10% Discount"), + Data(id = 2, name = "Exculsive Offer - 5% Off"), + + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/ss/smartfilter/screens/ExpandableDepartureType.kt b/app/src/main/java/com/ss/smartfilter/screens/ExpandableDepartureType.kt index 87e6197..d61fc2d 100644 --- a/app/src/main/java/com/ss/smartfilter/screens/ExpandableDepartureType.kt +++ b/app/src/main/java/com/ss/smartfilter/screens/ExpandableDepartureType.kt @@ -1,6 +1,7 @@ package com.ss.smartfilter.screens import android.widget.LinearLayout +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth @@ -19,14 +20,18 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.BlendMode.Companion.Color import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.data.UiToolingDataApi import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.viewinterop.AndroidView +import com.ss.smartfilter.addMultiSelectionListVertical +import com.ss.smartfilter.addRadioButtonMultiRow import com.ss.smartfilter.addRadioMultiRowDeparture import com.ss.smartfilterlib.SmartFilter +import com.ss.smartfilterlib.utils.toast /** * created by Mala Ruparel ON 16/05/24 diff --git a/app/src/main/java/com/ss/smartfilter/screens/ExpandableSeatType.kt b/app/src/main/java/com/ss/smartfilter/screens/ExpandableSeatType.kt index ea38fd7..4c74c4e 100644 --- a/app/src/main/java/com/ss/smartfilter/screens/ExpandableSeatType.kt +++ b/app/src/main/java/com/ss/smartfilter/screens/ExpandableSeatType.kt @@ -25,7 +25,7 @@ import androidx.compose.ui.tooling.data.UiToolingDataApi import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.viewinterop.AndroidView -import com.ss.smartfilter.addMultiSelectionListSeat +import com.ss.smartfilter.addSingleSelectionListSeat import com.ss.smartfilterlib.SmartFilter /** @@ -75,8 +75,8 @@ fun ExpandableSeatType(title: String) { } }) { view -> - SmartFilter.addListViewMultiSelection { - addMultiSelectionListSeat(view) { } + SmartFilter.addListViewSingleSelectionSeat { + addSingleSelectionListSeat(view) { } } } } diff --git a/ss-smart-filter/src/main/res/drawable/ic_ac.xml b/app/src/main/res/drawable/ic_ac.xml similarity index 100% rename from ss-smart-filter/src/main/res/drawable/ic_ac.xml rename to app/src/main/res/drawable/ic_ac.xml diff --git a/ss-smart-filter/src/main/res/drawable/ic_alert.xml b/app/src/main/res/drawable/ic_alert.xml similarity index 100% rename from ss-smart-filter/src/main/res/drawable/ic_alert.xml rename to app/src/main/res/drawable/ic_alert.xml diff --git a/ss-smart-filter/src/main/res/drawable/ic_cyclone.xml b/app/src/main/res/drawable/ic_cyclone.xml similarity index 100% rename from ss-smart-filter/src/main/res/drawable/ic_cyclone.xml rename to app/src/main/res/drawable/ic_cyclone.xml diff --git a/app/src/main/res/drawable/ic_documents.xml b/app/src/main/res/drawable/ic_documents.xml new file mode 100644 index 0000000..f2faed9 --- /dev/null +++ b/app/src/main/res/drawable/ic_documents.xml @@ -0,0 +1,24 @@ + + + + + + + + + + diff --git a/ss-smart-filter/src/main/res/drawable/ic_hive.xml b/app/src/main/res/drawable/ic_hive.xml similarity index 100% rename from ss-smart-filter/src/main/res/drawable/ic_hive.xml rename to app/src/main/res/drawable/ic_hive.xml diff --git a/ss-smart-filter/src/main/res/drawable/ic_smile.xml b/app/src/main/res/drawable/ic_smile.xml similarity index 100% rename from ss-smart-filter/src/main/res/drawable/ic_smile.xml rename to app/src/main/res/drawable/ic_smile.xml diff --git a/app/src/main/res/drawable/ic_star.xml b/app/src/main/res/drawable/ic_star.xml new file mode 100644 index 0000000..82e6ff6 --- /dev/null +++ b/app/src/main/res/drawable/ic_star.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/ss-smart-filter/src/main/res/drawable/ic_time.xml b/app/src/main/res/drawable/ic_time.xml similarity index 100% rename from ss-smart-filter/src/main/res/drawable/ic_time.xml rename to app/src/main/res/drawable/ic_time.xml diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 2f0efe7..90c886e 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,6 @@ @color/purple_200 @color/colorPrimaryVariant - @color/colorOnSecondary + @color/black @color/colorSecondary @color/colorSecondary - @color/colorOnSecondary + @color/black ?attr/colorPrimaryVariant diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index ab1e015..210318e 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -5,7 +5,7 @@ #FF3700B3 #FF03DAC5 #FF018786 - #FF000000 + #FF000000 #FFFFFFFF \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 7d7e643..b528733 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -9,7 +9,7 @@ @color/colorSecondary @color/colorSecondaryVariant - @color/colorOnSecondary + @color/black ?attr/colorPrimaryVariant @@ -26,7 +26,7 @@ @drawable/rb_selector 8dp 8dp - @color/text_color_selector + @color/text_selector 8sp 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 f4efd0a..b31a301 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 @@ -11,28 +11,30 @@ import com.ss.smartfilterlib.utils.Params object SmartFilter { - + fun addRadioGroupSingleSelection(singleSelectionParams: () -> Params.SingleSelection) { val param = singleSelectionParams().data val singleLineRadioGroup = SingleSelectionRadioGroup(param.rootView.context) singleLineRadioGroup.configureRadioButton( - param.mData, - param.orientation, - param.bgSelector, - param.textSelector, - param.onItemSelected + mData = param.mData, + orientation = param.orientation, + bgSelector = param.bgSelector, + textSelector = param.textSelector, + checkedChangedListener = param.onItemSelected ) param.rootView.addView(singleLineRadioGroup) } + fun addRadioMultiRawSingleSelection(singleSelectionParams: () -> Params.SingleSelection) { val param = singleSelectionParams().data val multiLineRadioGroup = SingleSelectionMultiLineRadioButton(param.rootView.context) - multiLineRadioGroup.configureRadioButton( - param.mData, - param.bgSelector, - param.textSelector, - param.onItemSelected + multiLineRadioGroup.configureRadioButton( + mData = param.mData, + spanCount = 2, + bgSelector = param.bgSelector, + textSelector = param.textSelector, + checkedChangedListener = param.onItemSelected ) param.rootView.addView(multiLineRadioGroup) @@ -66,6 +68,7 @@ object SmartFilter { param.rootView.addView(singleSelectionChipGroup) } + fun addChipGroupMultiSelection(multiselection: () -> Params.MultiSelection) { val param = multiselection().data val multiSelectionChipGroup = MultiselectionChipGroup(param.rootView.context) @@ -80,6 +83,7 @@ object SmartFilter { param.rootView.addView(multiSelectionChipGroup) } + fun addListViewSingleSelection(singleSelectionListView: () -> Params.SingleSelection) { val param = singleSelectionListView().data val singleSelectionListView = SingleSelectionListView(param.rootView.context) @@ -92,6 +96,20 @@ object SmartFilter { ) param.rootView.addView(singleSelectionListView) + } + + fun addListViewSingleSelectionSeat(singleSelectionListView: () -> Params.SingleSelection) { + val param = singleSelectionListView().data + val singleSelectionListView = SingleSelectionListView(param.rootView.context) + singleSelectionListView.configureView( + param.mData, + param.orientation, + param.bgSelector, + param.textSelector, + param.onItemSelected + ) + param.rootView.addView(singleSelectionListView) + } fun addListViewMultiSelection(singleSelectionParams: () -> Params.MultiSelection) { val param = singleSelectionParams().data 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 1d23af4..9e91102 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 @@ -52,13 +52,16 @@ class SingleSelectionListAdapter( isChecked = isSelected text = data.name applySelector(this) + setCompoundDrawablesWithIntrinsicBounds(0, data.image, 0, 0) + setPaddingRelative(0, 30,0, 30 ) } } } private fun applySelector(textView: CheckedTextView) { textView.setTextColor(viewTextColor) - textView.setCheckMarkDrawable(checkSelector) + textView.background=(checkSelector?.constantState?.newDrawable()?.mutate()) + textView.compoundDrawableTintList=viewTextColor } } 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 index af6a3a8..bffba60 100644 --- 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 @@ -14,127 +14,3 @@ data class Data( 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_ac - ), - Data( - id = 2, - name = "Lollipop", - description = "Smart Filter Description 2", - image = R.drawable.ic_ac - ), - Data( - id = 3, - name = "Marshmallow", - description = "Smart Filter Description 3", - image = R.drawable.ic_ac - ), - 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_ac - ), - Data( - id = 6, - name = "Pie", - description = "Smart Filter Description 6", - image = R.drawable.ic_ac - ), - Data( - id = 7, - name = "Quince Tart", - description = "Smart Filter Description 7", - image = R.drawable.ic_ac - ), - Data( - id = 8, - name = "Red Velvet Cake", - description = "Smart Filter 8", - image = R.drawable.ic_ac - ), - Data( - id = 9, - name = "Snow Cone ", - description = "Smart Filter Description 9", - image = R.drawable.ic_ac - ), - - ) -} - -fun mBusType(): ArrayList { - return arrayListOf( - Data(id = 1, name = "Ac", image = R.drawable.ic_ac), - Data(id = 2, name = "Non Ac", image = R.drawable.ic_time), - Data(id = 3, name = "Sleeper", image = R.drawable.ic_alert), - Data(id = 4, name = "Seater", image = R.drawable.ic_cyclone), - Data(id = 5, name = "Semi Sleeper", image = R.drawable.ic_smile), - - ) -} - -fun mSeatType(): ArrayList { - return arrayListOf( - Data(id = 1, name = "Single Seat", image = R.drawable.ic_ac) - ) -} - -fun mOperatorType(): ArrayList { - return arrayListOf( - Data(id = 1, name = "5"), - Data(id = 2, name = "4.8 & Above"), - Data(id = 3, name = "3.5 & Above"), - Data(id = 4, name = "3 & Above"), - ) -} - -fun mBusOperatorType(): ArrayList { - return arrayListOf( - Data(id = 1, name = "Bluecity Bus"), - Data(id = 2, name = "Western Bus"), - Data(id = 3, name = "Volvo Bus"), - Data(id = 4, name = "VelloCity Bus"), - ) -} - -fun mTime(): ArrayList { - return arrayListOf( - Data(id = 1, name = "Night", image = R.drawable.ic_ac), - Data(id = 2, name = "Morning", image = R.drawable.ic_time), - Data(id = 3, name = "Afternoon", image = R.drawable.ic_alert), - Data(id = 4, name = "Evening", image = R.drawable.ic_cyclone) - ) -} -fun mAmenties(): ArrayList { - return arrayListOf( - Data(id = 1, name = "Live Tracking"), - Data(id = 2, name = "Wifi"), - Data(id = 3, name = "Water Bottle"), - Data(id = 4, name = "Blanket",) - ) -} -fun mDeal(): ArrayList { - return arrayListOf( - Data(id = 1, name = "Extra 10% Discount"), - Data(id = 2, name = "Exculsive Offer - 5% Off"), - - ) -} \ No newline at end of file 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 cea92eb..e6d94b0 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 @@ -5,14 +5,13 @@ import androidx.annotation.ColorRes import androidx.annotation.DrawableRes import com.ss.smartfilterlib.utils.MultiChipType import com.ss.smartfilterlib.utils.Orientation -import com.ss.smartfilterlib.utils.SingleGroupSubType + /** * created by Mala Ruparel ON 08/05/24 */ data class MultiSelectionParams( val rootView: ViewGroup, - val singleGroupSubType: SingleGroupSubType = SingleGroupSubType.NONE, val chipType: MultiChipType = MultiChipType.NONE, val orientation: Int = Orientation.HORIZONTAL, val mData: ArrayList, 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 a36673c..5c940f0 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 @@ -3,21 +3,21 @@ package com.ss.smartfilterlib.data import android.view.ViewGroup import androidx.annotation.ColorRes import androidx.annotation.DrawableRes -import androidx.appcompat.R +import com.ss.smartfilterlib.R + import com.ss.smartfilterlib.utils.SingleChipType -import com.ss.smartfilterlib.utils.SingleGroupSubType + /** * created by Mala Ruparel ON 08/05/24 */ data class SingleSelectionParams( val rootView: ViewGroup, - val singleGroupSubType: SingleGroupSubType, val chipType: SingleChipType, val orientation: Int, val mData: ArrayList, val onItemSelected: (Data) -> Unit, - @DrawableRes val bgSelector: Int = R.drawable.abc_btn_radio_material, - @ColorRes val textSelector: Int = android.R.color.black + @DrawableRes val bgSelector: Int = R.color.chip_bg_selector, + @ColorRes val textSelector: Int = R.color.chip_text_selector ) 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 5ba719d..3017caf 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 @@ -84,7 +84,7 @@ class MultiSelectionListView @JvmOverloads constructor( context: Context,attrs: } private fun setDefaultTextColor(): ColorStateList? { - return ContextCompat.getColorStateList(context, R.color.colorOnSecondary) + return ContextCompat.getColorStateList(context, R.color.multiline_text_selector) } 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 7842ba1..905d2cc 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 @@ -1,6 +1,7 @@ package com.ss.smartfilterlib.multiselection import android.content.Context +import android.content.res.ColorStateList import android.util.AttributeSet import android.view.View import android.widget.HorizontalScrollView @@ -30,8 +31,8 @@ class MultiselectionChipGroup @JvmOverloads constructor(context: Context, attrs: with(typedArray) { try { smartOrientation = getInt(R.styleable.SingleLineChipGroup_cg_sl_orientation,Orientation.VERTICAL) - chipBgSelector = getColorStateList(R.styleable.SingleLineChipGroup_cg_sl_background) - viewTextSelector = getColorStateList(R.styleable.SingleLineChipGroup_cg_sl_text_selector) + chipBgSelector = getColorStateList(R.styleable.SingleLineChipGroup_cg_sl_background) ?: setDefaultDrawable() + viewTextSelector = getColorStateList(R.styleable.SingleLineChipGroup_cg_sl_text_selector) ?: setDefaultTextColor() dataFromXml = getResourceId(R.styleable.SingleLineChipGroup_cg_sl_list_item, 0) } finally { typedArray.recycle() @@ -67,9 +68,7 @@ class MultiselectionChipGroup @JvmOverloads constructor(context: Context, attrs: this.multiCheckedChangeListener = onCheckedChangeListener this.chipBgSelector = ContextCompat.getColorStateList(context, bgSelector) this.viewTextSelector = ContextCompat.getColorStateList(context, textSelector) - // chipGroup.isSingleLine = orientation == smartOrientation - chipGroup.isSingleSelection = false - chipGroup.isSelectionRequired = true + } private fun setItems(mData: List, chipType: MultiChipType) { @@ -151,7 +150,13 @@ class MultiselectionChipGroup @JvmOverloads constructor(context: Context, attrs: chipStrokeWidth = 2f } } + private fun setDefaultDrawable(): ColorStateList? { + return ContextCompat.getColorStateList(context, R.color.chip_bg_selector) + } + private fun setDefaultTextColor(): ColorStateList? { + return ContextCompat.getColorStateList(context, R.color.chip_text_selector) + } private fun applyChipAttributes(chip: Chip) { chip.apply { chipBackgroundColor = chipBgSelector 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 cc9dbb9..79f1c21 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 @@ -3,6 +3,7 @@ package com.ss.smartfilterlib.singleselection import android.content.Context +import android.content.res.ColorStateList import android.util.AttributeSet import android.view.View import android.widget.HorizontalScrollView @@ -35,8 +36,8 @@ class SingleSelectionChipGroup @JvmOverloads constructor(context: Context, attrs with(typedArray) { try { smartOrientation = getInt(R.styleable.SingleLineChipGroup_cg_sl_orientation,Orientation.VERTICAL) - chipBgSelector = getColorStateList(R.styleable.SingleLineChipGroup_cg_sl_background) - viewTextSelector =getColorStateList(R.styleable.SingleLineChipGroup_cg_sl_text_selector) + chipBgSelector = getColorStateList(R.styleable.SingleLineChipGroup_cg_sl_background) ?: setDefaultDrawable() + viewTextSelector =getColorStateList(R.styleable.SingleLineChipGroup_cg_sl_text_selector) ?: setDefaultTextColor() dataFromXml = getResourceId(R.styleable.SingleLineChipGroup_cg_sl_list_item, 0) } finally { typedArray.recycle() @@ -67,9 +68,7 @@ class SingleSelectionChipGroup @JvmOverloads constructor(context: Context, attrs setItems(chipData,chipType) } private fun updateValue(orientation: Int,bgSelector: Int, primaryTextColor: Int,onCheckedChangeListener: ((Data) -> Unit)?) { - chipGroup.isSingleSelection = true - chipGroup.isSelectionRequired=true - chipGroup.isSingleLine = orientation == Orientation.HORIZONTAL + this.smartOrientation= orientation this.chipBgSelector = ContextCompat.getColorStateList(context, bgSelector) this.viewTextSelector = primaryTextColor.let { ContextCompat.getColorStateList(context, it) } this.singleCheckedChangeListener = onCheckedChangeListener @@ -174,6 +173,13 @@ class SingleSelectionChipGroup @JvmOverloads constructor(context: Context, attrs singleCheckedChangeListener?.invoke(chip.tag as Data) } } + private fun setDefaultDrawable(): ColorStateList? { + return ContextCompat.getColorStateList(context, R.color.chip_bg_selector) + } + + private fun setDefaultTextColor(): ColorStateList? { + return ContextCompat.getColorStateList(context, R.color.chip_text_selector) + } private fun generateViewWithId(radioButton: Chip, data: Data) { radioButton.id = View.generateViewId() radioButton.tag = data 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 b9d35dc..375495c 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 @@ -29,7 +29,7 @@ import com.ss.smartfilterlib.utils.BaseLinearLayout * * @constructor Creates a new SingleSelectionItemRadioGroup with the given context, attrs, and defStyle. */ -class SingleSelectionItemRadioGroup(context: Context, attrs: AttributeSet? =null,defStyle: Int = 0) : BaseLinearLayout(context, attrs, defStyle) { +class SingleSelectionItemRadioGroup @JvmOverloads constructor(context: Context, attrs: AttributeSet? =null,defStyle: Int = 0) : BaseLinearLayout(context, attrs, defStyle) { init { @@ -44,7 +44,7 @@ class SingleSelectionItemRadioGroup(context: Context, attrs: AttributeSet? =null try { viewTextSelector =getColorStateList(R.styleable.RowItemRadioGroup_rg_ri_text_selector) ?: setDefaultTextColor() viewBgSelector = getDrawable(R.styleable.RowItemRadioGroup_rg_ri_background) ?: setDefaultDrawable() - smartOrientation = getInt(R.styleable.RowItemRadioGroup_rg_ri_orientation, HORIZONTAL) + smartOrientation = getInt(R.styleable.RowItemRadioGroup_rg_ri_orientation, VERTICAL) dataFromXml = getResourceId(R.styleable.RowItemRadioGroup_rg_ri_list_item, 0) } finally { typedArray.recycle() @@ -138,7 +138,7 @@ class SingleSelectionItemRadioGroup(context: Context, attrs: AttributeSet? =null return ContextCompat.getDrawable(context,R.drawable.row_item_selector,) } private fun setDefaultTextColor(): ColorStateList? { - return ContextCompat.getColorStateList(context, R.color.colorOnSecondary) + return ContextCompat.getColorStateList(context, R.color.black) } } 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 25f7dea..0ab3104 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 @@ -82,10 +82,10 @@ class SingleSelectionListView @JvmOverloads constructor( context: Context,attrs: adapter = SingleSelectionListAdapter(viewBgSelector,viewTextSelector,onSingleSelectionClicked).apply { data = items } } private fun setDefaultDrawable() : Drawable?{ - return ContextCompat.getDrawable(context, R.drawable.multiline_default,) + return ContextCompat.getDrawable(context,R.drawable.multiline_bg_selector,) } private fun setDefaultTextColor(): ColorStateList? { - return ContextCompat.getColorStateList(context, R.color.colorOnSecondary) + return ContextCompat.getColorStateList(context, R.color.multiline_text_selector) } 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 31bcad6..83f19e2 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 @@ -197,11 +197,11 @@ class SingleSelectionMultiLineRadioButton @JvmOverloads constructor(context: Con } private fun setDefaultDrawable(): Drawable? { - return ContextCompat.getDrawable(context, R.drawable.multiline_default) + return ContextCompat.getDrawable(context, R.drawable.multiline_bg_selector) } private fun setDefaultTextColor(): ColorStateList? { - return ContextCompat.getColorStateList(context, R.color.colorOnSecondary) + return ContextCompat.getColorStateList(context, R.color.multiline_text_selector) } 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 f114dcf..046c74c 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 @@ -165,7 +165,7 @@ class SingleSelectionRadioGroup @JvmOverloads constructor(context: Context, attr return ContextCompat.getDrawable(context,androidx.appcompat.R.drawable.abc_btn_radio_material,) } private fun setDefaultTextColor(): ColorStateList? { - return ContextCompat.getColorStateList(context, R.color.colorOnSecondary) + return ContextCompat.getColorStateList(context, R.color.black) } private fun applyTextAttributes(radioButton: RadioButton) { diff --git a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Constant.kt b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Constant.kt index 877e428..d5ff364 100644 --- a/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Constant.kt +++ b/ss-smart-filter/src/main/java/com/ss/smartfilterlib/utils/Constant.kt @@ -9,4 +9,5 @@ object Constant { const val PRIMARY_TEXT_COLOR = Color.BLACK const val DEFAULT_SPAN_COUNT = 3 const val DEFAULT_SPACING = 4 + } \ No newline at end of file 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 d60ea78..f9c2318 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 @@ -5,13 +5,6 @@ package com.ss.smartfilterlib.utils */ -enum class SingleGroupSubType { - SINGLE_LINE, - MULTI_LINE, - ROW_ITEM, - CHIP_GROUP, - NONE -} object Orientation { const val VERTICAL = 1 diff --git a/ss-smart-filter/src/main/res/color/chip_bg_selector.xml b/ss-smart-filter/src/main/res/color/chip_bg_selector.xml index 3959d7c..e7acef8 100644 --- a/ss-smart-filter/src/main/res/color/chip_bg_selector.xml +++ b/ss-smart-filter/src/main/res/color/chip_bg_selector.xml @@ -1,7 +1,7 @@ diff --git a/ss-smart-filter/src/main/res/color/chip_text_selector.xml b/ss-smart-filter/src/main/res/color/chip_text_selector.xml index e9c1342..2c3abe6 100644 --- a/ss-smart-filter/src/main/res/color/chip_text_selector.xml +++ b/ss-smart-filter/src/main/res/color/chip_text_selector.xml @@ -1,6 +1,6 @@ - - - + + + \ No newline at end of file diff --git a/ss-smart-filter/src/main/res/color/multiline_text_selector.xml b/ss-smart-filter/src/main/res/color/multiline_text_selector.xml index e9c1342..2c3abe6 100644 --- a/ss-smart-filter/src/main/res/color/multiline_text_selector.xml +++ b/ss-smart-filter/src/main/res/color/multiline_text_selector.xml @@ -1,6 +1,6 @@ - - - + + + \ No newline at end of file diff --git a/ss-smart-filter/src/main/res/color/text_color_selector.xml b/ss-smart-filter/src/main/res/color/text_color_selector.xml deleted file mode 100644 index 8d50688..0000000 --- a/ss-smart-filter/src/main/res/color/text_color_selector.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ss-smart-filter/src/main/res/color/text_selector.xml b/ss-smart-filter/src/main/res/color/text_selector.xml new file mode 100644 index 0000000..6c92338 --- /dev/null +++ b/ss-smart-filter/src/main/res/color/text_selector.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/ss-smart-filter/src/main/res/drawable/ic_check.xml b/ss-smart-filter/src/main/res/drawable/ic_check.xml index 894e098..e1f5a14 100644 --- a/ss-smart-filter/src/main/res/drawable/ic_check.xml +++ b/ss-smart-filter/src/main/res/drawable/ic_check.xml @@ -1,7 +1,7 @@ diff --git a/ss-smart-filter/src/main/res/drawable/ic_check_filled.xml b/ss-smart-filter/src/main/res/drawable/ic_check_filled.xml index 350c4ed..c140211 100644 --- a/ss-smart-filter/src/main/res/drawable/ic_check_filled.xml +++ b/ss-smart-filter/src/main/res/drawable/ic_check_filled.xml @@ -1,7 +1,7 @@ diff --git a/ss-smart-filter/src/main/res/drawable/ic_documents.xml b/ss-smart-filter/src/main/res/drawable/ic_documents.xml index 3b2e41f..f2faed9 100644 --- a/ss-smart-filter/src/main/res/drawable/ic_documents.xml +++ b/ss-smart-filter/src/main/res/drawable/ic_documents.xml @@ -1,6 +1,6 @@ diff --git a/ss-smart-filter/src/main/res/drawable/ic_rb_checked.xml b/ss-smart-filter/src/main/res/drawable/ic_rb_checked.xml index 829445c..75eb232 100644 --- a/ss-smart-filter/src/main/res/drawable/ic_rb_checked.xml +++ b/ss-smart-filter/src/main/res/drawable/ic_rb_checked.xml @@ -2,6 +2,6 @@ android:viewportWidth="60" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android"> - + android:strokeColor="@color/colorPrimary" android:strokeWidth="2"/> + diff --git a/ss-smart-filter/src/main/res/drawable/ic_rb_unchecked.xml b/ss-smart-filter/src/main/res/drawable/ic_rb_unchecked.xml index 316b799..826ef22 100644 --- a/ss-smart-filter/src/main/res/drawable/ic_rb_unchecked.xml +++ b/ss-smart-filter/src/main/res/drawable/ic_rb_unchecked.xml @@ -5,5 +5,5 @@ android:viewportHeight="100"> + android:fillColor="@color/colorPrimary"/> diff --git a/ss-smart-filter/src/main/res/drawable/ic_star.xml b/ss-smart-filter/src/main/res/drawable/ic_star.xml index 27645f8..82e6ff6 100644 --- a/ss-smart-filter/src/main/res/drawable/ic_star.xml +++ b/ss-smart-filter/src/main/res/drawable/ic_star.xml @@ -1,7 +1,7 @@ diff --git a/ss-smart-filter/src/main/res/drawable/ic_star_filled.xml b/ss-smart-filter/src/main/res/drawable/ic_star_filled.xml index 954f7d8..5437b6e 100644 --- a/ss-smart-filter/src/main/res/drawable/ic_star_filled.xml +++ b/ss-smart-filter/src/main/res/drawable/ic_star_filled.xml @@ -1,7 +1,7 @@ diff --git a/ss-smart-filter/src/main/res/drawable/multiline_default.xml b/ss-smart-filter/src/main/res/drawable/multiline_default.xml index 22dfbd6..554fb9b 100644 --- a/ss-smart-filter/src/main/res/drawable/multiline_default.xml +++ b/ss-smart-filter/src/main/res/drawable/multiline_default.xml @@ -6,7 +6,7 @@ + android:color="@color/colorPrimary" /> diff --git a/ss-smart-filter/src/main/res/drawable/multiline_selected.xml b/ss-smart-filter/src/main/res/drawable/multiline_selected.xml index c5585ee..7b2e0db 100644 --- a/ss-smart-filter/src/main/res/drawable/multiline_selected.xml +++ b/ss-smart-filter/src/main/res/drawable/multiline_selected.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/ss-smart-filter/src/main/res/drawable/row_item_pressed.xml b/ss-smart-filter/src/main/res/drawable/row_item_pressed.xml index 9bdb70f..66648a8 100644 --- a/ss-smart-filter/src/main/res/drawable/row_item_pressed.xml +++ b/ss-smart-filter/src/main/res/drawable/row_item_pressed.xml @@ -6,7 +6,7 @@ android:left="16dp" android:right="16dp" android:top="0dp" /> - + \ No newline at end of file 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 e411887..f959204 100644 --- a/ss-smart-filter/src/main/res/layout/row_item.xml +++ b/ss-smart-filter/src/main/res/layout/row_item.xml @@ -35,7 +35,7 @@ android:ellipsize="end" android:includeFontPadding="false" android:maxLines="1" - android:textColor="@color/colorOnSecondary" + android:textColor="@color/black" android:textSize="14sp" tools:text="Title" /> @@ -52,7 +52,7 @@ android:ellipsize="end" android:gravity="start" android:maxLines="2" - android:textColor="@color/colorOnSecondary" + android:textColor="@color/black" android:textSize="@dimen/_11ssp" tools:text="Description" /> diff --git a/ss-smart-filter/src/main/res/values/colors.xml b/ss-smart-filter/src/main/res/values/colors.xml index fa29a42..af9c1e6 100644 --- a/ss-smart-filter/src/main/res/values/colors.xml +++ b/ss-smart-filter/src/main/res/values/colors.xml @@ -6,8 +6,8 @@ #FF3700B3 #FF03DAC5 #FF018786 - #FF000000 - #ffffff + #FF000000 + #ffffff #D3D3D3 #FFEEEEEE #FF9E9E9E diff --git a/ss-smart-filter/src/main/res/values/themes.xml b/ss-smart-filter/src/main/res/values/themes.xml index 949ab92..a423cc7 100644 --- a/ss-smart-filter/src/main/res/values/themes.xml +++ b/ss-smart-filter/src/main/res/values/themes.xml @@ -10,7 +10,7 @@