This app is built using https://rapidapi.com/contextualwebsearch/api/web-search API
This repository contains a detailed Image Search app that implementsClean Architecture with MVVM designpattern using Dagger2, Room, RxJava2, OkHttp3, Glide and Retrofit2
You will need to create an account from RapidAPI to obtain the API key as per instructions given in https://docs.rapidapi.com/docs.
In data layer RemoteSearchImageDataSource.java
return mApiServiceInterface.getSearchImagesBasedOnQuery(BuildConfig.RAPID_API_HOST,
BuildConfig.API_KEY, query, page, perSize, true, false);
Replace BuildConfig.API_KEY
with your key you have obtain from RapidAPI
On Your MacBook Open the Terminal
Put this into ~/.gradle/gradle.properties
RAPID_API_KEY={api_key_received_from_rapidapi_com}
- Modular approch followed
- It is heavily implemented by following standard clean architecture principle.
- Unit testing written for domain and data layers.
- Offline capability.
- S.O.L.I.D priciple followed for more understandable, flexible and maintainable.
App layers/module:
-
Domain - Would execute business logic which is independent of any layer and is just a pure kotlin/java package with no android specific dependency.The domain layer responsibility is to simply contain the UseCase instance used to retrieve data from the Data layer and pass it onto the Presentation layer.
-
Data - Would dispense the required data for the application to the domain layer by implementing interface exposed by the domain. The Data layer is our access point to external data layers and is used to fetch data from multiple sources (the cache and remote in our case).
-
Presentation - This layer's responsibility is to handle the presentation of the User Interface, but at the same time knows nothing about the user interface itself. This layer has no dependence on the Android Framework, it is a pure Kotlin module. Each ViewModel class that is created implements the ViewModel class found within the Architecture components library. This ViewModel can then be used by the UI layer to communicate with UseCases and retrieve data.
- RxJava2: https://github.com/amitshekhariitbhu/RxJava2-Android-Samples
- Dagger2: https://github.com/MindorksOpenSource/android-dagger2-example
- Retrofit2: https://square.github.io/retrofit/
- OkHttp3: https://square.github.io/okhttp/
- Glide: https://bumptech.github.io/glide/
- Room: https://developer.android.com/topic/libraries/architecture/room.html
- LiveData: https://developer.android.com/topic/libraries/architecture/livedata
- ViewModel: https://developer.android.com/topic/libraries/architecture/viewmodel
- Gson: https://github.com/google/gson
- Mockito: http://site.mockito.org
Copyright (C) 2021 Paramanathan Ilanthirayan
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.