Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
[Android] Enable transparent TextureView
Browse files Browse the repository at this point in the history
Enable transparent TextureView when user changes the default SurfaceView to TextureView.
BUG=XWALK-6519
  • Loading branch information
axinging committed Mar 18, 2016
1 parent 5c3da74 commit e7d4a95
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,22 @@ public ContentReadbackHandler getContentReadbackHandler() {
return mContentReadbackHandler;
}

private static boolean isOpaque(int color) {
return ((color >> 24) & 0xFF) == 0xFF;
}

/**
* Sets the background color of the surface view. This method is necessary because the
* Set the background color of SurfaceView or TextureView. This method is necessary because the
* background color of ContentViewRenderView itself is covered by the background of
* SurfaceView.
* SurfaceView or TextureView.
* @param color The color of the background.
*/
public void setSurfaceViewBackgroundColor(int color) {
if (mSurfaceView != null) {
mSurfaceView.setBackgroundColor(color);
} else if (mTextureView != null) {
mTextureView.setOpaque(isOpaque(color));
mTextureView.setBackgroundColor(color);
}
}

Expand Down

0 comments on commit e7d4a95

Please sign in to comment.