Skip to content

Commit 4e11cf1

Browse files
committed
updated readme and app version
1 parent 7ca6a36 commit 4e11cf1

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

ReadMe.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
## Android Weather App
22

3+
This is a simple android weather application that fetches weather data from [WeatherApi](https://weatherapi.com). It provides current hour data, hourly weather forecast, seven days weather forecast and city search. Selected city from city search result is saved in a shared preference
4+
to use the location as default weather location. By default city **London, UK** is selected.
5+
36
### Features
47

8+
1. current weather report
9+
2. hourly weather forecast
10+
3. find and set weather location
11+
4. 7 days weather forecast
12+
513
### Learning Outcome
614

715
- **Storing Secret Information:** For api calls we need api key. But this key should not be pushed to public repositories. Therefore, the right way to store and pass the apikey or any sensitive data during build time is adding it in `local.properties` in project root.
@@ -43,8 +51,17 @@ Like for this project gson converter is used so all the request body will be ser
4351
path will be considered relative the domain part. So don't prepend `/` in service method url paths. For example: if `@GET("/current.json")` then requests to https://api.weatherapi.com/current.json not to https://api.weatherapi.com/v1/current.json .
4452
- **OkHttpClient Interceptor:** In cases when I need to something for each request, then we can use OkHttpClient `Interceptor` interface to manipulate each request before sending. For example: this is project we need to append a `key` query which
4553
contains the api key value. I added an Interceptor that appends `key` query parameter to each request.
54+
- **Get ViewModel:** using `ViewModelProvider.get(Class)` I can get and existing view model instance or create if not exists
55+
- **RecyclerView item click:** to handle recyclerview item click i have used `RecyclerView.OnItemTouchListener` and `GestureDetector`. GestureDetector requires a `OnGestureListener`. This gesture listener provides different methods to handle different
56+
click events like single click, long click etc. finally an instance of OnItemTouchListener to be added to RecyclerView with `addOnItemTouchListener`
4657

4758
### Change Log
59+
- **v2.0**
60+
4 features implemented
61+
1. city search and change current weather location
62+
2. detailed weather report for current hour
63+
3. hourly weather forecast for current date
64+
4. 7 days weather forecast for the current weather location
4865

4966
- **v1.0**
5067
simple api call and display the current weather report for city **London** on success or log error body if request fails.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ android {
1111
applicationId "rahulstech.android.weatherapp"
1212
minSdk 26
1313
targetSdk 34
14-
versionCode 1
15-
versionName "1.0"
14+
versionCode 2
15+
versionName "2.0.0"
1616

1717
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1818

0 commit comments

Comments
 (0)