_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q5400 | GVRAvatar.loadModel | train | public void loadModel(GVRAndroidResource avatarResource, String attachBone)
{
EnumSet<GVRImportSettings> settings = GVRImportSettings.getRecommendedSettingsWith(EnumSet.of(GVRImportSettings.OPTIMIZE_GRAPH, GVRImportSettings.NO_ANIMATION));
GVRContext ctx = mAvatarRoot.getGVRContext();
GVRResourceVolume volume = new GVRResourceVolume(ctx, avatarResource);
GVRSceneObject modelRoot = new GVRSceneObject(ctx);
GVRSceneObject boneObject;
int boneIndex;
if (mSkeleton == null)
{
throw new IllegalArgumentException("Cannot attach model to avatar - there is no skeleton");
}
boneIndex = mSkeleton.getBoneIndex(attachBone);
if (boneIndex < 0)
{
throw new IllegalArgumentException(attachBone + " is not a bone in the avatar skeleton");
}
boneObject = mSkeleton.getBone(boneIndex);
if (boneObject == null)
{
throw new IllegalArgumentException(attachBone +
" does not have a bone object in the avatar skeleton");
}
boneObject.addChildObject(modelRoot);
ctx.getAssetLoader().loadModel(volume, modelRoot, settings, false, mLoadModelHandler);
} | java | {
"resource": ""
} |
q5401 | GVRAvatar.loadAnimation | train | public void loadAnimation(GVRAndroidResource animResource, String boneMap)
{
String filePath = animResource.getResourcePath();
GVRContext ctx = mAvatarRoot.getGVRContext();
GVRResourceVolume volume = new GVRResourceVolume(ctx, animResource);
if (filePath.endsWith(".bvh"))
{
GVRAnimator animator = new GVRAnimator(ctx);
animator.setName(filePath);
try
{
BVHImporter importer = new BVHImporter(ctx);
GVRSkeletonAnimation skelAnim;
if (boneMap != null)
{
GVRSkeleton skel = importer.importSkeleton(animResource);
skelAnim = importer.readMotion(skel);
animator.addAnimation(skelAnim);
GVRPoseMapper retargeter = new GVRPoseMapper(mSkeleton, skel, skelAnim.getDuration());
retargeter.setBoneMap(boneMap);
animator.addAnimation(retargeter);
}
else
{
skelAnim = importer.importAnimation(animResource, mSkeleton);
animator.addAnimation(skelAnim);
}
addAnimation(animator);
ctx.getEventManager().sendEvent(this,
IAvatarEvents.class,
"onAnimationLoaded",
GVRAvatar.this,
animator,
filePath,
null);
}
catch (IOException ex)
{
ctx.getEventManager().sendEvent(this,
IAvatarEvents.class,
"onAnimationLoaded",
GVRAvatar.this,
null,
filePath,
ex.getMessage());
}
}
else
{
EnumSet<GVRImportSettings> settings = GVRImportSettings.getRecommendedSettingsWith(EnumSet.of(GVRImportSettings.OPTIMIZE_GRAPH, GVRImportSettings.NO_TEXTURING));
GVRSceneObject animRoot = new GVRSceneObject(ctx);
ctx.getAssetLoader().loadModel(volume, animRoot, settings, false, mLoadAnimHandler);
}
} | java | {
"resource": ""
} |
q5402 | GVRAvatar.start | train | public void start(String name)
{
GVRAnimator anim = findAnimation(name);
if (name.equals(anim.getName()))
{
start(anim);
return;
}
} | java | {
"resource": ""
} |
q5403 | GVRAvatar.findAnimation | train | public GVRAnimator findAnimation(String name)
{
for (GVRAnimator anim : mAnimations)
{
if (name.equals(anim.getName()))
{
return anim;
}
}
return null;
} | java | {
"resource": ""
} |
q5404 | GVRAvatar.start | train | public GVRAnimator start(int animIndex)
{
if ((animIndex < 0) || (animIndex >= mAnimations.size()))
{
throw new IndexOutOfBoundsException("Animation index out of bounds");
}
GVRAnimator anim = mAnimations.get(animIndex);
start(anim);
return anim;
} | java | {
"resource": ""
} |
q5405 | GVRAvatar.animate | train | public GVRAnimator animate(int animIndex, float timeInSec)
{
if ((animIndex < 0) || (animIndex >= mAnimations.size()))
{
throw new IndexOutOfBoundsException("Animation index out of bounds");
}
GVRAnimator anim = mAnimations.get(animIndex);
anim.animate(timeInSec);
return anim;
} | java | {
"resource": ""
} |
q5406 | GVRAvatar.stop | train | public void stop()
{
synchronized (mAnimQueue)
{
if (mIsRunning && (mAnimQueue.size() > 0))
{
mIsRunning = false;
GVRAnimator animator = mAnimQueue.get(0);
mAnimQueue.clear();
animator.stop();
}
}
} | java | {
"resource": ""
} |
q5407 | GVRMain.getSplashTexture | train | public GVRTexture getSplashTexture(GVRContext gvrContext) {
Bitmap bitmap = BitmapFactory.decodeResource( //
gvrContext.getContext().getResources(), //
R.drawable.__default_splash_screen__);
GVRTexture tex = new GVRTexture(gvrContext);
tex.setImage(new GVRBitmapImage(gvrContext, bitmap));
return tex;
} | java | {
"resource": ""
} |
q5408 | GVRMain.onSplashScreenCreated | train | public void onSplashScreenCreated(GVRSceneObject splashScreen) {
GVRTransform transform = splashScreen.getTransform();
transform.setPosition(0, 0, DEFAULT_SPLASH_Z);
} | java | {
"resource": ""
} |
q5409 | Cursor.setPosition | train | public void setPosition(float x, float y, float z) {
if (isActive()) {
mIODevice.setPosition(x, y, z);
}
} | java | {
"resource": ""
} |
q5410 | Cursor.close | train | void close() {
mIODevice = null;
GVRSceneObject owner = getOwnerObject();
if (owner.getParent() != null) {
owner.getParent().removeChildObject(owner);
}
} | java | {
"resource": ""
} |
q5411 | GVRAssetLoader.findMesh | train | public GVRMesh findMesh(GVRSceneObject model)
{
class MeshFinder implements GVRSceneObject.ComponentVisitor
{
private GVRMesh meshFound = null;
public GVRMesh getMesh() { return meshFound; }
public boolean visit(GVRComponent comp)
{
GVRRenderData rdata = (GVRRenderData) comp;
meshFound = rdata.getMesh();
return (meshFound == null);
}
};
MeshFinder findMesh = new MeshFinder();
model.forAllComponents(findMesh, GVRRenderData.getComponentType());
return findMesh.getMesh();
} | java | {
"resource": ""
} |
q5412 | GVRScriptFile.invokeFunction | train | @Override
public boolean invokeFunction(String funcName, Object[] params) {
// Run script if it is dirty. This makes sure the script is run
// on the same thread as the caller (suppose the caller is always
// calling from the same thread).
checkDirty();
// Skip bad functions
if (isBadFunction(funcName)) {
return false;
}
String statement = getInvokeStatementCached(funcName, params);
synchronized (mEngineLock) {
localBindings = mLocalEngine.getBindings(ScriptContext.ENGINE_SCOPE);
if (localBindings == null) {
localBindings = mLocalEngine.createBindings();
mLocalEngine.setBindings(localBindings, ScriptContext.ENGINE_SCOPE);
}
}
fillBindings(localBindings, params);
try {
mLocalEngine.eval(statement);
} catch (ScriptException e) {
// The function is either undefined or throws, avoid invoking it later
addBadFunction(funcName);
mLastError = e.getMessage();
return false;
} finally {
removeBindings(localBindings, params);
}
return true;
} | java | {
"resource": ""
} |
q5413 | GearWearableDevice.isInInnerCircle | train | private boolean isInInnerCircle(float x, float y) {
return GearWearableUtility.isInCircle(x, y, CENTER_X, CENTER_Y, INNER_RADIUS);
} | java | {
"resource": ""
} |
q5414 | AiCamera.getUp | train | @SuppressWarnings("unchecked")
public <V3, M4, C, N, Q> V3 getUp(AiWrapperProvider<V3, M4, C, N, Q>
wrapperProvider) {
return (V3) m_up;
} | java | {
"resource": ""
} |
q5415 | TemplateDevice.dispatchKeyEvent | train | public void dispatchKeyEvent(int code, int action) {
int keyCode = 0;
int keyAction = 0;
if (code == BUTTON_1) {
keyCode = KeyEvent.KEYCODE_BUTTON_1;
} else if (code == BUTTON_2) {
keyCode = KeyEvent.KEYCODE_BUTTON_2;
}
if (action == ACTION_DOWN) {
keyAction = KeyEvent.ACTION_DOWN;
} else if (action == ACTION_UP) {
keyAction = KeyEvent.ACTION_UP;
}
KeyEvent keyEvent = new KeyEvent(keyAction, keyCode);
setKeyEvent(keyEvent);
} | java | {
"resource": ""
} |
q5416 | WidgetState.setState | train | void setState(final WidgetState.State state) {
Log.d(TAG, "setState(%s): state is %s, setting to %s", mWidget.getName(), mState, state);
if (state != mState) {
final WidgetState.State nextState = getNextState(state);
Log.d(TAG, "setState(%s): next state '%s'", mWidget.getName(), nextState);
if (nextState != mState) {
Log.d(TAG, "setState(%s): setting state to '%s'", mWidget.getName(), nextState);
setCurrentState(false);
mState = nextState;
setCurrentState(true);
}
}
} | java | {
"resource": ""
} |
q5417 | GVRAudioManager.setEnable | train | public void setEnable(boolean flag)
{
if (mEnabled == flag)
{
return;
}
mEnabled = flag;
if (flag)
{
mContext.registerDrawFrameListener(this);
mContext.getApplication().getEventReceiver().addListener(this);
mAudioEngine.resume();
}
else
{
mContext.unregisterDrawFrameListener(this);
mContext.getApplication().getEventReceiver().removeListener(this);
mAudioEngine.pause();
}
} | java | {
"resource": ""
} |
q5418 | GVRAudioManager.addSource | train | public void addSource(GVRAudioSource audioSource)
{
synchronized (mAudioSources)
{
if (!mAudioSources.contains(audioSource))
{
audioSource.setListener(this);
mAudioSources.add(audioSource);
}
}
} | java | {
"resource": ""
} |
q5419 | GVRAudioManager.removeSource | train | public void removeSource(GVRAudioSource audioSource)
{
synchronized (mAudioSources)
{
audioSource.setListener(null);
mAudioSources.remove(audioSource);
}
} | java | {
"resource": ""
} |
q5420 | GVRAudioManager.clearSources | train | public void clearSources()
{
synchronized (mAudioSources)
{
for (GVRAudioSource source : mAudioSources)
{
source.setListener(null);
}
mAudioSources.clear();
}
} | java | {
"resource": ""
} |
q5421 | GVRSphericalEmitter.generateParticleTimeStamps | train | private float[] generateParticleTimeStamps(float totalTime)
{
float timeStamps[] = new float[mEmitRate * 2];
if ( burstMode ) {
for (int i = 0; i < mEmitRate * 2; i += 2) {
timeStamps[i] = totalTime;
timeStamps[i + 1] = 0;
}
}
else {
for (int i = 0; i < mEmitRate * 2; i += 2) {
timeStamps[i] = totalTime + mRandom.nextFloat();
timeStamps[i + 1] = 0;
}
}
return timeStamps;
} | java | {
"resource": ""
} |
q5422 | GVRSphericalEmitter.generateParticleVelocities | train | private float[] generateParticleVelocities()
{
float [] particleVelocities = new float[mEmitRate * 3];
Vector3f temp = new Vector3f(0,0,0);
for ( int i = 0; i < mEmitRate * 3 ; i +=3 )
{
temp.x = mParticlePositions[i];
temp.y = mParticlePositions[i+1];
temp.z = mParticlePositions[i+2];
float velx = mRandom.nextFloat() * (maxVelocity.x- minVelocity.x)
+ minVelocity.x;
float vely = mRandom.nextFloat() * (maxVelocity.y - minVelocity.y)
+ minVelocity.y;
float velz = mRandom.nextFloat() * (maxVelocity.z - minVelocity.z)
+ minVelocity.z;
temp = temp.normalize();
temp.mul(velx, vely, velz, temp);
particleVelocities[i] = temp.x;
particleVelocities[i+1] = temp.y;
particleVelocities[i+2] = temp.z;
}
return particleVelocities;
} | java | {
"resource": ""
} |
q5423 | CameraPermissionHelper.launchPermissionSettings | train | public static void launchPermissionSettings(Activity activity) {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.fromParts("package", activity.getPackageName(), null));
activity.startActivity(intent);
} | java | {
"resource": ""
} |
q5424 | TextParams.setFromJSON | train | public void setFromJSON(Context context, JSONObject properties) {
String backgroundResStr = optString(properties, Properties.background);
if (backgroundResStr != null && !backgroundResStr.isEmpty()) {
final int backgroundResId = getId(context, backgroundResStr, "drawable");
setBackGround(context.getResources().getDrawable(backgroundResId, null));
}
setBackgroundColor(getJSONColor(properties, Properties.background_color, getBackgroundColor()));
setGravity(optInt(properties, TextContainer.Properties.gravity, getGravity()));
setRefreshFrequency(optEnum(properties, Properties.refresh_freq, getRefreshFrequency()));
setTextColor(getJSONColor(properties, Properties.text_color, getTextColor()));
setText(optString(properties, Properties.text, (String) getText()));
setTextSize(optFloat(properties, Properties.text_size, getTextSize()));
final JSONObject typefaceJson = optJSONObject(properties, Properties.typeface);
if (typefaceJson != null) {
try {
Typeface typeface = WidgetLib.getTypefaceManager().getTypeface(typefaceJson);
setTypeface(typeface);
} catch (Throwable e) {
Log.e(TAG, e, "Couldn't set typeface from properties: %s", typefaceJson);
}
}
} | java | {
"resource": ""
} |
q5425 | Layout.onLayoutApplied | train | public void onLayoutApplied(final WidgetContainer container, final Vector3Axis viewPortSize) {
mContainer = container;
mViewPort.setSize(viewPortSize);
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
} | java | {
"resource": ""
} |
q5426 | Layout.invalidate | train | public void invalidate() {
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "invalidate all [%d]", mMeasuredChildren.size());
mMeasuredChildren.clear();
}
} | java | {
"resource": ""
} |
q5427 | Layout.invalidate | train | public void invalidate(final int dataIndex) {
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "invalidate [%d]", dataIndex);
mMeasuredChildren.remove(dataIndex);
}
} | java | {
"resource": ""
} |
q5428 | Layout.getChildSize | train | public float getChildSize(final int dataIndex, final Axis axis) {
float size = 0;
Widget child = mContainer.get(dataIndex);
if (child != null) {
switch (axis) {
case X:
size = child.getLayoutWidth();
break;
case Y:
size = child.getLayoutHeight();
break;
case Z:
size = child.getLayoutDepth();
break;
default:
throw new RuntimeAssertion("Bad axis specified: %s", axis);
}
}
return size;
} | java | {
"resource": ""
} |
q5429 | Layout.getSize | train | public float getSize(final Axis axis) {
float size = 0;
if (mViewPort != null && mViewPort.isClippingEnabled(axis)) {
size = mViewPort.get(axis);
} else if (mContainer != null) {
size = getSizeImpl(axis);
}
return size;
} | java | {
"resource": ""
} |
q5430 | Layout.setDividerPadding | train | public void setDividerPadding(float padding, final Axis axis) {
if (!equal(mDividerPadding.get(axis), padding)) {
mDividerPadding.set(padding, axis);
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
}
} | java | {
"resource": ""
} |
q5431 | Layout.setOffset | train | public void setOffset(float offset, final Axis axis) {
if (!equal(mOffset.get(axis), offset)) {
mOffset.set(offset, axis);
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
}
} | java | {
"resource": ""
} |
q5432 | Layout.measureChild | train | public synchronized Widget measureChild(final int dataIndex, boolean calculateOffset) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "measureChild dataIndex = %d", dataIndex);
Widget widget = mContainer.get(dataIndex);
if (widget != null) {
synchronized (mMeasuredChildren) {
mMeasuredChildren.add(dataIndex);
}
}
return widget;
} | java | {
"resource": ""
} |
q5433 | Layout.measureAll | train | public boolean measureAll(List<Widget> measuredChildren) {
boolean changed = false;
for (int i = 0; i < mContainer.size(); ++i) {
if (!isChildMeasured(i)) {
Widget child = measureChild(i, false);
if (child != null) {
if (measuredChildren != null) {
measuredChildren.add(child);
}
changed = true;
}
}
}
if (changed) {
postMeasurement();
}
return changed;
} | java | {
"resource": ""
} |
q5434 | Layout.layoutChildren | train | public void layoutChildren() {
Set<Integer> copySet;
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "layoutChildren [%d] layout = %s",
mMeasuredChildren.size(), this);
copySet = new HashSet<>(mMeasuredChildren);
}
for (int nextMeasured: copySet) {
Widget child = mContainer.get(nextMeasured);
if (child != null) {
child.preventTransformChanged(true);
layoutChild(nextMeasured);
postLayoutChild(nextMeasured);
child.preventTransformChanged(false);
}
}
} | java | {
"resource": ""
} |
q5435 | Layout.getViewPortSize | train | protected float getViewPortSize(final Axis axis) {
float size = mViewPort == null ? 0 : mViewPort.get(axis);
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "getViewPortSize for %s %f mViewPort = %s", axis, size, mViewPort);
return size;
} | java | {
"resource": ""
} |
q5436 | Layout.layoutChild | train | protected void layoutChild(final int dataIndex) {
Widget child = mContainer.get(dataIndex);
if (child != null) {
float offset = mOffset.get(Axis.X);
if (!equal(offset, 0)) {
updateTransform(child, Axis.X, offset);
}
offset = mOffset.get(Axis.Y);
if (!equal(offset, 0)) {
updateTransform(child, Axis.Y, offset);
}
offset = mOffset.get(Axis.Z);
if (!equal(offset, 0)) {
updateTransform(child, Axis.Z, offset);
}
}
} | java | {
"resource": ""
} |
q5437 | Layout.postLayoutChild | train | protected void postLayoutChild(final int dataIndex) {
if (!mContainer.isDynamic()) {
boolean visibleInLayout = !mViewPort.isClippingEnabled() || inViewPort(dataIndex);
ViewPortVisibility visibility = visibleInLayout ?
ViewPortVisibility.FULLY_VISIBLE : ViewPortVisibility.INVISIBLE;
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "onLayout: child with dataId [%d] viewportVisibility = %s",
dataIndex, visibility);
Widget childWidget = mContainer.get(dataIndex);
if (childWidget != null) {
childWidget.setViewPortVisibility(visibility);
}
}
} | java | {
"resource": ""
} |
q5438 | GVRCollider.lookup | train | static GVRCollider lookup(long nativePointer)
{
synchronized (sColliders)
{
WeakReference<GVRCollider> weakReference = sColliders.get(nativePointer);
return weakReference == null ? null : weakReference.get();
}
} | java | {
"resource": ""
} |
q5439 | GVRCubeSceneObject.createSimpleCubeSixMeshes | train | private void createSimpleCubeSixMeshes(GVRContext gvrContext,
boolean facingOut, String vertexDesc, ArrayList<GVRTexture> textureList)
{
GVRSceneObject[] children = new GVRSceneObject[6];
GVRMesh[] meshes = new GVRMesh[6];
GVRVertexBuffer vbuf = new GVRVertexBuffer(gvrContext, vertexDesc, SIMPLE_VERTICES.length / 3);
if (facingOut)
{
vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0);
vbuf.setFloatArray("a_normal", SIMPLE_OUTWARD_NORMALS, 3, 0);
vbuf.setFloatArray("a_texcoord", SIMPLE_OUTWARD_TEXCOORDS, 2, 0);
meshes[0] = createMesh(vbuf, SIMPLE_OUTWARD_FRONT_INDICES);
meshes[1] = createMesh(vbuf, SIMPLE_OUTWARD_RIGHT_INDICES);
meshes[2] = createMesh(vbuf, SIMPLE_OUTWARD_BACK_INDICES);
meshes[3] = createMesh(vbuf, SIMPLE_OUTWARD_LEFT_INDICES);
meshes[4] = createMesh(vbuf, SIMPLE_OUTWARD_TOP_INDICES);
meshes[5] = createMesh(vbuf, SIMPLE_OUTWARD_BOTTOM_INDICES);
}
else
{
vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0);
vbuf.setFloatArray("a_normal", SIMPLE_INWARD_NORMALS, 3, 0);
vbuf.setFloatArray("a_texcoord", SIMPLE_INWARD_TEXCOORDS, 2, 0);
meshes[0] = createMesh(vbuf, SIMPLE_INWARD_FRONT_INDICES);
meshes[1] = createMesh(vbuf, SIMPLE_INWARD_RIGHT_INDICES);
meshes[2] = createMesh(vbuf, SIMPLE_INWARD_BACK_INDICES);
meshes[3] = createMesh(vbuf, SIMPLE_INWARD_LEFT_INDICES);
meshes[4] = createMesh(vbuf, SIMPLE_INWARD_TOP_INDICES);
meshes[5] = createMesh(vbuf, SIMPLE_INWARD_BOTTOM_INDICES);
}
for (int i = 0; i < 6; i++)
{
children[i] = new GVRSceneObject(gvrContext, meshes[i], textureList.get(i));
addChildObject(children[i]);
}
// attached an empty renderData for parent object, so that we can set some common properties
GVRRenderData renderData = new GVRRenderData(gvrContext);
attachRenderData(renderData);
} | java | {
"resource": ""
} |
q5440 | ARCorePlane.update | train | protected void update(float scale) {
GVRSceneObject owner = getOwnerObject();
if (isEnabled() && (owner != null) && owner.isEnabled())
{
float w = getWidth();
float h = getHeight();
mPose.update(mARPlane.getCenterPose(), scale);
Matrix4f m = new Matrix4f();
m.set(mPose.getPoseMatrix());
m.scaleLocal(w * 0.95f, h * 0.95f, 1.0f);
owner.getTransform().setModelMatrix(m);
}
} | java | {
"resource": ""
} |
q5441 | GVRPositionKey.setValue | train | public void setValue(Vector3f pos) {
mX = pos.x;
mY = pos.y;
mZ = pos.z;
} | java | {
"resource": ""
} |
q5442 | GVRFloatAnimation.getKey | train | public void getKey(int keyIndex, float[] values)
{
int index = keyIndex * mFloatsPerKey;
System.arraycopy(mKeys, index + 1, values, 0, values.length);
} | java | {
"resource": ""
} |
q5443 | GVRFloatAnimation.setKey | train | public void setKey(int keyIndex, float time, final float[] values)
{
int index = keyIndex * mFloatsPerKey;
Integer valSize = mFloatsPerKey-1;
if (values.length != valSize)
{
throw new IllegalArgumentException("This key needs " + valSize.toString() + " float per value");
}
mKeys[index] = time;
System.arraycopy(values, 0, mKeys, index + 1, values.length);
} | java | {
"resource": ""
} |
q5444 | GVRFloatAnimation.resizeKeys | train | public void resizeKeys(int numKeys)
{
int n = numKeys * mFloatsPerKey;
if (mKeys.length == n)
{
return;
}
float[] newKeys = new float[n];
n = Math.min(n, mKeys.length);
System.arraycopy(mKeys, 0, newKeys, 0, n);
mKeys = newKeys;
mFloatInterpolator.setKeyData(mKeys);
} | java | {
"resource": ""
} |
q5445 | GVRComponent.setEnable | train | public void setEnable(boolean flag) {
if (flag == mIsEnabled)
return;
mIsEnabled = flag;
if (getNative() != 0)
{
NativeComponent.setEnable(getNative(), flag);
}
if (flag)
{
onEnable();
}
else
{
onDisable();
}
} | java | {
"resource": ""
} |
q5446 | AsyncManager.registerDatatype | train | public void registerDatatype(Class<? extends GVRHybridObject> textureClass,
AsyncLoaderFactory<? extends GVRHybridObject, ?> asyncLoaderFactory) {
mFactories.put(textureClass, asyncLoaderFactory);
} | java | {
"resource": ""
} |
q5447 | GVRContext.assertGLThread | train | public void assertGLThread() {
if (Thread.currentThread().getId() != mGLThreadID) {
RuntimeException e = new RuntimeException(
"Should not run GL functions from a non-GL thread!");
e.printStackTrace();
throw e;
}
} | java | {
"resource": ""
} |
q5448 | GVRContext.logError | train | public void logError(String message, Object sender) {
getEventManager().sendEvent(this, IErrorEvents.class, "onError", new Object[] { message, sender });
} | java | {
"resource": ""
} |
q5449 | GVRContext.stopDebugServer | train | public synchronized void stopDebugServer() {
if (mDebugServer == null) {
Log.e(TAG, "Debug server is not running.");
return;
}
mDebugServer.shutdown();
mDebugServer = null;
} | java | {
"resource": ""
} |
q5450 | GVRContext.showToast | train | public void showToast(final String message, float duration) {
final float quadWidth = 1.2f;
final GVRTextViewSceneObject toastSceneObject = new GVRTextViewSceneObject(this, quadWidth, quadWidth / 5,
message);
toastSceneObject.setTextSize(6);
toastSceneObject.setTextColor(Color.WHITE);
toastSceneObject.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP);
toastSceneObject.setBackgroundColor(Color.DKGRAY);
toastSceneObject.setRefreshFrequency(GVRTextViewSceneObject.IntervalFrequency.REALTIME);
final GVRTransform t = toastSceneObject.getTransform();
t.setPositionZ(-1.5f);
final GVRRenderData rd = toastSceneObject.getRenderData();
final float finalOpacity = 0.7f;
rd.getMaterial().setOpacity(0);
rd.setRenderingOrder(2 * GVRRenderData.GVRRenderingOrder.OVERLAY);
rd.setDepthTest(false);
final GVRCameraRig rig = getMainScene().getMainCameraRig();
rig.addChildObject(toastSceneObject);
final GVRMaterialAnimation fadeOut = new GVRMaterialAnimation(rd.getMaterial(), duration / 4.0f) {
@Override
protected void animate(GVRHybridObject target, float ratio) {
final GVRMaterial material = (GVRMaterial) target;
material.setOpacity(finalOpacity - ratio * finalOpacity);
}
};
fadeOut.setOnFinish(new GVROnFinish() {
@Override
public void finished(GVRAnimation animation) {
rig.removeChildObject(toastSceneObject);
}
});
final GVRMaterialAnimation fadeIn = new GVRMaterialAnimation(rd.getMaterial(), 3.0f * duration / 4.0f) {
@Override
protected void animate(GVRHybridObject target, float ratio) {
final GVRMaterial material = (GVRMaterial) target;
material.setOpacity(ratio * finalOpacity);
}
};
fadeIn.setOnFinish(new GVROnFinish() {
@Override
public void finished(GVRAnimation animation) {
getAnimationEngine().start(fadeOut);
}
});
getAnimationEngine().start(fadeIn);
} | java | {
"resource": ""
} |
q5451 | MFVec2f.append | train | public void append(float[] newValue) {
if ( (newValue.length % 2) == 0) {
for (int i = 0; i < (newValue.length/2); i++) {
value.add( new SFVec2f(newValue[i*2], newValue[i*2+1]) );
}
}
else {
Log.e(TAG, "X3D MFVec3f append set with array length not divisible by 2");
}
} | java | {
"resource": ""
} |
q5452 | MFVec2f.insertValue | train | public void insertValue(int index, float[] newValue) {
if ( newValue.length == 2) {
try {
value.add( index, new SFVec2f(newValue[0], newValue[1]) );
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) out of bounds." + e);
}
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) exception " + e);
}
}
else {
Log.e(TAG, "X3D MFVec2f insertValue set with array length not equal to 2");
}
} | java | {
"resource": ""
} |
q5453 | GVRSpotLight.setOuterConeAngle | train | public void setOuterConeAngle(float angle)
{
setFloat("outer_cone_angle", (float) Math.cos(Math.toRadians(angle)));
mChanged.set(true);
} | java | {
"resource": ""
} |
q5454 | GVRSpotLight.setCastShadow | train | public void setCastShadow(boolean enableFlag)
{
GVRSceneObject owner = getOwnerObject();
if (owner != null)
{
GVRShadowMap shadowMap = (GVRShadowMap) getComponent(GVRRenderTarget.getComponentType());
if (enableFlag)
{
if (shadowMap != null)
{
shadowMap.setEnable(true);
}
else
{
float angle = (float) Math.acos(getFloat("outer_cone_angle")) * 2.0f;
GVRCamera shadowCam = GVRShadowMap.makePerspShadowCamera(getGVRContext().getMainScene().getMainCameraRig().getCenterCamera(), angle);
shadowMap = new GVRShadowMap(getGVRContext(), shadowCam);
owner.attachComponent(shadowMap);
}
mChanged.set(true);
}
else if (shadowMap != null)
{
shadowMap.setEnable(false);
}
}
mCastShadow = enableFlag;
} | java | {
"resource": ""
} |
q5455 | GVRInputManager.findCursorController | train | public GVRCursorController findCursorController(GVRControllerType type) {
for (int index = 0, size = cache.size(); index < size; index++)
{
int key = cache.keyAt(index);
GVRCursorController controller = cache.get(key);
if (controller.getControllerType().equals(type)) {
return controller;
}
}
return null;
} | java | {
"resource": ""
} |
q5456 | GVRInputManager.clear | train | public int clear()
{
int n = 0;
for (GVRCursorController c : controllers)
{
c.stopDrag();
removeCursorController(c);
++n;
}
return n;
} | java | {
"resource": ""
} |
q5457 | GVRInputManager.close | train | public void close()
{
inputManager.unregisterInputDeviceListener(inputDeviceListener);
mouseDeviceManager.forceStopThread();
gamepadDeviceManager.forceStopThread();
controllerIds.clear();
cache.clear();
controllers.clear();
} | java | {
"resource": ""
} |
q5458 | GVRInputManager.getUniqueControllerId | train | private GVRCursorController getUniqueControllerId(int deviceId) {
GVRCursorController controller = controllerIds.get(deviceId);
if (controller != null) {
return controller;
}
return null;
} | java | {
"resource": ""
} |
q5459 | GVRInputManager.getCacheKey | train | private int getCacheKey(InputDevice device, GVRControllerType controllerType) {
if (controllerType != GVRControllerType.UNKNOWN &&
controllerType != GVRControllerType.EXTERNAL) {
// Sometimes a device shows up using two device ids
// here we try to show both devices as one using the
// product and vendor id
int key = device.getVendorId();
key = 31 * key + device.getProductId();
key = 31 * key + controllerType.hashCode();
return key;
}
return -1; // invalid key
} | java | {
"resource": ""
} |
q5460 | GVRInputManager.addDevice | train | private GVRCursorController addDevice(int deviceId) {
InputDevice device = inputManager.getInputDevice(deviceId);
GVRControllerType controllerType = getGVRInputDeviceType(device);
if (mEnabledControllerTypes == null)
{
return null;
}
if (controllerType == GVRControllerType.GAZE && !mEnabledControllerTypes.contains(GVRControllerType.GAZE))
{
return null;
}
int key;
if (controllerType == GVRControllerType.GAZE) {
// create the controller if there isn't one.
if (gazeCursorController == null) {
gazeCursorController = new GVRGazeCursorController(context, GVRControllerType.GAZE,
GVRDeviceConstants.OCULUS_GEARVR_DEVICE_NAME,
GVRDeviceConstants.OCULUS_GEARVR_TOUCHPAD_VENDOR_ID,
GVRDeviceConstants.OCULUS_GEARVR_TOUCHPAD_PRODUCT_ID);
}
// use the cached gaze key
key = GAZE_CACHED_KEY;
} else {
key = getCacheKey(device, controllerType);
}
if (key != -1)
{
GVRCursorController controller = cache.get(key);
if (controller == null)
{
if ((mEnabledControllerTypes == null) || !mEnabledControllerTypes.contains(controllerType))
{
return null;
}
if (controllerType == GVRControllerType.MOUSE)
{
controller = mouseDeviceManager.getCursorController(context, device.getName(), device.getVendorId(), device.getProductId());
}
else if (controllerType == GVRControllerType.GAMEPAD)
{
controller = gamepadDeviceManager.getCursorController(context, device.getName(), device.getVendorId(), device.getProductId());
}
else if (controllerType == GVRControllerType.GAZE)
{
controller = gazeCursorController;
}
cache.put(key, controller);
controllerIds.put(device.getId(), controller);
return controller;
}
else
{
controllerIds.put(device.getId(), controller);
}
}
return null;
} | java | {
"resource": ""
} |
q5461 | GVRTexture.getAtlasInformation | train | public List<GVRAtlasInformation> getAtlasInformation()
{
if ((mImage != null) && (mImage instanceof GVRImageAtlas))
{
return ((GVRImageAtlas) mImage).getAtlasInformation();
}
return null;
} | java | {
"resource": ""
} |
q5462 | GVRTexture.setImage | train | public void setImage(final GVRImage imageData)
{
mImage = imageData;
if (imageData != null)
NativeTexture.setImage(getNative(), imageData, imageData.getNative());
else
NativeTexture.setImage(getNative(), null, 0);
} | java | {
"resource": ""
} |
q5463 | InputProviderService.sendEvent | train | public static void sendEvent(Context context, Parcelable event) {
Intent intent = new Intent(EventManager.ACTION_ACCESSORY_EVENT);
intent.putExtra(EventManager.EXTRA_EVENT, event);
context.sendBroadcast(intent);
} | java | {
"resource": ""
} |
q5464 | Jassimp.importFile | train | public static AiScene importFile(String filename) throws IOException {
return importFile(filename, EnumSet.noneOf(AiPostProcessSteps.class));
} | java | {
"resource": ""
} |
q5465 | GVRSkeletonAnimation.addChannel | train | public void addChannel(String boneName, GVRAnimationChannel channel)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
mBoneChannels[boneId] = channel;
mSkeleton.setBoneOptions(boneId, GVRSkeleton.BONE_ANIMATE);
Log.d("BONE", "Adding animation channel %d %s ", boneId, boneName);
}
} | java | {
"resource": ""
} |
q5466 | GVRSkeletonAnimation.findChannel | train | public GVRAnimationChannel findChannel(String boneName)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
return mBoneChannels[boneId];
}
return null;
} | java | {
"resource": ""
} |
q5467 | GVRSkeletonAnimation.animate | train | public void animate(float timeInSec)
{
GVRSkeleton skel = getSkeleton();
GVRPose pose = skel.getPose();
computePose(timeInSec,pose);
skel.poseToBones();
skel.updateBonePose();
skel.updateSkinPose();
} | java | {
"resource": ""
} |
q5468 | ResourceCache.put | train | public void put(GVRAndroidResource androidResource, T resource) {
Log.d(TAG, "put resource %s to cache", androidResource);
super.put(androidResource, resource);
} | java | {
"resource": ""
} |
q5469 | ControlBar.removeControl | train | public void removeControl(String name) {
Widget control = findChildByName(name);
if (control != null) {
removeChild(control);
if (mBgResId != -1) {
updateMesh();
}
}
} | java | {
"resource": ""
} |
q5470 | ControlBar.addControl | train | public void addControl(String name, JSONObject properties, Widget.OnTouchListener listener) {
final JSONObject allowedProperties = new JSONObject();
put(allowedProperties, Widget.Properties.name, optString(properties, Widget.Properties.name));
put(allowedProperties, Widget.Properties.size, new PointF(mControlDimensions.x, mControlDimensions.y));
put(allowedProperties, Widget.Properties.states, optJSONObject(properties, Widget.Properties.states));
Widget control = new Widget(getGVRContext(), allowedProperties);
setupControl(name, control, listener, -1);
} | java | {
"resource": ""
} |
q5471 | ControlBar.addControl | train | public Widget addControl(String name, int resId, Widget.OnTouchListener listener) {
return addControl(name, resId, null, listener, -1);
} | java | {
"resource": ""
} |
q5472 | ControlBar.addControl | train | public Widget addControl(String name, int resId, String label, Widget.OnTouchListener listener) {
return addControl(name, resId, label, listener, -1);
} | java | {
"resource": ""
} |
q5473 | ControlBar.addControl | train | public Widget addControl(String name, int resId, Widget.OnTouchListener listener, int position) {
Widget control = findChildByName(name);
if (control == null) {
control = createControlWidget(resId, name, null);
}
setupControl(name, control, listener, position);
return control;
} | java | {
"resource": ""
} |
q5474 | GVRMeshCollider.setMesh | train | public void setMesh(GVRMesh mesh) {
mMesh = mesh;
NativeMeshCollider.setMesh(getNative(), mesh.getNative());
} | java | {
"resource": ""
} |
q5475 | GVRGenericConstraint.setLinearLowerLimits | train | public void setLinearLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearLowerLimits(getNative(), limitX, limitY, limitZ);
} | java | {
"resource": ""
} |
q5476 | GVRGenericConstraint.setLinearUpperLimits | train | public void setLinearUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearUpperLimits(getNative(), limitX, limitY, limitZ);
} | java | {
"resource": ""
} |
q5477 | GVRGenericConstraint.setAngularLowerLimits | train | public void setAngularLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularLowerLimits(getNative(), limitX, limitY, limitZ);
} | java | {
"resource": ""
} |
q5478 | GVRGenericConstraint.setAngularUpperLimits | train | public void setAngularUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularUpperLimits(getNative(), limitX, limitY, limitZ);
} | java | {
"resource": ""
} |
q5479 | Particles.makeParticleMesh | train | GVRSceneObject makeParticleMesh(float[] vertices, float[] velocities,
float[] particleTimeStamps )
{
mParticleMesh = new GVRMesh(mGVRContext);
//pass the particle positions as vertices, velocities as normals, and
//spawning times as texture coordinates.
mParticleMesh.setVertices(vertices);
mParticleMesh.setNormals(velocities);
mParticleMesh.setTexCoords(particleTimeStamps);
particleID = new GVRShaderId(ParticleShader.class);
material = new GVRMaterial(mGVRContext, particleID);
material.setVec4("u_color", mColorMultiplier.x, mColorMultiplier.y,
mColorMultiplier.z, mColorMultiplier.w);
material.setFloat("u_particle_age", mAge);
material.setVec3("u_acceleration", mAcceleration.x, mAcceleration.y, mAcceleration.z);
material.setFloat("u_particle_size", mSize);
material.setFloat("u_size_change_rate", mParticleSizeRate);
material.setFloat("u_fade", mFadeWithAge);
material.setFloat("u_noise_factor", mNoiseFactor);
GVRRenderData renderData = new GVRRenderData(mGVRContext);
renderData.setMaterial(material);
renderData.setMesh(mParticleMesh);
material.setMainTexture(mTexture);
GVRSceneObject meshObject = new GVRSceneObject(mGVRContext);
meshObject.attachRenderData(renderData);
meshObject.getRenderData().setMaterial(material);
// Set the draw mode to GL_POINTS, disable writing to depth buffer, enable depth testing
// and set the rendering order to transparent.
// Disabling writing to depth buffer ensure that the particles blend correctly
// and keeping the depth test on along with rendering them
// after the geometry queue makes sure they occlude, and are occluded, correctly.
meshObject.getRenderData().setDrawMode(GL_POINTS);
meshObject.getRenderData().setDepthTest(true);
meshObject.getRenderData().setDepthMask(false);
meshObject.getRenderData().setRenderingOrder(GVRRenderData.GVRRenderingOrder.TRANSPARENT);
return meshObject;
} | java | {
"resource": ""
} |
q5480 | GVRScriptBehavior.setFilePath | train | public void setFilePath(String filePath) throws IOException, GVRScriptException
{
GVRResourceVolume.VolumeType volumeType = GVRResourceVolume.VolumeType.ANDROID_ASSETS;
String fname = filePath.toLowerCase();
mLanguage = FileNameUtils.getExtension(fname);
if (fname.startsWith("sd:"))
{
volumeType = GVRResourceVolume.VolumeType.ANDROID_SDCARD;
}
else if (fname.startsWith("http:") || fname.startsWith("https:"))
{
volumeType = GVRResourceVolume.VolumeType.NETWORK;
}
GVRResourceVolume volume = new GVRResourceVolume(getGVRContext(), volumeType,
FileNameUtils.getParentDirectory(filePath));
GVRAndroidResource resource = volume.openResource(filePath);
setScriptFile((GVRScriptFile)getGVRContext().getScriptManager().loadScript(resource, mLanguage));
} | java | {
"resource": ""
} |
q5481 | GVRScriptBehavior.setScriptText | train | public void setScriptText(String scriptText, String language)
{
GVRScriptFile newScript = new GVRJavascriptScriptFile(getGVRContext(), scriptText);
mLanguage = GVRScriptManager.LANG_JAVASCRIPT;
setScriptFile(newScript);
} | java | {
"resource": ""
} |
q5482 | GVRScriptBehavior.invokeFunction | train | public boolean invokeFunction(String funcName, Object[] args)
{
mLastError = null;
if (mScriptFile != null)
{
if (mScriptFile.invokeFunction(funcName, args))
{
return true;
}
}
mLastError = mScriptFile.getLastError();
if ((mLastError != null) && !mLastError.contains("is not defined"))
{
getGVRContext().logError(mLastError, this);
}
return false;
} | java | {
"resource": ""
} |
q5483 | GVRViewSceneObject.setTextureBufferSize | train | public void setTextureBufferSize(final int size) {
mRootViewGroup.post(new Runnable() {
@Override
public void run() {
mRootViewGroup.setTextureBufferSize(size);
}
});
} | java | {
"resource": ""
} |
q5484 | GVRCamera.setBackgroundColor | train | public void setBackgroundColor(int color) {
setBackgroundColorR(Colors.byteToGl(Color.red(color)));
setBackgroundColorG(Colors.byteToGl(Color.green(color)));
setBackgroundColorB(Colors.byteToGl(Color.blue(color)));
setBackgroundColorA(Colors.byteToGl(Color.alpha(color)));
} | java | {
"resource": ""
} |
q5485 | GVRCamera.setBackgroundColor | train | public void setBackgroundColor(float r, float g, float b, float a) {
setBackgroundColorR(r);
setBackgroundColorG(g);
setBackgroundColorB(b);
setBackgroundColorA(a);
} | java | {
"resource": ""
} |
q5486 | GVRCamera.addPostEffect | train | public void addPostEffect(GVRMaterial postEffectData) {
GVRContext ctx = getGVRContext();
if (mPostEffects == null)
{
mPostEffects = new GVRRenderData(ctx, postEffectData);
GVRMesh dummyMesh = new GVRMesh(getGVRContext(),"float3 a_position float2 a_texcoord");
mPostEffects.setMesh(dummyMesh);
NativeCamera.setPostEffect(getNative(), mPostEffects.getNative());
mPostEffects.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
}
else
{
GVRRenderPass rpass = new GVRRenderPass(ctx, postEffectData);
rpass.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
mPostEffects.addPass(rpass);
}
} | java | {
"resource": ""
} |
q5487 | GVRSkeleton.getBoneIndex | train | public int getBoneIndex(GVRSceneObject bone)
{
for (int i = 0; i < getNumBones(); ++i)
if (mBones[i] == bone)
return i;
return -1;
} | java | {
"resource": ""
} |
q5488 | GVRSkeleton.getBoneIndex | train | public int getBoneIndex(String bonename)
{
for (int i = 0; i < getNumBones(); ++i)
if (mBoneNames[i].equals(bonename))
return i;
return -1;
} | java | {
"resource": ""
} |
q5489 | GVRSkeleton.setBoneName | train | public void setBoneName(int boneindex, String bonename)
{
mBoneNames[boneindex] = bonename;
NativeSkeleton.setBoneName(getNative(), boneindex, bonename);
} | java | {
"resource": ""
} |
q5490 | GVRSkeleton.poseFromBones | train | public void poseFromBones()
{
for (int i = 0; i < getNumBones(); ++i)
{
GVRSceneObject bone = mBones[i];
if (bone == null)
{
continue;
}
if ((mBoneOptions[i] & BONE_LOCK_ROTATION) != 0)
{
continue;
}
GVRTransform trans = bone.getTransform();
mPose.setLocalMatrix(i, trans.getLocalModelMatrix4f());
}
mPose.sync();
updateBonePose();
} | java | {
"resource": ""
} |
q5491 | GVRSkeleton.merge | train | public void merge(GVRSkeleton newSkel)
{
int numBones = getNumBones();
List<Integer> parentBoneIds = new ArrayList<Integer>(numBones + newSkel.getNumBones());
List<String> newBoneNames = new ArrayList<String>(newSkel.getNumBones());
List<Matrix4f> newMatrices = new ArrayList<Matrix4f>(newSkel.getNumBones());
GVRPose oldBindPose = getBindPose();
GVRPose curPose = getPose();
for (int i = 0; i < numBones; ++i)
{
parentBoneIds.add(mParentBones[i]);
}
for (int j = 0; j < newSkel.getNumBones(); ++j)
{
String boneName = newSkel.getBoneName(j);
int boneId = getBoneIndex(boneName);
if (boneId < 0)
{
int parentId = newSkel.getParentBoneIndex(j);
Matrix4f m = new Matrix4f();
newSkel.getBindPose().getLocalMatrix(j, m);
newMatrices.add(m);
newBoneNames.add(boneName);
if (parentId >= 0)
{
boneName = newSkel.getBoneName(parentId);
parentId = getBoneIndex(boneName);
}
parentBoneIds.add(parentId);
}
}
if (parentBoneIds.size() == numBones)
{
return;
}
int n = numBones + parentBoneIds.size();
int[] parentIds = Arrays.copyOf(mParentBones, n);
int[] boneOptions = Arrays.copyOf(mBoneOptions, n);
String[] boneNames = Arrays.copyOf(mBoneNames, n);
mBones = Arrays.copyOf(mBones, n);
mPoseMatrices = new float[n * 16];
for (int i = 0; i < parentBoneIds.size(); ++i)
{
n = numBones + i;
parentIds[n] = parentBoneIds.get(i);
boneNames[n] = newBoneNames.get(i);
boneOptions[n] = BONE_ANIMATE;
}
mBoneOptions = boneOptions;
mBoneNames = boneNames;
mParentBones = parentIds;
mPose = new GVRPose(this);
mBindPose = new GVRPose(this);
mBindPose.copy(oldBindPose);
mPose.copy(curPose);
mBindPose.sync();
for (int j = 0; j < newSkel.getNumBones(); ++j)
{
mBindPose.setLocalMatrix(numBones + j, newMatrices.get(j));
mPose.setLocalMatrix(numBones + j, newMatrices.get(j));
}
setBindPose(mBindPose);
mPose.sync();
updateBonePose();
} | java | {
"resource": ""
} |
q5492 | GVRApplication.getFullScreenView | train | public View getFullScreenView() {
if (mFullScreenView != null) {
return mFullScreenView;
}
final DisplayMetrics metrics = new DisplayMetrics();
mActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
final int screenWidthPixels = Math.max(metrics.widthPixels, metrics.heightPixels);
final int screenHeightPixels = Math.min(metrics.widthPixels, metrics.heightPixels);
final ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams(screenWidthPixels, screenHeightPixels);
mFullScreenView = new View(mActivity);
mFullScreenView.setLayoutParams(layout);
mRenderableViewGroup.addView(mFullScreenView);
return mFullScreenView;
} | java | {
"resource": ""
} |
q5493 | GVRApplication.unregisterView | train | public final void unregisterView(final View view) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (null != mRenderableViewGroup && view.getParent() == mRenderableViewGroup) {
mRenderableViewGroup.removeView(view);
}
}
});
} | java | {
"resource": ""
} |
q5494 | GroupWidget.clear | train | public void clear() {
List<Widget> children = getChildren();
Log.d(TAG, "clear(%s): removing %d children", getName(), children.size());
for (Widget child : children) {
removeChild(child, true);
}
requestLayout();
} | java | {
"resource": ""
} |
q5495 | GroupWidget.inViewPort | train | protected boolean inViewPort(final int dataIndex) {
boolean inViewPort = true;
for (Layout layout: mLayouts) {
inViewPort = inViewPort && (layout.inViewPort(dataIndex) || !layout.isClippingEnabled());
}
return inViewPort;
} | java | {
"resource": ""
} |
q5496 | GVRCompressedImage.setDataOffsets | train | public void setDataOffsets(int[] offsets)
{
assert(mLevels == offsets.length);
NativeBitmapImage.updateCompressed(getNative(), mWidth, mHeight, mImageSize, mData, mLevels, offsets);
mData = null;
} | java | {
"resource": ""
} |
q5497 | FileNameUtils.getFilename | train | public static String getFilename(String path) throws IllegalArgumentException {
if (Pattern.matches(sPatternUrl, path))
return getURLFilename(path);
return new File(path).getName();
} | java | {
"resource": ""
} |
q5498 | FileNameUtils.getParentDirectory | train | public static String getParentDirectory(String filePath) throws IllegalArgumentException {
if (Pattern.matches(sPatternUrl, filePath))
return getURLParentDirectory(filePath);
return new File(filePath).getParent();
} | java | {
"resource": ""
} |
q5499 | FileNameUtils.getURLParentDirectory | train | public static String getURLParentDirectory(String urlString) throws IllegalArgumentException {
URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
throw Exceptions.IllegalArgument("Malformed URL: %s", url);
}
String path = url.getPath();
int lastSlashIndex = path.lastIndexOf("/");
String directory = lastSlashIndex == -1 ? "" : path.substring(0, lastSlashIndex);
return String.format("%s://%s%s%s%s", url.getProtocol(),
url.getUserInfo() == null ? "" : url.getUserInfo() + "@",
url.getHost(),
url.getPort() == -1 ? "" : ":" + Integer.toString(url.getPort()),
directory);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.