Skip to content

Camera Capture Widget

siddutgikar edited this page May 12, 2020 · 2 revisions

The camera capture widget is a compound widget that aggregates the interaction with the camera on the drone based on Camera Mode. The Camera Mode has the following values

  • Shoot Photo
  • Record Video
  • Playback
  • Media Download
  • Broadcast

The widget currently constitutes of ShootPhotoWidget which is shown when the current Camera Mode is Shoot Photo and RecordVideoWidget when the current Camera Mode is Record Video. This enables the user to include a single widget for shooting photos and recording videos.

Usage

<dji.ux.beta.cameracore.widget.cameracapture.CameraCaptureWidget
     android:id="@+id/widget_camera_capture"
     android:layout_width="80dp"
     android:layout_height="80dp" />

Customizations

As a part of customization, the widget provides access to its children. This will enable the user to customize the widget to match their theming. Apart from the two modes that are currently supported, the widget can be configured to display any other view group based on the Camera Mode.

Example

CameraCaptureWidget cameraCaptureWidget = findViewById(R.id.widget_camera_capture);
ImageView iv = new ImageView(this);
iv.setImageResource(R.drawable.ic_play_back);
cameraCaptureWidget.addViewByMode(SettingsDefinitions.CameraMode.PLAYBACK, iv);

APIs

List of the customization APIs
  • @Nullable public ShootPhotoWidget getShootPhotoWidget() - Get the shoot photo widget
  • @Nullable public RecordVideoWidget getRecordVideoWidget() - Get the record video widget
  • public void addViewByMode(@NonNull CameraMode cameraMode, @NonNull View view) - Add/Replace the view to be shown based on Camera Mode
  • @Nullable public View getViewByMode(@NonNull CameraMode cameraMode) - Get the view being shown based on Camera Mode
  • public void removeViewByMode(@NonNull CameraMode cameraMode) - Remove the view based on Camera Mode
Clone this wiki locally