mirror of
https://github.com/AdrianKuta/android-challange-adrian-kuta.git
synced 2025-10-30 23:53:40 +01:00
This commit introduces several enhancements to the flight search user interface and underlying logic.
Key changes:
- Added an extension function `Flight.hasFlights()` to check if a flight object contains any actual flight data. This is located in `ui/home/src/main/kotlin/dev/adriankuta/flights/ui/home/extensions/FlightExt.kt`.
- In `StationsScreen.kt`:
- The origin airport display now includes a "Origin airport" label.
- The search input field placeholder text dynamically changes based on whether an origin airport has been selected (e.g., "Search origin airport" vs. "Search destination airport").
- In `StationsScreenViewModel.kt`:
- When an airport is selected, the search query is now automatically cleared.
- Added new string resources in `ui/stations/src/main/res/values/strings.xml` for the dynamic placeholder text: `search_origin_airport` and `search_destination_airport`.
- In `SearchResults.kt`:
- Implemented an `EmptyListComponent` to display a user-friendly message with an icon when no flights are found for the given search criteria.
- The `SearchResults` composable now utilizes `itemsIndexed` for better handling of dividers between trip cards.
- Dividers are no longer shown after the last item in the list of trips or trip dates.
- Added previews for the empty list state (`EmptyListPreview` and `SearchResultsEmptyPreview`).