This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement WebXR Interstitial (#3136)
* Implement WebXR Interstitial * Fix for AnimatedVectorDrawables in Pico devices * Improve layout and flow. * Remove old spinner * Hide controller input until the interstitial is hidden. * Fix grip button detection in Oculus * Rebase and update to latest spec * Restore required disabling hw acceleration for voice animation Co-authored-by: Manuel Martin <imanol.martin@gmail.com>
- Loading branch information
1 parent
f914e0d
commit 93b3f9f
Showing
46 changed files
with
1,280 additions
and
5,123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WebXRInterstitialController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package org.mozilla.vrbrowser.ui.widgets; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
|
||
import androidx.annotation.IntDef; | ||
import androidx.databinding.DataBindingUtil; | ||
|
||
import org.mozilla.vrbrowser.R; | ||
import org.mozilla.vrbrowser.VRBrowserActivity; | ||
import org.mozilla.vrbrowser.databinding.WebxrInterstitialControllerBinding; | ||
import org.mozilla.vrbrowser.utils.DeviceType; | ||
|
||
public class WebXRInterstitialController extends UIWidget { | ||
private WebxrInterstitialControllerBinding mBinding; | ||
|
||
@IntDef(value = { HAND_NONE, HAND_LEFT, HAND_RIGHT }) | ||
public @interface Hand {} | ||
public static final int HAND_NONE = -1; | ||
public static final int HAND_LEFT = 0; | ||
public static final int HAND_RIGHT = 1; | ||
|
||
public WebXRInterstitialController(Context aContext, int aModel, @Hand int aHand ) { | ||
super(aContext); | ||
initialize(aModel, aHand); | ||
} | ||
|
||
@Override | ||
protected void initializeWidgetPlacement(WidgetPlacement aPlacement) { | ||
aPlacement.scene = WidgetPlacement.SCENE_WEBXR_INTERSTITIAL; | ||
aPlacement.visible = false; | ||
aPlacement.cylinder = false; | ||
} | ||
|
||
private void updatePlacement() { | ||
mWidgetPlacement.setSizeFromMeasure(getContext(), this); | ||
mWidgetPlacement.worldWidth = mWidgetPlacement.width * WidgetPlacement.worldToDpRatio(getContext()) * 1.15f; | ||
if (mBinding.getHand() == HAND_LEFT) { | ||
mWidgetPlacement.anchorX = 1.0f; | ||
mWidgetPlacement.anchorY = 0.5f; | ||
mWidgetPlacement.parentAnchorX = 0.0f; | ||
mWidgetPlacement.parentAnchorY = 0.5f; | ||
mWidgetPlacement.translationX = -WidgetPlacement.dpDimension(getContext(), R.dimen.webxr_interstitial_controller_margin_h); | ||
} else if (mBinding.getHand() == HAND_RIGHT) { | ||
mWidgetPlacement.anchorX = 0.0f; | ||
mWidgetPlacement.anchorY = 0.5f; | ||
mWidgetPlacement.parentAnchorX = 1.0f; | ||
mWidgetPlacement.parentAnchorY = 0.5f; | ||
mWidgetPlacement.translationX = WidgetPlacement.dpDimension(getContext(), R.dimen.webxr_interstitial_controller_margin_h); | ||
} else { | ||
mWidgetPlacement.anchorX = 0.5f; | ||
mWidgetPlacement.anchorY = 1.0f; | ||
mWidgetPlacement.parentAnchorX = 0.5f; | ||
mWidgetPlacement.parentAnchorY = 0.0f; | ||
mWidgetPlacement.translationY = 0;//-WidgetPlacement.dpDimension(getContext(), R.dimen.webxr_interstitial_controller_margin_v); | ||
} | ||
} | ||
|
||
private void initialize(int aModel, @Hand int aHand) { | ||
LayoutInflater inflater = LayoutInflater.from(getContext()); | ||
mBinding = DataBindingUtil.inflate(inflater, R.layout.webxr_interstitial_controller, this, true); | ||
mBinding.setLifecycleOwner((VRBrowserActivity)getContext()); | ||
mBinding.setModel(aModel); | ||
mBinding.setHand(aHand); | ||
mBinding.executePendingBindings(); | ||
updatePlacement(); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.