本文整理了Java中android.view.TextureView.isAvailable()
方法的一些代码示例,展示了TextureView.isAvailable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextureView.isAvailable()
方法的具体详情如下:
包路径:android.view.TextureView
类名称:TextureView
方法名:isAvailable
暂无
代码示例来源:origin: square/assertj-android
public TextureViewAssert isAvailable() {
isNotNull();
assertThat(actual.isAvailable()) //
.overridingErrorMessage("Expected to be available but was not available.") //
.isTrue();
return this;
}
代码示例来源:origin: square/assertj-android
public TextureViewAssert isNotAvailable() {
isNotNull();
assertThat(actual.isAvailable()) //
.overridingErrorMessage("Expected to not be available but was available.") //
.isFalse();
return this;
}
}
代码示例来源:origin: journeyapps/zxing-android-embedded
/**
* Start the camera preview and decoding. Typically this should be called from the Activity's
* onResume() method.
*
* Call from UI thread only.
*/
public void resume() {
// This must be safe to call multiple times
Util.validateMainThread();
Log.d(TAG, "resume()");
// initCamera() does nothing if called twice, but does log a warning
initCamera();
if (currentSurfaceSize != null) {
// The activity was paused but not stopped, so the surface still exists. Therefore
// surfaceCreated() won't be called, so init the camera here.
startPreviewIfReady();
} else if(surfaceView != null) {
// Install the callback and wait for surfaceCreated() to init the camera.
surfaceView.getHolder().addCallback(surfaceCallback);
} else if(textureView != null) {
if(textureView.isAvailable()) {
surfaceTextureListener().onSurfaceTextureAvailable(textureView.getSurfaceTexture(), textureView.getWidth(), textureView.getHeight());
} else {
textureView.setSurfaceTextureListener(surfaceTextureListener());
}
}
// To trigger surfaceSized again
requestLayout();
rotationListener.listen(getContext(), rotationCallback);
}
代码示例来源:origin: google/ExoPlayer
@Override
public void setVideoTextureView(TextureView textureView) {
verifyApplicationThread();
removeSurfaceCallbacks();
this.textureView = textureView;
if (textureView == null) {
setVideoSurfaceInternal(null, true);
maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0);
} else {
if (textureView.getSurfaceTextureListener() != null) {
Log.w(TAG, "Replacing existing SurfaceTextureListener.");
}
textureView.setSurfaceTextureListener(componentListener);
SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture()
: null;
if (surfaceTexture == null) {
setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true);
maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0);
} else {
setVideoSurfaceInternal(new Surface(surfaceTexture), /* ownsSurface= */ true);
maybeNotifySurfaceSizeChanged(textureView.getWidth(), textureView.getHeight());
}
}
}
代码示例来源:origin: wangli135/BlogDemo
@Override
protected void onResume() {
super.onResume();
mBackgroundThread = new HandlerThread("camera");
mBackgroundThread.start();
mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
if (textureView.isAvailable()) {
openCamera();
} else {
textureView.setSurfaceTextureListener(mSurfaceTextureListener);
}
}
代码示例来源:origin: com.squareup.assertj/assertj-android
public TextureViewAssert isAvailable() {
isNotNull();
assertThat(actual.isAvailable()) //
.overridingErrorMessage("Expected to be available but was not available.") //
.isTrue();
return this;
}
代码示例来源:origin: com.squareup.assertj/assertj-android
public TextureViewAssert isNotAvailable() {
isNotNull();
assertThat(actual.isAvailable()) //
.overridingErrorMessage("Expected to not be available but was available.") //
.isFalse();
return this;
}
}
代码示例来源:origin: lb377463323/GraphicsTestBed
@Override
protected void onResume() {
super.onResume();
startCameraThread();
if (!mTextureView.isAvailable()) {
mTextureView.setSurfaceTextureListener(mTextureListener);
} else {
startPreview();
}
}
代码示例来源:origin: fanbaoying/FBYIDCardRecognition-Android
@Override
public void resume() {
takingPicture.set(false);
if (camera == null) {
openCamera();
} else {
previewView.textureView.setSurfaceTextureListener(surfaceTextureListener);
if (previewView.textureView.isAvailable()) {
startPreview(false);
}
}
}
代码示例来源:origin: Stoick001/SnapchatClone
private void startOpenCamera() {
if (textureView.isAvailable()) {
setupCamera(screenWidth, screenHeight);
openCamera();
} else {
textureView.setSurfaceTextureListener(surfaceTextureListener);
}
}
代码示例来源:origin: Stoick001/SnapchatClone
@Override
public void onResume() {
super.onResume();
openBackgroundTread();
if (textureView.isAvailable()) {
setupCamera(screenWidth, screenHeight);
openCamera();
} else {
textureView.setSurfaceTextureListener(surfaceTextureListener);
}
}
代码示例来源:origin: mobapptuts/android_camera2_api_video_app
@Override
protected void onResume() {
super.onResume();
startBackgroundThread();
if(mTextureView.isAvailable()) {
setupCamera(mTextureView.getWidth(), mTextureView.getHeight());
connectCamera();
} else {
mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
}
}
代码示例来源:origin: org.boofcv/boofcv-android
if (mTextureView.isAvailable()) {
openCamera(mTextureView.getWidth(), mTextureView.getHeight());
} else {
代码示例来源:origin: org.boofcv/boofcv-android
open.mPreviewRequestBuilder = open.mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
if( mTextureView != null && mTextureView.isAvailable() ) {
SurfaceTexture texture = mTextureView.getSurfaceTexture();
assert texture != null;
代码示例来源:origin: googlecreativelab/shadercam
if (null == mCameraDevice || !mTextureView.isAvailable() || null == mPreviewSize) {
return;
代码示例来源:origin: square1-io/rich-text-android
public void handover(RichVideoView destination){
destination.mMediaPlayer = mMediaPlayer;
if(destination.mTextureView.isAvailable() == true){
destination.mSurfaceTextureListener.onSurfaceTextureAvailable(destination.mTextureView.getSurfaceTexture(),
destination.mTextureView.getWidth(),
destination.mTextureView.getHeight());
}
destination.initMediaPlayer();
destination.mMediaPlayer.syncMediaState();
}
代码示例来源:origin: fanbaoying/FBYIDCardRecognition-Android
@Override
public void start() {
startBackgroundThread();
if (textureView.isAvailable()) {
openCamera(textureView.getWidth(), textureView.getHeight());
textureView.setSurfaceTextureListener(surfaceTextureListener);
} else {
textureView.setSurfaceTextureListener(surfaceTextureListener);
}
}
代码示例来源:origin: square1-io/rich-text-android
@Override
public void onViewCreated(View view, Bundle savedInstanceState){
super.onViewCreated(view, savedInstanceState);
view.setOnTouchListener(this);
mMainVideoContainer = (FrameLayout)view;
mAspectRatioContainer = (FrameLayout)view.findViewById(R.id.internal_aspect_ratio_view);
//mAspectRatioContainer.setRotation(90);
ViewTreeObserver vto = mMainVideoContainer.getViewTreeObserver();
vto.addOnGlobalLayoutListener(mLayoutListener);
//setup the progress bar
mLoadingProgress = (ProgressBar) view.findViewById(R.id.internal_progress);
mLoadingProgress.setIndeterminate(true);
mVideoControls = new VideoControls(getActivity(),
mInitialView,
mAspectRatioContainer ,
true);
mVideoControls.setFullScreenButtonVisible(true);
mVideoControls.setOverrideFullScreenListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismissAllowingStateLoss();
}
});
mFullScreenView = (TextureView) view.findViewById(R.id.internal_texture_view);
mFullScreenView.setSurfaceTextureListener(this);
if(mFullScreenView.isAvailable() == true){
SurfaceTexture surfaceTexture = mFullScreenView.getSurfaceTexture();
onSurfaceTextureAvailable(surfaceTexture,mFullScreenView.getWidth(),mFullScreenView.getHeight() );
}
}
代码示例来源:origin: square1-io/rich-text-android
public void init(){
initMediaPlayer();
LayoutInflater.from(getContext())
.inflate(R.layout.internal_richtext_video_display,
this, true);
mMainVideoContainer = (FrameLayout)findViewById(R.id.internal_aspect_ratio_view);
mTextureView = (TextureView)findViewById(R.id.internal_texture_view);
mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
if(mTextureView.isAvailable() == true){
mSurfaceTextureListener.onSurfaceTextureAvailable(mTextureView.getSurfaceTexture(),
mTextureView.getWidth()
,mTextureView.getHeight());
}
mControlsContainer = new VideoControls(getContext(), this);
ViewGroup.LayoutParams currentLayoutParams = getLayoutParams();
if(currentLayoutParams == null){
currentLayoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
currentLayoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
setLayoutParams(currentLayoutParams);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
//setup the progress bar
mLoadingProgress = (ProgressBar) findViewById(R.id.internal_progress);
mLoadingProgress.setIndeterminate(true);
}
代码示例来源:origin: googlecreativelab/shadercam
@Override
protected void onResume() {
super.onResume();
Log.d(TAG, "onResume()");
ShaderUtils.goFullscreen(this.getWindow());
/**
* if we're on M and not satisfied, check for permissions needed
* {@link PermissionsHelper#checkPermissions()} will also instantly return true if we've
* checked prior and we have all the correct permissions, allowing us to continue, but if its
* false, we want to {@code return} here so that the popup will trigger without {@link #setReady(SurfaceTexture, int, int)}
* being called prematurely
*/
//
if(PermissionsHelper.isMorHigher() && !mPermissionsSatisfied) {
if(!mPermissionsHelper.checkPermissions())
return;
else
mPermissionsSatisfied = true; //extra helper as callback sometimes isnt quick enough for future results
}
if(!mTextureView.isAvailable())
mTextureView.setSurfaceTextureListener(mTextureListener); //set listener to handle when its ready
else
setReady(mTextureView.getSurfaceTexture(), mTextureView.getWidth(), mTextureView.getHeight());
}
内容来源于网络,如有侵权,请联系作者删除!