Skip to content

LvJujin/WeaKnow

Repository files navigation

WeaKnow | ็Ÿฅ้ฃŽ้›จ

Version Platform MinSDK License

A Clean and Elegant Android Weather Application

Features โ€ข Tech Stack โ€ข Quick Start โ€ข Architecture โ€ข Contributing


๐Ÿ“– Introduction

WeaKnow is an Android application focused on providing accurate and timely weather information services. Through the combination of "localized data + multi-source API + intelligent background synchronization", it provides users with a one-stop weather experience including real-time weather, hourly/daily forecasts, air quality, and life indices.

Design Philosophy

  • Accuracy & Timeliness: Based on Amap (Gaode Maps) positioning and QWeather API, combined with local database caching and periodic background synchronization to ensure data freshness and stability
  • Multi-location Management: Supports adding, switching, and deleting multiple cities or locations to meet diverse needs such as cross-city travel and hometown monitoring
  • Visual & Interaction: Adopts Material Design 3 theme and Lottie dynamic backgrounds, automatically switching background animations based on weather types to enhance user experience

โœจ Features

Core Features

  • ๐ŸŒก๏ธ Real-time Weather Information - Current temperature, feels-like temperature, weather phenomena, wind direction and speed, and other real-time data
  • โฐ Hourly Weather Forecast - 6-24 hour weather trends with temperature curve visualization
  • ๐Ÿ“… Future Weather Forecast - 7-15 day weather predictions including high/low temperatures, precipitation probability, humidity, and other detailed metrics
  • ๐ŸŒฌ๏ธ Air Quality Monitoring - AQI index, major pollutant concentrations, and air quality level visualization
  • ๐Ÿ“Š Life Index Reminders - Multi-dimensional life advice including clothing, car washing, UV index, and sports
  • ๐Ÿ“ Multi-location Management - Supports adding, switching, and deleting multiple cities for quick weather checks in different regions
  • โš ๏ธ Weather Warning Notifications - Real-time push notifications for meteorological disaster warnings
  • ๐ŸŽจ Smart Background Animation - Automatically switches Lottie dynamic backgrounds based on weather types

Technical Highlights

  • ๐Ÿ”„ Intelligent Background Synchronization - Four-level synchronization strategy (real-time/short-term/mid-term/long-term) balancing data freshness and battery consumption
  • ๐Ÿ’พ Offline Availability - Room local cache allows viewing historical data in weak or no network environments
  • ๐ŸŽฏ Material Design 3 - Follows the latest design specifications, supports dynamic colors and dark mode
  • โšก Coroutine Concurrency - Multi-interface concurrent requests improve data synchronization efficiency
  • ๐Ÿ—๏ธ MVVM Architecture - Clear layered design, easy to maintain and extend

๐Ÿ› ๏ธ Tech Stack

Core Technologies

Technology Description
Kotlin Primary development language
Jetpack Compose Modern UI toolkit
Material Design 3 UI design specification
MVVM Architecture pattern
Room Local database
Retrofit + OkHttp Network requests
WorkManager Background task scheduling
Koin Dependency injection
Coroutines + Flow Asynchronous programming
Lottie Animation rendering

Third-party Services

  • QWeather API - Weather data source
  • Amap (Gaode Maps) API - Positioning and geocoding services

๐Ÿš€ Quick Start

Requirements

  • Android Studio Arctic Fox or higher
  • JDK 17+
  • Android SDK 35
  • Gradle 8.10.2

Clone the Project

git clone https://github.com/LvJujin/WeaKnow.git
cd WeaKnow

Configure API Keys

  1. Create a local.properties file in the project root directory
  2. Add the following configurations:
# QWeather API Key
QWEATHER_WEB_API_KEY=your_qweather_api_key

# Amap API Keys
AMAP_WEB_API_KEY=your_amap_api_key
AMAP_ANDROID_API_KEY=your_amap_android_key

# Application Signature SHA1
CERT_SHA1=your_cert_sha1

Build and Run

  1. Open the project with Android Studio
  2. Wait for Gradle synchronization to complete
  3. Connect an Android device or start an emulator
  4. Click the run button

๐Ÿ—๏ธ Architecture

Layered Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚            UI Layer                 โ”‚
โ”‚  (Compose UI, Activity, Screen)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         ViewModel Layer             โ”‚
โ”‚    (State Management, Logic)        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚        Repository Layer             โ”‚
โ”‚   (Data Coordination, Cache)        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
      โ”‚                       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Remote API  โ”‚      โ”‚ Local Databaseโ”‚
