Tiger-Pro For Android
Sample Android app that i use at Tiger Application as a reference for new Android projects. It demonstrates the architecture, tools that i use when developing for the Android platform.
(Nowadays, i have used this pattern in at least 3 projects, it turns out to speed up the android development and make a cool application.)
Libraries and tools included:
- Support libraries
- RxJava and RxAndroid
- Retrofit 2
- Dagger 2
- Functional tests with Espresso
- Checkstyle, PMD and Findbugs for code analysis
This project follows Android architecture guidelines that are based on MVP. For more details, you can checkout android-architecture
How to implement a new screen following MVP
Imagine you have to implement a sign in screen (Include an activity only).
- Create a new package under
- Create an new class called
- Create a
SignInActivityViewPresenterclass that extends
- Implement the methods in
SignInActivityViewPresenter, add functions that your Activity requires to perform the necessary actions, e.g.
signIn(String email). Once the sign in action finishes you should call
- Create a
SignInActivityViewPresenterTestand write unit tests for
- Fragments also provide the same workflow.
From above, you should have
SignInActivityViewPresenter in your
ui.signin package to define your MVP view.
This project include code analysis tools and unit test tools, but still working on unit test and functional test for this project.
Code Analysis tools
The following code analysis tools are set up on this project:
- PMD: It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. See this project's PMD ruleset.
- Findbugs: This tool uses static analysis to find bugs in Java code. Unlike PMD, it uses compiled Java bytecode instead of source code.
- Checkstyle: It ensures that the code style follows your team development guidelines. See checkstyle config file.
The check task
To ensure that your code is valid and stable use check:
This will run checkstyle -> findbugs -> PMD -> Android Lint -> Unit Test. All Done!
New project setup
To quickly start a new project, you can:
- Keep the
mvppackage and rename the
tigerpackage to your application.
- Modify package in
- Add sign config to project.
- Add proguard files to project, if it's the library proguard file, you should put it in
- If you want to enable jni support, checkout
build.gradlefor more details.
- All Done! Enjoy your development.
- Unit Test For Project
- Project Template for Android Studio IDE
- Usage Examples For New Project
Q: How to do pull requests?
A: Ensure good code quality and consistent formatting.
Copyright 2016 HwangJR, Inc. 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.