/RedditApp

RedditApp code challenge

Primary LanguageJavaApache License 2.0Apache-2.0

RedditApp

RedditApp code challenge

Code complilation instructions

Android Studio 3.1

Building

./gradlew app:assembleDebug

Testing

To run unit tests only:

./gradlew test

UI tests

To run instrumentation tests on connected devices:

./gradlew connectedAndroidTest

Jacoco Report

Generate Jacoco coverage reports. Both unit and espresso tests.

./gradlew jacocoTestReport

After executing the command line, the code coverge report can be found in this path:

/build/reports/jacoco/jacocoTestReport/html/index.html

Designing the app using MVP

The app consist of one UI Screen:

  • FrontPage - Screen which manage a list of RedditPosts

This screen was implemented using the following classes:

  • A Contract class (FrontPageContract)
  • An Activity which ensembles the fragment and presenter.
  • A Fragment which implements the view interface. It contains almost any business logic. It is using DataBinding in order to make the fragment even cleaner and light. Using the BindAdapters and layout data variables the fragment class it is easy to read and more maintainable.
  • A presenter which implements the presenter interface in the corresponding contract. The presenter handles the UI and it also has a references to the repository class. The presenter contains important business logic for the screen, it handles the single observable from the respository in order to the filtering, sorting and validations required.

This project uses: