-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Urdzik/dagger2-branch-activity
Added dagger 2 and new caching system
- Loading branch information
Showing
47 changed files
with
557 additions
and
663 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,59 @@ | ||
# MovieApp | ||
![MovieApp](/readme/Photo%20for%20github.png?raw=true) | ||
|
||
|
||
[![Kotlin](https://img.shields.io/badge/Kotlin-1.3.61-blue.svg)](https://kotlinlang.org) | ||
[![Dagger2](https://img.shields.io/badge/Dagger%202-2.26-red.svg)](https://github.com/google/dagger) | ||
[![Material design](https://img.shields.io/badge/Material%20Design-1.2.0--alpha%205-%237464f2)](https://material.io) | ||
|
||
<h3 size="1">Application which retrieves data from Webserver (via Retrofit), saves it into Room and get from it if user is offline. There are applying MVVM architecture pattern and Dagger 2 example.</h3><br/> | ||
|
||
<font size="6">Overview:</font><br/> | ||
======================================================= | ||
|
||
|
||
* ### __Model__ | ||
Model is implemented as Repository pattern. Firstly it begins from internet connection checking. Consequently if it's alive we're retrieving data from the server (by using Retrofit 2) and inserting into the SQLite database. Otherwise we're trying to fetch data from the SQLite itself. | ||
* ### __View__ | ||
View is realised as 2 fragments. First one contains RecyclerView, second one depends on clicks on recycler-items and finally displays detailed data fetched from the Model. It implements state saving reflected on configuration changes. | ||
<br/><br/> | ||
|
||
<div align = "center"> | ||
<img src = "readme/Screenshot_1582798408_framed.png?raw=true" width="330"> | ||
<img src = "readme/Screenshot_1582798427_framed.png?raw=true" width="330"> | ||
</div> | ||
|
||
* ### __ViewModel__ | ||
ViewModel is responsible for transferring data between view and model. | ||
* ### __Dagger 2__ | ||
– Implementation of dependency injection for communication between app modules<br/> | ||
– AndroidInjector applying for injecting into View components<br/> | ||
– Unit-testing simplifying | ||
<br/><br/> | ||
|
||
|
||
<font size="6">Applied technologies and libraries:</font><br/> | ||
======================================================= | ||
|
||
* ### __Model__ | ||
* __Retrofit 2__ <br/> | ||
– getting data from server into pojo-classes | ||
|
||
* __SQLite__ <br/> | ||
– storing data fetched from server. User get data here if he is offline | ||
|
||
* __Coroutines__ <br/> | ||
– managing asynchronous database and network queries<br/> | ||
– using instead of callbacks<br/> | ||
– providing light asynchronous operations | ||
|
||
* ### __ViewModel__ | ||
* __LiveData__ <br/> | ||
– observer-pattern implementation for View interaction | ||
|
||
* ### __View__ | ||
* __Fragments__ <br/> | ||
– interactive displaying and click reflecting | ||
|
||
* __Data Binding__ <br/> | ||
– replace basic operations with UI (e.g. findViewById() ) to the XML | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.example.movieapp.dagger | ||
|
||
import android.app.Application | ||
import com.example.movieapp.dagger.component.AppComponent | ||
import com.example.movieapp.dagger.component.DaggerAppComponent | ||
import com.example.movieapp.dagger.module.NetworkModule | ||
import com.example.movieapp.ui.detail.DetailActivity | ||
|
||
|
||
class App : Application(){ | ||
companion object{ | ||
lateinit var appComponent: AppComponent | ||
} | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
appComponent = DaggerAppComponent | ||
.builder() | ||
.networkModule(NetworkModule(this)) | ||
.build() | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/example/movieapp/dagger/component/AppComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.example.movieapp.dagger.component | ||
|
||
|
||
import com.example.movieapp.dagger.module.NetworkModule | ||
import com.example.movieapp.dagger.module.viewModule.ViewModelModule | ||
import com.example.movieapp.ui.detail.DetailActivity | ||
import com.example.movieapp.ui.overview.OverviewFragment | ||
import dagger.Component | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
@Component(modules = [NetworkModule::class, ViewModelModule::class]) | ||
interface AppComponent{ | ||
fun inject(overviewFragment: OverviewFragment) | ||
fun inject(detailActivity: DetailActivity) | ||
} |
Oops, something went wrong.