Skip to content

Commit faa30ff

Browse files
committed
minor change: readme, icon etc.
1 parent b2c16ab commit faa30ff

27 files changed

+33
-55
lines changed

ReadMe.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
## Android Weather App
22

33
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.
4+
to use the location as default weather location. ~~By default city **London, UK** is selected~~ On first use of app an alter dialog is show to choose a city.
55

66
### Features
77

88
1. current weather report
99
2. hourly weather forecast
1010
3. find and set weather location
11+
1. choose from saved cities
12+
2. search cities
1113
4. 7 days weather forecast
14+
5. locally cached for offline first
1215

1316
### Learning Outcome
1417

@@ -54,8 +57,14 @@ contains the api key value. I added an Interceptor that appends `key` query para
5457
- **Get ViewModel:** using `ViewModelProvider.get(Class)` I can get and existing view model instance or create if not exists
5558
- **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
5659
click events like single click, long click etc. finally an instance of OnItemTouchListener to be added to RecyclerView with `addOnItemTouchListener`
60+
- **Working with data layer and multiple data source:** The app now use **Room** as local data source and the **WeatherApi* api as remote data source. Android data layer design guideline is follow to design difference data source and repository to
61+
properly perform the crud operation while maintaining data integrity.
62+
- **DI using koin:** **koin** di library is used to perform dependency injection
5763

5864
### Change Log
65+
- **v3.0**
66+
local cache implemented via [Room](https://developer.android.com/training/data-storage/room) and made it offline first
67+
5968
- **v2.0**
6069
4 features implemented
6170
1. city search and change current weather location
85.8 KB
Loading

app/src/main/res/layout/activity_city_search.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
77
android:orientation="vertical"
8-
android:gravity="center"
8+
android:gravity="top|center_horizontal"
99
tools:context=".ui.search.CitySearchActivity">
1010

1111
<EditText
@@ -54,7 +54,7 @@
5454
android:layout_width="match_parent"
5555
android:layout_height="match_parent"
5656
android:layout_weight="1"
57-
android:layout_margin="8dp"
57+
android:layout_marginTop="16dp"
5858
android:visibility="gone"
5959
tools:visibility="visible"/>
6060

app/src/main/res/layout/activity_weather_forecast.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
android:layout_width="match_parent"
3333
android:layout_height="match_parent"
3434
tools:listitem="@layout/item_daily_weather_forecast"
35-
android:layout_marginStart="8dp"
36-
android:layout_marginEnd="8dp"
37-
android:layout_marginTop="16dp"
3835
android:layout_marginBottom="8dp"
3936
android:visibility="gone"
4037
tools:itemCount="3"

app/src/main/res/layout/hourly_forecast_item.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@
2323
android:textAlignment="center"
2424
android:layout_marginTop="4dp"
2525
android:textAppearance="@style/TextAppearance.AppCompat.Large"
26+
android:textColor="?attr/colorOnSecondary"
2627
tools:text="12:00 AM"/>
2728

2829
<com.github.pwittchen.weathericonview.WeatherIconView
2930
android:id="@+id/icon_weather_condition"
3031
android:layout_width="36dp"
3132
android:layout_height="36dp"
3233
android:layout_marginTop="8dp"
33-
app:weatherIconColor="?android:attr/textColorPrimary"
34+
app:weatherIconColor="?attr/colorOnSecondary"
3435
app:weatherIconSize="24"/>
3536

3637
<TextView
@@ -41,6 +42,7 @@
4142
android:textAlignment="center"
4243
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
4344
android:textStyle="bold"
45+
android:textColor="?attr/colorOnSecondary"
4446
tools:text="55°c"/>
4547

4648
<TextView
@@ -50,6 +52,7 @@
5052
android:layout_marginTop="8dp"
5153
android:textAlignment="center"
5254
android:textAppearance="@style/TextAppearance.AppCompat.Small"
55+
android:textColor="?attr/colorOnSecondary"
5356
android:maxLines="2"
5457
tools:text="Moderate snow with thunder" />
5558

app/src/main/res/layout/item_daily_weather_forecast.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
app:layout_constraintTop_toTopOf="parent"
1515
app:layout_constraintStart_toStartOf="parent"
1616
app:weatherIconSize="36"
17-
app:weatherIconColor="@color/black"/>
17+
app:weatherIconColor="@android:color/black"/>
1818

1919

2020
<TextView android:id="@+id/label_date"
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3-
<background android:drawable="@drawable/ic_launcher_background" />
4-
<foreground android:drawable="@drawable/ic_launcher_foreground" />
5-
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
3+
<background android:drawable="@color/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
65
</adaptive-icon>
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3-
<background android:drawable="@drawable/ic_launcher_background" />
4-
<foreground android:drawable="@drawable/ic_launcher_foreground" />
5-
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
3+
<background android:drawable="@color/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
65
</adaptive-icon>
206 Bytes
Loading
2.29 KB
Loading

0 commit comments

Comments
 (0)