您的位置:首页 > 移动开发 > Android开发

Google cardBoard Android API (一):CardboardActivity

2016-03-21 14:33 573 查看

public class CardboardActivityBase activity that provides easy integration with Cardboard devices.Exposes events to interact with Cardboards and handles many of the details commonly required when creating an Activity for VR rendering.

Public Constructors

CardboardActivity()

Public Methods

CardboardViewgetCardboardView()
synchronized booleangetConvertTapIntoTrigger()
voidonCardboardTrigger()
voidsetCardboardView(CardboardView cardboardView)
synchronized voidsetConvertTapIntoTrigger(booleanenabled)

Protected Methods

voidupdateCardboardDeviceParams(CardboardDeviceParams newParams)

Inherited Methods

▸From class java.lang.Object▸From interface com.google.vrtoolkit.cardboard.VolumeKeyState.Handler▸From interface com.google.vrtoolkit.cardboard.sensors.SensorConnection.SensorListener

Public Constructors

public CardboardActivity ()

Public Methods

public CardboardView getCardboardView ()

Returns the
Cardboard
view
associated with this activity.ReturnsThe
CardboardView
objectassociated with this activity. Can be null.

public synchronized boolean getConvertTapIntoTrigger ()

Returns whether single screen taps are converted to Cardboard trigger events.Returnswhether single screen taps are converted to Cardboard trigger events.

public void onCardboardTrigger ()

Override to detect when the Cardboard trigger was pulled and released.Provides click-like events when the device is inside a Cardboard.

public void setCardboardView (CardboardView cardboardView)

Associates a Cardboard view with this activity.This method does not set or change the content view, but associates the activity with a
CardboardView
andensures it receives any required activity lifecycle notifications.This is automatically done if
setContentView
is used to directly set a
CardboardView
object.Should be called if the
CardboardView
isset in any other way (e.g. from a layout resource).Parameters
cardboardViewThe
Cardboard view
to associatewith. Can be null.

public synchronized void setConvertTapIntoTrigger (boolean enabled)

Sets whether single screen taps should be converted to Cardboard trigger events.If this is true, a single tap on the phone screen will result in a call to
onCardboardTrigger
.This is enabled by default.Parameters
enabledwhether screen taps should be converted to Cardboard trigger events.

Protected Methods

protected void updateCardboardDeviceParams (CardboardDeviceParams newParams)

Requests an update of the parameters for the current Cardboard device.Compares against existing configuration and updates if the new parameters differ.This method requires a
CardboardView
tobe already set. See
setCardboardView
.Parameters
newParamsNew Cardboard device params to set.

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: