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