Skip to content

feat: Add home screen widget for one-click proxy toggle#1167

Open
cjb2667 wants to merge 1 commit intoMatsuriDayo:mainfrom
cjb2667:feat/home-screen-widget
Open

feat: Add home screen widget for one-click proxy toggle#1167
cjb2667 wants to merge 1 commit intoMatsuriDayo:mainfrom
cjb2667:feat/home-screen-widget

Conversation

@cjb2667
Copy link
Copy Markdown

@cjb2667 cjb2667 commented Apr 16, 2026

Summary

  • Add a 1x1 home screen widget (AppWidget) for one-click proxy on/off toggle
  • Widget displays a power icon with color-coded background indicating service state:
    • Dark gray = Stopped
    • Pink (#fb7299) = Connected
    • Orange = Connecting/Stopping
  • Widget runs in :bg process for instant state synchronization with the proxy service
  • Supports English, Simplified Chinese, and Traditional Chinese

Changes

  • New: ProxyToggleWidget.kt — AppWidgetProvider with toggle and state update logic
  • New: Widget layout, drawable resources, and widget info XML
  • Modified: BaseService.kt — triggers widget update on state change
  • Modified: AndroidManifest.xml — registers the widget receiver
  • Modified: Constants.kt — adds WIDGET_UPDATE action
  • Modified: strings.xml (en, zh-CN, zh-TW) — adds widget-related strings

Test plan

  • Add widget to home screen from widget picker
  • Tap widget to start proxy — background should turn pink
  • Tap widget again to stop proxy — background should turn dark gray
  • Verify connecting/stopping states show orange background
  • Test widget update after toggling from the app's main UI or quick settings tile

Made with Cursor

新增 1x1 大小的桌面小组件(Home Screen Widget),通过电源图标按钮
一键控制 VPN/代理服务的启停。小组件背景色随服务状态实时变化:
- 深灰色:已断开
- 粉色:已连接
- 橙色:连接中/停止中

小组件运行在 :bg 进程,与代理服务共享状态,响应即时。
支持英文、简体中文、繁体中文三种语言。

Made-with: Cursor
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.

1 participant