Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 78b9858

Browse files
authored
Add Vive Focus WebXR Interstitial (#3361)
1 parent 14cf31e commit 78b9858

10 files changed

Lines changed: 65 additions & 11 deletions

File tree

app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ public int getPointerColor() {
11621162
@Keep
11631163
@SuppressWarnings("unused")
11641164
private void setDeviceType(int aType) {
1165-
if (DeviceType.isOculusBuild()) {
1165+
if (DeviceType.isOculusBuild() || DeviceType.isWaveBuild()) {
11661166
runOnUiThread(() -> DeviceType.setType(aType));
11671167
}
11681168
}

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WebXRInterstitialWidget.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ private void initializeControllers() {
9393
addController(DeviceType.PicoNeo2, WebXRInterstitialController.HAND_RIGHT);
9494
} else if (deviceType == DeviceType.PicoG2) {
9595
addController(DeviceType.PicoG2, WebXRInterstitialController.HAND_NONE);
96+
} else if (deviceType == DeviceType.ViveFocus) {
97+
addController(DeviceType.ViveFocus, WebXRInterstitialController.HAND_NONE);
9698
} else if (deviceType == DeviceType.ViveFocusPlus) {
9799
addController(DeviceType.ViveFocusPlus, WebXRInterstitialController.HAND_LEFT);
98100
addController(DeviceType.ViveFocusPlus, WebXRInterstitialController.HAND_RIGHT);

app/src/common/shared/org/mozilla/vrbrowser/utils/DeviceType.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88

99
public class DeviceType {
1010
// These values need to match those in Device.h
11-
@IntDef(value = { Unknown, OculusGo, OculusQuest, ViveFocusPlus, PicoNeo2, PicoG2 })
11+
@IntDef(value = { Unknown, OculusGo, OculusQuest, ViveFocus, ViveFocusPlus, PicoNeo2, PicoG2 })
1212
public @interface Type {}
1313
public static final int Unknown = 0;
1414
public static final int OculusGo = 1;
1515
public static final int OculusQuest = 2;
16-
public static final int ViveFocusPlus = 3;
17-
public static final int PicoNeo2 = 4;
18-
public static final int PicoG2 = 5;
16+
public static final int ViveFocus = 3;
17+
public static final int ViveFocusPlus = 4;
18+
public static final int PicoNeo2 = 6;
19+
public static final int PicoG2 = 7;
1920

2021
private static @Type int mType = Unknown;
2122

@@ -28,6 +29,9 @@ public static void setType(@Type int aType) {
2829
case OculusQuest:
2930
name = "Oculus Quest";
3031
break;
32+
case ViveFocus:
33+
name = "Vive Focus";
34+
break;
3135
case ViveFocusPlus:
3236
name = "Vive Focus Plus";
3337
break;

app/src/wavevr/cpp/DeviceDelegateWaveVR.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ struct DeviceDelegateWaveVR::State {
9090
GestureDelegatePtr gestures;
9191
std::array<Controller, kMaxControllerCount> controllers;
9292
ImmersiveDisplayPtr immersiveDisplay;
93+
device::DeviceType deviceType;
9394
bool lastSubmitDiscarded;
9495
bool recentered;
9596
vrb::Matrix reorientMatrix;
@@ -110,6 +111,7 @@ struct DeviceDelegateWaveVR::State {
110111
, renderHeight(0)
111112
, devicePairs {}
112113
, controllers {}
114+
, deviceType(device::UnknownType)
113115
, lastSubmitDiscarded(false)
114116
, recentered(false)
115117
, ignoreNextRecenter(false)
@@ -132,6 +134,11 @@ struct DeviceDelegateWaveVR::State {
132134
sixDoFControllerCount++;
133135
}
134136
}
137+
if (sixDoFControllerCount) {
138+
deviceType = device::ViveFocusPlus;
139+
} else {
140+
deviceType = device::ViveFocus;
141+
}
135142
reorientMatrix = vrb::Matrix::Identity();
136143
}
137144

@@ -454,6 +461,11 @@ DeviceDelegateWaveVR::Create(vrb::RenderContextPtr& aContext) {
454461
return result;
455462
}
456463

464+
device::DeviceType
465+
DeviceDelegateWaveVR::GetDeviceType() {
466+
return m.deviceType;
467+
}
468+
457469
void
458470
DeviceDelegateWaveVR::SetRenderMode(const device::RenderMode aMode) {
459471
if (aMode == m.renderMode) {

app/src/wavevr/cpp/DeviceDelegateWaveVR.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class DeviceDelegateWaveVR : public DeviceDelegate {
1515
public:
1616
static DeviceDelegateWaveVRPtr Create(vrb::RenderContextPtr& aContext);
1717
// DeviceDelegate interface
18+
device::DeviceType GetDeviceType() override;
1819
void SetRenderMode(const device::RenderMode aMode) override;
1920
device::RenderMode GetRenderMode() override;
2021
void RegisterImmersiveDisplay(ImmersiveDisplayPtr aDisplay) override;

app/src/wavevr/java/org/mozilla/vrbrowser/PlatformActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public PlatformActivity() {
3636
@Override
3737
protected void onCreate(Bundle savedInstanceState) {
3838
super.onCreate(savedInstanceState);
39-
DeviceType.setType(DeviceType.ViveFocusPlus);
4039

4140
queueRunnable(new Runnable() {
4241
@Override
24.1 KB
Loading

app/src/wavevr/res/drawable/controller_focus_left.png renamed to app/src/wavevr/res/drawable/controller_focus_plus_left.png

File renamed without changes.

app/src/wavevr/res/drawable/controller_focus_right.png renamed to app/src/wavevr/res/drawable/controller_focus_plus_right.png

File renamed without changes.

app/src/wavevr/res/layout/webxr_interstitial_controller.xml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
android:background="#00000000"
2121
android:padding="5dp">
2222

23-
<!-- Vive Left Controller -->
24-
<!-- vive Right Controller -->
23+
<!-- Vive Focus Plus Left Controller -->
24+
<!-- vive Focus Plus Right Controller -->
2525
<RelativeLayout
2626
app:visibleGone="@{model == DeviceType.ViveFocusPlus &amp;&amp; hand == WebXRInterstitialController.HAND_LEFT}"
2727
tools:visibility="gone"
@@ -34,7 +34,7 @@
3434
android:layout_alignParentLeft="true"
3535
android:layout_centerVertical="true"
3636
android:scaleType="fitCenter"
37-
android:src="@drawable/controller_focus_left"
37+
android:src="@drawable/controller_focus_plus_left"
3838
tools:ignore="RtlHardcoded" />
3939
<ImageView
4040
android:layout_width="wrap_content"
@@ -62,7 +62,7 @@
6262
android:text="@string/webxr_interstitial_exit_webxr"/>
6363
</RelativeLayout>
6464

65-
<!-- Vive Right Controller -->
65+
<!-- Vive Focus Plus Right Controller -->
6666
<RelativeLayout
6767
app:visibleGone="@{model == DeviceType.ViveFocusPlus &amp;&amp; hand == WebXRInterstitialController.HAND_RIGHT}"
6868
tools:visibility="visible"
@@ -74,7 +74,7 @@
7474
android:layout_alignParentRight="true"
7575
android:layout_centerVertical="true"
7676
android:scaleType="fitCenter"
77-
android:src="@drawable/controller_focus_right"
77+
android:src="@drawable/controller_focus_plus_right"
7878
tools:ignore="RtlHardcoded" />
7979
<ImageView
8080
android:layout_width="wrap_content"
@@ -100,6 +100,42 @@
100100
tools:ignore="RtlHardcoded,RtlSymmetry"
101101
android:text="@string/webxr_interstitial_exit_webxr"/>
102102
</RelativeLayout>
103+
<!-- Vive Focus Controller -->
104+
<RelativeLayout
105+
app:visibleGone="@{model == DeviceType.ViveFocus }"
106+
tools:visibility="gone"
107+
android:layout_width="250dp"
108+
android:layout_height="120dp"
109+
>
110+
<ImageView
111+
android:layout_width="100dp"
112+
android:layout_height="100dp"
113+
android:layout_alignParentBottom="true"
114+
android:layout_centerHorizontal="true"
115+
android:scaleType="fitCenter"
116+
android:src="@drawable/controller_focus"
117+
tools:ignore="RtlHardcoded" />
118+
<ImageView
119+
android:layout_width="wrap_content"
120+
android:layout_height="wrap_content"
121+
android:layout_alignParentBottom="true"
122+
android:paddingRight="70dp"
123+
android:layout_marginBottom="60dp"
124+
android:layout_centerHorizontal="true"
125+
android:scaleType="fitCenter"
126+
android:src="@drawable/ic_webxr_controller_arrow"
127+
tools:ignore="RtlHardcoded,RtlSymmetry"/>
128+
<TextView
129+
android:layout_width="wrap_content"
130+
android:layout_height="wrap_content"
131+
android:textAlignment="textEnd"
132+
android:layout_alignParentTop="true"
133+
android:paddingRight="140dp"
134+
android:layout_centerHorizontal="true"
135+
android:textSize="18sp"
136+
tools:ignore="RtlHardcoded,RtlSymmetry"
137+
android:text="@string/webxr_interstitial_exit_webxr"/>
138+
</RelativeLayout>
103139
</FrameLayout>
104140

105141
</layout>

0 commit comments

Comments
 (0)