Skip to content

Add a resizable Glance launcher widget - #6186

Open
eliotcougar wants to merge 7 commits into
2dust:masterfrom
eliotcougar:codex/launcher-widget
Open

eliotcougar wants to merge 7 commits into
2dust:masterfrom
eliotcougar:codex/launcher-widget

Conversation

@eliotcougar

@eliotcougar eliotcougar commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace the fixed legacy launcher switch with a horizontally resizable AndroidX Glance widget, using the main screen's server-row styling. Following review feedback, keep it focused on the selected server and service start/stop.

Behavior

  • 1x1: unchanged compact tile with the app's V mark and Play/Stop symbol. The whole tile controls the service.
  • Every wider size: one line containing the currently selected server name and a Start/Stop button. More width gives the name more space; it does not add controls or information.
  • Tapping the server name opens the app, including in the 2x1 layout.

Implementation and cleanup

  • Two layouts only: compact and horizontal. Remove the separate wider-size variants, test/restart callbacks, result formatting, status colors, and custom font-scale observer/metrics.
  • All Glance components run in the existing daemon process. The widget observes core-owned running state rather than maintaining a persisted running flag.
  • The small repository loads the selected profile off the main thread and combines it with live core state. Selecting a different profile updates the displayed name without losing the ability to stop the currently running service.
  • Keep storage-owned profile-change notifications and guarded widget updates. Shared app/core connection-testing behavior is unchanged by this simplification.

Validation

  • After merging upstream: focused widget/request-ownership tests and all 97 Play Store debug unit tests passed.
  • Passed :app:compilePlaystoreDebugKotlin, :app:assemblePlaystoreRelease, and git diff --check.
  • Pixel 9 Pro API 37 x86_64 emulator: installed a locally signed release build over the existing app after checking signer compatibility and the three required native libraries.
  • Checked 1x1 appearance and Stop, horizontal resizing through 2x1/3x1/4x1, Start/Stop updates, orange/grey bar transitions, and opening the app by tapping the name.
  • Checked the single-line 2x1 row at font scale 2.0; text remained vertically centered without overlapping the button. Restored font scale afterward.
  • JVM coverage includes missing/blank profiles, profile refresh, stop/recreation state, distinct profile-change/cancellation message IDs, failure containment, and responsive width boundaries including five-column Pixel widths.

@eliotcougar
eliotcougar marked this pull request as ready for review September 4, 2026 15:11
Comment thread V2rayNG/app/src/main/java/com/v2ray/ang/handler/MmkvManager.kt Outdated
@2dust

2dust commented Sep 5, 2026

Copy link
Copy Markdown
Owner

非常感谢
widget 只是一个辅助小功能,请不要增加太多的功能。
widget 就是为了快速启动和关闭,其他功能请进入 app 操作。

@eliotcougar

Copy link
Copy Markdown
Contributor Author

非常感谢 widget 只是一个辅助小功能,请不要增加太多的功能。 widget 就是为了快速启动和关闭,其他功能请进入 app 操作。

It has only the most used additional actions when it is in 3x1, 4x1 sizes: Test current connection and restart service.
The basic 1x1 layout is a simple start/stop toggle.

It is also part of Compose migration as it uses Compose Glance.

Lower the minimum width and responsive action breakpoints for five-column Pixel layouts. Tighten connection text metrics and remove trailing padding while retaining button touch targets.
Align all widget receivers, actions and rendering services with upstream :daemon so they continue observing the same in-process connection state. Keep the separate :tasks services unchanged, and retain widget labels and shortcut task affinity.

Validated Play Store debug compilation, merged manifest processing and JVM tests after rebasing onto upstream 2.3.8.
@2dust

2dust commented Sep 11, 2026

Copy link
Copy Markdown
Owner

暂时不接受这么多功能的 widget

@eliotcougar

eliotcougar commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

暂时不接受这么多功能的 widget

How much less functions do you want in a widget?

How about this:
1x1 start/stop widget
Resizable horizontally to show current server and connected/disconnected status. And a simple start/stop button.

Remove test and restart service buttons entirely.

@eliotcougar
eliotcougar marked this pull request as draft September 11, 2026 14:35
Use one horizontal layout at every wider size, retain the compact V tile, and show an orange or grey service indicator. Remove obsolete test/restart controls, status formatting, font metrics and localized status strings.
@eliotcougar

Copy link
Copy Markdown
Contributor Author

The widget is now very simple.

@eliotcougar
eliotcougar marked this pull request as ready for review September 11, 2026 15:53
@eliotcougar
eliotcougar requested a review from 2dust September 11, 2026 15:53
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