summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJae Seo <jaeseo@google.com>2014-06-09 19:29:17 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-09 19:29:17 +0000
commit9aea9c93c531e0649e40f60692f775d45cc01f69 (patch)
tree00e46eb102a3d97bb578a43db052f0b7355105e3 /media
parent0d99a507b22056233a280545270198aa4a7a3d6a (diff)
parent182dc33e9efcbfa80d6b277666c427c1b4afc3bf (diff)
downloadframeworks_base-9aea9c93c531e0649e40f60692f775d45cc01f69.zip
frameworks_base-9aea9c93c531e0649e40f60692f775d45cc01f69.tar.gz
frameworks_base-9aea9c93c531e0649e40f60692f775d45cc01f69.tar.bz2
am 73fe04a4: Merge "TIF: Address the feedback from the API review - 3/3" into lmp-preview-dev
* commit '73fe04a41f88eb9e4a9da8e229351ce8458d0e0d': TIF: Address the feedback from the API review - 3/3
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/tv/TvView.java36
1 files changed, 30 insertions, 6 deletions
diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java
index 2453325..2831d9e 100644
--- a/media/java/android/media/tv/TvView.java
+++ b/media/java/android/media/tv/TvView.java
@@ -33,12 +33,13 @@ import android.view.MotionEvent;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
+import android.view.ViewGroup;
import android.view.ViewRootImpl;
/**
* View playing TV
*/
-public class TvView extends SurfaceView {
+public class TvView extends ViewGroup {
private static final String TAG = "TvView";
// STOPSHIP: Turn debugging off.
private static final boolean DEBUG = true;
@@ -57,6 +58,7 @@ public class TvView extends SurfaceView {
private final Handler mHandler = new Handler();
private TvInputManager.Session mSession;
+ private final SurfaceView mSurfaceView;
private Surface mSurface;
private boolean mOverlayViewCreated;
private Rect mOverlayViewFrame;
@@ -124,7 +126,14 @@ public class TvView extends SurfaceView {
public TvView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- getHolder().addCallback(mSurfaceHolderCallback);
+ mSurfaceView = new SurfaceView(context, attrs, defStyleAttr) {
+ @Override
+ protected void updateWindow(boolean force, boolean redrawNeeded) {
+ super.updateWindow(force, redrawNeeded);
+ relayoutSessionOverlayView();
+ }};
+ mSurfaceView.getHolder().addCallback(mSurfaceHolderCallback);
+ addView(mSurfaceView);
mTvInputManager = (TvInputManager) getContext().getSystemService(Context.TV_INPUT_SERVICE);
}
@@ -310,11 +319,26 @@ public class TvView extends SurfaceView {
super.onDetachedFromWindow();
}
- /** @hide */
@Override
- protected void updateWindow(boolean force, boolean redrawNeeded) {
- super.updateWindow(force, redrawNeeded);
- relayoutSessionOverlayView();
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ mSurfaceView.layout(0, 0, right - left, bottom - top);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ mSurfaceView.measure(widthMeasureSpec, heightMeasureSpec);
+ int width = mSurfaceView.getMeasuredWidth();
+ int height = mSurfaceView.getMeasuredHeight();
+ int childState = mSurfaceView.getMeasuredState();
+ setMeasuredDimension(resolveSizeAndState(width, widthMeasureSpec, childState),
+ resolveSizeAndState(height, heightMeasureSpec,
+ childState << MEASURED_HEIGHT_STATE_SHIFT));
+ }
+
+ @Override
+ public void setVisibility(int visibility) {
+ super.setVisibility(visibility);
+ mSurfaceView.setVisibility(visibility);
}
private void release() {