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


Java TextureView.setOnClickListener方法代码示例

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


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

示例1: onCreate

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

	cancelBtn = (Button) findViewById(R.id.play_cancel);
	cancelBtn.setOnClickListener(this);
	
	DisplayMetrics displaymetrics = new DisplayMetrics();
	getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
	surfaceView = (TextureView) findViewById(R.id.preview_video);
	
	RelativeLayout previewVideoParent = (RelativeLayout)findViewById(R.id.preview_video_parent);
	LayoutParams layoutParams = (LayoutParams) previewVideoParent
			.getLayoutParams();
	layoutParams.width = displaymetrics.widthPixels;
	layoutParams.height = displaymetrics.widthPixels;
	previewVideoParent.setLayoutParams(layoutParams);
	
	surfaceView.setSurfaceTextureListener(this);
	surfaceView.setOnClickListener(this);
	
	path = getIntent().getStringExtra("path");
	
	imagePlay = (ImageView) findViewById(R.id.previre_play);
	imagePlay.setOnClickListener(this);
	
	mediaPlayer = new MediaPlayer();
	mediaPlayer.setOnCompletionListener(this);
}
 
开发者ID:feigxj,项目名称:VideoRecorder-master,代码行数:31,代码来源:FFmpegPreviewActivity.java

示例2: example

import android.view.TextureView; //导入方法依赖的package包/类
private void example() {
    // Prevent window dimming
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    // Here we use the camera preview as below surface and rendering surface as upper one
    SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
    surfaceView.setZOrderOnTop(false);

    // Rendering surface
    TextureView textureView = (TextureView) findViewById(R.id.textureView);
    // Enables support for alpha value in pixels (0 is transparent pixel)
    textureView.setOpaque(false);

    // Creates a new RenderScript context and enables our custom render holder
    mRS = RenderScript.create(this);

    // Enables surface callback to init the entire process.
    // When surface gets initialized, camera preview is enabled
    surfaceView.getHolder().addCallback(mSurfaceHolderCallback);

    textureView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            System.exit(0); // Terminates app when surface is clicked
        }
    });

}
 
开发者ID:csarron,项目名称:renderscript_examples,代码行数:29,代码来源:MainActivity.java

示例3: init

import android.view.TextureView; //导入方法依赖的package包/类
private void init(Context context) {
        showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS;

        formatBuilder = new StringBuilder();
        formatter = new Formatter(formatBuilder, Locale.getDefault());
        currentWindow = new Timeline.Window();
        componentListener = new ComponentListener();

        LayoutInflater.from(context).inflate(R.layout.item_video_control, this);
        controlLayout = (LinearLayout) findViewById(R.id.video_control_layout);
        time = (TextView) findViewById(R.id.time);
        timeCurrent = (TextView) findViewById(R.id.time_current);
        fullscreen = (ImageView) findViewById(R.id.video_fullscreen);
        fullscreen.setOnClickListener(componentListener);
        progressBar = (SeekBar) findViewById(R.id.video_controller_progress);
        progressBar.setOnSeekBarChangeListener(componentListener);
        progressBar.setMax(PROGRESS_BAR_MAX);

        videoView = new TextureView(context);
        FrameLayout.LayoutParams videoParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        videoView.setLayoutParams(videoParams);
        videoView.setOnClickListener(componentListener);

        thumbnailView = new SimpleDraweeView(context);
        FrameLayout.LayoutParams thumbParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
                .setPlaceholderImage(R.color.loading_color)
                .build();
        thumbnailView.setHierarchy(hierarchy);
        thumbnailView.setLayoutParams(thumbParams);

        loadingBar = new ProgressBar(context, null, android.R.attr.progressBarStyle);
        FrameLayout.LayoutParams loadingParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        loadingParams.gravity = Gravity.CENTER;
        loadingBar.setLayoutParams(loadingParams);
        loadingBar.setVisibility(GONE);

        playView = new ImageView(context);
        FrameLayout.LayoutParams playParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        playParams.gravity = Gravity.CENTER;
        playView.setLayoutParams(playParams);
        int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,
                context.getResources().getDisplayMetrics());
        playView.setPadding(padding, padding, padding, padding);
        playView.setOnClickListener(componentListener);

//        setOnClickListener(componentListener);
        leftTime = new TextView(context);
        FrameLayout.LayoutParams leftParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        leftParams.gravity = Gravity.BOTTOM;
        leftParams.bottomMargin = padding / 2;
        leftParams.leftMargin = padding / 2;
        leftTime.setLayoutParams(leftParams);
        leftTime.setTextColor(Color.WHITE);
        leftTime.setVisibility(GONE);

        addView(videoView, 0);
        addView(thumbnailView, 1);
        addView(loadingBar, 2);
        addView(playView, 3);
        addView(leftTime, 4);
    }
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:68,代码来源:CommonExoPlayerView.java

示例4: example

import android.view.TextureView; //导入方法依赖的package包/类
private void example() {
    timings = new Timings(this);

    // To calculate the timings' average on a different measurements set size, change
    // the following instruction
    timings.setTimingDebugInterval(50);

    // Prevent window dimming
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    // We load the NDK library we created. This library's code can be seen
    // inside app/src/main/jni folder. Its compiling cannot be done using
    // Android Studio default NDK build system, as it cannot include custom
    // CPP flags (we include the OpenMP library).
    // Please refer to the app/build.gradle file (last section of it) to understand
    // how the build process works.
    System.loadLibrary("native");

    // We instantiate the surfaces, camera preview one and RenderScript
    // preview one.
    cameraPreviewSurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
    rsResultTextureView = (TextureView) findViewById(R.id.textureView);

    // Instantiation of surfaces' callbacks, to trigger the execution of our
    // example.
    cameraPreviewSurfaceView.getHolder().addCallback(cameraPreviewCallback);
    rsResultTextureView.setSurfaceTextureListener(surfaceTextureListener);

    // As we are using a forced landscape mode (look at AndroidManifest.xml file),
    // we need the TextureView to rotate accordingly.
    rsResultTextureView.requestLayout();
    rsResultTextureView.invalidate();

    // Set the TextureView to use alpha channel, as it is overlapping the camera preview.
    rsResultTextureView.setOpaque(false);

    // Exit on surface touch
    rsResultTextureView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            System.exit(0);
        }
    });
}
 
开发者ID:csarron,项目名称:renderscript_examples,代码行数:45,代码来源:MainActivity.java

示例5: onViewCreated

import android.view.TextureView; //导入方法依赖的package包/类
@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    mTextureView = (TextureView) view.findViewById(R.id.texture);
    mTextureView.setOnClickListener(this);
}
 
开发者ID:stfalcon-studio,项目名称:patrol-android,代码行数:6,代码来源:Camera2VideoFragment.java

示例6: initViews

import android.view.TextureView; //导入方法依赖的package包/类
private void initViews(View rootView) {
    mPreview = (TextureView) rootView.findViewById(R.id.texture);
    mPreview.setOnClickListener(this);
    mPreview.setSurfaceTextureListener(this);
}
 
开发者ID:stfalcon-studio,项目名称:patrol-android,代码行数:6,代码来源:CameraVideoFragment.java


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