All Projects → TayfunCesur → Githubprojectbrowser

TayfunCesur / Githubprojectbrowser

This is a sample Android Project that is based on Clean Architecture

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Githubprojectbrowser

movies
An example approach for modularization, reactive clean architecture and persistancy.
Stars: ✭ 110 (+71.88%)
Mutual labels:  room, clean-architecture, dagger2, retrofit2, rxkotlin, livedata, architecture-components
News Sample App
A sample news app which demonstrates clean architecture and best practices for developing android app
Stars: ✭ 334 (+421.88%)
Mutual labels:  dagger2, clean-architecture, viewmodel, room, architecture-components, retrofit2, livedata
Tdcapp
Sample app which access the TDC (The Developer's Conference) REST API.
Stars: ✭ 55 (-14.06%)
Mutual labels:  clean-architecture, viewmodel, room, architecture-components, mockito, livedata
Wanandroid
🏄 基于Architecture Components dependencies (Lifecycles,LiveData,ViewModel,Room)构建的WanAndroid开源项目。 你值得拥有的MVVM快速开发框架:https://github.com/jenly1314/MVVMFrame
Stars: ✭ 410 (+540.63%)
Mutual labels:  dagger2, viewmodel, room, architecture-components, retrofit2, livedata
Star Wars Shop
Simple project with clean architecture and android lifecycle
Stars: ✭ 37 (-42.19%)
Mutual labels:  rxkotlin, dagger2, clean-architecture, architecture-components, mockito, retrofit2
Base Mvvm
App built to showcase basic Android View components like ViewPager, RecyclerView(homogeneous and heterogeneous items), NavigationDrawer, Animated Vector Drawables, Collapsing Toolbar Layout etc. housed in a MVVM architecture
Stars: ✭ 18 (-71.87%)
Mutual labels:  dagger2, viewmodel, room, architecture-components, retrofit2, livedata
Mvvmframe
🏰 MVVMFrame for Android 是一个基于Google官方推出的Architecture Components dependencies(现在叫JetPack){ Lifecycle,LiveData,ViewModel,Room } 构建的快速开发框架。有了MVVMFrame的加持,从此构建一个MVVM模式的项目变得快捷简单。
Stars: ✭ 218 (+240.63%)
Mutual labels:  dagger2, viewmodel, room, architecture-components, retrofit2, livedata
Superhero-App
🦸🏻‍♂️🦹🏻‍♀️Superhero app built with Kotlin, ViewModel, LiveData, ViewBinding, Room, and Hilt
Stars: ✭ 27 (-57.81%)
Mutual labels:  room, dagger2, viewmodel, retrofit2, livedata, architecture-components
Android tmdb clean architecture
Showcase of clean architecture concepts along with Continuous Integration and Development for modular Android applications. Includes test suits (functional and unit tests) along with code coverage.
Stars: ✭ 63 (-1.56%)
Mutual labels:  dagger2, clean-architecture, room, espresso, mockito, retrofit2
Blockchain Tracker
A blockchain market tracking app. Example implementation of reactive clean architecture and testing.
Stars: ✭ 30 (-53.12%)
Mutual labels:  rxkotlin, dagger2, clean-architecture, architecture-components, espresso
Mvvmarms
Android MVVM Architecture Components based on MVPArms and Android Architecture Components.
Stars: ✭ 425 (+564.06%)
Mutual labels:  dagger2, viewmodel, room, retrofit2, livedata
Changedetection
Automatically track websites changes on Android in background.
Stars: ✭ 563 (+779.69%)
Mutual labels:  dagger2, viewmodel, room, architecture-components, livedata
flickr-android
A small sample app to showcase architecting app using Clean Architecture and MVVM
Stars: ✭ 25 (-60.94%)
Mutual labels:  room, clean-architecture, dagger2, retrofit2, architecture-components
Android-Mvi-Starter
Android MVI Starter application
Stars: ✭ 19 (-70.31%)
Mutual labels:  dagger2, viewmodel, retrofit2, livedata, architecture-components
paybill-manager
Your personal finance manager
Stars: ✭ 46 (-28.12%)
Mutual labels:  clean-architecture, espresso, dagger2, retrofit2, architecture-components
Weatherapp
5 Day Forecast app that works on Android and uses latest tools (Kotlin, Navigation, Room, LiveData, Databinding, Dagger 2)
Stars: ✭ 426 (+565.63%)
Mutual labels:  rxkotlin, dagger2, clean-architecture, viewmodel, room
GithubApp-android-architecture
Let's learn a deep look at the Android architecture
Stars: ✭ 16 (-75%)
Mutual labels:  clean-architecture, dagger2, viewmodel, retrofit2, livedata
Simple-Notes-Kotlin-App
✍️ Simple Note Making App use mvvm architecture , dagger , coroutines and navigation component. Features includes 🗒️ create , edit and ❌ delete notes
Stars: ✭ 40 (-37.5%)
Mutual labels:  room, dagger2, viewmodel, livedata, architecture-components
News
A sample News 🗞 app built using Modern Android Development [Architecture Components, Coroutines, Retrofit, Room, Kotlin, Dagger]
Stars: ✭ 774 (+1109.38%)
Mutual labels:  dagger2, viewmodel, room, architecture-components, retrofit2
Android Architecture Components Kotlin
Clean code App with Kotlin and Android Architecture Components
Stars: ✭ 23 (-64.06%)
Mutual labels:  dagger2, clean-architecture, room, retrofit2, livedata

Github Project Browser

      This is a sample Android Project that is based on Uncle Bob's Clean Architecture .It contains six different layers but the count of layers may change with respect to your project, you may have more or less layers. All of them have own mission but none of them interests with the others. That is the main idea actually. I will not explain the Clean Architecture because this is already well documented. I will just explain how I implemented. Here is the preview of project for just motivation before diving

Layers

When you do an action in your application, the flow will be like below respectively

  • UI Layer is the layer that displays your data. You may use multi UI layer in your project. (For instance you have already an app that runs in phones and if you want to expand your targets for new platforms such as watches or TVs. There is no problem for you anymore.)
  • Presentation Layer is the layer like a gateway between your UI and Business. You can use any design pattern in here(MVP,MVVM,MVI etc.) (MVVM is used in this project)
  • Domain Layer, is the core layer that represents the use cases of project. You can think this layer as a middleman.
  • Data Layer, is the layer that determines where the data will come from. It has two sublayers.
    • Remote Layer is the layer that fetches the data from network. (Retrofit2 is used in this project)
    • Cache Layer is the layer that is responsible for getting data from sqlite (Room is used in this project)

UI Layer

      As I mentioned above, this is the layer that displays your data. It may use your presenters or your ViewModels. (ViewModels are used in this projects.) This layer works as usual way. I mean, observes your livedatas and displays the user.

Presentation

      This is the layer that is the easiest one in my opinion. It's mission is so simple. It has ViewModels that are just executing your command like below.( For instance, getProjects)

	fun getProjects() {  
	    remoteProjectsLiveData.postValue(Resource.Loading())  
	    getProjects.execute(ProjectsSubscriber())//Here, the flow navigates through the domain layer
	}

The ViewModel's main functions are so simple like above.

Domain

      This is the core layer. You should determine your projects use cases. For instance, in this project, I needed four use cases. These are, (in my ProjectsRepository interface)

  • getProjects(): Observable<List>
  • getBookmarkedProjects(): Observable<List>
  • bookmarkProject(projectId: String): Completable
  • unbookmarkProject(projectId: String)

      But of course that depends on your projects needs. And you can imagine this interface like a bridge that navigates your flow to the data layer. So if you want to display projects, your class (GetProjects) calls the getProjects() function of the ProjectsRepository and then the flow navigates through the data layer because data layer implements your bridge.

Data

      The core class of Data layer is ProjectsDataRepository class in this project because that class implements your use cases and takes care of them.

   class ProjectsDataRepository @Inject constructor(  
       	private val mapper: ProjectMapper,  
   	private val dataStore: ProjectsDataStoreFactory  
   	) : ProjectsRepository { // This is the interface that represents your use cases
   	       		        // You defined it in the Domain Layer
   	override fun getProjects(): Observable<List<Project>> {
       	    return dataStore.getRemoteDataStore().getProjects().map {
                      it.map {
                          mapper.mapFromEntity(it)
                      }
                   }
               }
    }

      You can think this layer responsible for getting and serving data through the Domain layer but it doesn't care about where or how the data comes. It just a navigator that navigates your flow through the Remote or Cache.       In this project, Data layer navigates the flow if getProjects() calls, because projects must be fetched from network, but if the other use cases are intended for example bookmarkProject or getBookmarkedProjects, these data must be fetched from local storage.So data layer navigates your flow though the cache layer.

Remote Layer

      This layer is also easy layer because it has only one responsibility. It just making a network request via Retrofit2 It has only one class that is called by ProjectsRemoteImpl

Cache Layer

      This layer is responsible for managing the local storage, getting and serving data through the Data Layer. It uses Room which is an awesome library. It just calls the DAO functions.

Keynotes & Bonuses

Mapper

      This project have many mapper classes. This was my decision actually not a requirement but this is good way because for this, each layer can work with different model and anyone don't depends on some other model. I have mapper interface like below,(For example CacheMapper, because I can cache some additional data like creationDate etc which doesn't concerns the other layers.)

interface CacheMapper<I, O> { //Like I: Input, O:Output 
 
      fun mapFromCache(cache: I): O  
 
      fun mapToCache(dataToCache: O): I  
} 

Dependencies

      Many of these layers above uses same dependencies like RX, JavaxAnnotation, or mockito for testing. So it would be really good to manage them all in one file. For this reason, this project uses the dependencies.gradle file and it applies in main build.gradle file

apply from: 'dependencies.gradle'

Bonus 1: Tests

       This project contains all its units and UI tests and I strongly recommmend you to have a look cache layer unit tests because there are Room and local storage tests.

Bonus 2: ReactiveNetwork

       You can learn the implementation of the ReactiveNetwork and how to broadcast the network connection with Rx from this project. It is really useful because there is a behaviour changes between API levels.

Core Libraries

Summary

      To use Clean Architecture or not, this is not requirement actually this is up to you and your project. But if you want to seperate your concerns for example testing, maintaining. I found it really useful.

Thanks

      This project is based on Joe Birch's Github Trending If you have any questions, hit me on Twitter

Licence

Copyright 2019 Tayfun CESUR

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].