Display this list of items to the user based on the following requirements:
- Display all the items grouped by "listId"
- Sort the results first by "listId" then by "name" when displaying.
- Filter out any items where "name" is blank or null.
- The final result should be displayed to the user in an easy-to-read list.
Please make the project buildable on the latest (non-pre release) tools and supporting the current release mobile OS.
[
{
"id": 684,
"listId": 1,
"name": "Item 684"
},
{
"id": 276,
"listId": 1,
"name": "Item 276"
},
{
"id": null,
"listId": 1,
"nme": null
}
]These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Android Studio Jellyfish | 2023.3.1 Patch 1 or later
- Git
- JDK 11 or newer (recommended for development, although the project targets JVM 1.8)
- Open a terminal.
- Change the current working directory to the location where you want the cloned directory.
- Type
git clone git@github.com:BryanKAdams/FetchTakeHome.gitand press Enter to create your local clone.
- Open Android Studio.
- Select
File>Open...from the menu bar. - Navigate to the directory where you cloned the project, select it, and click
OK. - Android Studio will import the project and index its contents.
- Once the indexing and Gradle sync are complete, select
Build>Make Projectto build the app. - To run the app, select
Run>Run 'app'and choose an emulator or connected device.
- To run unit tests, right-click on the
testfolder in the Project view and selectRun 'Tests in 'com.bryankeltonadams.fetchtakehometest...''. - To run Android Instrumentation tests, right-click on the
androidTestfolder and selectRun 'Tests in 'com.bryankeltonadams.fetchtakehometest...''.
- Select
Build>Build Bundle(s) / APK(s)>Build APK(s). - Once the build is complete, Android Studio will notify you. The APK can be found
in
projectname/app/build/outputs/apk/debug/app-debug.apk.
- Enable USB debugging on your Android device.
- Connect your device to your development machine via USB.
- Open a terminal and navigate to the project's root directory.
- Run
./gradlew installDebugto install the debug APK on your device.
After installing the APK on a device, you can also run the unit tests from the command line to verify the correctness of your application logic. This method is useful for automated testing environments or when you prefer not to use the Android Studio UI.
- Open a terminal.
- Navigate to the root directory of your project.
- Run the following command:
./gradlew test
This project is a Jetpack Compose project using Jetpack Navigation, Ktor(w/OkHttp engine), Hilt for Dependency Injection, Kotlin Coroutines (suspend functions and Flows), Material3 for U.I., and KotlinX for serialization.
- Advanced Filtering and Sorting: Allow users to dynamically customize views with more sophisticated filtering and sorting options.
- Search Functionality: Implement a search bar for querying items by name or other relevant properties.
- Offline Support: Enable the app to function without an internet connection by fetching and storing data for offline use.
- Detail View: Enhance user experience on tablets and desktops by introducing a detail view
through navigation or using
ListDetailPaneScaffold.
- Pull to Refresh: Users can refresh content by pulling down, with the ability to retry after a failure.
- Error Messaging: A snackbar system has been implemented to display error messages to users.
- Navigation: A navigation system has been set up, facilitating the addition of a detail view and other navigational elements like a hamburger menu or bottom action bar.
- Dedicated Database/API: Future enhancements could include using Firestore for persistent data storage and feature expansion, such as adding new items. Additionally, developing a REST API in Kotlin could further extend the app's capabilities.
- I considered keeping the dataset as a
List<Item>instead of aMap<Int, Item>for the U.I. - I could have sorted by name, groupedBy listId, and then flattened back into a list in order,
- I then could have checked the first occurrence of every listId within the list in order to attach
the header a singular time, this would have prevented me from doing a
forEachinside the u.i. but other methods would be required instead.
-
Ktor -> Retrofit: I decided to use Ktor in order to grow my familiarity with it and because I like using it for its Multiplatform support.
-
Hilt -> Koin: I decided to use Hilt instead of Koin, this is the one dependency that breaks KMP support for this project, I would most likely refactor this later in the future. But I have a strong familiarity with Hilt and it's also a more common D.I. library for Android.
-
KotlinX Serialization -> Moshi: The production applications I work with at Fishbowl use Moshi, but I personally prefer KotlinX Serialization, especially when sometimes it's required anyway, such is the case with Type Safe Navigation with Jetpack Navigation with Compose.
-
Jetpack Navigation -> No navigation: This app is so simple, it could have been built without a nav library and been just fine. If I needed to mimic navigation, I could have used state within a viewModel to change the screen, started a new activity or fragment that had it's own compose contents, etc. I prefer Single Activity architecture with Jetpack Navigation though, it's clean to me.
-
Material3 -> Material2: Very similar, and would have been fine implementing Compose components in either.
-
Jetpack Compose: I could have written this with Views, but I much prefer the way Compose is, and it's the future in my opinion.