當前位置: 首頁>>代碼示例>>Java>>正文


Java SurfaceView.setOnTouchListener方法代碼示例

本文整理匯總了Java中android.view.SurfaceView.setOnTouchListener方法的典型用法代碼示例。如果您正苦於以下問題:Java SurfaceView.setOnTouchListener方法的具體用法?Java SurfaceView.setOnTouchListener怎麽用?Java SurfaceView.setOnTouchListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.SurfaceView的用法示例。


在下文中一共展示了SurfaceView.setOnTouchListener方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initPlayer

import android.view.SurfaceView; //導入方法依賴的package包/類
private void initPlayer() {
    mLoadingView = findViewById(R.id.LoadingView);
    bgImage = (ImageView) findViewById(R.id.bgImg);
    mSurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
    mSurfaceView.setOnTouchListener(this);
    try {
        mPlayBean = (FirstBean.RoomBean.ListBean) getIntent().getSerializableExtra("playBean");
    } catch (ClassCastException e) {
        mPlayBean1 = (OtherBean.DataBean) getIntent().getSerializableExtra("playBean");
    }

    mCodec = getIntent().getIntExtra("mediaCodec", 0);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:TvShowActivity.java

示例2: onCreate

import android.view.SurfaceView; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_live_camera);
        if (Build.VERSION.SDK_INT >= 23) {
            permissionCheck();
        } else {
            mHasPermission = true;
        }
        mScaledTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop();//判斷是否滑動的基準
        getExtraData();
        initView();
        setRequestedOrientation(screenOrientation ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        //采集
        _CameraSurface = (SurfaceView) findViewById(R.id.camera_surface);
        _CameraSurface.getHolder().addCallback(_CameraSurfaceCallback);
        _CameraSurface.setOnTouchListener(mOnTouchListener);
        //對焦,縮放
        mDetector = new GestureDetector(_CameraSurface.getContext(), mGestureDetector);
        mScaleDetector = new ScaleGestureDetector(_CameraSurface.getContext(), mScaleGestureListener);

        mMediaRecorder = AlivcMediaRecorderFactory.createMediaRecorder();
        mMediaRecorder.init(this);

        //注冊推流狀態回調監聽
        mMediaRecorder.setOnRecordStatusListener(mRecordStatusListener);
        mMediaRecorder.setOnNetworkStatusListener(mOnNetworkStatusListener);
        mMediaRecorder.setOnRecordErrorListener(mOnErrorListener);

        mConfigure.put(AlivcMediaFormat.KEY_CAMERA_FACING, cameraFrontFacing);
        mConfigure.put(AlivcMediaFormat.KEY_I_FRAME_INTERNAL, 3);
        mConfigure.put(AlivcMediaFormat.KEY_MAX_ZOOM_LEVEL, 3);
        mConfigure.put(AlivcMediaFormat.KEY_OUTPUT_RESOLUTION, resolution);
        mConfigure.put(AlivcMediaFormat.KEY_MAX_VIDEO_BITRATE, maxBitrate * 1000);
        mConfigure.put(AlivcMediaFormat.KEY_BEST_VIDEO_BITRATE, bestBitrate * 1000);
        mConfigure.put(AlivcMediaFormat.KEY_MIN_VIDEO_BITRATE, minBitrate * 1000);
        mConfigure.put(AlivcMediaFormat.KEY_INITIAL_VIDEO_BITRATE, initBitrate * 1000);
        mConfigure.put(AlivcMediaFormat.KEY_DISPLAY_ROTATION, screenOrientation ? AlivcMediaFormat.DISPLAY_ROTATION_90 : AlivcMediaFormat.DISPLAY_ROTATION_0);
//        mConfigure.put(AlivcMediaFormat.KEY_EXPOSURE_COMPENSATION, 10);//曝光度
        mConfigure.put(AlivcMediaFormat.KEY_WATERMARK, mWatermark);
        mConfigure.put(AlivcMediaFormat.KEY_FRAME_RATE, frameRate);
        mConfigure.put(AlivcMediaFormat.KEY_AUDIO_BITRATE, 32000);
        mConfigure.put(AlivcMediaFormat.KEY_AUDIO_SAMPLE_RATE, 44100);

        setLogo();

        wx_user_name.post(new Runnable() {
            @Override
            public void run() {
                View pop_talk_view = LayoutInflater.from(LiveCameraActivity.this).inflate(R.layout.pop_talk_layout, null);
                c_pop_talk_empty_tip = pop_talk_view.findViewById(R.id.c_pop_talk_empty_tip);
                pop_comment = new CustomPopupWindow.Builder(LiveCameraActivity.this)
                        .setView(pop_talk_view)
                        .setWidthAndHeight(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT)
                        .setOutsideTouchable(true)
                        .setAnimationStyle(R.style.AnimationFade)
                        .create();
                pop_comment.setOnDismissListener(new PopupWindow.OnDismissListener() {
                    @Override
                    public void onDismiss() {
                        int visible = push_state ? View.VISIBLE : View.INVISIBLE;
                        push_state_ll.setVisibility(visible);
                    }
                });
                mListView = (ListView) pop_talk_view.findViewById(R.id.lv_pop_comment);
            }
        });
    }
 
開發者ID:JunGeges,項目名稱:AliZhiBoHao,代碼行數:69,代碼來源:LiveCameraActivity.java


注:本文中的android.view.SurfaceView.setOnTouchListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。