Skip to content

fyildirim-debug/glass-widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌀️ Glass Widget β€” Clock & Weather

A minimal, boxless home-screen widget for Android that shows a live clock and global weather β€” directly on your wallpaper, with no app-drawer icon and zero third-party dependencies.

πŸ‡¬πŸ‡§ English Β Β·Β  πŸ‡ΉπŸ‡· TΓΌrkΓ§e

Platform minSdk Kotlin Dependencies APK size License

Glass Widget on the home screen

✨ What is it?

Glass Widget is a 5Γ—2 Android home-screen widget that combines a large, elegant live clock with the current weather for your location. It is intentionally boxless β€” the text sits straight on your wallpaper (no card, no frame), in the spirit of the stock Android digital-clock widget.

  • πŸ• Tap the clock β†’ opens your Clock app
  • 🌦️ Tap the weather β†’ opens your Weather app
  • πŸ™ˆ No icon in the app drawer β€” it behaves like a pure background app; it only shows up in the widget picker and in Settings β†’ Apps.
  • 🌍 Global weather via Open-Meteo β€” works anywhere on Earth, no API key required.
  • πŸͺΆ Zero third-party dependencies β€” 100% Android framework + Kotlin stdlib. The APK is only ~880 KB.

Optimized for Xiaomi / Redmi / POCO (MIUI) with sensible fallbacks that keep it working on any brand.


πŸ“Έ Screenshots

Home-screen widget Add / permission screen

The date and weather condition are localized to your device language (e.g. 18 July Β· Saturday / Clear in English, 18 Temmuz Β· Cumartesi / AΓ§Δ±k in Turkish).


πŸš€ Features

  • Live clock using TextClock β€” updates itself with zero battery cost.
  • Global current weather (temperature, condition, city) from Open-Meteo β€” no key, no sign-up.
  • Boxless / transparent design β€” big, clean type on your wallpaper with legible text shadows.
  • Bilingual UI β€” English (default) and Turkish, auto-selected by device language.
  • Two independent tap zones β€” clock β†’ Clock app, weather β†’ Weather app (Xiaomi-first with fallbacks to Google/Samsung/AOSP, and finally a web weather page).
  • No launcher icon β€” no LAUNCHER activity is declared, so nothing appears in the app drawer.
  • Actively finds your location β€” fetches a fresh fix from the Android LocationManager (network + GPS, no Google Play Services required) and reverse-geocodes the city name. Falls back to a configurable default city only when location is unavailable.
  • Auto-refresh ~every 10 minutes and after reboot β€” runs even if the app is never opened, via AlarmManager + a JobService; re-armed on BOOT_COMPLETED. No WorkManager (which MIUI aggressively kills).
  • Tiny & self-contained β€” ~880 KB APK, no external libraries.

πŸ“¦ Installation

Option A β€” Install the prebuilt APK

  1. Download the latest GlassWidget-x.y.apk from the Releases page.
  2. Copy it to your phone and open it. Allow "install from unknown sources" if prompted.
  3. There is no app icon to look for (by design) β€” go straight to adding the widget.

Option B β€” Build from source

Requires the Android SDK (API 36) and JDK 17+.

git clone https://github.com/fyildirim-debug/glass-widget.git
cd glass-widget
./gradlew assembleDebug        # Windows: .\gradlew.bat assembleDebug
# APK: app/build/outputs/apk/debug/app-debug.apk

Or just open the folder in Android Studio and press Run.


βž• Adding the widget

  1. Long-press an empty area of your home screen β†’ Widgets.
  2. Find β€œGlass Β· Clock & Weather” and drop it onto the home screen (it fills a 5Γ—2 area).
  3. On the setup screen tap β€œUse location & add”:
    • Grant the normal location prompt (β€œWhile using the app”).
    • On the next screen choose β€œAllow all the time” so the weather keeps tracking your location while you travel. (Android hides β€œAllow all the time” from the first dialog for privacy β€” it only appears on the second step / in Settings.)
    • Prefer not to share location? Tap β€œAdd without permission” β€” a default city (Istanbul, editable in code) is used.

πŸ“Œ MIUI (Xiaomi/Redmi/POCO) notes

For reliable background weather refresh:

  • Settings β†’ Apps β†’ Glass Widget β†’ Autostart β†’ enable
  • Settings β†’ Apps β†’ Glass Widget β†’ Battery saver β†’ No restrictions
  • Location permission β†’ Allow all the time

The clock is always live regardless of these β€” they only affect automatic weather refresh.


🎨 Customization

