예제 #1
0
  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);
  }
예제 #2
0
 private void setTextAlpha(float alpha) {
   mLeftView.setTextViewAlpha(alpha);
   mRightView.setTextViewAlpha(alpha);
 }
예제 #3
0
 private void setText(String text) {
   mLeftView.setText(text);
   mRightView.setText(text);
 }
예제 #4
0
 private void setDepthOffset(float offset) {
   mLeftView.setOffset(offset);
   mRightView.setOffset(-offset);
 }
예제 #5
0
 private void setColor(int color) {
   mLeftView.setColor(color);
   mRightView.setColor(color);
 }