本文整理汇总了Java中android.view.TextureView.setSurfaceTextureListener方法的典型用法代码示例。如果您正苦于以下问题:Java TextureView.setSurfaceTextureListener方法的具体用法?Java TextureView.setSurfaceTextureListener怎么用?Java TextureView.setSurfaceTextureListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.TextureView
的用法示例。
在下文中一共展示了TextureView.setSurfaceTextureListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.view.TextureView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAudioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
// Initialize instance variables.
TextureView textureView = (TextureView) getActivity().findViewById(R.id.texture_view);
textureView.setSurfaceTextureListener(this);
setBackgroundType(BACKGROUND_TYPE);
// Set up listener.
setOnItemViewClickedListener(new ItemViewClickedListener());
}
示例2: 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);
}
示例3: setupSurfaceView
import android.view.TextureView; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@SuppressLint("NewAPI")
private void setupSurfaceView() {
if(useTextureView && Build.VERSION.SDK_INT >= 14) {
textureView = new TextureView(getContext());
textureView.setSurfaceTextureListener(surfaceTextureListener());
addView(textureView);
} else {
surfaceView = new SurfaceView(getContext());
if (Build.VERSION.SDK_INT < 11) {
surfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
surfaceView.getHolder().addCallback(surfaceCallback);
addView(surfaceView);
}
}
示例4: initPickupPlayer
import android.view.TextureView; //导入方法依赖的package包/类
/**
* ピックアップ再生用のViewとMediaPlayerを初期化する
*/
private void initPickupPlayer() {
mPlayer = new MediaPlayer();
mPlayer.setOnPreparedListener(this);
mPlayer.setOnCompletionListener(this);
RelativeLayout.LayoutParams videoLayoutParams = new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
videoLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
Context context = getActivity().getApplicationContext();
mPickedVideoView = new TextureView(context);
mPickedVideoView.setSurfaceTextureListener(this);
mPickedVideoView.setVisibility(View.GONE);
mRootView.addView(mPickedVideoView, videoLayoutParams);
}
示例5: onCreate
import android.view.TextureView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play_movie);
mTextureView = (TextureView) findViewById(R.id.movie_texture_view);
mTextureView.setSurfaceTextureListener(this);
// Populate file-selection spinner.
Spinner spinner = (Spinner) findViewById(R.id.playMovieFile_spinner);
// Need to create one of these fancy ArrayAdapter thingies, and specify the generic layout
// for the widget itself.
mMovieFiles = MiscUtils.getFiles(getFilesDir(), "*.mp4");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, mMovieFiles);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner.
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(this);
updateControls();
}
示例6: CameraView
import android.view.TextureView; //导入方法依赖的package包/类
public CameraView(Context context, boolean frontface) {
super(context, null);
isFrontface = frontface;
textureView = new TextureView(context);
textureView.setSurfaceTextureListener(this);
addView(textureView);
focusAreaSize = AndroidUtilities.dp(96);
outerPaint.setColor(0xffffffff);
outerPaint.setStyle(Paint.Style.STROKE);
outerPaint.setStrokeWidth(AndroidUtilities.dp(2));
innerPaint.setColor(0x7fffffff);
}
示例7: onCreate
import android.view.TextureView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fold);
mImageView = (ImageView)findViewById(R.id.image_view);
mImageView.setPadding(ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING,
ANTIALIAS_PADDING);
mImageView.setScaleType(ImageView.ScaleType.FIT_XY);
mImageView.setImageDrawable(getResources().getDrawable(R.drawable.image));
mTextureView = new TextureView(this);
mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
mAnchorSeekBar = (SeekBar)findViewById(R.id.anchor_seek_bar);
mFoldLayout = (FoldingLayout)findViewById(R.id.fold_view);
mFoldLayout.setBackgroundColor(Color.BLACK);
mFoldLayout.setFoldListener(mOnFoldListener);
mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop();
mAnchorSeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener);
mScrollGestureDetector = new GestureDetector(this, new ScrollGestureDetector());
mItemSelectedListener = new ItemSelectedListener();
mDefaultPaint = new Paint();
mSepiaPaint = new Paint();
ColorMatrix m1 = new ColorMatrix();
ColorMatrix m2 = new ColorMatrix();
m1.setSaturation(0);
m2.setScale(1f, .95f, .82f, 1.0f);
m1.setConcat(m2, m1);
mSepiaPaint.setColorFilter(new ColorMatrixColorFilter(m1));
}
示例8: onViewCreated
import android.view.TextureView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final ImageView closeButton = (ImageView) view.findViewById(R.id.close_vide_button);
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
textureView = (TextureView) view.findViewById(R.id.video_surface);
textureView.setSurfaceTextureListener(this);
}
示例9: onCreate
import android.view.TextureView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mProgramListView = (ListView) findViewById(R.id.lv_program);
mProgramListView.setAdapter(ArrayAdapter.createFromResource(this, R.array.program_list, android.R.layout.simple_list_item_1));
mProgramListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mProgramListView.setVisibility(View.GONE);
playVideo();
}
});
mVideoView = (TextureView) findViewById(R.id.video_view);
mVideoView.setSurfaceTextureListener(this);
mMediaPlayer = MediaPlayer.create(this,R.raw.test_4);
mMediaPlayer.setOnPreparedListener(this);
mDragVideoView = (DragVideoView) findViewById(R.id.drag_view);
mDragVideoView.setCallback(this);
mDetailInfoListView = (ListView) findViewById(R.id.lv_info);
mDetailInfoListView.setAdapter(ArrayAdapter.createFromResource(this, R.array.info_list, android.R.layout.simple_list_item_1));
}
示例10: _startPreview
import android.view.TextureView; //导入方法依赖的package包/类
private void _startPreview(TextureView preview, PreviewSize size)
{
if (mState == CameraState.Opened)
{
mState = CameraState.PreviewStarted;
mCurrentPreviewSize = size;
preview.setSurfaceTextureListener(this);
synchronized (mCameraLock)
{
Camera.Parameters p = mCamera.getParameters();
p.setPreviewSize(size.width, size.height);
mCamera.setParameters(p);
}
mTargetTexture = preview;
Log.d(ImagingUtils.TAG, "Camera preview is avalable: " + preview.isAvailable());
if (preview.isAvailable())
{
onSurfaceTextureAvailable(mTargetTexture.getSurfaceTexture(), mTargetTexture.getWidth(), mTargetTexture.getHeight());
}
}
}
示例11: onCreate
import android.view.TextureView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mTextureView = new TextureView(this);
mTextureView.setSurfaceTextureListener(this);
setContentView(mTextureView);
}
示例12: onCreate
import android.view.TextureView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
// Start up the Renderer thread. It'll sleep until the TextureView is ready.
mRenderer = new Renderer();
mRenderer.start();
setContentView(R.layout.activity_texture_view_canvas);
mTextureView = (TextureView) findViewById(R.id.canvasTextureView);
mTextureView.setSurfaceTextureListener(mRenderer);
}
示例13: onCreate
import android.view.TextureView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
// Start up the Renderer thread. It'll sleep until the TextureView is ready.
mRenderer = new Renderer();
mRenderer.start();
setContentView(R.layout.activity_texture_view_gl);
mTextureView = (TextureView) findViewById(R.id.glTextureView);
mTextureView.setSurfaceTextureListener(mRenderer);
}
示例14: onViewCreated
import android.view.TextureView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
if (mediaPlayer == null) {
TextureView textureView = (TextureView) view.findViewById(R.id.tutorial_view_texture_view);
textureView.setSurfaceTextureListener(this);
}
int textId = getArguments().getInt(TEXT_RES_ID);
TextView textView = (TextView) view.findViewById(R.id.tutorial_view_text_view);
textView.setOnClickListener((OnNextSlideClicked) getActivity());
textView.setText(textId);
}
示例15: initUI
import android.view.TextureView; //导入方法依赖的package包/类
private void initUI() {
// init mVideoSurface
mVideoSurface = (TextureView)findViewById(R.id.video_previewer_surface);
recordingTime = (TextView) findViewById(R.id.timer);
mCaptureBtn = (Button) findViewById(R.id.btn_capture);
mRecordBtn = (ToggleButton) findViewById(R.id.btn_record);
mShootPhotoModeBtn = (Button) findViewById(R.id.btn_shoot_photo_mode);
mRecordVideoModeBtn = (Button) findViewById(R.id.btn_record_video_mode);
mWayPointBtn=(Button)findViewById(R.id.btn_wayPoint);
if (null != mVideoSurface) {
mVideoSurface.setSurfaceTextureListener(this);
}
mCaptureBtn.setOnClickListener(this);
mRecordBtn.setOnClickListener(this);
mShootPhotoModeBtn.setOnClickListener(this);
mRecordVideoModeBtn.setOnClickListener(this);
mWayPointBtn.setOnClickListener(this);
recordingTime.setVisibility(View.INVISIBLE);
mRecordBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
startRecord();
} else {
stopRecord();
}
}
});
}