当前位置: 首页>>代码示例>>Java>>正文


Java SurfaceView.getHolder方法代码示例

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


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

示例1: onResume

import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    Log.d(TAG, "xxxxxxxxxxxxxxxxxxxonResume");
    SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
    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;
    final AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
    if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
        playBeep = false;
    }
    initBeepSound();
    vibrate = true;
}
 
开发者ID:yiwent,项目名称:Mobike,代码行数:24,代码来源:CaptureActivity.java

示例2: onPause

import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
protected void onPause() {
    if (handler != null) {
        handler.quitSynchronously();
        handler = null;
    }
    inactivityTimer.onPause();
    ambientLightManager.stop();
    beepManager.close();
    cameraManager.closeDriver();
    if (!hasSurface) {
        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
    super.onPause();
}
 
开发者ID:yun2win,项目名称:tvConnect_android,代码行数:18,代码来源:CaptureActivity.java

示例3: onResume

import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
protected void onResume() {
	super.onResume();
	SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
	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:CoderCF,项目名称:ZXingDemo,代码行数:24,代码来源:CaptureActivity.java

示例4: onCreate

import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    log("onCreate");

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_shoot);

    Intent intent = getIntent();
    settings = Settings.getFromIntent(intent);

    shotCount = 0;
    takingPicture = false;

    tvCount = (TextView) findViewById(R.id.tvCount);
    //tvInfo = (TextView) findViewById(R.id.tvInfo);

    reviewSurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
    reviewSurfaceView.setZOrderOnTop(false);
    cameraSurfaceHolder = reviewSurfaceView.getHolder();
    cameraSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
 
开发者ID:jonasjuffinger,项目名称:TimeLapse,代码行数:22,代码来源:ShootActivity.java

示例5: onCreate

import android.view.SurfaceView; //导入方法依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFormat(PixelFormat.TRANSLUCENT); // 使得窗口支持透明度
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.nim_capture_video_activity);
    setTitle(R.string.video_record);

    parseIntent();
    findViews();
    initActionBar();

    setViewsListener();
    updateRecordUI();

    getVideoPreviewSize();

    surfaceview = (SurfaceView) this.findViewById(R.id.videoView);
    SurfaceHolder holder = surfaceview.getHolder();
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    holder.addCallback(this);

    resizeSurfaceView();
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:25,代码来源:CaptureVideoActivity.java

示例6: Holder

import android.view.SurfaceView; //导入方法依赖的package包/类
Holder(int adapterPosition, View rootView) {
    super(adapterPosition, rootView);
    FlingRelativeLayout flingRelativeLayout = (FlingRelativeLayout) rootView.findViewById(R.id.fling_root_view);
    flingRelativeLayout.setOnClickListener(v -> toggleFullscreen());
    flingRelativeLayout.setOnSingleFlingListener(new CloseOnFlingListener(rootView.getContext()) {
        @Override
        public boolean onVerticalFling(float distanceByY) {
            goBack();
            return true;
        }
    });

    mSurfaceView = (SurfaceView) rootView.findViewById(R.id.surface_view);
    mSurfaceHolder = mSurfaceView.getHolder();
    mSurfaceHolder.addCallback(this);

    mAspectRatioLayout = (AlternativeAspectRatioFrameLayout) rootView.findViewById(R.id.aspect_ratio_layout);
    mProgressBar = (ProgressBar) rootView.findViewById(R.id.preparing_progress_bar);
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:20,代码来源:GifPagerFragment.java

示例7: initView

import android.view.SurfaceView; //导入方法依赖的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

示例8: onPause

import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
protected void onPause() {
	if (handler != null) {
		handler.quitSynchronously();
		handler = null;
	}
	inactivityTimer.onPause();
	ambientLightManager.stop();
	beepManager.close();
	cameraManager.closeDriver();
	// historyManager = null; // Keep for onActivityResult
	if (!hasSurface) {
		SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
		SurfaceHolder surfaceHolder = surfaceView.getHolder();
		surfaceHolder.removeCallback(this);
	}
	super.onPause();
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:19,代码来源:CaptureActivity.java

示例9: onCreate

import android.view.SurfaceView; //导入方法依赖的package包/类
/**
 *
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.activity_media_player);

    mPreview = (SurfaceView) findViewById(R.id.surface);
    mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
    holder = mPreview.getHolder();
    holder.addCallback(this);
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    extras = getIntent().getExtras();
    path = extras.getString("url");

    mProgressBar.setVisibility(View.VISIBLE);
}
 
开发者ID:narenkukreja,项目名称:quire,代码行数:20,代码来源:MediaPlayerActivity.java

示例10: surfaceCreated

import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
public void surfaceCreated(SurfaceHolder holder) {
    Log.d(TAG, "surfaceCreated holder=" + holder);
    // If we already have a Surface, we just need to resume the frame notifications.

    SurfaceView sv = (SurfaceView) findViewById(R.id.scheduledSwap_surfaceView);
    mRenderThread = new RenderThread(sv.getHolder(), this);
    mRenderThread.setName("ScheduledSwap GL render");
    mRenderThread.start();
    mRenderThread.waitUntilReady();

    RenderHandler rh = mRenderThread.getHandler();
    if (rh != null) {
        rh.sendSetParameters(mUpdatePatternIndex, mFramesAheadIndex);
        rh.sendSurfaceCreated();
    }

    // start the draw events
    Choreographer.getInstance().postFrameCallback(this);
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:21,代码来源:ScheduledSwapActivity.java

示例11: onCreate

import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_texture_from_camera);

    mHandler = new MainHandler(this);

    SurfaceView sv = (SurfaceView) findViewById(R.id.cameraOnTexture_surfaceView);
    SurfaceHolder sh = sv.getHolder();
    sh.addCallback(this);

    mZoomBar = (SeekBar) findViewById(R.id.tfcZoom_seekbar);
    mSizeBar = (SeekBar) findViewById(R.id.tfcSize_seekbar);
    mRotateBar = (SeekBar) findViewById(R.id.tfcRotate_seekbar);
    mZoomBar.setProgress(DEFAULT_ZOOM_PERCENT);
    mSizeBar.setProgress(DEFAULT_SIZE_PERCENT);
    mRotateBar.setProgress(DEFAULT_ROTATE_PERCENT);
    mZoomBar.setOnSeekBarChangeListener(this);
    mSizeBar.setOnSeekBarChangeListener(this);
    mRotateBar.setOnSeekBarChangeListener(this);

    updateControls();
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:24,代码来源:TextureFromCameraActivity.java

示例12: onCreate

import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_continuous_capture);

    SurfaceView sv = (SurfaceView) findViewById(R.id.continuousCapture_surfaceView);
    SurfaceHolder sh = sv.getHolder();
    sh.addCallback(this);

    mHandler = new MainHandler(this);
    mHandler.sendEmptyMessageDelayed(MainHandler.MSG_BLINK_TEXT, 1500);

    mOutputFile = new File(getFilesDir(), "continuous-capture.mp4");
    mSecondsOfVideo = 0.0f;
    updateControls();
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:17,代码来源:ContinuousCaptureActivity.java

示例13: onPause

import android.view.SurfaceView; //导入方法依赖的package包/类
public void onPause() {
    if (handler != null) {
        handler.quitSynchronously();
        handler = null;
    }
    if (inactivityTimer != null) {
        inactivityTimer.onPause();
    }
    if (ambientLightManager != null) {
        ambientLightManager.stop();
    }
    if (beepManager != null) {
        beepManager.close();
    }
    if (cameraManager != null) {
        cameraManager.closeDriver();
    }
    if (!hasSurface) {
        mSurfaceView = new SurfaceView(mActivity, null);
        SurfaceHolder surfaceHolder = mSurfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
}
 
开发者ID:10045125,项目名称:QrCode,代码行数:24,代码来源:QrCodeView.java

示例14: onPause

import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
protected void onPause() {
    if (handler != null) {
        handler.quitSynchronously();
        handler = null;
    }
    inactivityTimer.onPause();
    ambientLightManager.stop();
    beepManager.close();
    cameraManager.closeDriver();
    //historyManager = null; // Keep for onActivityResult
    if (!hasSurface) {
        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
    super.onPause();
}
 
开发者ID:xiong-it,项目名称:ZXingAndroidExt,代码行数:19,代码来源:QrCodeScannerActivity.java

示例15: InitTouchPoint

import android.view.SurfaceView; //导入方法依赖的package包/类
private void InitTouchPoint() {
    trackpadTouchPoint = (SurfaceView) view.findViewById(R.id.trackpad_surfaceView);
    trackpadTouchPoint.setZOrderOnTop(true);
    holder = trackpadTouchPoint.getHolder();
    holder.setFormat(PixelFormat.TRANSPARENT);
    paint = new Paint();
    paint.setColor(getResources().getColor(R.color.touchpoint));
}
 
开发者ID:peter10110,项目名称:Android-SteamVR-controller,代码行数:9,代码来源:ControllerFragment.java


注:本文中的android.view.SurfaceView.getHolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。