Foodie is a simple application displaying restaurants nearby the user.
Restaurants page view
Fetching new restaurants page
Saving restaurants in favorites
A restaurant can be added to favorites by pressing the heart button. The view model calls
FavoritesRepository to change favorites state and read it.
Global application timer
AppTimer is global timer for the application that is started for the first time when the
application is initialized in
MainActivity. Since that moment every second
it emits tics in a
SharedFlow with strategy
SharingStarted.Eagerly so all observers
will get only the most recent tic.
Timer is paused and resumed by
MainActivity when the application is backgrounded and
foregrounded to prevent the application from running processes in the background.
Other components can listen to this flow to perform actions that need to be performed repeatedly in some interval. Example can be found here: Current location provider.
Current location provider
CurrentLocationProvider is global provider for the current location of the device.
It listens to
AppTimer‘s tics and transforms this flow to a flow of locations. New location
is fetched from
LocationRepository and emitted only every 10 seconds.
AppTimer it exposes
SharedFlow of locations which is shared with
SharingStarted.Eagerly strategy. It also replays the latest value for each new
subscriber, so they don’t need to wait until a new location is emitted.
Currently implementation of this repository is mocked to fixed list of 10 predefined locations.
Splash screen to app bar transition
SplashAppBar can be both the splash screen and the application top bar. When shown as the
splash screen it displays the initial enter animation created using
When the data is loaded for the first time and the application is initialized then the splash
screen transforms to the app bar using
Retry view animations
Foodie is also adjusted to work in dark mode. Different color palettes for light and dark mode
are defined in the
The behaviour of the application can be adjusted by modifying
Currently it’s hardcoded but ideally it should be received from backend when the application is launching.
Restaurant data is provided by Wolt API.