The Rokid Glasses HUD is a monochrome binocular display projected directly into the wearer’s field of view. Unlike a phone screen, it has fixed physical constraints — a portrait aspect ratio, green-only color, and transparency where you render black. This page covers the hardware specs, theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/RealComputer/GlassKit/llms.txt
Use this file to discover all available pages before exploring further.
ScreenController pattern for managing screens, the HudViewportLayout custom view that handles correct scaling, and practical guidance for building readable HUD interfaces.
HUD Hardware Specifications
| Property | Value |
|---|---|
| Resolution | 480 × 640 px (portrait) |
| Display density | 240 dpi |
| Color | Monochrome binocular (green) |
| Black pixels | Transparent (see-through) |
| White pixels | Appear green on-device |
| Design canvas | 320 × 427 dp (at 240 dpi) |
ScreenController Pattern
GlassKit apps organize their HUD content into screens, each managed by aScreenController. A controller owns one panel view and implements a small lifecycle interface. The hosting Activity holds all controllers, shows the active one, and routes navigation actions to it.
This approach keeps screens independent and testable without the overhead of the Android Fragment back stack.
Interface and Base Class
TheScreenController interface from the starter app defines the full contract:
Lifecycle Methods
| Method | When called |
|---|---|
onEnter() | After the screen becomes the active one |
onExit() | Before switching away from this screen |
onHostStart() | On Activity onStart() (feature-demo variant) |
onHostStop() | On Activity onStop() (feature-demo variant) |
onPermissionsUpdated() | After a runtime permission result |
onDestroy() | On Activity onDestroy() |
render() | Called by the host whenever HUD state should be redrawn |
setVisible(Boolean) | Shows or hides the panel view |
Navigation Result Types
handleAction returns a sealed type that tells the host Activity what to do next:
HudViewportLayout
HudViewportLayout is a custom FrameLayout that scales its children to always fill the available space at the correct 3:4 portrait aspect ratio, matching the physical HUD. It handles both the Rokid device (where the view fills the exact HUD window) and phone or emulator testing (where the window may be a different size or orientation).
How It Works
- On
onMeasure, it calculates the largest 3:4 rectangle that fits in the available space. - It measures all children against the design canvas size (320 dp wide × 427 dp tall).
- On
onLayout, it positions children at(0,0)in design coordinates, then applies a uniform scale transform and centering translation so they appear correctly at the actual measured size.
Starter App Implementation
RokidHudViewportLayout (Feature Demo Variant)
The feature-demo example includesRokidHudViewportLayout, which uses the physical pixel and DPI constants directly rather than design-DP constants. The layout logic is identical — it converts reference pixels to current-device pixels via DisplayMetrics.DENSITY_DEFAULT:
RokidHudViewportLayout variant makes the hardware constraints explicit in the code.
Screen Navigation Pattern
Screens are independent objects, not Android Fragments. The hosting Activity holds an array of controllers, tracks the active screen index, and dispatches input actions:Initialize all screens
Create every
ScreenController in onCreate, inflate each panel view, and add all panel views to the HudViewportLayout in the activity XML.Show the initial screen
Call
setVisible(true) on the starting controller and setVisible(false) on all others. Call onEnter() on the active controller.Route navigation actions
Pass
NavigationAction values (SELECT, BACK, NEXT, PREVIOUS) to activeController.handleAction(action). Inspect the returned ScreenCommand to decide whether to stay, open a new screen, or exit.Transition between screens
Call
activeController.onExit(), update the active reference, call newController.setVisible(true), oldController.setVisible(false), then newController.onEnter().HUD UI Best Practices
Text size — Use at minimum 14 sp for body text. The HUD sits in the wearer’s peripheral vision while they work; text that looks fine on a phone preview can be unreadable at a glance. Contrast — Always use white (#FFFFFF) foreground on black (#000000) background. Gray text reduces brightness on the green display. Avoid colored backgrounds — they become unpredictable shades of green.
Content density — Show only what the wearer needs right now. A maximum of three to five lines of text per screen avoids cognitive overload. Use short words and sentence fragments.
Navigation hints — Always display available touchpad actions at the bottom of the screen. The wearer cannot see a physical keyboard or button labels.
When testing on a phone or emulator, the white-on-black color scheme will look stark. This is correct. The on-device experience is green-on-transparent, which appears natural in the wearer’s field of view.