Java SurfaceHolder类代码示例(javasurfaceholder类代码示例汇总)

本文整理汇总了Java中android.view.SurfaceHolder的典型用法代码示例。如果您正苦于以下问题:Java SurfaceHolder类的具体用法?Java SurfaceHolder怎么用?Java SurfaceHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java SurfaceHolder类代码示例(javasurfaceholder类代码示例汇总)

SurfaceHolder类属于android.view包,在下文中一共展示了SurfaceHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

import android.view.SurfaceHolder; //导入依赖的package包/类
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);

} 
开发者ID:vitaviva,项目名称:QRCodeScanner,代码行数:20,代码来源:BarcodeScanView.java

示例2: surfaceChanged

import android.view.SurfaceHolder; //导入依赖的package包/类
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();
        }
    }
} 
开发者ID:typer9527,项目名称:FaceDetectDemo,代码行数:18,代码来源:CameraBridgeViewBase.java

示例3: initVideoView

import android.view.SurfaceHolder; //导入依赖的package包/类
@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);
  }
} 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:21,代码来源:VideoView.java

示例4: surfaceChanged

import android.view.SurfaceHolder; //导入依赖的package包/类
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();
    }
  }
} 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:26,代码来源:VideoPlayerView.java

示例5: openDriver

import android.view.SurfaceHolder; //导入依赖的package包/类
/**
 * 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();
	}
} 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:CameraManager.java

示例6: surfaceChanged

import android.view.SurfaceHolder; //导入依赖的package包/类
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);
} 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:18,代码来源:ViESurfaceRenderer.java

示例7: surfaceChanged

import android.view.SurfaceHolder; //导入依赖的package包/类
@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);
    }
} 
开发者ID:SethWen,项目名称:GestureVideoView,代码行数:17,代码来源:SurfaceRenderView.java

示例8: openDriver

import android.view.SurfaceHolder; //导入依赖的package包/类
/**
     * 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();
        }
    } 
开发者ID:guxiaonian,项目名称:MeiLa_GNN,代码行数:30,代码来源:CameraManager.java

示例9: initView

import android.view.SurfaceHolder; //导入依赖的package包/类
@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加入回调接口
} 
开发者ID:f-evil,项目名称:EVideoRecorder,代码行数:21,代码来源:ERecorderActivity.java

示例10: surfaceCreated

import android.view.SurfaceHolder; //导入依赖的package包/类
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);
    }
} 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:24,代码来源:ViESurfaceRenderer.java

示例11: onResume

import android.view.SurfaceHolder; //导入依赖的package包/类
@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;
} 
开发者ID:jeasinlee,项目名称:AndroidBasicLibs,代码行数:22,代码来源:CaptureActivity.java

示例12: initCamera

import android.view.SurfaceHolder; //导入依赖的package包/类
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();
    }
} 
开发者ID:angcyo,项目名称:RLibrary,代码行数:21,代码来源:UIScanView.java

示例13: openDriver

import android.view.SurfaceHolder; //导入依赖的package包/类
/**
   * 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();
    }
  } 
开发者ID:CoderCF,项目名称:ZXingDemo,代码行数:30,代码来源:CameraManager.java

示例14: onCreate

import android.view.SurfaceHolder; //导入依赖的package包/类
@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);
      } 
开发者ID:mwsrc,项目名称:Dendroid-HTTP-RAT,代码行数:14,代码来源:CameraView.java

示例15: setDisplay

import android.view.SurfaceHolder; //导入依赖的package包/类
/**
 * 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();
  }
} 
开发者ID:Leavessilent,项目名称:QuanMinTV,代码行数:18,代码来源:MediaPlayer.java

本文标签属性:

示例:示例图

代码:代码转换器

java:javascript18岁

SurfaceHolder:SurfaceHolder

上一篇:Java SurfaceHolder.lockCanvas方法代码示例(javasurfaceholder.lockcanvas使用的例子)
下一篇:什么是核污染?(什么是核污染?)

为您推荐