-
Notifications
You must be signed in to change notification settings - Fork 54
RC Battery List Item Widget
siddutgikar edited this page Jul 31, 2020
·
1 revision
RC Battery List Item Widget is a LABEL type of widget which will display the current battery level of the remote controller. Following are examples of the widget states:
Disconnected
Normal
Low Battery
<dji.ux.beta.core.listitemwidget.rcbattery.RCBatteryListItemWidget
android:id="@+id/rc_battery_list_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
The UI elements can be customized to match the style of the user's application. The customizations can be done using attributes in XML or programmatically using the APIs. The widget supports all the customizations that its parent LABEL widget supports.
<dji.ux.beta.core.listitemwidget.rcbattery.RCBatteryListItemWidget
android:id="@+id/rc_battery_list_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/gray"
app:uxsdk_list_item_title_text_color="@color/black"
app:uxsdk_list_item_normal_color="@color/green"
app:uxsdk_list_item_error_color="@color/orange"/>
RCBatteryListItemWidget rcBatteryListItemWidget = findViewById(R.id.rc_battery_list_item);
rcBatteryListItemWidget.setListItemTitleTextColor(getResources().getColor(R.color.black));
rcBatteryListItemWidget.setBackgroundColor(getResources().getColor(R.color.gray));
rcBatteryListItemWidget.setNormalValueColor(getResources().getColor(R.color.green));
rcBatteryListItemWidget.setErrorValueColor(getResources().getColor(R.color.orange));
val rcBatteryListItemWidget = findViewById<RCBatteryListItemWidget>(R.id.rc_battery_list_item)
rcBatteryListItemWidget.listItemTitleTextColor = resources.getColor(R.color.black)
rcBatteryListItemWidget.setBackgroundColor(resources.getColor(R.color.gray))
rcBatteryListItemWidget.normalValueColor = resources.getColor(R.color.green)
rcBatteryListItemWidget.errorValueColor = resources.getColor(R.color.orange)
The widget provides hooks for the users to add functionality based on the state changes in the widget. The RCBatteryListItemWidget provides the following hooks
-
RCBatteryListItemState
- Provides hooks in events received by the widget from the widget model.-
data class ProductConnected(val isConnected: Boolean) : RCBatteryListItemState()
- Event when the product is connected or disconnected. -
data class RCBatteryStateUpdate(val rcBatteryState: RCBatteryState) : RCBatteryListItemState()
- Event when the RC battery level is updated.
-
The user can subscribe to this using public override fun getWidgetStateUpdate(): Flowable<RCBatteryListItemState>
DJI UX SDK Version 5 Beta 5
UX SDK 5.0 Overview
Core Module
Camera Core Module
Visual Cameras Module
- Camera Config