Shows latest Flickr feed images and metadata.
This project uses Clean architecture by means of Model-View-Presenter (MVP) for the presentation layer with repository pattern and
one network data source and another cache data source as well as Dagger 2
for Dependency Injection, trying to respect SOLID principles as much as possible.
The exchange between the different layers is as follows:
- Data layer: from the Repository, which is responsible of the data logic and communicating results to the Interactor
- Domain layer: from an Use Case, which is responsible of the business logic and communicating results to the Presenter
- Presentation layer: from the Presenter, which orchestrates different interactors when required and also provides the final formatted info to a passive
View
from a UI element (fragments / activities). Finally, this information would be passed through the UI thread. - All these 3 layers are tested in-depth. Therefore there is no need for UI testing, all the logic is tested.
- Shows the Flickr public feed as the latest 20 items uploaded by people
- Shows detail view of every feed item and its main meta data
- The code is lowly coupled and highly cohesive to enable SOLID principles
- TDD approach has been followed, using SOLID as a proper strategy to test small units
- Caches images (Picasso) & content on RAM memory (Cache data source)
- Internet connection handling when no connection
New Task is: Search by tag:
- using a SearchView or EditText with a debounce time to enable look after no key is pressed at the main screen to filter by tag
- the idea would be to index a list of items with the same tags under a dictionary or using a Trie instead if wanted to be predictable
- once a word is typed, the presenter asks to the use case, to pass information from the repository
- the repository asks to the cache data source, where would be parsed once the API request was done
- update at the saveFeed method of the cache data source would be required for it
Support SDKs from 19 to 27
- Dagger 2 for Dependency Injection
- Retrofit 2 with OkHttp for network requests
- RxJava 2 for multithreading and network response asynchronous handling
- Gson for easy JSON parsing
- Timber for console logging on debug mode only
- Picasso for image rendering and cache
- ButterKnife v8.X.X for Views Injection
References (special thanks) - those are the same I indicated at my personal blog (Insights and projects):
- Uncle Bob: The Clean Architecture by Uncle Bob
- The Repository pattern by Microsoft
- Effective Android UI by Pedro Gomez
- Android Clean Architecture by Fernando Cejas
Raul Hernandez Lopez,
Copyright (C) 2018 Raul Hernandez Lopez
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.