Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VisionGlass] Improve phone UI #1273

Merged
merged 4 commits into from
Feb 28, 2024
Merged

[VisionGlass] Improve phone UI #1273

merged 4 commits into from
Feb 28, 2024

Conversation

svillar
Copy link
Member

@svillar svillar commented Feb 27, 2024

This PR adds some major changes to the Phone UI in the VisionGlass. It's based in two important refactorings:

  1. Decouple phone UI initialization from glasses initialization. The latter is an async process that might fail. We should not depend on that to initialize the UI widgets.
  2. Introduce a new PlatformActivityPlugin interface that will be called by VRBrowserActivity to perform platform specific tasks. It's needed because the different PlatformActivitys are superclasses of VRBrowserActivity and thus don't have access to data and interface implementations of the latter.

Once these two are in place the following changes were implemented in the phone UI:

  1. Added a voice search button. Only active whenever the on screen keyboard is shown, as it's the only time were it's really needed
  2. Added media controls playback. Only visible when playing media. It contains a play/pause button, a mute/volume button, and a fast forward and fast backward buttons.

…ation

Prevents errors that might appear due to UI elements not being
properly initialized or UI layouts not being inflated because
the code is trying to initialize the whole VisionGlass system
(note that VisionGlass initialization is fundamentally an
async process).
@svillar svillar requested a review from felipeerias February 27, 2024 18:27
@svillar svillar force-pushed the vg_improved_phoneui branch 2 times, most recently from e97c863 to 95adffd Compare February 27, 2024 18:46
The current architecture of the Activity class is suboptimal. The main
class, the VRBrowserActivity, turns out to be a subclass of a
PlatformActivity class which is platform specific (because some flavours
inherit from different types of Activity). The problem is that we cannot
add platform specifics to VRBrowserActivity, but at the same time it's the
class that has all the information, so it's complex to do anything
meaningful at the PlatformActivity level.

In order to do that in a clean way we're adding this new interface
which will be implemented and instantiated at the PlatformActivity
level. It'll contain the platform specific code, and as it will be
used by VRBrowserActivity, it would receive any required information
as parametters of the different interface methods.

This way we could encapsulate platform specifics at the PlatformActivity
level without losing access to the data/methods of the VRBrowserActivity.
Added a new Voice Search button to the phone UI. It's only enabled
when the keyboard is shown, i.e., when input is required. Once
clicked the handling of the input is directly managed by the
KeyboardWidget which properly handles the different types of input
(like entering text in a Web page vs entering text in a UI widget).
Media controls were added to the phone UI using the newly added
PlatformActivityPlugin architecture. The media playback controls
are only shown whenever the web engine detects that a media
element is present and hidden as soon as the media element is
gone.

The controls include play/pause button, mute button, fast forward
and fast backward buttons and a progress seekbar. There are some
caveats though caused by limitations of the GeckoView API, for
example progress information is only issued for fullscreen media.
@svillar svillar force-pushed the vg_improved_phoneui branch from 95adffd to d4a0e91 Compare February 27, 2024 18:58
Copy link
Collaborator

@felipeerias felipeerias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@felipeerias felipeerias merged commit 18e279a into main Feb 28, 2024
20 checks passed
@felipeerias felipeerias deleted the vg_improved_phoneui branch February 28, 2024 06:17
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