Skip to content

Develop - AI advice card and air quality (AQI) card - #26

Open
HmnDev-Tech wants to merge 7 commits into
sameerasw:developfrom
HmnDev-Tech:feature/ai-advice-aqi
Open

HmnDev-Tech wants to merge 7 commits into
sameerasw:developfrom
HmnDev-Tech:feature/ai-advice-aqi

Conversation

@HmnDev-Tech

Copy link
Copy Markdown

Summary

Adds two new cards to the main weather screen plus a settings section to configure them. No build or CI changes — purely feature code.

AI advice card (What to wear today)

  • A new card on the main screen sends a compact summary of the current weather (temperature, feels like, humidity, wind, rain chance, high/low, active alerts) to an LLM and renders short advice: what to wear, whether to take an umbrella, best time to go outside, one health tip.
  • Default model: gemini-3.5-flash-lite via the Google AI Studio API (generativelanguage.googleapis.com), chosen for low latency and low cost at small request volumes.
  • The API key is entered in Settings → AI advice and stored on-device only (same pattern as weather provider keys); the key is sent only to the selected provider.
  • Provider selection between cloud providers:
    • Gemini (AI Studio) — native generateContent endpoint, free-key link in settings.
    • OpenAI — OpenAI-compatible /chat/completions, custom model + base URL.
    • OpenRouter — OpenAI-compatible, custom model + base URL.
  • Model name and base URL are editable per provider with sensible pre-filled defaults.
  • All card states handled: no key yet (button straight to settings), loading, error with the message shown, cached advice with a refresh button.

Air quality (AQI) card

  • A standalone card fetching live data from the Open-Meteo Air Quality API (no API key required): US AQI, PM2.5, PM10, O3, NO2.
  • Category label with color coding: Good / Moderate / Unhealthy for sensitive groups / Unhealthy / Very unhealthy / Hazardous.
  • Uses the same location resolution as the weather data (manual location first, then device location).
  • Manual refresh button; the data source is credited in the card footer.

Both cards are added to the portrait layout and the wide/two-pane (tablet/foldable) layout.

Files changed

  • weather/ai/AiProviders.kt, weather/ai/AiAdvisor.kt — provider registry and Gemini / OpenAI-compatible client (HTTP via the existing ProviderHttp).
  • weather/aqi/AqiRepository.kt — Open-Meteo air quality fetch + category mapping.
  • ui/features/weather/AiAdviceCard.kt, ui/features/weather/AqiCard.kt — the two new cards.
  • ui/features/weather/AiSettingsUI.kt — new settings section, mounted in SettingsActivity.
  • ui/features/weather/WeatherDetailSheet.kt — cards inserted in both layouts.
  • data/repository/SettingsRepository.kt — AI provider / model / base URL / key storage (SharedPreferences, same pattern as weather keys).
  • res/values/strings.xml — new strings.

Testing

  • Local: ./gradlew assembleGithubDebug succeeds on JDK 21 / Android SDK 37.1; all new Kotlin code compiles.
  • Not run: assembleGithubRelease (minified build).
  • Manual on-device testing of the AI/AQI cards not performed yet — feedback welcome.

Notes for maintainers

  • Privacy: the API key and weather summary are only sent to the provider the user selected; nothing else leaves the device and nothing is logged.
  • Strings are English-only, matching the current values/strings.xml; happy to add translations if there is a localization flow.
  • The AI settings section renders below the existing settings groups and the cards render below the details card, so existing sections are untouched.

sameerasw and others added 7 commits October 7, 2026 20:50
DevelopDevelop - more weather units, lowe sdk, improve rain and particle visuals, adjsut effect intensity, improve app startup, improve location, custom icons and more
Develop - Widgets, Screensaver, full screen mode, Compatibility mode and more
Develop - new settings UI, remove accurate location, onboarding, accuweather, build flavors, play billing
Develop - Island SDK and remote rendering
Develop  - timeline mode, ui fixes, landscape ui, yandex weather, moon phases, past hour weather data fix, improved effects, fixed screesaver heaviors and more
@HmnDev-Tech
HmnDev-Tech changed the base branch from main to develop October 15, 2026 17:10
@HmnDev-Tech HmnDev-Tech changed the title feat: AI advice card and air quality (AQI) card Develop - AI advice card and air quality (AQI) card Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants