public CardboardOverlayView(Context context, AttributeSet attrs) { super(context, attrs); setOrientation(HORIZONTAL); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f); params.setMargins(0, 0, 0, 0); mLeftView = new CardboardOverlayEyeView(context, attrs); mLeftView.setLayoutParams(params); addView(mLeftView); mRightView = new CardboardOverlayEyeView(context, attrs); mRightView.setLayoutParams(params); addView(mRightView); // Set some reasonable defaults. setDepthOffset(0.016f); setColor(Color.rgb(150, 255, 180)); setVisibility(View.VISIBLE); mTextFadeAnimation = new AlphaAnimation(1.0f, 0.0f); mTextFadeAnimation.setDuration(5000); }
private void setTextAlpha(float alpha) { mLeftView.setTextViewAlpha(alpha); mRightView.setTextViewAlpha(alpha); }
private void setText(String text) { mLeftView.setText(text); mRightView.setText(text); }
private void setDepthOffset(float offset) { mLeftView.setOffset(offset); mRightView.setOffset(-offset); }
private void setColor(int color) { mLeftView.setColor(color); mRightView.setColor(color); }