Skip to content

This repository is part of my master thesis with the title: "Towards developing maintainable, high quality apps: A framework based on android best practices and clean architecture" where i developed a fully testable blueprint as reference work and for rapid prototyping.

Notifications You must be signed in to change notification settings

bulicovic/boilerplate-kotlin

 
 

Repository files navigation

Build Status

Boilerplate Kotlin

Languages, libraries and tools used

Features

  • Welcome Screens with ViewPager
  • Login Screen with Account + Sync
  • Offline first approach with cache logic
  • RecyclerView with dummy data from RestAPI
  • Detail Screens with additional data
  • Background sync + Notifications
  • Homescreen Widget

Requirements

  • JDK 1.8
  • Android Studio 3
  • Android SDK
  • Android Oreo (API 27)
  • Latest Android SDK Tools and build tools.

Architecture

This project follows Android architecture guidelines that are based on MVP (Model View Presenter).

Architecture Diagram

How to implement a new screen following MVP

Imagine you have to implement a sign in screen.

  1. Create a new package under ui called signin
  2. Create an new Activity called ActivitySignIn. You could also use a Fragment.
  3. Define the view interface that your Activity is going to implement. Create a new interface called SignInMvpView that extends MvpView. Add the methods that you think will be necessary, e.g. showSignInSuccessful()
  4. Create a SignInPresenter class that extends BasePresenter<SignInMvpView>
  5. Implement the methods in SignInPresenter that your Activity requires to perform the necessary actions, e.g. signIn(String email). Once the sign in action finishes you should call getMvpView().showSignInSuccessful().
  6. Create a SignInPresenterTestand write unit tests for signIn(email). Remember to mock the SignInMvpView and also the DataManager.
  7. Make your ActivitySignIn implement SignInMvpView and implement the required methods like showSignInSuccessful()
  8. In your activity, inject a new instance of SignInPresenter and call presenter.attachView(this) from onCreate and presenter.detachView() from onDestroy(). Also, set up a click listener in your button that calls presenter.signIn(email).

Code Quality

This project integrates a combination of unit and functional tests.

Tests

To run unit tests on your machine:

./gradlew test

To run functional tests on connected devices:

./gradlew connectedAndroidTest

Note: For Android Studio to use syntax highlighting for Automated tests and Unit tests you must switch the Build Variant to the desired mode.

License

    Copyright 2018 Dennis Wehrle

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

About

This repository is part of my master thesis with the title: "Towards developing maintainable, high quality apps: A framework based on android best practices and clean architecture" where i developed a fully testable blueprint as reference work and for rapid prototyping.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 100.0%