Skip to content

Camera Config White Balance Widget

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

(Updated widget in develop branch)

Camera Config White Balance Widget is created using Base Camera Config Widget and shows the camera's current white balance value. The widget shows the preset name in the label and the exact temperature value in the value.

Usage

<dji.ux.beta.visualcamera.widget.cameraconfig.wb.CameraConfigWBWidget
        android:id="@+id/widget_camera_config_wb"
        android:layout_width="wrap_content"
        android:layout_height="50dp" />

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.wb.CameraConfigWBWidget
        android:id="@+id/widget_camera_config_wb"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:background="@color/white"
        app:uxsdk_label_text_color="@color/blue"
        app:uxsdk_value_normal_color="@color/red" />

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 cameraConfigWBWidget = findViewById<CameraConfigWBWidget>(R.id.widget_camera_config_wb)
cameraConfigWBWidget.setBackgroundColor(getResources().getColor(R.color.white))
cameraConfigWBWidget.labelTextColor = getResources().getColor(R.color.blue)
cameraConfigWBWidget.normalValueColor = getResources().getColor(R.color.red)

Java Example

CameraConfigWBWidget cameraConfigWBWidget = findViewById(R.id.widget_camera_config_wb);
cameraConfigWBWidget.setBackgroundColor(getResources().getColor(R.color.white));
cameraConfigWBWidget.setLabelTextColor(getResources().getColor(R.color.blue));
cameraConfigWBWidget.setNormalValueColor(getResources().getColor(R.color.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 WB 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 WhiteBalanceStateUpdated(val whiteBalanceState: CameraConfigWBState) : ModelState() - Event when camera white balance state is updated.

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

Clone this wiki locally