Samsung / GearVRf

The GearVR framework(GearVRf) is an Open Source VR rendering library for application development on VR-supported Android devices.
http://www.gearvrf.org
Apache License 2.0
407 stars 217 forks source link

Does the Framework support dialogs? #1920

Closed Nathipha closed 6 years ago

Nathipha commented 6 years ago

I'm using an AsyncTask to preload objects (read .obj files from storage and create GVRSceneObjects without adding them to the scene), so it doesn't just freeze the game, and a ProgressDialog to show the progress.

Since it only lets me use the standard Android context...

ProgressDialog progressdialog = new ProgressDialog(gvrcontext.getContext());

... the dialog spans the whole screen (similar to this):

https://i.imgur.com/vd5qISP.png?1

Does the Framework support any type of dialog like this in any version (I'm still on 3.0.1) or is there maybe a trick to get it to display properly within the borders of the two separate images? Or is creating your own dialogs what everyone's doing at this point?

liaxim commented 6 years ago

You could look at our GVRViewSceneObject class. Few demos use it; for example gvr-events, gvr-renderableview. You can pass your android view to it.

Nathipha commented 6 years ago

Thanks, I'll try it.

In the meantime I've solved it with a GVRTextViewSceneObject, there's no progress bar but it was updateable and looked similar (enough):

GVRTextViewSceneObject progressdialog = new GVRTextViewSceneObject(gvrc, 3f, 1f, "myText");     
progressdialog.getTransform().setPosition(x, z, y);
progressdialog.setGravity(Gravity.CENTER | Gravity.CENTER);
progressdialog.setTextSize(5);
progressdialog.setTextColor(Color.BLACK);
progressdialog.setBackgroundColor(Color.WHITE);
scene.addSceneObject(progressdialog);
Nathipha commented 6 years ago

A ProgressDialog is a subclass of Dialog, so not sure how to get its View and if "Window.getCurrentFocus()" (which returns a View) doesn't just return the parent View, even if you do "progressdialog.show()" first.

I'm going to try it with that one anyway once I've updated (can't pass a View yet in the version I'm using).

liaxim commented 6 years ago

@Nathipha Do you have other questions regarding this issue? If not, can we close it?

Nathipha commented 6 years ago

I haven't been able to update and test getting the View yet but for now there are no more questions. Thanks!