Languages, libraries and tools used
- Kotlin
- Support libraries
- RecyclerViews and CardViews
- RxJava and RxAndroid
- Dependency Injection with Dagger 2
- Room Persistence Library
- Network communication with Retrofit 2
- Stetho as debug bridge
- Image loading and caching with Glide
- Timber
- Espresso
- Robolectric
- Mockito
- DexOpener
- 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
- JDK 1.8
- Android Studio 3
- Android SDK
- Android Oreo (API 27)
- Latest Android SDK Tools and build tools.
This project follows Android architecture guidelines that are based on MVP (Model View Presenter).
Imagine you have to implement a sign in screen.
- Create a new package under
ui
calledsignin
- Create an new Activity called
ActivitySignIn
. You could also use a Fragment. - Define the view interface that your Activity is going to implement. Create a new interface called
SignInMvpView
that extendsMvpView
. Add the methods that you think will be necessary, e.g.showSignInSuccessful()
- Create a
SignInPresenter
class that extendsBasePresenter<SignInMvpView>
- 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 callgetMvpView().showSignInSuccessful()
. - Create a
SignInPresenterTest
and write unit tests forsignIn(email)
. Remember to mock theSignInMvpView
and also theDataManager
. - Make your
ActivitySignIn
implementSignInMvpView
and implement the required methods likeshowSignInSuccessful()
- In your activity, inject a new instance of
SignInPresenter
and callpresenter.attachView(this)
fromonCreate
andpresenter.detachView()
fromonDestroy()
. Also, set up a click listener in your button that callspresenter.signIn(email)
.
This project integrates a combination of unit and functional 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.
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.