|
16 | 16 | import android.graphics.SurfaceTexture;
|
17 | 17 | import android.util.Log;
|
18 | 18 | import android.view.Surface;
|
19 |
| -import android.view.TextureView; |
| 19 | +import android.view.SurfaceHolder; |
20 | 20 |
|
21 | 21 | import com.facebook.react.common.ReactConstants;
|
22 | 22 | import com.facebook.react.uimanager.ReactShadowNode;
|
|
25 | 25 | import com.facebook.yoga.YogaValue;
|
26 | 26 | import com.facebook.yoga.YogaUnit;
|
27 | 27 |
|
| 28 | + |
28 | 29 | /* package */ class FlatARTSurfaceViewShadowNode extends FlatShadowNode
|
29 |
| - implements AndroidView, TextureView.SurfaceTextureListener { |
| 30 | + implements AndroidView, SurfaceHolder.Callback { |
30 | 31 | private boolean mPaddingChanged = false;
|
31 | 32 | private @Nullable Surface mSurface;
|
32 | 33 |
|
@@ -123,21 +124,16 @@ public void setPaddingPercent(int spacingType, float percent) {
|
123 | 124 | }
|
124 | 125 |
|
125 | 126 | @Override
|
126 |
| - public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { |
127 |
| - mSurface = new Surface(surface); |
| 127 | + public void surfaceCreated(SurfaceHolder holder) { |
| 128 | + mSurface = holder.getSurface(); |
128 | 129 | drawOutput();
|
129 | 130 | }
|
130 | 131 |
|
131 | 132 | @Override
|
132 |
| - public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { |
133 |
| - surface.release(); |
| 133 | + public void surfaceDestroyed(SurfaceHolder holder) { |
134 | 134 | mSurface = null;
|
135 |
| - return true; |
136 | 135 | }
|
137 | 136 |
|
138 | 137 | @Override
|
139 |
| - public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {} |
140 |
| - |
141 |
| - @Override |
142 |
| - public void onSurfaceTextureUpdated(SurfaceTexture surface) {} |
| 138 | + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {} |
143 | 139 | }
|
0 commit comments