-
Notifications
You must be signed in to change notification settings - Fork 54
Camera Config Color Widget
Siddharth Utgikar edited this page Feb 26, 2021
·
1 revision
(Updated widget in develop branch)
Camera Config Color Widget is created using Base Camera Config Widget and shows the camera's current color profile. The widget will be hidden when camera color is UNKNOWN
or NONE
.
<dji.ux.beta.visualcamera.widget.cameraconfig.color.CameraConfigColorWidget
android:id="@+id/widget_camera_config_color"
android:layout_width="wrap_content"
android:layout_height="35dp" />
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.
<dji.ux.beta.visualcamera.widget.cameraconfig.color.CameraConfigColorWidget
android:id="@+id/widget_camera_config_color"
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" />
List of the customizable XML attributes
-
uxsdk_cameraIndex
- The camera index to which the widget should react.
val cameraConfigColorWidget = findViewById<CameraConfigColorWidget>(R.id.widget_camera_config_color)
cameraConfigColorWidget.setBackgroundColor(resources.getColor(R.color.white))
cameraConfigColorWidget.labelTextColor = resources.getColor(R.color.black)
cameraConfigColorWidget.normalValueColor = resources.getColor(R.color.red)
CameraConfigColorWidget cameraConfigColorWidget = findViewById(R.id.widget_camera_config_color);
cameraConfigColorWidget.setBackgroundColor(getResources().getColor(R.color.white));
cameraConfigColorWidget.setLabelTextColor(getResources().getColor(R.color.black));
cameraConfigColorWidget.setNormalValueColor(getResources().getColor(R.color.red));
List of the customization APIs
-
var cameraIndex: CameraIndex
- The camera index for which the widget should react.
The widget provides hooks for users to add functionality based on state changes in the widget. The Camera Config Color widget provides the following hooks
-
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 ColorStateUpdated(val colorState: CameraConfigColorState) : ModelState()
- Event when camera color state is updated.
-
The user can subscribe to this using public override fun getWidgetStateUpdate(): Flowable<ModelState>
.
DJI UX SDK Version 5 Beta 5
UX SDK 5.0 Overview
Core Module
Camera Core Module
Visual Cameras Module
- Camera Config