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

Commit 0e24c19

Browse files
authored
Closes #2626 Pico controller updates and quit confirm dialog (#3111)
* Pico controllers update * Pico confirm quit dialog * Fix keys and added L/R
1 parent cd7e648 commit 0e24c19

22 files changed

+10646
-78955
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,22 @@ public void onBackPressed() {
693693
return;
694694
}
695695
if (!mWindows.handleBack()) {
696-
super.onBackPressed();
696+
if (DeviceType.isPicoVR()) {
697+
mWindows.getFocusedWindow().showConfirmPrompt(
698+
getString(R.string.app_name),
699+
getString(R.string.exit_confirm_dialog_body, getString(R.string.app_name)),
700+
new String[]{
701+
getString(R.string.exit_confirm_dialog_button_cancel),
702+
getString(R.string.exit_confirm_dialog_button_quit),
703+
}, index -> {
704+
if (index == PromptDialogWidget.POSITIVE) {
705+
VRBrowserActivity.super.onBackPressed();
706+
}
707+
});
708+
709+
} else {
710+
super.onBackPressed();
711+
}
697712
}
698713
}
699714

app/src/main/cpp/BrowserWorld.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ struct BrowserWorld::State {
204204
rootOpaqueParent->AddNode(rootOpaque);
205205
//rootOpaque->AddLight(light);
206206
//rootTransparent->AddLight(light);
207-
rootController->AddLight(light);
208207
cullVisitor = CullVisitor::Create(create);
209208
drawList = DrawableList::Create(create);
210209
controllers = ControllerContainer::Create(create, rootTransparent);
@@ -804,6 +803,9 @@ BrowserWorld::InitializeJava(JNIEnv* aEnv, jobject& aActivity, jobject& aAssetMa
804803
m.controllers->SetPointerColor(vrb::Color(VRBrowser::GetPointerColor()));
805804
m.loadingAnimation->LoadModels(m.loader);
806805
m.rootController->AddNode(m.controllers->GetRoot());
806+
if (m.device->IsControllerLightEnabled()) {
807+
m.rootController->AddLight(m.light);
808+
}
807809
#if !defined(SNAPDRAGONVR)
808810
UpdateEnvironment();
809811
// Don't load the env model, we are going for skyboxes in v1.0

app/src/main/cpp/DeviceDelegate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class DeviceDelegate {
8989
virtual VRLayerCubePtr CreateLayerCube(int32_t aWidth, int32_t aHeight, GLint aInternalFormat) { return nullptr; }
9090
virtual VRLayerEquirectPtr CreateLayerEquirect(const VRLayerPtr &aSource) { return nullptr; }
9191
virtual void DeleteLayer(const VRLayerPtr& aLayer) {};
92+
virtual bool IsControllerLightEnabled() const { return true; }
9293
protected:
9394
DeviceDelegate() {}
9495

app/src/main/res/values/strings.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,4 +1463,13 @@ the Select` button. When clicked it closes all the previously selected tabs -->
14631463

14641464
<!-- This string is displayed in the disable button of the quick Tracking Protection dialog, accessed from the Tracking Protection icon in the URL bar. -->
14651465
<string name="tracking_dialog_button_disable">Disable</string>
1466+
1467+
<!-- This string is displayed in the body of the confirm dialog shown in some platforms when the back button is pressed to quit the app. -->
1468+
<string name="exit_confirm_dialog_body">Are you sure you want to exit %1$s?</string>
1469+
1470+
<!-- This string is displayed in the Cancel button of the confirm dialog shown in some platforms when the back button is pressed to quit the app. -->
1471+
<string name="exit_confirm_dialog_button_cancel">Cancel</string>
1472+
1473+
<!-- This string is displayed in the Quit button of the confirm dialog shown in some platforms when the back button is pressed to quit the app. -->
1474+
<string name="exit_confirm_dialog_button_quit">Quit</string>
14661475
</resources>

app/src/picovr/assets/g2-Controller.mtl

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)