โ”‚  (Retrofit)  โ”‚      โ”‚    (Room)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Core Modules

Data Layer

  • Repository: Encapsulates data access logic, coordinates remote API and local database
  • DAO: Room data access objects, defines database operations
  • Entity: Database entity models
  • API Client: Retrofit service interfaces, encapsulates network requests

Business Layer

  • ViewModel: Manages UI state, handles business logic
  • Worker: Background synchronization tasks, ensures data freshness
  • UseCase: Business use case encapsulation (if applicable)

Presentation Layer

  • Activity: Application entry point, permission management, navigation control
  • Screen: Compose page components
  • Component: Reusable UI components
  • Theme: Theme and style definitions

Background Synchronization Strategy

Sync Type Frequency Data Content
Real-time Sync 15 minutes Real-time weather, warning information
Short-term Sync 30 minutes Hourly forecast, air quality
Mid-term Sync 1 hour Multi-day forecast
Long-term Sync 6 hours Weather indices

๐Ÿ“ฑ Screenshots

Note: Please add actual screenshots based on the application interface


๐Ÿ“‚ Project Structure

app/src/main/
โ”œโ”€โ”€ kotlin/me/ljj/weaknow/
โ”‚   โ”œโ”€โ”€ application/          # Application class
โ”‚   โ”œโ”€โ”€ ui/                   # UI Layer
โ”‚   โ”‚   โ”œโ”€โ”€ activity/         # Activities
โ”‚   โ”‚   โ”œโ”€โ”€ screen/           # Screen components
โ”‚   โ”‚   โ”œโ”€โ”€ component/        # Reusable components
โ”‚   โ”‚   โ”œโ”€โ”€ layout/           # Layout components
โ”‚   โ”‚   โ”œโ”€โ”€ dialog/           # Dialogs
โ”‚   โ”‚   โ””โ”€โ”€ theme/            # Theme styles
โ”‚   โ”œโ”€โ”€ viewmodel/            # ViewModels
โ”‚   โ”œโ”€โ”€ data/                 # Data Layer
โ”‚   โ”‚   โ”œโ”€โ”€ remote/           # Remote data
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ api/          # API interfaces
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ client/       # API clients
โ”‚   โ”‚   โ”œโ”€โ”€ local/            # Local data
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ database/     # Database
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ dao/          # DAOs
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ entity/       # Entities
โ”‚   โ”‚   โ””โ”€โ”€ repository/       # Repositories
โ”‚   โ”œโ”€โ”€ domain/               # Domain Layer
โ”‚   โ”‚   โ”œโ”€โ”€ model/            # Business models
โ”‚   โ”‚   โ””โ”€โ”€ response/         # API response models
โ”‚   โ””โ”€โ”€ core/                 # Core utilities
โ”‚       โ”œโ”€โ”€ constant/         # Constants
โ”‚       โ”œโ”€โ”€ util/             # Utilities
โ”‚       โ”œโ”€โ”€ extension/        # Extension functions
โ”‚       โ”œโ”€โ”€ config/           # Configuration
โ”‚       โ””โ”€โ”€ interfaze/        # Interface definitions
โ”œโ”€โ”€ res/                      # Resource files
โ””โ”€โ”€ assets/                   # Static assets
    โ””โ”€โ”€ ic_qweather/          # Weather icons

๐Ÿ”ง Development Guide

Code Standards

  • Follow Kotlin official coding conventions
  • Use KDoc for documentation comments
  • Follow MVVM architecture layering principles
  • Compose UI components use functional programming style

Commit Convention

feat: New feature
fix: Bug fix
docs: Documentation update
style: Code formatting
refactor: Code refactoring
test: Testing
chore: Build/tooling

๐Ÿงช Testing

Run Unit Tests

./gradlew test

Run UI Tests

./gradlew connectedAndroidTest

๐Ÿ“„ License

This project is licensed under the GNU General Public License v3.0.

Copyright (C) 2024 ๅ•้’œ่ฟ› (Lv Jujin)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Lv Jujin (ๅ•้’œ่ฟ›)


๐Ÿค Contributing

Issues and Pull Requests are welcome!

  1. Fork this repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'feat: Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ฎ Contact

If you have any questions or suggestions, feel free to contact us through:


๐Ÿ™ Acknowledgments


โญ If this project helps you, please give it a star! โญ

Made with โค๏ธ by Lv Jujin

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages