Java Code Examples for android.view.SurfaceHolder

The following are top voted examples for showing how to use android.view.SurfaceHolder. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: QRCodeScanner   File: BarcodeScanView.java   View source code 6 votes vote down vote up
private void init() {
    // init surfaceholder
    SurfaceHolder holder = getHolder();
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    holder.addCallback(this);

    WindowManager manager = (WindowManager) getContext().getSystemService(
            Context.WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    screenWidth = display.getWidth();
    screenHeight = display.getHeight();
    int width = screenWidth >= screenHeight ? screenWidth : screenHeight;
    int height = screenWidth + screenHeight - width;
    int rotation = display.getRotation();
    mScanner = CameraScanner.getInstance();
    mScanner.setRotation(0);  //此处直接设为0,配合竖屏展示
    mScanner.setReqSize(width, height);

}
 
Example 2
Project: FaceDetectDemo   File: CameraBridgeViewBase.java   View source code 6 votes vote down vote up
public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {
    Log.d(TAG, "call surfaceChanged event");
    synchronized(mSyncObject) {
        if (!mSurfaceExist) {
            mSurfaceExist = true;
            checkCurrentState();
        } else {
            /** Surface changed. We need to stop camera and restart with new parameters */
            /* Pretend that old surface has been destroyed */
            mSurfaceExist = false;
            checkCurrentState();
            /* Now use new surface. Say we have it now */
            mSurfaceExist = true;
            checkCurrentState();
        }
    }
}
 
Example 3
Project: TPlayer   File: VideoView.java   View source code 6 votes vote down vote up
@SuppressWarnings("deprecation")
private void initVideoView(Context ctx) {
  mContext = ctx;
  mVideoWidth = 0;
  mVideoHeight = 0;
  getHolder().setFormat(PixelFormat.RGBA_8888); // PixelFormat.RGB_565
  getHolder().addCallback(mSHCallback);
  // this value only use Hardware decoder before Android 2.3
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && mHardwareDecoder) {
    getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  }
  setFocusable(true);
  setFocusableInTouchMode(true);
  requestFocus();
  mCurrentState = STATE_IDLE;
  mTargetState = STATE_IDLE;
  if (ctx instanceof Activity) {
      ((Activity) ctx).setVolumeControlStream(AudioManager.STREAM_MUSIC);
  }
}
 
Example 4
Project: BilibiliClient   File: VideoPlayerView.java   View source code 6 votes vote down vote up
public void surfaceChanged(SurfaceHolder holder, int format, int w,
                           int h) {

  mSurfaceHolder = holder;
  if (mMediaPlayer != null) {
    mMediaPlayer.setDisplay(mSurfaceHolder);
  }

  mSurfaceWidth = w;
  mSurfaceHeight = h;
  boolean isValidState = (mTargetState == STATE_PLAYING);
  boolean hasValidSize = (mVideoWidth == w && mVideoHeight == h);
  if (mMediaPlayer != null && isValidState && hasValidSize) {
    if (mSeekWhenPrepared != 0) {
      seekTo(mSeekWhenPrepared);
    }
    start();
    if (mMediaController != null) {
      if (mMediaController.isShowing()) {
        mMediaController.hide();
      }
      mMediaController.show();
    }
  }
}
 
Example 5
Project: GitHub   File: CameraManager.java   View source code 6 votes vote down vote up
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public void openDriver(SurfaceHolder holder) throws IOException {
	if (camera == null) {
		camera = Camera.open();
		if (camera == null) {
			throw new IOException();
		}
		camera.setPreviewDisplay(holder);

		if (!initialized) {
			initialized = true;
			configManager.initFromCameraParameters(camera);
		}
		configManager.setDesiredCameraParameters(camera);

		//FIXME
		//     SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
		//�Ƿ�ʹ��ǰ��
		//      if (prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false)) {
		//        FlashlightManager.enableFlashlight();
		//      }
		FlashlightManager.enableFlashlight();
	}
}
 
Example 6
Project: MOAAP   File: CameraBridgeViewBase.java   View source code 6 votes vote down vote up
public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {
    Log.d(TAG, "call surfaceChanged event");
    synchronized(mSyncObject) {
        if (!mSurfaceExist) {
            mSurfaceExist = true;
            checkCurrentState();
        } else {
            /** Surface changed. We need to stop camera and restart with new parameters */
            /* Pretend that old surface has been destroyed */
            mSurfaceExist = false;
            checkCurrentState();
            /* Now use new surface. Say we have it now */
            mSurfaceExist = true;
            checkCurrentState();
        }
    }
}
 
Example 7
Project: CSipSimple   File: ViESurfaceRenderer.java   View source code 6 votes vote down vote up
public void surfaceChanged(SurfaceHolder holder, int format,
        int in_width, int in_height) {
    Log.d(TAG, "ViESurfaceRender::surfaceChanged");

    changeDestRect(in_width, in_height);

    Log.d(TAG, "ViESurfaceRender::surfaceChanged" +
            " in_width:" + in_width + " in_height:" + in_height +
            " srcRect.left:" + srcRect.left +
            " srcRect.top:" + srcRect.top +
            " srcRect.right:" + srcRect.right +
            " srcRect.bottom:" + srcRect.bottom +
            " dstRect.left:" + dstRect.left +
            " dstRect.top:" + dstRect.top +
            " dstRect.right:" + dstRect.right +
            " dstRect.bottom:" + dstRect.bottom);
}
 
Example 8
Project: OpenCV   File: CameraBridgeViewBase.java   View source code 6 votes vote down vote up
public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {
    Log.d(TAG, "call surfaceChanged event");
    synchronized(mSyncObject) {
        if (!mSurfaceExist) {
            mSurfaceExist = true;
            checkCurrentState();
        } else {
            /** Surface changed. We need to stop camera and restart with new parameters */
            /* Pretend that old surface has been destroyed */
            mSurfaceExist = false;
            checkCurrentState();
            /* Now use new surface. Say we have it now */
            mSurfaceExist = true;
            checkCurrentState();
        }
    }
}
 
Example 9
Project: GestureVideoView   File: SurfaceRenderView.java   View source code 6 votes vote down vote up
@Override
public void surfaceChanged(SurfaceHolder holder, int format,
                           int width, int height) {
    mSurfaceHolder = holder;
    mIsFormatChanged = true;
    mFormat = format;
    mWidth = width;
    mHeight = height;

    // mMeasureHelper.setVideoSize(width, height);

    ISurfaceHolder surfaceHolder = new InternalSurfaceHolder(mWeakSurfaceView.get(), mSurfaceHolder);
    for (IRenderCallback renderCallback : mRenderCallbackMap.keySet()) {
        renderCallback.onSurfaceChanged(surfaceHolder, format, width, height);
    }
}
 
Example 10
Project: MeiLa_GNN   File: CameraManager.java   View source code 6 votes vote down vote up
/**
     * Opens the camera driver and initializes the hardware parameters.
     *
     * @param holder The surface object which the camera will draw preview frames into.
     * @throws IOException Indicates the camera driver failed to open.
     */
    public void openDriver(SurfaceHolder holder) throws IOException {
        if (camera == null) {
            camera = Camera.open();
            if (camera == null) {
                throw new IOException();
            }
            camera.setPreviewDisplay(holder);

            if (!initialized) {
                initialized = true;
                configManager.initFromCameraParameters(camera);
            }
            configManager.setDesiredCameraParameters(camera);

            //FIXME
            //     SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
            //�Ƿ�ʹ��ǰ��
//      if (prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false)) {
//        FlashlightManager.enableFlashlight();
//      }
            FlashlightManager.enableFlashlight();
        }
    }
 
Example 11
Project: EVideoRecorder   File: ERecorderActivity.java   View source code 6 votes vote down vote up
@Override
protected void initView() {

    mSurfaceview = (SurfaceView) findViewById(R.id.surfaceview);
    mRlTakeVedio = (RelativeLayout) findViewById(R.id.rl_take_vedio);
    mIvCancel = (ImageView) findViewById(R.id.iv_cancel);
    mTrpbController = (TimeRoundProgressBar) findViewById(R.id.trpb_controller);
    mRlConfrmVedio = (RelativeLayout) findViewById(R.id.rl_confrm_vedio);
    mIvDelete = (ImageView) findViewById(R.id.iv_delete);
    mIvConfirm = (ImageView) findViewById(R.id.iv_confirm);


    mDialog = ERecorderActivityImpl.getCreateVedioDialog(getActivity());
    mTrpbController.setMax(mRecordTime);

    SurfaceHolder holder = mSurfaceview.getHolder();// 取得holder
    holder.setFormat(PixelFormat.TRANSPARENT);
    holder.setKeepScreenOn(true);
    holder.addCallback(this); // holder加入回调接口
}
 
Example 12
Project: CSipSimple   File: ViESurfaceRenderer.java   View source code 6 votes vote down vote up
public void surfaceCreated(SurfaceHolder holder) {
    Canvas canvas = surfaceHolder.lockCanvas();
    if(canvas != null) {
        Rect dst = surfaceHolder.getSurfaceFrame();
        if(dst != null) {
            changeDestRect(dst.right - dst.left, dst.bottom - dst.top);
            Log.d(TAG, "ViESurfaceRender::surfaceCreated" +
                    " dst.left:" + dst.left +
                    " dst.top:" + dst.top +
                    " dst.right:" + dst.right +
                    " dst.bottom:" + dst.bottom +
                    " srcRect.left:" + srcRect.left +
                    " srcRect.top:" + srcRect.top +
                    " srcRect.right:" + srcRect.right +
                    " srcRect.bottom:" + srcRect.bottom +
                    " dstRect.left:" + dstRect.left +
                    " dstRect.top:" + dstRect.top +
                    " dstRect.right:" + dstRect.right +
                    " dstRect.bottom:" + dstRect.bottom);
        }
        surfaceHolder.unlockCanvasAndPost(canvas);
    }
}
 
Example 13
Project: AndroidBasicLibs   File: CaptureActivity.java   View source code 6 votes vote down vote up
@Override
protected void onResume() {
	super.onResume();
	SurfaceHolder surfaceHolder = surfaceView.getHolder();
	if (hasSurface) {
		initCamera(surfaceHolder);
	} else {
		surfaceHolder.addCallback(this);
		surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
	}
	decodeFormats = null;
	characterSet = null;

	playBeep = true;
	AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
	if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
		playBeep = false;
	}
	initBeepSound();
	vibrate = true;
}
 
Example 14
Project: RLibrary   File: UIScanView.java   View source code 6 votes vote down vote up
private void initCamera(SurfaceHolder surfaceHolder) {
    if (surfaceHolder == null) {
        return;
    }
    if (cameraManager.isOpen()) {
        return;
    }
    try {
        cameraManager.openDriver(surfaceHolder);
        if (handler == null) {
            handler = new CaptureActivityHandler(this, decodeFormats,
                    decodeHints, characterSet, cameraManager);
        }
        decodeOrStoreSavedBitmap(null, null);
    } catch (IOException ioe) {
        displayFrameworkBugMessageAndExit();
    } catch (RuntimeException e) {
        displayFrameworkBugMessageAndExit();
    }
}
 
Example 15
Project: ZXingDemo   File: CameraManager.java   View source code 6 votes vote down vote up
/**
   * Opens the camera driver and initializes the hardware parameters.
   *
   * @param holder The surface object which the camera will draw preview frames into.
   * @throws IOException Indicates the camera driver failed to open.
   */
  public void openDriver(SurfaceHolder holder) throws IOException {
    if (camera == null) {
      camera = Camera.open();
      if (camera == null) {
        throw new IOException();
      }
      camera.setPreviewDisplay(holder);

      if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(camera);
      }
      configManager.setDesiredCameraParameters(camera);

      //FIXME
 //     SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
      //是否使用前灯
//      if (prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false)) {
//        FlashlightManager.enableFlashlight();
//      }
      FlashlightManager.enableFlashlight();
    }
  }
 
Example 16
Project: Dendroid-HTTP-RAT   File: CameraView.java   View source code 5 votes vote down vote up
@SuppressWarnings("deprecation")
public void onCreate(Bundle icicle){
          super.onCreate(icicle);
          
          Log.e(TAG, "onCreate");

          setContentView(R.layout.cameraview);
          
          mSurfaceView = (SurfaceView) findViewById(R.id.surface_camera);
          mSurfaceHolder = mSurfaceView.getHolder();
          mSurfaceHolder.addCallback(this);
          mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
      }
 
Example 17
Project: QuanMinTV   File: MediaPlayer.java   View source code 5 votes vote down vote up
/**
 * Sets the SurfaceHolder to use for displaying the video portion of the
 * media. This call is optional. Not calling it when playing back a video will
 * result in only the audio track being played.
 *
 * @param sh the SurfaceHolder to use for video display
 */
public void setDisplay(SurfaceHolder sh) {
  if (sh == null) {
    releaseDisplay();
  } else {
    mSurfaceHolder = sh;
    mSurface = sh.getSurface();
    _setVideoSurface(mSurface);
    updateSurfaceScreenOn();
  }
}
 
Example 18
Project: AndroidRTC   File: SurfaceViewRenderer.java   View source code 5 votes vote down vote up
@Override
public void surfaceCreated(final SurfaceHolder holder) {
  ThreadUtils.checkIsOnMainThread();
  eglRenderer.createEglSurface(holder.getSurface());
  surfaceWidth = surfaceHeight = 0;
  updateSurfaceSize();
}
 
Example 19
Project: AR   File: CameraView.java   View source code 5 votes vote down vote up
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height ) {
    Camera.Parameters parameters = camera.getParameters();
    List<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes();
    Camera.Size previewSize = previewSizes.get(previewSizes.size()-1);
    Camera.Parameters p = camera.getParameters();

    p.setPreviewSize( previewSize.width, previewSize.height );
    camera.setParameters( p );
    try{camera.setPreviewDisplay( holder );} catch(IOException e){e.printStackTrace();}
    camera.startPreview();
}
 
Example 20
Project: Expert-Android-Programming   File: DefaultEasyCamera.java   View source code 5 votes vote down vote up
@Override
public CameraActions startPreview(SurfaceHolder holder) throws IOException {
    if (holder == null) {
        throw new NullPointerException("You cannot start preview without a preview surface");
    }
    camera.setPreviewDisplay(holder);
    camera.startPreview();
    return new DefaultCameraActions(this);
}
 
Example 21
Project: Mobike   File: CaptureActivity.java   View source code 5 votes vote down vote up
private void initCamera(SurfaceHolder surfaceHolder) {
    try {
        CameraManager.get().openDriver(surfaceHolder);
    } catch (IOException ioe) {
        return;
    } catch (RuntimeException e) {
        return;
    }
    if (handler == null) {
        handler = new CaptureActivityHandler(this, decodeFormats,
                characterSet);
    }
}
 
Example 22
Project: boohee_v5.6   File: SurfaceRenderView.java   View source code 5 votes vote down vote up
public void surfaceDestroyed(SurfaceHolder holder) {
    this.mSurfaceHolder = null;
    this.mIsFormatChanged = false;
    this.mFormat = 0;
    this.mWidth = 0;
    this.mHeight = 0;
    ISurfaceHolder surfaceHolder = new InternalSurfaceHolder((SurfaceRenderView) this
            .mWeakSurfaceView.get(), this.mSurfaceHolder);
    for (IRenderCallback renderCallback : this.mRenderCallbackMap.keySet()) {
        renderCallback.onSurfaceDestroyed(surfaceHolder);
    }
}
 
Example 23
Project: GestureVideoView   File: SurfaceRenderView.java   View source code 5 votes vote down vote up
private void initView(Context context) {
    mMeasureHelper = new MeasureHelper(this);
    mSurfaceCallback = new SurfaceCallback(this);
    getHolder().addCallback(mSurfaceCallback);
    //noinspection deprecation
    getHolder().setType(SurfaceHolder.SURFACE_TYPE_NORMAL);
}
 
Example 24
Project: AdronEngine   File: CameraSurface.java   View source code 5 votes vote down vote up
public CameraSurface( Context context ) {
    super( context );
    // We're implementing the Callback interface and want to get notified
    // about certain surface events.
    getHolder().addCallback( this );
    // We're changing the surface to a PUSH surface, meaning we're receiving
    // all buffer data from another component - the camera, in this case.
    getHolder().setType( SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS );
}
 
Example 25
Project: GitHub   File: SurfaceRenderView.java   View source code 5 votes vote down vote up
private void initView(Context context) {
    mMeasureHelper = new MeasureHelper(this);
    mSurfaceCallback = new SurfaceCallback(this);
    getHolder().addCallback(mSurfaceCallback);
    //noinspection deprecation
    getHolder().setType(SurfaceHolder.SURFACE_TYPE_NORMAL);
}
 
Example 26
Project: letv   File: VideoViewH264m3u8_4D.java   View source code 5 votes vote down vote up
public void surfaceCreated(SurfaceHolder holder) {
    LogTag.i("mSHCallback:surfaceCreated()");
    if (VideoViewH264m3u8_4D.this.mSurfaceHolder == null) {
        VideoViewH264m3u8_4D.this.mSurfaceHolder = holder;
        VideoViewH264m3u8_4D.this.openVideo();
    }
}
 
Example 27
Project: NSMPlayer-Android   File: WrapExoPlayer.java   View source code 5 votes vote down vote up
@Override
public void setDisplay(SurfaceHolder sh) {
    if (sh == null) {
        setSurface(null);
    } else {
        setSurface(sh.getSurface());
    }
}
 
Example 28
Project: GitHub   File: FireView.java   View source code 5 votes vote down vote up
@Override
public void surfaceCreated(SurfaceHolder holder) {
    fireHeight = getHeight() * 3 / 4;
    halfWidth = getWidth() / 2;
    fireWidth = halfWidth / 4;
    distance = fireWidth / 8;
    running = true;
    new RefreshThread().start();
}
 
Example 29
Project: keepass2android   File: CaptureActivity.java   View source code 5 votes vote down vote up
@Override
public void surfaceCreated(SurfaceHolder holder) {
  if (holder == null) {
    Log.e(TAG, "*** WARNING *** surfaceCreated() gave us a null surface!");
  }
  if (!hasSurface) {
    hasSurface = true;
    initCamera(holder);
  }
}
 
Example 30
Project: AndroidRTC   File: EglBase10.java   View source code 5 votes vote down vote up
private void createSurfaceInternal(Object nativeWindow) {
  if (!(nativeWindow instanceof SurfaceHolder) && !(nativeWindow instanceof SurfaceTexture)) {
    throw new IllegalStateException("Input must be either a SurfaceHolder or SurfaceTexture");
  }
  checkIsNotReleased();
  if (eglSurface != EGL10.EGL_NO_SURFACE) {
    throw new RuntimeException("Already has an EGLSurface");
  }
  int[] surfaceAttribs = {EGL10.EGL_NONE};
  eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig, nativeWindow, surfaceAttribs);
  if (eglSurface == EGL10.EGL_NO_SURFACE) {
    throw new RuntimeException(
        "Failed to create window surface: 0x" + Integer.toHexString(egl.eglGetError()));
  }
}
 
Example 31
Project: tvConnect_android   File: ImageSurfaceView.java   View source code 5 votes vote down vote up
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
                           int height) {

    synchronized (ImageSurfaceView.class) {
        mRectDes.set(0, 0, width, height);
        mSurfaceHeight = height;
        mSurfaceWidth = width;
        init(default_scale);
        if (mBitmap != null) {
            showBitmap();
        }
    }
}
 
Example 32
Project: aos-Video   File: Player.java   View source code 5 votes vote down vote up
public void surfaceDestroyed(SurfaceHolder holder)
{
    // after we return from this we can't use the surface any more
    mSurfaceHolder = null;
    mSurfaceWidth = 0;
    mSurfaceHeight = 0;
    stopPlayback();
}
 
Example 33
Project: AndroidBasicLibs   File: CaptureActivity.java   View source code 5 votes vote down vote up
private void initCamera(SurfaceHolder surfaceHolder) {
	try {
		CameraManager.get().openDriver(surfaceHolder);
	} catch (IOException ioe) {
		return;
	} catch (RuntimeException e) {
		return;
	}
	if (handler == null) {
		handler = new CaptureActivityHandler(this, decodeFormats,
				characterSet, viewfinderView, this);
	}
}
 
Example 34
Project: PlayerBase   File: SurfaceRenderView.java   View source code 5 votes vote down vote up
private void initView(Context context) {
    mMeasureHelper = new MeasureHelper(this);
    mSurfaceCallback = new SurfaceCallback(this);
    getHolder().addCallback(mSurfaceCallback);
    //noinspection deprecation
    getHolder().setType(SurfaceHolder.SURFACE_TYPE_NORMAL);
}
 
Example 35
Project: CameraCardCropDemo   File: CameraView.java   View source code 5 votes vote down vote up
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
    if (autoFocusManager != null) {
        autoFocusManager.stop();
        autoFocusManager = null;
    }
}
 
Example 36
Project: HexColorTime   File: Wallpaper.java   View source code 4 votes vote down vote up
@Override
public void onSurfaceChanged(SurfaceHolder holder, int format,
                             int width, int height) {
    super.onSurfaceChanged(holder, format, width, height);
    draw();
}
 
Example 37
Project: WithYou   File: VideoVerify.java   View source code 4 votes vote down vote up
@Override
public void surfaceCreated(SurfaceHolder holder) {
	openCamera();
}
 
Example 38
Project: PlayerBase   File: DelegateDecoderPlayer.java   View source code 4 votes vote down vote up
@Override
public void setDisplay(SurfaceHolder surfaceHolder) {
    if(isLegalState()){
        mDecoder.setDisplay(surfaceHolder);
    }
}
 
Example 39
Project: ubiquitous   File: MyWatchFace.java   View source code 4 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFace.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .setAcceptsTapEvents(true)
            .build());
    Resources resources = MyWatchFace.this.getResources();
    mYOffset = resources.getDimension(R.dimen.digital_y_offset);
    mY1Offset = resources.getDimension(R.dimen.digital_y1_offset);

    mLowTextSize = resources.getDimension(R.dimen.low_temp_text_size);
    mHighTextSize = resources.getDimension(R.dimen.high_temp_text_size);

    dp_10 = resources.getDimension(R.dimen.dp_10);
    dp_5 = resources.getDimension(R.dimen.dp_5);

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(resources.getColor(R.color.colorPrimary));

    mTextPaint = new Paint();
    mTextPaint = createTextPaint(resources.getColor(R.color.digital_text));

    dateTextPaint = new Paint();
    dateTextPaint = createTextPaint(resources.getColor(R.color.light_white));

    lineTextPaint = new Paint();
    lineTextPaint = createTextPaint(resources.getColor(R.color.light_white));

    mLowTempPaint = new Paint();
    mLowTempPaint = createTextPaint(resources.getColor(R.color.light_white));

    mHighTempPaint = new Paint();
    mHighTempPaint = createTextPaint(resources.getColor(R.color.white));

    mCalendar = Calendar.getInstance();

    mWearClient = new GoogleApiClient.Builder(MyWatchFace.this)
            .addApi(Wearable.API)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();
}
 
Example 40
Project: FaceDetectDemo   File: CameraBridgeViewBase.java   View source code 4 votes vote down vote up
public void surfaceCreated(SurfaceHolder holder) {
    /* Do nothing. Wait until surfaceChanged delivered */
}