當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。