Comments (2)
I rewrote the REST services to be injected through Dagger 2.
I added NetworkModule.java, (interface)Repository.java , GiphyService.java and removed ServiceUtil.java
Repository is injected so now
//MainFragment, Field Injection
@Inject Repository mRepository
...
...
...void loadTrendingImages(){
loadImages(mRepository.getTrendingResults())
}
GiphyService implements repository and the lower abstraction methods are now private
//Constructor injection
@Inject
public GiphyService(String accessToken, GiphyApiService service){...}
@OverRide
public Observable getTrendingResults(){
return getTrendingResults(mAccessToken);
// and lower abstractions such as limits, searches etc.
}
However I did not rewrite the GiphyServiceTest since I'm not yet totally sure how to do it with Dagger, but I'm working on learning it. If you know how to do it feel free to fix it
In the meantime you can check my fork here if you want
from android-gif-search.
Ok cool. I will check it out!
from android-gif-search.
Related Issues (19)
- Modularize build
- Hilt on GifAdapter HOT 1
- Remove DI injections from tests
- Look into using the Dagger for Android HOT 1
- Use Glide's RecyclerView preloader integration HOT 1
- Look into new Android Architecture components HOT 2
- Need better icon for app
- Fix Espresso tests in 'androidTest' HOT 1
- Question not an issue HOT 6
- OutOfMemoryError HOT 4
- Fix espresso tests on API 19 and lower
- Use "gradlePluginPortal()" instead of "maven { setUrl("https://plugins.gradle.org/m2/") }"
- Use Jack HOT 1
- Add endless scrolling
- Upgrade to Mockito-Kotlin 2 HOT 1
- Create null to non null default value Moshi type adapter
- Material components
- Plugin unsupported on gradle 5.4.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-gif-search.