From ed7537e422b046ce323ee4030e31c97b26cab231 Mon Sep 17 00:00:00 2001 From: Mala Ruparel Date: Thu, 30 May 2024 10:26:22 +0530 Subject: [PATCH] remove white space --- .../com/ss/smartfilterdemo/MainActivity.kt | 1 - .../main/java/com/ss/smartfilterdemo/Utils.kt | 251 ++++++++++-------- .../java/com/ss/smartfilterdemo/data/data.kt | 9 +- .../screens/ExpandableBusOperatorType.kt | 4 +- .../screens/ExpandableBusType.kt | 1 - .../screens/ExpandableSeatType.kt | 1 - .../java/com/ss/smartfilterdemo/theme/Type.kt | 2 +- app/src/main/res/drawable/ic_back.xml | 16 +- app/src/main/res/drawable/ic_filter.xml | 15 +- app/src/main/res/drawable/ic_hive.xml | 51 ++-- app/src/main/res/layout/activity_main.xml | 1 - app/src/main/res/values/themes.xml | 1 + .../java/com/ss/smartfilter/SmartFilter.kt | 1 + .../adapter/MultiSelectionListAdapter.kt | 7 +- .../adapter/SingleSelectionAdapter.kt | 6 +- .../multiselection/MultiselectionChipGroup.kt | 6 +- .../ss/smartfilter/utils/BaseRecycleView.kt | 9 +- .../java/com/ss/smartfilter/utils/Utils.kt | 2 - 18 files changed, 224 insertions(+), 160 deletions(-) diff --git a/app/src/main/java/com/ss/smartfilterdemo/MainActivity.kt b/app/src/main/java/com/ss/smartfilterdemo/MainActivity.kt index f90f5ff..c0733c3 100644 --- a/app/src/main/java/com/ss/smartfilterdemo/MainActivity.kt +++ b/app/src/main/java/com/ss/smartfilterdemo/MainActivity.kt @@ -16,7 +16,6 @@ class MainActivity : AppCompatActivity() { smartFilterTheme() { Surface { FilterScreen() - } } } diff --git a/app/src/main/java/com/ss/smartfilterdemo/Utils.kt b/app/src/main/java/com/ss/smartfilterdemo/Utils.kt index a2d6715..4184fa6 100644 --- a/app/src/main/java/com/ss/smartfilterdemo/Utils.kt +++ b/app/src/main/java/com/ss/smartfilterdemo/Utils.kt @@ -22,7 +22,8 @@ import com.ss.smartfilter.R /** * created by Mala Ruparel ON 23/04/24 */ -fun addRadioGroupSingleLineVertical(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( +fun addRadioGroupSingleLineVertical(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( SingleSelectionParams( rootView = rootView, chipType = SingleChipType.NONE, @@ -34,7 +35,8 @@ fun addRadioGroupSingleLineVertical(rootView: ViewGroup,onItemSelected: (Data) - ) ) -fun addRadioGroupSingleLineHorizontal(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( +fun addRadioGroupSingleLineHorizontal(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( SingleSelectionParams( rootView = rootView, chipType = SingleChipType.NONE, @@ -46,7 +48,8 @@ fun addRadioGroupSingleLineHorizontal(rootView: ViewGroup,onItemSelected: (Data) ) ) -fun addRadioButtonMultiRow(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( +fun addRadioButtonMultiRow(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( SingleSelectionParams( rootView = rootView, chipType = SingleChipType.NONE, @@ -59,32 +62,36 @@ fun addRadioButtonMultiRow(rootView: ViewGroup, onItemSelected: (Data) -> Unit) ) -fun addRadioGroupRowItemHorizontal(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( - SingleSelectionParams( - rootView = rootView, - chipType = SingleChipType.NONE, - orientation = Orientation.HORIZONTAL, - mData = mData(), - onItemSelected = onItemSelected, - bgSelector = R.drawable.row_item_selector, - textSelector = R.color.text_selector +fun addRadioGroupRowItemHorizontal(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( + SingleSelectionParams( + rootView = rootView, + chipType = SingleChipType.NONE, + orientation = Orientation.HORIZONTAL, + mData = mData(), + onItemSelected = onItemSelected, + bgSelector = R.drawable.row_item_selector, + textSelector = R.color.text_selector + ) ) -) -fun addRadioGroupRowItemVertical(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( - SingleSelectionParams( - rootView = rootView, - chipType = SingleChipType.NONE, - orientation = Orientation.VERTICAL, - mData = mData(), - onItemSelected = onItemSelected, - bgSelector = R.drawable.row_item_selector, - textSelector = R.color.text_selector +fun addRadioGroupRowItemVertical(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( + SingleSelectionParams( + rootView = rootView, + chipType = SingleChipType.NONE, + orientation = Orientation.VERTICAL, + mData = mData(), + onItemSelected = onItemSelected, + bgSelector = R.drawable.row_item_selector, + textSelector = R.color.text_selector + + ) ) -) -fun addSingleSelectionChipGroupVertical(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( +fun addSingleSelectionChipGroupVertical(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( SingleSelectionParams( rootView = rootView, chipType = SingleChipType.ACTION_CHIP, @@ -95,8 +102,10 @@ fun addSingleSelectionChipGroupVertical(rootView: ViewGroup, onItemSelected: (Da textSelector = R.color.chip_text_selector ) ) -fun addSingleSelectionChipGroupHorizontal(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( - SingleSelectionParams( + +fun addSingleSelectionChipGroupHorizontal(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( + SingleSelectionParams( rootView = rootView, chipType = SingleChipType.ENTRY_CHIP, orientation = Orientation.HORIZONTAL, @@ -106,7 +115,9 @@ fun addSingleSelectionChipGroupHorizontal(rootView: ViewGroup, onItemSelected: ( textSelector = R.color.chip_text_selector ) ) -fun addMultiSelectionChipGroupVertical(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = Params.MultiSelection( + +fun addMultiSelectionChipGroupVertical(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = + Params.MultiSelection( MultiSelectionParams( rootView = rootView, chipType = MultiChipType.ACTION_CHIP, @@ -119,41 +130,50 @@ fun addMultiSelectionChipGroupVertical(rootView: ViewGroup, onItemsSelected: (Li ) -fun addMultiSelectionChipGroupHorizontal(rootView: ViewGroup, onItemsSelected: (List) -> Unit) =Params.MultiSelection( - MultiSelectionParams( +fun addMultiSelectionChipGroupHorizontal( + rootView: ViewGroup, + onItemsSelected: (List) -> Unit +) = Params.MultiSelection( + MultiSelectionParams( + rootView = rootView, + chipType = MultiChipType.FILTER_CHIP, + orientation = Orientation.HORIZONTAL, + mData = mData(), + onItemsSelected = onItemsSelected, + bgSelector = R.color.chip_bg_selector, + textSelector = R.color.chip_text_selector + ) +) + +fun addSingleSelectionListHorizontal(rootView: ViewGroup, onItemselected: (Data) -> Unit) = + Params.SingleSelection( + SingleSelectionParams( rootView = rootView, - chipType = MultiChipType.FILTER_CHIP, + chipType = SingleChipType.NONE, orientation = Orientation.HORIZONTAL, mData = mData(), - onItemsSelected = onItemsSelected, - bgSelector = R.color.chip_bg_selector, + onItemSelected = onItemselected, + bgSelector = R.drawable.multiline_bg_selector, textSelector = R.color.chip_text_selector ) ) -fun addSingleSelectionListHorizontal(rootView: ViewGroup, onItemselected: (Data) -> Unit) = Params.SingleSelection( + +fun addSingleSelectionListVertical(rootView: ViewGroup, onItemselected: (Data) -> Unit) = + Params.SingleSelection( SingleSelectionParams( rootView = rootView, chipType = SingleChipType.NONE, - orientation = Orientation.HORIZONTAL, + orientation = Orientation.VERTICAL, mData = mData(), onItemSelected = onItemselected, bgSelector = R.drawable.multiline_bg_selector, textSelector = R.color.chip_text_selector ) ) -fun addSingleSelectionListVertical(rootView: ViewGroup, onItemselected: (Data) -> Unit) = Params.SingleSelection( - SingleSelectionParams( - rootView = rootView, - chipType = SingleChipType.NONE, - orientation = Orientation.VERTICAL, - mData = mData(), - onItemSelected = onItemselected, - bgSelector = R.drawable.multiline_bg_selector, - textSelector = R.color.chip_text_selector - ) -) -fun addMultiSelectionListVertical(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = Params.MultiSelection( - MultiSelectionParams( + +fun addMultiSelectionListVertical(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = + Params.MultiSelection( + MultiSelectionParams( rootView = rootView, chipType = MultiChipType.NONE, orientation = Orientation.VERTICAL, @@ -163,40 +183,48 @@ fun addMultiSelectionListVertical(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = Params.MultiSelection( - MultiSelectionParams( - rootView = rootView, - chipType = MultiChipType.NONE, - orientation = Orientation.HORIZONTAL, - mData = mBusType(), - onItemsSelected = onItemsSelected, - bgSelector = R.drawable.multiline_bg_selector, - textSelector = R.color.chip_text_selector + +fun addMultiSelectionListBus(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = + Params.MultiSelection( + MultiSelectionParams( + rootView = rootView, + chipType = MultiChipType.NONE, + orientation = Orientation.HORIZONTAL, + mData = mBusType(), + onItemsSelected = onItemsSelected, + bgSelector = R.drawable.multiline_bg_selector, + textSelector = R.color.chip_text_selector + ) ) -) -fun addSingleSelectionListSeat(rootView: ViewGroup, onItemsSelected: (Data) -> Unit) = Params.SingleSelection( - SingleSelectionParams( - rootView = rootView, - chipType = SingleChipType.NONE, - orientation = Orientation.HORIZONTAL, - mData = mSeatType(), - onItemSelected = onItemsSelected, - bgSelector = R.drawable.multiline_bg_selector, - textSelector = R.color.chip_text_selector + +fun addSingleSelectionListSeat(rootView: ViewGroup, onItemsSelected: (Data) -> Unit) = + Params.SingleSelection( + SingleSelectionParams( + rootView = rootView, + chipType = SingleChipType.NONE, + orientation = Orientation.HORIZONTAL, + mData = mSeatType(), + onItemSelected = onItemsSelected, + bgSelector = R.drawable.multiline_bg_selector, + textSelector = R.color.chip_text_selector + ) ) -) -fun addRadioGroupSingleOperator(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( - SingleSelectionParams( - rootView = rootView, - chipType = SingleChipType.NONE, - orientation = Orientation.VERTICAL, - mData = mOperatorType(), - onItemSelected = onItemSelected, - bgSelector = R.drawable.star_selector, - textSelector = R.color.text_selector + +fun addRadioGroupSingleOperator(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( + SingleSelectionParams( + rootView = rootView, + chipType = SingleChipType.NONE, + orientation = Orientation.VERTICAL, + mData = mOperatorType(), + onItemSelected = onItemSelected, + bgSelector = R.drawable.star_selector, + textSelector = R.color.text_selector + ) ) -) - fun addRadioGroupSingleBusOperator(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( + +fun addRadioGroupSingleBusOperator(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( SingleSelectionParams( rootView = rootView, chipType = SingleChipType.NONE, @@ -206,38 +234,43 @@ fun addRadioGroupSingleOperator(rootView: ViewGroup,onItemSelected: (Data) -> Un bgSelector = R.drawable.check_selector, textSelector = R.color.text_selector ) -) -fun addMultiSelectionChipGroupAmenties(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = Params.MultiSelection( - MultiSelectionParams( - rootView = rootView, - chipType = MultiChipType.ENTRY_CHIP, - orientation = Orientation.VERTICAL, - mData = mAmenties(), - onItemsSelected = onItemsSelected, - bgSelector = R.color.chip_bg_selector, - textSelector = R.color.chip_text_selector ) -) -fun addRadioGroupSingleLineHorizontalDeal(rootView: ViewGroup,onItemSelected: (Data) -> Unit) = Params.SingleSelection( - SingleSelectionParams( - rootView = rootView, - chipType = SingleChipType.NONE, - orientation = Orientation.VERTICAL, - mData = mDeal(), - onItemSelected = onItemSelected, - bgSelector = R.drawable.rb_selector, - textSelector = R.color.text_selector +fun addMultiSelectionChipGroupAmenties(rootView: ViewGroup, onItemsSelected: (List) -> Unit) = + Params.MultiSelection( + MultiSelectionParams( + rootView = rootView, + chipType = MultiChipType.ENTRY_CHIP, + orientation = Orientation.VERTICAL, + mData = mAmenties(), + onItemsSelected = onItemsSelected, + bgSelector = R.color.chip_bg_selector, + textSelector = R.color.chip_text_selector + ) ) -) -fun addRadioMultiRowDeparture(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = Params.SingleSelection( - SingleSelectionParams( - rootView = rootView, - chipType = SingleChipType.NONE, - orientation = Orientation.VERTICAL, - mData = mTime(), - onItemSelected = onItemSelected, - bgSelector = R.drawable.multiline_bg_selector, - textSelector = R.color.multiline_text_selector + +fun addRadioGroupSingleLineHorizontalDeal(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( + SingleSelectionParams( + rootView = rootView, + chipType = SingleChipType.NONE, + orientation = Orientation.VERTICAL, + mData = mDeal(), + onItemSelected = onItemSelected, + bgSelector = R.drawable.rb_selector, + textSelector = R.color.text_selector + ) + ) + +fun addRadioMultiRowDeparture(rootView: ViewGroup, onItemSelected: (Data) -> Unit) = + Params.SingleSelection( + SingleSelectionParams( + rootView = rootView, + chipType = SingleChipType.NONE, + orientation = Orientation.VERTICAL, + mData = mTime(), + onItemSelected = onItemSelected, + bgSelector = R.drawable.multiline_bg_selector, + textSelector = R.color.multiline_text_selector + ) ) -) diff --git a/app/src/main/java/com/ss/smartfilterdemo/data/data.kt b/app/src/main/java/com/ss/smartfilterdemo/data/data.kt index a93141a..7549c80 100644 --- a/app/src/main/java/com/ss/smartfilterdemo/data/data.kt +++ b/app/src/main/java/com/ss/smartfilterdemo/data/data.kt @@ -4,11 +4,6 @@ import com.ss.smartfilterdemo.R import com.ss.smartfilter.data.Data -fun getNamesFromDataList(): ArrayList { - return mData().map { it.name } as ArrayList -} - - fun mData(): ArrayList { return arrayListOf( Data( @@ -113,14 +108,16 @@ fun mTime(): ArrayList { 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",) + Data(id = 4, name = "Blanket") ) } + fun mDeal(): ArrayList { return arrayListOf( Data(id = 1, name = "Extra 10% Discount"), diff --git a/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableBusOperatorType.kt b/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableBusOperatorType.kt index 8be567e..c0a2f7f 100644 --- a/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableBusOperatorType.kt +++ b/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableBusOperatorType.kt @@ -47,7 +47,8 @@ fun ExpandableBusOperatorType(title: String) { Text( modifier = Modifier - .weight(1f).padding(16.dp), + .weight(1f) + .padding(16.dp), text = title, fontSize = 18.sp, style = TextStyle(fontWeight = FontWeight.Bold) @@ -78,7 +79,6 @@ fun ExpandableBusOperatorType(title: String) { } } - } } } \ No newline at end of file diff --git a/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableBusType.kt b/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableBusType.kt index d040fdd..cc7fdde 100644 --- a/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableBusType.kt +++ b/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableBusType.kt @@ -82,6 +82,5 @@ fun ExpandableBusType(title: String) { } } - } } \ No newline at end of file diff --git a/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableSeatType.kt b/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableSeatType.kt index bcc2481..9fc3a21 100644 --- a/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableSeatType.kt +++ b/app/src/main/java/com/ss/smartfilterdemo/screens/ExpandableSeatType.kt @@ -81,6 +81,5 @@ fun ExpandableSeatType(title: String) { } } - } } \ No newline at end of file diff --git a/app/src/main/java/com/ss/smartfilterdemo/theme/Type.kt b/app/src/main/java/com/ss/smartfilterdemo/theme/Type.kt index 9e87b23..71559b5 100644 --- a/app/src/main/java/com/ss/smartfilterdemo/theme/Type.kt +++ b/app/src/main/java/com/ss/smartfilterdemo/theme/Type.kt @@ -6,7 +6,7 @@ import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.sp -// Set of Material typography styles to start with + val Typography = Typography( bodyLarge = TextStyle( fontFamily = FontFamily.Default, diff --git a/app/src/main/res/drawable/ic_back.xml b/app/src/main/res/drawable/ic_back.xml index a1fcc04..931d280 100644 --- a/app/src/main/res/drawable/ic_back.xml +++ b/app/src/main/res/drawable/ic_back.xml @@ -1,5 +1,13 @@ - - - - + + + + diff --git a/app/src/main/res/drawable/ic_filter.xml b/app/src/main/res/drawable/ic_filter.xml index 3073da5..54bbccf 100644 --- a/app/src/main/res/drawable/ic_filter.xml +++ b/app/src/main/res/drawable/ic_filter.xml @@ -1,5 +1,12 @@ - - - - + + + + diff --git a/app/src/main/res/drawable/ic_hive.xml b/app/src/main/res/drawable/ic_hive.xml index da65171..660c52c 100644 --- a/app/src/main/res/drawable/ic_hive.xml +++ b/app/src/main/res/drawable/ic_hive.xml @@ -1,17 +1,36 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 90c886e..d61ed1b 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -8,6 +8,5 @@ android:padding="16dp"> - diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index a61821b..15b2d4e 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -22,6 +22,7 @@ 8dp 8dp +