The WeatherApp is a simple Android application that allows users to search for real-time weather information for any city using the OpenWeather API. With a user-friendly interface, users can view the current temperature, feels-like temperature, humidity, and the time of the last weather update.
- Real-time weather search by city.
- Displays the current temperature (in Celsius), feels-like temperature, humidity, and city name.
- Minimalistic and user-friendly interface.
- Customized toast for errors and messages.
- Kotlin: Main language used for app development.
- Coroutines: Used for asynchronous operations like requests to the weather API.
- Retrofit: Library used for consuming RESTful APIs.
- OpenWeather API: API used to obtain weather information.
- Material Design: Android Material Design components for a visually appealing interface.
- Customized Toast: To display more striking error messages.
- Android Studio 4.1 or higher.
- Gradle 7.0 or higher.
- An account on [OpenWeather API](https://openweathermap.org/api) to obtain an API key.
1. Clone the repository:
```bash
git clone git@github.com:SamuelRocha91/kotlinWeatherApp.git
```
2. Open the project in **Android Studio**.
3. Add your OpenWeather API key in the `local.properties` file:
```
API_KEY=your_api_key_here
```
4. Build and run the project on your emulator or Android device.
- MainActivity.kt: Main activity of the application that manages the interface and handles user interactions.
- OpenWeather.kt: Interface that defines the calls to the weather API using Retrofit.
- Utilities: Utility functions, such as converting Unix timestamp to a readable format, can be extracted and placed in a utility class.
- Layouts: XML layout files defined in the
res/layout
folder, which include the structure of the user interface.
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.google.android.material:material:1.4.0"
- Open the app.
- Enter the name of a city in the search field.
- Click the "Search" button.
- View the weather information, including:
- Current temperature.
- Feels-like temperature.
- Humidity.
- City and country name.