Skip to content

Commit

Permalink
remove white space
Browse files Browse the repository at this point in the history
  • Loading branch information
MalaRuparel2023 committed May 30, 2024
1 parent ea17b10 commit ed7537e
Show file tree
Hide file tree
Showing 18 changed files with 224 additions and 160 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/ss/smartfilterdemo/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class MainActivity : AppCompatActivity() {
smartFilterTheme() {
Surface {
FilterScreen()

}
}
}
Expand Down
251 changes: 142 additions & 109 deletions app/src/main/java/com/ss/smartfilterdemo/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -106,7 +115,9 @@ fun addSingleSelectionChipGroupHorizontal(rootView: ViewGroup, onItemSelected: (
textSelector = R.color.chip_text_selector
)
)
fun addMultiSelectionChipGroupVertical(rootView: ViewGroup, onItemsSelected: (List<Int>) -> Unit) = Params.MultiSelection(

fun addMultiSelectionChipGroupVertical(rootView: ViewGroup, onItemsSelected: (List<Int>) -> Unit) =
Params.MultiSelection(
MultiSelectionParams(
rootView = rootView,
chipType = MultiChipType.ACTION_CHIP,
Expand All @@ -119,41 +130,50 @@ fun addMultiSelectionChipGroupVertical(rootView: ViewGroup, onItemsSelected: (Li
)


fun addMultiSelectionChipGroupHorizontal(rootView: ViewGroup, onItemsSelected: (List<Int>) -> Unit) =Params.MultiSelection(
MultiSelectionParams(
fun addMultiSelectionChipGroupHorizontal(
rootView: ViewGroup,
onItemsSelected: (List<Int>) -> 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<Int>) -> Unit) = Params.MultiSelection(
MultiSelectionParams(

fun addMultiSelectionListVertical(rootView: ViewGroup, onItemsSelected: (List<Int>) -> Unit) =
Params.MultiSelection(
MultiSelectionParams(
rootView = rootView,
chipType = MultiChipType.NONE,
orientation = Orientation.VERTICAL,
Expand All @@ -163,40 +183,48 @@ fun addMultiSelectionListVertical(rootView: ViewGroup, onItemsSelected: (List<I
textSelector = R.color.chip_text_selector
)
)
fun addMultiSelectionListBus(rootView: ViewGroup, onItemsSelected: (List<Int>) -> 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<Int>) -> 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,
Expand All @@ -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<Int>) -> 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<Int>) -> 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
)
)
)
9 changes: 3 additions & 6 deletions app/src/main/java/com/ss/smartfilterdemo/data/data.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ import com.ss.smartfilterdemo.R
import com.ss.smartfilter.data.Data


fun getNamesFromDataList(): ArrayList<Data> {
return mData().map { it.name } as ArrayList<Data>
}


fun mData(): ArrayList<Data> {
return arrayListOf(
Data(
Expand Down Expand Up @@ -113,14 +108,16 @@ fun mTime(): ArrayList<Data> {
Data(id = 4, name = "Evening", image = R.drawable.ic_cyclone)
)
}

fun mAmenties(): ArrayList<Data> {
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<Data> {
return arrayListOf(
Data(id = 1, name = "Extra 10% Discount"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -78,7 +79,6 @@ fun ExpandableBusOperatorType(title: String) {
}
}


}
}
}
Loading

0 comments on commit ed7537e

Please sign in to comment.