This app demonstrates how to use Uncle Bob's Clean Architecture in practice, with MVP on presentation layer. App is based on this famous repository (thanks author for it). But for me, there were a lot of things that I wanted somehow to modify or improve, somewhere to simplify or to generify the code with creating Base-classes, somewhere to separate or move the code to other places etc. That's why I created this app and I will continue developing it and show, thus, how to apply this architecture approach on real projects.
The app, for now, allows to Sign in with Google using FirebaseAuth and to chat with other users across the FirebaseDatabase service. It is also possible to edit and delete your message. App provides offline data cache with Realm. Also user can edit his profile on appropriate screen. If user is not on a Dialog Screen or application is in background, the user will receive Push Notification message, which appear in Android Status Bar. By clicking on message notification, Dialog Screen will be opened for messaging.
|Sign In||Push Notification||Edit Profile|
|![Sign in demo movie] (https://github.com/ihorvitruk/buddysearch/blob/develop/README/sign_in.gif)||![Push Notification demo movie] (https://github.com/ihorvitruk/buddysearch/blob/develop/README/push_notification.gif)||![Edit profile demo movie] (https://github.com/ihorvitruk/buddysearch/blob/develop/README/edit_profile.gif)|
|Send/Edit/Delete Message||Sign Out|
|![Send/edit/delete message demo movie] (https://github.com/ihorvitruk/buddysearch/blob/develop/README/send_edit_delete_message.gif)||![Sign out demo movie] (https://github.com/ihorvitruk/buddysearch/blob/develop/README/sign_out.gif)|
- Dagger2 - used to make the app more structural and its modules - more independent (weak connected).
- RxJava/RxAndroid - used for multithreading.
- FirebaseAuth - used for user authentication.
- FirebaseDatabase - used as a remote data repository.
- FirebaseMessaging - used for Push Notifications implementation.
- Realm - used for local data caching.
- Play Services Auth - used for signing in with Google.
- Android Data Binding Library.
- LeakCanary - used to avoid possible memory leaks.
- Lombok - useful annotations.
- Parceler - used to make work with
- Saripaar - used for user input validation.
- Dart / Henson - annotation processor that make navigation between screens easier (with extras injection).
- AppCompat, Design Library.
Libraries for testing
- Add Firebase to Android Project, for data module. (As a result you should have google-services.json file in data module)
- Go to the Firebase Console and navigate to your project:
- Select the Auth panel and then click the Sign In Method tab.
- Click Google and turn on the Enable switch, then click Save.
- Compile the presentation module and run on your device or emulator. (should have Play Services enabled)
Description of Classes and Layers
- Data layer - responsible for working with all data that app requires.
- Entity - data class for data layer.
- BaseMapper - can convert one object to another and vice versa.
- EntityStore - provides data (used by Repository)
- Cache - an extension to EntityStore (also can provide all related data), but with own methods for data caching.
- Domain layer - the whole business logic of your project is described here. When you decide to implement a new feature in app, start from this layer. Describe new dto, usecases and repositories for it.
- Dto - data class on domain layer.
- UseCase - appropriate business logic use case is described here.
- Repository - describes what data should pe provided from data layer.
- Presentation layer - platform-specific implementation of the app.
- Model - data class for presentation layer (MVP Model).
- View - MVP View
- Presenter - MVP Presenter
- Library module - base classes for data and presentation layers can be found here.
Dagger 2 - dependency injection (implemented on
@AppScope- global scope (one instance of specific object per application)
@ViewScope- one instance of specific object per MVP-View. As an MVP-View next android classes can be used:
AppComponent- global component (use
AppModule- provides global application objects like
Managersetc (included in
Repositoryobjects (included in
Cacheobjects (included in
EntityStoreobjects (included in
MVP-View-related objects (included in
- Add presentation_mvvm module - Write alternative presentation layer to demonstrate MVVM architectural pattern.
- Write data layer tests.
- Write presentation layer tests.
- Add NavigationDrawer and a few fragments with some new logic: Dialogs List, Users Map (using Google Map) etc.
- Write Kotlin version of this project to demonstrate power and benefits of this programming language on real project example.
Copyright 2016 Ihor Vitruk 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.
- xUtils discreteSeekBar HoloGraphLibrary NineOldAnimations Jave Proxy 公共技术点之依赖注入 CalendarListView EventBus SlidingMenu cling 公共技术点之 View 事件传递 ViewPagerIndicator CircularFloatingActionMenu android-lockpattern 公共技术点之 View 绘制流程 公共技术点之 Java 反射 Reflection PagerSlidingTabStrip BaseAdapterHelper Side Menu.Android Volley Dagger DynamicLoadApk PhotoView 公共技术点之 Java 注解 Annotation 公共技术点之 Android 动画基础 android-Ultra-Pull-To-Refresh Android-Universal-Image-Loader