This commit refactors the HomeScreen by extracting the search form logic into a new `SearchForm` composable and the passenger selection into a `PassengersOptions` composable.
Key changes:
- Created `PassengersOptions.kt` with a composable function to handle adult, teen, and child passenger counts.
- Created `SearchForm.kt` with a composable function that encapsulates airport selection, date picking, passenger options, and the search button.
- Updated `HomeScreen.kt`:
- Replaced the previous inline form layout with the new `SearchForm` composable.
- Made the screen content vertically scrollable using `Box` and `verticalScroll`.
- Passed a new `onSearch` lambda to the `HomeScreenContent`.
- Updated `HomeScreenViewModel.kt`:
- Modified `updateAdultCount`, `updateTeenCount`, and `updateChildCount` to accept the new count directly instead of a diff.
- Added a `search()` function (currently logs to Timber).
- Ensured child count does not exceed adult count when adult count changes.
- Updated `Counter.kt` in `ui/sharedui`:
- Changed `onCountChange` parameter to `onValueChange` which now receives the new absolute value.
- Added a `maxVal` parameter to limit the maximum value of the counter.
This commit introduces a passenger counter component to the home screen, allowing users to specify the number of adults, teens, and children for their flight search.
Key changes:
- Added `ui:sharedui` module dependency to `ui:home`.
- Updated `PreviewDevices` annotation to include `showBackground = true`.
- Modified `HomeScreen`:
- Added parameters to `HomeContent` and `SearchForm` for passenger count change callbacks.
- Integrated the `Counter` composable from `ui:sharedui` for adults, teens, and children.
- Added `VerticalDivider` between counters.
- Updated previews to reflect passenger counter integration.
- Updated `HomeScreenViewModel`:
- Introduced `MutableStateFlow` for `adultCount`, `teenCount`, and `childCount`.
- Created `passengersState` flow by combining individual passenger count flows.
- Updated `homeUiState` to include `passengersState`.
- Added public functions `updateAdultCount`, `updateTeenCount`, and `updateChildCount` to modify passenger counts with validation.
- Added `PassengersState` data class to hold passenger counts.
- Updated `Counter` composable in `ui:sharedui`:
- Added an optional `minVal` parameter (defaulting to 0) to define the minimum allowed value for the counter.
- Ensured the decrement button is disabled when the counter value reaches `minVal`.
- Centered text in increment and decrement buttons.
This commit applies code formatting changes across multiple files and updates lint baseline files.
Key changes:
- Added trailing commas to data classes in the `domain/types` module and related files.
- Formatted `HomeScreenViewModel.kt`, `Result.kt`, `ObserveAirportsUseCase.kt`, `AirportService.kt`, `ObserveAirportsUseCaseModule.kt`, `AirportInfoDomainMapper.kt`, `AirportInfoModelMapper.kt`, `AirportsDatasourceModule.kt`, `AirportsDatasourceImpl.kt`, `FlightService.kt`, `Cache.kt`, and `CacheImpl.kt`.
- Updated `README.md` and `LICENCE.md` with minor formatting adjustments.
- Updated various `lint-baseline.xml` files due to changes in cached dependencies or formatting.
- Added new `lint-baseline.xml` files for `model/datasource/airports`, `model/datasource/shared`, `domain/search`, and `model/data/api`.
- Removed unused imports from `app/build.gradle.kts`.
- Reformatted XML files: `ic_launcher_round.xml`, `ic_launcher.xml`, `strings.xml`, `ic_launcher_background.xml`.
- Added project code style configuration files: `.idea/codeStyles/codeStyleConfig.xml` and `.idea/codeStyles/Project.xml`.
- Reformatted `characters.json`.
- Updated response data classes in `model/data/api/entities` with trailing commas and minor formatting.