@Override public synchronized void updateFromPreferences(SharedPreferences prefs) { boolean newEnabled = prefs.getBoolean("pref_motion_detection_enabled", false); int newBoxes = Integer.parseInt(prefs.getString("pref_motion_detection_granularity", "20")); int newLeniency = Integer.parseInt(prefs.getString("pref_motion_detection_leniency", "20")); int newDeviceRotation = mContext.getWindowManager().getDefaultDisplay().getRotation(); if (newEnabled) { mListener.updateFromPreferences(prefs); boolean changed = newBoxes != mBoxes || newLeniency != mLeniency || newDeviceRotation != mDeviceRotation; if (changed && mEnabled) { stopDetection(); } if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) { try { mBoxes = newBoxes; mLeniency = newLeniency; mDeviceRotation = newDeviceRotation; startDetection((TextureView) mContext.findViewById(R.id.previewView), newDeviceRotation * 90); mEnabled = true; } catch (CameraException e) { Log.e(TAG, "Could not enable MotionDetector", e); } } else { ActivityCompat.requestPermissions(mContext, new String[]{Manifest.permission.CAMERA}, MY_PERMISSIONS_MOTION_REQUEST_CAMERA); } } else if (mEnabled) { stopDetection(); mEnabled = false; } }
@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()); }
@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); }
@Override public void initViews() { surfaceView = (TextureView) findViewById(R.id.preview_video); image_back = (ImageView) findViewById(R.id.image_back); image_button = (ImageView) findViewById(R.id.image_button); progress_bar = (ProgressBar) findViewById(R.id.progress_bar); }
@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); } }
private Bitmap captureView (View view) { int w = view.getWidth(); int h = view.getHeight(); if (w <= 0 || h <= 0) { throw new RuntimeException("Impossible to snapshot the view: view is invalid"); } Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); Bitmap childBitmapBuffer; Canvas c = new Canvas(bitmap); view.draw(c); List<View> childrenList = getAllChildren(view); for (View child : childrenList) { if(child instanceof TextureView) { ((TextureView) child).setOpaque(false); childBitmapBuffer = ((TextureView) child).getBitmap(child.getWidth(), child.getHeight()); c.drawBitmap(childBitmapBuffer, child.getLeft() + ((ViewGroup)child.getParent()).getLeft() + child.getPaddingLeft(), child.getTop() + ((ViewGroup)child.getParent()).getTop() + child.getPaddingTop(), null); } } if (bitmap == null) { throw new RuntimeException("Impossible to snapshot the view"); } return bitmap; }
/** * Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and * {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous * assignments are overridden. * * @param player The {@link SimpleExoPlayer} to use. */ public void setPlayer(SimpleExoPlayer player) { if (this.player == player) { return; } if (this.player != null) { this.player.setTextOutput(null); this.player.setVideoListener(null); this.player.removeListener(componentListener); this.player.setVideoSurface(null); } this.player = player; shutterView.setVisibility(VISIBLE); if (player != null) { if (surfaceView instanceof TextureView) { player.setVideoTextureView((TextureView) surfaceView); } else if (surfaceView instanceof SurfaceView) { player.setVideoSurfaceView((SurfaceView) surfaceView); } player.setVideoListener(componentListener); player.addListener(componentListener); player.setTextOutput(componentListener); } }
private static ViewAssertion showingPreview() { return new ViewAssertion() { @Override public void check(View view, NoMatchingViewException noViewFoundException) { if (android.os.Build.VERSION.SDK_INT < 14) { return; } CameraView cameraView = (CameraView) view; TextureView textureView = (TextureView) cameraView.findViewById(R.id.texture_view); Bitmap bitmap = textureView.getBitmap(); int topLeft = bitmap.getPixel(0, 0); int center = bitmap.getPixel(bitmap.getWidth() / 2, bitmap.getHeight() / 2); int bottomRight = bitmap.getPixel( bitmap.getWidth() - 1, bitmap.getHeight() - 1); assertFalse("Preview possibly blank: " + Integer.toHexString(topLeft), topLeft == center && center == bottomRight); } }; }
/** * ピックアップ再生用の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); }
@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(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_double_decode); if (!sVideoRunning) { sBlob[0] = new VideoBlob((TextureView) findViewById(R.id.double1_texture_view), ContentManager.MOVIE_SLIDERS, 0); sBlob[1] = new VideoBlob((TextureView) findViewById(R.id.double2_texture_view), ContentManager.MOVIE_EIGHT_RECTS, 1); sVideoRunning = true; } else { sBlob[0].recreateView((TextureView) findViewById(R.id.double1_texture_view)); sBlob[1].recreateView((TextureView) findViewById(R.id.double2_texture_view)); } }
private void configureTransform(TextureView textureView) { if (null == textureView || null == mPreviewSize || null == mActivity) { return; } int rotation = mActivity.getWindowManager().getDefaultDisplay().getRotation(); Matrix matrix = new Matrix(); RectF viewRect = new RectF(0, 0, textureView.getWidth(), textureView.getHeight()); RectF bufferRect = new RectF(0, 0, mPreviewSize.y, mPreviewSize.x); float centerX = viewRect.centerX(); float centerY = viewRect.centerY(); if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) { bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY()); matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL); float scale = Math.max( (float) textureView.getHeight() / mPreviewSize.y, (float) textureView.getWidth() / mPreviewSize.x); matrix.postScale(scale, scale, centerX, centerY); } matrix.postRotate(-90 * rotation, centerX, centerY); textureView.setTransform(matrix); }
/** * Creates instances of TextureRender and SurfaceTexture, and a Surface associated * with the SurfaceTexture. */ private void setup() { mTextureView = new TextureView(mContext); mTextureRender = new TextureRender(); mTextureRender.surfaceCreated(); // Even if we don't access the SurfaceTexture after the constructor returns, we // still need to keep a reference to it. The Surface doesn't retain a reference // at the Java level, so if we don't either then the object can get GCed, which // causes the native finalizer to run. if (VERBOSE) Log.d(TAG, "textureID=" + mTextureRender.getTextureId()); mSurfaceTexture = new SurfaceTexture(mTextureRender.getTextureId()); mTextureView.setSurfaceTexture(mSurfaceTexture); task = new TimerTask() { public void run() { if (VERBOSE) Log.d(TAG, "new frame available"); synchronized (mFrameSyncObject) { mFrameSyncObject.notifyAll(); } } }; timer = new Timer(); timer.scheduleAtFixedRate(task, 25, 25); }
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); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.floating_player); mFirstScreenSurfaceView = (TextureView) findViewById(R.id.gl_surface_view); mCallback.onFirstScreenPresentationCreated(findViewById(R.id.root)); }
public SurfaceController(View rootView) { ViewGroup mLp = (ViewGroup)rootView; mEffectView = (TextureView) mLp.findViewById(R.id.gl_surface_view); mSurfaceView = (SurfaceView) mLp.findViewById(R.id.surface_view); if (mEffectEnable) { mView = mEffectView; mSurfaceView.setVisibility(View.GONE); } else { mView = mSurfaceView; mEffectView.setVisibility(View.GONE); } }
@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)); }
private void findview(View v) { mTextureView = (TextureView) v.findViewById(R.id.tv_textview); mButton = (Button) v.findViewById(R.id.btn_takepic); mThumbnail = (ImageView) v.findViewById(R.id.iv_Thumbnail); mThumbnail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(getActivity(), "别戳了,那个页面还没写", Toast.LENGTH_SHORT).show(); } }); }
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); setContentView(R.layout.scan_activity); scannerView = (ScannerView) findViewById(R.id.scan_activity_mask); previewView = (TextureView) findViewById(R.id.scan_activity_preview); previewView.setSurfaceTextureListener(this); cameraThread = new HandlerThread("cameraThread", Process.THREAD_PRIORITY_BACKGROUND); cameraThread.start(); cameraHandler = new Handler(cameraThread.getLooper()); if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA }, 0); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_take_head_photo); linearLayout = (LinearLayout) findViewById(R.id.bottom_linear_layout); bt_ok = (Button) findViewById(R.id.id_bt_ok); bt_reCapture = (Button) findViewById(R.id.id_bt_again); bt_home = (Button) findViewById(R.id.id_bt_home); tv_shoot = (TextView) findViewById(R.id.id_tv_oval); iv_show = (ImageView) findViewById(R.id.id_iv_show_picture); mTextureView = (TextureView) findViewById(R.id.id_texture_view); initView(); initCamera(); initOnClickListener(); }
void resetRenderHolder(Point renderInSize) { TextureView textureView = (TextureView) findViewById(R.id.textureView); // These two functions are a simple hack to help TextureView behave like we want it to: // If we are on landscape mode, it will rotate accordingly. Otherwise, a badly stretched image would be shown. textureView.requestLayout(); textureView.invalidate(); // Scales down preview size by 2 times, for performance reasons. Point renderOutSize = new Point(Math.round(renderInSize.x * 0.5f), Math.round(renderInSize.y * 0.5f)); // Instantiates a new custom compute class, passing information about input image size (camera preview) // and output size (render holder surface scaled size) rsCompute = new RSCompute(mRS, renderInSize, renderOutSize); // Sets TextureView to display output rsCompute.setRenderTextureView(textureView); }
private View searchAndFindDrawingView(ViewGroup group) { int childCount = group.getChildCount(); for (int i = 0; i < childCount; i++) { View child = group.getChildAt(i); if (child instanceof ViewGroup) { View view = searchAndFindDrawingView((ViewGroup) child); if (view != null) { return view; } } if (child instanceof SurfaceView) { return child; } if (hasTextureViewSupport) { // if we have support for texture view if (child instanceof TextureView) { return child; } } } return null; }
@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); }
@SuppressWarnings("SuspiciousNameCombination") public void rotate(@NonNull TextureView view, @IntRange(from = 0, to = 359) int rotation) { if (!ready()) { requestedRotation = rotation; requestedModificationView = new WeakReference<>(view); return; } boolean swapWidthHeight = ((rotation / QUARTER_ROTATION) % 2) == 1; boolean currentWidthHeightSwapped = ((currentRotation / QUARTER_ROTATION) % 2) == 1; //Makes sure the width and height are correctly swapped if (swapWidthHeight != currentWidthHeightSwapped) { int tempX = intrinsicVideoSize.x; intrinsicVideoSize.x = intrinsicVideoSize.y; intrinsicVideoSize.y = tempX; //We re-apply the scale to make sure it is correct scale(view, currentScaleType); } currentRotation = rotation; view.setRotation(rotation); }
private static ViewAssertion showingPreview() { return new ViewAssertion() { @Override public void check(View view, NoMatchingViewException noViewFoundException) { if (android.os.Build.VERSION.SDK_INT < 14) { return; } CameraView cameraView = (CameraView) view; TextureView textureView = (TextureView) cameraView.findViewById(com.google.android.cameraview.test.R.id.texture_view); Bitmap bitmap = textureView.getBitmap(); int topLeft = bitmap.getPixel(0, 0); int center = bitmap.getPixel(bitmap.getWidth() / 2, bitmap.getHeight() / 2); int bottomRight = bitmap.getPixel( bitmap.getWidth() - 1, bitmap.getHeight() - 1); assertFalse("Preview possibly blank: " + Integer.toHexString(topLeft), topLeft == center && center == bottomRight); } }; }
@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)); }
public ExoPlayerView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); boolean useTextureView = false; ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); componentListener = new ComponentListener(); FrameLayout.LayoutParams aspectRatioParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); aspectRatioParams.gravity = Gravity.CENTER; layout = new AspectRatioFrameLayout(context); layout.setLayoutParams(aspectRatioParams); shutterView = new View(getContext()); shutterView.setLayoutParams(params); shutterView.setBackgroundColor(ContextCompat.getColor(context, android.R.color.black)); subtitleLayout = new SubtitleView(context); subtitleLayout.setLayoutParams(params); subtitleLayout.setUserDefaultStyle(); subtitleLayout.setUserDefaultTextSize(); View view = useTextureView ? new TextureView(context) : new SurfaceView(context); view.setLayoutParams(params); surfaceView = view; layout.addView(surfaceView, 0, params); layout.addView(shutterView, 1, params); layout.addView(subtitleLayout, 2, params); addViewInLayout(layout, 0, aspectRatioParams); }
@Override public void showReplayView(int visibility) { if (playerView != null && playerView.getVideoSurfaceView() instanceof TextureView) { TextureView surfaceView = (TextureView) playerView.getVideoSurfaceView(); showBottomView(VISIBLE, surfaceView.getBitmap()); } showReplay(visibility); }
/** * Set the {@link SimpleExoPlayer} to use. * <p> * To transition a {@link SimpleExoPlayer} from targeting one view to another, it's recommended to * use {@link #switchTargetView(SimpleExoPlayer, SimpleExoPlayerView, SimpleExoPlayerView)} rather * than this method. If you do wish to use this method directly, be sure to attach the player to * the new view <em>before</em> calling {@code setPlayer(null)} to detach it from the old one. * This ordering is significantly more efficient and may allow for more seamless transitions. * * @param player The {@link SimpleExoPlayer} to use. */ public void setPlayer(SimpleExoPlayer player) { if (this.player == player) { return; } if (this.player != null) { this.player.removeListener(componentListener); this.player.removeTextOutput(componentListener); this.player.removeVideoListener(componentListener); if (surfaceView instanceof TextureView) { this.player.clearVideoTextureView((TextureView) surfaceView); } else if (surfaceView instanceof SurfaceView) { this.player.clearVideoSurfaceView((SurfaceView) surfaceView); } } this.player = player; if (useController) { controller.setPlayer(player); } if (shutterView != null) { shutterView.setVisibility(VISIBLE); } if (player != null) { if (surfaceView instanceof TextureView) { player.setVideoTextureView((TextureView) surfaceView); } else if (surfaceView instanceof SurfaceView) { player.setVideoSurfaceView((SurfaceView) surfaceView); } player.addVideoListener(componentListener); player.addTextOutput(componentListener); player.addListener(componentListener); maybeShowController(false); updateForCurrentTrackSelections(); } else { hideController(); hideArtwork(); } }
/** * Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and * {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous * assignments are overridden. * <p> * @param player The {@link SimpleExoPlayer} to use. */ public void setPlayer(SimpleExoPlayer player, @NonNull TubiPlaybackInterface playbackInterface) { setPlaybackInterface(playbackInterface); if (this.player == player) { return; } if (this.player != null) { this.player.removeListener(componentListener); this.player.clearTextOutput(componentListener); this.player.clearVideoListener(componentListener); if (surfaceView instanceof TextureView) { this.player.clearVideoTextureView((TextureView) surfaceView); } else if (surfaceView instanceof SurfaceView) { this.player.clearVideoSurfaceView((SurfaceView) surfaceView); } } this.player = player; if (useController) { controller.setPlayer(player,this, playbackInterface); } if (shutterView != null) { shutterView.setVisibility(VISIBLE); } if (player != null) { if (surfaceView instanceof TextureView) { player.setVideoTextureView((TextureView) surfaceView); } else if (surfaceView instanceof SurfaceView) { player.setVideoSurfaceView((SurfaceView) surfaceView); } player.setVideoListener(componentListener); player.setTextOutput(componentListener); player.addListener(componentListener); // maybeShowController(false); updateForCurrentTrackSelections(); } else { hideController(); hideArtwork(); } }
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()); } } }
/** * @param surfaceNumber 識別用番号 * @param imageView ImageView */ DecoderSurface(int surfaceNumber, ImageView imageView, TextureView textureView) { this.mImageView = imageView; this.mTextureView = textureView; this.mSurfaceNumber = surfaceNumber; mManager = DecodeQueueManager.getInstance(); }
/** * Constructs the VideoBlob. * * @param view The TextureView object we want to draw into. * @param movieTag Which movie to play. * @param ordinal The blob's ordinal (only used for log messages). */ public VideoBlob(TextureView view, int movieTag, int ordinal) { LTAG = TAG + ordinal; Log.d(LTAG, "VideoBlob: tag=" + movieTag + " view=" + view); mMovieTag = movieTag; mCallback = new SpeedControlCallback(); recreateView(view); }
/** * Performs partial construction. The VideoBlob is already created, but the Activity * was recreated, so we need to update our view. */ public void recreateView(TextureView view) { Log.d(LTAG, "recreateView: " + view); mTextureView = view; mTextureView.setSurfaceTextureListener(this); if (mSavedSurfaceTexture != null) { Log.d(LTAG, "using saved st=" + mSavedSurfaceTexture); view.setSurfaceTexture(mSavedSurfaceTexture); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTextureView = new TextureView(this); mTextureView.setSurfaceTextureListener(this); setContentView(mTextureView); }
@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); }
@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); }