A simple app to search/filter Peakon employees. The collection of managers is fetched from this gist. There is a possible back-end bug in the received data model as collection of employees is intermixed with accounts. The workaround strategy for this issue has been to ignore those two misplaced employees; another could have been to merge them together with the rest of the employees.
Before filtering takes place, both input and employee names and e-mails are normalized by applying Unicode's Normalization and case is ignored. In the suggestion list matching strings are highlighted using bold font style. Once a suggestion has been selected, details of that employee are presented underneath the input field and a face generator service is used as placeholder for missing avatar in the data collection.
Filtering | Details |
---|---|
The codebase honors the MVVM-pattern encouraged by Google with the use of Android's Architecture Components. VIEWs observe VIEW MODELs through LiveData
. This pattern creates a clear separation of concerns and allows VIEW MODELs to be easily unit tested (not done in the first release). VIEW MODELs communicate with so called repositories for obtaining MODELs from a back-end and/or a cached source. Repositories could be shared among several VIEW MODELs.
The Data Binding Library allows the data sources in the app to bind to UI components in the layouts using a declarative format. The bindings are generated on the fly from XML layouts. Besides reducing boilerplate code for calls such as findViewById
, it also allows for optimized re-layouting and/or redrawing of the UI when several attributes need to be changed simultaneously.
With the use of Dagger2 and its specialized Android Dagger library the consumer components of utility dependencies to become agnostic to where the dependencies originate further separating the concerns between components. The pattern also allows for seamless swapping of one implementation with another in for instance testing environments.
In order for Dagger2 to correctly build a dependency tree, all dependencies need to be "touched". The AppModule
includes an ActivitiesModule
defines a SubComponent
for each Activity
in the project. Each of these SubComponent
s in turn define their own dependents such as Fragment
s that also want to be included in the tree. This approach allows for future modularization of the codebase into separate feature modules.
The project can be built using Gradle.
./gradlew app:clean app:assembleDebug app:installDebug
gradlew.bat app:clean app:assembleDebug app:installDebug
- Download the APK to an Android device
- Run
app-debug.apk
- Allow the installation to take place
- Run the app