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


Java SurfaceHolder.addCallback方法代码示例

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


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

示例1: 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:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:CaptureActivity.java

示例2: GameView

import android.view.SurfaceHolder; //导入方法依赖的package包/类
public GameView(
        @NonNull Context context,
        @NonNull AttributeSet attributeSet) {
    super(context, attributeSet);

    _logger = new SmartMirrorLogger(TAG);
    _logger.Debug("GameView created...");

    _receiverController = new ReceiverController(context);

    SurfaceHolder holder = getHolder();
    holder.addCallback(this);
    setFocusable(true);

    _thread = new GameThread(holder);
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:17,代码来源:GameView.java

示例3: onResume

import android.view.SurfaceHolder; //导入方法依赖的package包/类
/**
 * 启动相机预览与扫描,在Activity/Fragment的onResume方法中调用。
 */
public void onResume() {
    if (checkCameraHardware()) {
        mCameraManager = new CameraManager(this);
        if (frameWidth > 0 && frameHeight > 0) {
            mCameraManager.setManualFramingRect(frameWidth, frameHeight, frameTopOffset);
        }
        SurfaceHolder surfaceHolder = getHolder();
        if (hasSurface) {
            initCamera(surfaceHolder);
        } else {
            surfaceHolder.addCallback(this);
        }
    } else {
        if (mOnBarcodeReadListener != null) {
            mOnBarcodeReadListener.onCameraNotFound();
        }
    }
}
 
开发者ID:CoderChoy,项目名称:BarcodeReaderView,代码行数:22,代码来源:BarcodeReaderView.java

示例4: onCreate

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

示例5: 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

示例6: setVideoSurfaceHolder

import android.view.SurfaceHolder; //导入方法依赖的package包/类
/**
 * Sets the {@link SurfaceHolder} that holds the {@link Surface} onto which video will be
 * rendered. The player will track the lifecycle of the surface automatically.
 *
 * @param surfaceHolder The surface holder.
 */
public void setVideoSurfaceHolder(SurfaceHolder surfaceHolder) {
  removeSurfaceCallbacks();
  this.surfaceHolder = surfaceHolder;
  if (surfaceHolder == null) {
    setVideoSurfaceInternal(null, false);
  } else {
    setVideoSurfaceInternal(surfaceHolder.getSurface(), false);
    surfaceHolder.addCallback(componentListener);
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:17,代码来源:SimpleExoPlayer.java

示例7: initRenderer

import android.view.SurfaceHolder; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void initRenderer() {
    mRenderer = new RendererImpl(mGLSurfaceView);
    mGLSurfaceView.setEGLContextClientVersion(2);
    mGLSurfaceView.setRenderer(mRenderer);
    mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
    SurfaceHolder surfaceHolder = mGLSurfaceView.getHolder();
    surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    surfaceHolder.addCallback(mSurfaceHolderCallback);
}
 
开发者ID:wuyisheng,项目名称:libRtmp,代码行数:11,代码来源:LivingView.java

示例8: setSurfaceHolder

import android.view.SurfaceHolder; //导入方法依赖的package包/类
/**
 * 设置预览输出SurfaceHolder
 * @param sh
 */
@SuppressWarnings("deprecation")
public void setSurfaceHolder(SurfaceHolder sh) {
	if (sh != null) {
		sh.addCallback(this);
		if (!DeviceUtils.hasHoneycomb()) {
			sh.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
		}
	}
}
 
开发者ID:Zhaoss,项目名称:WeiXinRecordedDemo,代码行数:14,代码来源:MediaRecorderBase.java

示例9: DreamView

import android.view.SurfaceHolder; //导入方法依赖的package包/类
public DreamView(Context context, AttributeSet attrs) {
    super(context, attrs);

    // Disable hardware acceleration so we can use BlurMaskFilter
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    SurfaceHolder holder = getHolder();
    holder.addCallback(this);

    mRenderThread = new RenderThread(context, holder);
}
 
开发者ID:catalinc,项目名称:stars-daydream-android,代码行数:12,代码来源:DreamView.java

示例10: onCreate

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

        setSupportActionBar(mToolbar);

        mPermissionsChecker = new PermissionsChecker(this);

        streamer = new EvilsLiveStreamer(this);

//        ViewGroup.LayoutParams layoutParams = mPreviewView.getLayoutParams();
//        layoutParams.width = 640;
//        layoutParams.height = 480;
//        mPreviewView.setLayoutParams(layoutParams);
        SurfaceHolder holder = mPreviewView.getHolder();
        holder.addCallback(this);

        audioCapture = new AudioCapture();
        audioPlay = new AudioPlayer();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.setDrawerListener(toggle);
        toggle.syncState();

        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
        ActivityComponent activityComponent = DaggerActivityComponent.builder()
                .activityModule(new ActivityModule(this)).build();
        activityComponent.getActivity();

//        CameraComponent cameraComponent = DaggerCameraComponent.builder().activityComponent(activityComponent).
//                cameraModule(new com.thinkkeep.videolib.di.modules.CameraModule(this)).build();
//        cameraComponent.inject(this);
    }
 
开发者ID:ThinkKeep,项目名称:EvilsLive,代码行数:39,代码来源:MainActivity.java

示例11: init

import android.view.SurfaceHolder; //导入方法依赖的package包/类
private void init(Context context) {
    if (!this.isInEditMode()) {

        splats[0] = BitmapFactory.decodeResource(getResources(), R.drawable.splat1);
        splats[1] = BitmapFactory.decodeResource(getResources(), R.drawable.splat2);
        splats[2] = BitmapFactory.decodeResource(getResources(), R.drawable.splat2);
        anchor[0] = BitmapFactory.decodeResource(getResources(), R.drawable.anchor_sm);
        axes[0] = BitmapFactory.decodeResource(getResources(), R.drawable.axe2);
        bgs[0] = BitmapFactory.decodeResource(getResources(), R.drawable.sea);
        fgtops[0] = BitmapFactory.decodeResource(getResources(), R.drawable.sail);
        fgbottoms[0] = BitmapFactory.decodeResource(getResources(), R.drawable.shipside2);

        final SurfaceHolder holder = getHolder();
        holder.addCallback(this);
        TypedArray fish = getResources().obtainTypedArray(R.array.fish);
        int[] values = getResources().getIntArray(R.array.points);
        totalValue = 0;
        for (int i = 0; i < fish.length(); i++) {
            FlyingItem item = new FlyingItem(BitmapFactory.decodeResource(getResources(), fish.getResourceId(i, 0)));
            item.setValue(values[i]);
            availableItems.add(item);
            totalValue += (100 - values[i]);
        }
        fish.recycle();

        this.setOnTouchListener(this);
        mLinePaint = new Paint();
        mLinePaint.setARGB(255, 255, 64, 64);
        mLinePaint.setStrokeWidth(5);
        mBGPaint = new Paint();
        mBGPaint.setARGB(255, 127, 127, 200);

        mTextPaint = new Paint();
        mTextPaint.setColor(Color.BLACK);
        mTextPaint.setShadowLayer(8,8,8,Color.WHITE);
        mTextPaint.setTextSize(80);

    }
}
 
开发者ID:quaap,项目名称:SeafoodBerserker,代码行数:40,代码来源:MainFishView.java

示例12: onResume

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

}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:16,代码来源:QrCodeActivity.java

示例13: init

import android.view.SurfaceHolder; //导入方法依赖的package包/类
private void init() {
	// Install a SurfaceHolder.Callback so we get notified when the
	// underlying surface is created and destroyed
	SurfaceHolder holder = getHolder();
	holder.addCallback(this);
	holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
	mKeyguardManager = ((KeyguardManager)getContext().getSystemService(Context.KEYGUARD_SERVICE));
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:9,代码来源:GLSurfaceView_SDL.java

示例14: SeismoView

import android.view.SurfaceHolder; //导入方法依赖的package包/类
public SeismoView(Context ctx, int period) {
  super(ctx);

  SurfaceHolder holder = getHolder();
  holder.addCallback(this);
  setKeepScreenOn(true);
  ctx_ = ctx;
  period_ = period;
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:10,代码来源:SeismoView.java

示例15: init

import android.view.SurfaceHolder; //导入方法依赖的package包/类
private void init() {
    LayoutInflater.from(getContext()).inflate(R.layout.preview_layout, this);
    mPreviewView = findViewById(R.id.preview);
    // Install a SurfaceHolder.Callback so we get notified when the
    // underlying surface is created and destroyed.
    SurfaceHolder holder = mPreviewView.getHolder();
    holder.addCallback(new PreviewCallback());
    // deprecated setting, but required on Android versions prior to 3.0
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

}
 
开发者ID:android-notes,项目名称:CameraPreview,代码行数:12,代码来源:PreviewView.java


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