Java Code Examples for android.view.TextureView#setOnClickListener()

The following examples show how to use android.view.TextureView#setOnClickListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From OnionCamera with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    preview = (TextureView) findViewById(R.id.preview);
    overlay = (TextureView) findViewById(R.id.overlay);

    filter = new Filter(RenderScript.create(this));
    preview.setSurfaceTextureListener(this);
    overlay.setSurfaceTextureListener(filter);

    preview.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            filter.toggleBlending();
        }
    });
}
 
Example 2
Source File: FFmpegPreviewActivity.java    From FFmpegRecorder with GNU General Public License v3.0 5 votes vote down vote up
@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 preview_video_parent = (RelativeLayout)findViewById(R.id.preview_video_parent);
	LayoutParams layoutParams = (LayoutParams) preview_video_parent
			.getLayoutParams();
	layoutParams.width = displaymetrics.widthPixels;
	layoutParams.height = displaymetrics.widthPixels;
	preview_video_parent.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);
}
 
Example 3
Source File: FFmpegPreviewActivity.java    From VideoRecorder with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 4
Source File: Camera2VideoFragment.java    From patrol-android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    mTextureView = (TextureView) view.findViewById(R.id.texture);
    mTextureView.setOnClickListener(this);
}
 
Example 5
Source File: CameraVideoFragment.java    From patrol-android with GNU General Public License v3.0 4 votes vote down vote up
private void initViews(View rootView) {
    mPreview = (TextureView) rootView.findViewById(R.id.texture);
    mPreview.setOnClickListener(this);
    mPreview.setSurfaceTextureListener(this);
}