forked from cheer4ftc/OpModeCamera
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFtcRobotControllerActivityCameraExtras
More file actions
49 lines (43 loc) · 1.72 KB
/
FtcRobotControllerActivityCameraExtras
File metadata and controls
49 lines (43 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/////////////////////////////////////////////////////////
// ADDED FOR CAMERA!!!
public void initPreview(final Camera camera, final OpModeCamera context, final Camera.PreviewCallback previewCallback) {
runOnUiThread(new Runnable() {
@Override
public void run() {
context.preview = new CameraPreview(FtcRobotControllerActivity.this, camera, previewCallback);
FrameLayout previewLayout = (FrameLayout) findViewById(R.id.previewLayout);
previewLayout.addView(context.preview);
}
});
}
// poor coding style here. Shouldn't have to duplicate these routines for regular and linear OpModes.
public void initPreviewLinear(final Camera camera, final LinearOpModeCamera context, final Camera.PreviewCallback previewCallback) {
runOnUiThread(new Runnable() {
@Override
public void run() {
context.preview = new CameraPreview(FtcRobotControllerActivity.this, camera, previewCallback);
FrameLayout previewLayout = (FrameLayout) findViewById(R.id.previewLayout);
previewLayout.addView(context.preview);
}
});
}
public void removePreview(final OpModeCamera context) {
runOnUiThread(new Runnable() {
@Override
public void run() {
FrameLayout previewLayout = (FrameLayout) findViewById(R.id.previewLayout);
previewLayout.removeAllViews();
}
});
}
public void removePreviewLinear(final LinearOpModeCamera context) {
runOnUiThread(new Runnable() {
@Override
public void run() {
FrameLayout previewLayout = (FrameLayout) findViewById(R.id.previewLayout);
previewLayout.removeAllViews();
}
});
}
// END CAMERA ADD!!!
//////////////////////////////////////////////