What File How
Default city (when no permission) app/src/main/java/.../Config.kt DEFAULT_LAT / DEFAULT_LON / DEFAULT_CITY
Which apps open on tap app/src/main/java/.../AppLaunch.kt CLOCK_PACKAGES / WEATHER_PACKAGES
Clock font weight res/layout/widget_glass.xml fontFamily β€” sans-serif, -light, -thin, -medium
Text sizes / layout res/layout/widget_glass.xml textSize, layout_weight, padding
Text colors / shadows res/layout/widget_glass.xml + res/values/colors.xml textColor, shadow*
Clock & date format res/layout/widget_glass.xml format24Hour on clock_time / clock_date
Translations res/values/strings.xml (EN) Β· res/values-tr/strings.xml (TR) add a values-<lang> folder for more languages

🧩 How it works (architecture)

GlassWidgetProvider (AppWidgetProvider + BroadcastReceiver)
β”œβ”€ onUpdate / onEnabled β†’ render cached data, schedule alarm, refresh now
β”œβ”€ onReceive            β†’ ACTION_REFRESH (alarm) & BOOT_COMPLETED β†’ reschedule + refresh
β”œβ”€ buildViews(context)  β†’ RemoteViews (clock + weather + click PendingIntents)
└─ refreshBlocking()    β†’ active location β†’ reverse-geocode β†’ Open-Meteo β†’ cache β†’ re-render

WidgetScheduler      β†’ AlarmManager (~10 min) + one-shot JobScheduler
WeatherJobService    β†’ runs refreshBlocking() in a long window (no ~10s broadcast limit)
WidgetConfigActivity β†’ shown when the widget is added; two-step location permission
LocationHelper       β†’ framework LocationManager: active fix (network + GPS) + reverse geocode
WeatherRepository    β†’ Open-Meteo current weather over HttpURLConnection (org.json)
WeatherCodes         β†’ WMO code β†’ emoji + localized condition string
Config               β†’ SharedPreferences cache + defaults
AppLaunch            β†’ resolves the Clock / Weather app intents (with fallbacks)

Design decisions

  • No WorkManager / Play Services β€” MIUI kills background workers aggressively and not every device ships GMS. AlarmManager (10-min tick) firing a short-lived JobService, plus the framework LocationManager, is more robust and keeps the app dependency-free.
  • Active location β€” the refresh requests a fresh fix (network + GPS) rather than only reading the last-known one, then reverse-geocodes the city. This needs "Allow all the time" to work from the background on Android 10+.
  • RemoteViews-safe layout β€” widgets only allow a whitelist of views (no bare View), so the layout uses TextClock, TextView, ImageView and LinearLayout only.

πŸ› οΈ Tech stack

  • Language: Kotlin
  • Min / Target / Compile SDK: 24 / 36 / 36
  • Build: Gradle (AGP with built-in Kotlin)
  • Weather API: Open-Meteo (free, key-less, global)
  • Dependencies: none (Android framework + Kotlin stdlib only)

πŸ—ΊοΈ Roadmap ideas

  • In-widget settings screen to change city without rebuilding
  • Extra metrics (feels-like, humidity, wind) and an hourly strip
  • Additional sizes (4Γ—2, 5Γ—1) and theme accents
  • More translations

Contributions and suggestions are welcome β€” open an issue or a PR.


🩺 Troubleshooting

Shows a default city (e.g. Istanbul) instead of my location

  1. Turn Location on system-wide (quick settings).
  2. Grant the location permission as β€œAllow all the time” (Settings β†’ Apps β†’ Glass Widget β†’ Permissions β†’ Location). Background location is required for the widget to update your position on its own.
  3. On MIUI: enable Autostart and set Battery β†’ No restrictions.
  4. Give it a few minutes (it refreshes ~every 10 min and shortly after you unlock the phone), or remove & re-add the widget to force an immediate update.

Watch what it resolves with:

adb logcat -s GlassWidget:I
# refresh: located=true city=Ankara permission=true
# weather: 21Β° (Ankara)

β€œCan't load widget” after adding it β€” reinstall the latest APK (older builds had a layout bug, fixed in v1.0+).

Weather never loads β€” make sure the phone has internet; the widget calls https://api.open-meteo.com.


πŸ“„ License

Released under the MIT License β€” see LICENSE.


Keywords: android widget Β· home-screen widget Β· app widget Β· clock widget Β· weather widget Β· glassmorphism Β· boxless widget Β· minimal widget Β· kotlin Β· textclock Β· remoteviews Β· open-meteo Β· no-dependencies Β· xiaomi Β· miui Β· digital clock Β· weather Β· appwidgetprovider

Made with ❀️ for a cleaner home screen.

About

Minimal boxless clock & weather home-screen widget for Android - live clock, global weather (Open-Meteo), no app-drawer icon, zero dependencies. MIUI-friendly.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages