Skip to content

Camera Config Shutter Speed Widget

Siddharth Utgikar edited this page Feb 26, 2021 · 2 revisions

(Updated widget in develop branch)

Camera Config Shutter Speed Widget is created using Base Camera Config Widget and shows the camera's current shutter speed.

Usage

<dji.ux.beta.visualcamera.widget.cameraconfig.shutter.CameraConfigShutterWidget
        android:id="@+id/widget_camera_config_shutter"
        android:layout_width="wrap_content"
        android:layout_height="35dp" />

Customizations

The widget can be customized by the user to serve their purpose and theme. It supports all the customizations that its parent Base Camera Config Widget does. The customizations can be done using attributes in XML or programmatically using the APIs.

XML Example

<dji.ux.beta.visualcamera.widget.cameraconfig.shutter.CameraConfigShutterWidget
        android:id="@+id/widget_camera_config_shutter"
        android:layout_width="wrap_content"
        android:layout_height="35dp"
        android:background="@color/white"
        app:uxsdk_value_normal_color="@color/red"
        app:uxsdk_label_text_color="@color/black" />

Attributes

List of the customizable XML attributes
  • uxsdk_cameraIndex - The camera index to which the widget should react.
  • uxsdk_lensType - The type of lens to which the widget should react.

Kotlin Example

val cameraConfigShutterWidget: CameraConfigShutterWidget = findViewById<CameraConfigShutterWidget>(R.id.widget_camera_config_shutter)
cameraConfigShutterWidget.setBackgroundColor(getResources().getColor(R.color.white))
cameraConfigShutterWidget.labelTextColor = getResources().getColor(R.color.black)
cameraConfigShutterWidget.normalValueColor = getResources().getColor(R.color.uxsdk_red)

Java Example

CameraConfigShutterWidget cameraConfigShutterWidget = findViewById(R.id.widget_camera_config_shutter);
cameraConfigShutterWidget.setBackgroundColor(getResources().getColor(R.color.white));
cameraConfigShutterWidget.setLabelTextColor(getResources().getColor(R.color.black));
cameraConfigShutterWidget.setNormalValueColor(getResources().getColor(R.color.uxsdk_red));

APIs

List of the customization APIs
  • var cameraIndex: CameraIndex - The camera index for which the widget should react.
  • var lensType: LensType - The type of the lens the widget is reacting to.

Hooks

The widget provides hooks for users to add functionality based on state changes in the widget. The Camera Config Shutter widget provides the following hooks

  1. ModelState - Provides hooks for events received by the widget from the widget model.
    • data class ProductConnected(val isConnected: Boolean) : ModelState() - Event when product is connected or disconnected.
    • data class ShutterStateUpdated(val shutterState: CameraConfigShutterState) : ModelState() - Event when camera shutter state is updated.

The user can subscribe to this using public override fun getWidgetStateUpdate(): Flowable<ModelState>.

Clone this wiki locally