use of android.view.TextureView in project platform_frameworks_base by android.
the class GlTextureViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mTextureView = new TextureView(this);
mTextureView.setSurfaceTextureListener(this);
setContentView(mTextureView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER));
}
use of android.view.TextureView in project android_frameworks_base by ParanoidAndroid.
the class GetBitmapActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout content = new FrameLayout(this);
mTextureView = new TextureView(this);
mTextureView.setSurfaceTextureListener(this);
Button button = new Button(this);
button.setText("Copy bitmap to /sdcard/textureview.png");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bitmap b = mTextureView.getBitmap();
try {
FileOutputStream out = new FileOutputStream(Environment.getExternalStorageDirectory() + "/textureview.png");
try {
b.compress(Bitmap.CompressFormat.PNG, 100, out);
} finally {
try {
out.close();
} catch (IOException e) {
// Ignore
}
}
} catch (FileNotFoundException e) {
// Ignore
}
}
});
content.addView(mTextureView, new FrameLayout.LayoutParams(500, 400, Gravity.CENTER));
content.addView(button, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM));
setContentView(content);
}
use of android.view.TextureView in project android_frameworks_base by ParanoidAndroid.
the class CanvasTextureViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout content = new FrameLayout(this);
mTextureView = new TextureView(this);
mTextureView.setSurfaceTextureListener(this);
mTextureView.setOpaque(false);
content.addView(mTextureView, new FrameLayout.LayoutParams(500, 500, Gravity.CENTER));
setContentView(content);
}
use of android.view.TextureView in project platform_frameworks_base by android.
the class Crossfade method captureValues.
private void captureValues(TransitionValues transitionValues) {
View view = transitionValues.view;
Rect bounds = new Rect(0, 0, view.getWidth(), view.getHeight());
if (mFadeBehavior != FADE_BEHAVIOR_REVEAL) {
bounds.offset(view.getLeft(), view.getTop());
}
transitionValues.values.put(PROPNAME_BOUNDS, bounds);
if (Transition.DBG) {
Log.d(LOG_TAG, "Captured bounds " + transitionValues.values.get(PROPNAME_BOUNDS));
}
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
if (view instanceof TextureView) {
bitmap = ((TextureView) view).getBitmap();
} else {
Canvas c = new Canvas(bitmap);
view.draw(c);
}
transitionValues.values.put(PROPNAME_BITMAP, bitmap);
// TODO: I don't have resources, can't call the non-deprecated method?
BitmapDrawable drawable = new BitmapDrawable(bitmap);
// TODO: lrtb will be wrong if the view has transXY set
drawable.setBounds(bounds);
transitionValues.values.put(PROPNAME_DRAWABLE, drawable);
}
use of android.view.TextureView in project Transitions-Everywhere by andkulikov.
the class Crossfade method captureValues.
private void captureValues(TransitionValues transitionValues) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return;
}
View view = transitionValues.view;
Rect bounds = new Rect(0, 0, view.getWidth(), view.getHeight());
if (mFadeBehavior != FADE_BEHAVIOR_REVEAL) {
bounds.offset(view.getLeft(), view.getTop());
}
transitionValues.values.put(PROPNAME_BOUNDS, bounds);
if (Transition.DBG) {
Log.d(LOG_TAG, "Captured bounds " + transitionValues.values.get(PROPNAME_BOUNDS));
}
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
if (view instanceof TextureView) {
bitmap = ((TextureView) view).getBitmap();
} else {
Canvas c = new Canvas(bitmap);
view.draw(c);
}
transitionValues.values.put(PROPNAME_BITMAP, bitmap);
BitmapDrawable drawable = new BitmapDrawable(view.getResources(), bitmap);
// TODO: lrtb will be wrong if the view has transXY set
drawable.setBounds(bounds);
transitionValues.values.put(PROPNAME_DRAWABLE, drawable);
}
Aggregations