-
Notifications
You must be signed in to change notification settings - Fork 54
Bar Panel Widget
The BarPanelWidget
is one of the panel cluster widgets. A Bar Panel Widget is a collection of simple widgets that can be grouped together in two orientations:
BarPanelWidgetOrientation.VERTICAL
BarPanelWidgetOrientation.HORIZONTAL
This type of PanelWidget
is primarily used for the application's top bar or other similarly sized widgets.
The Bar Panel Widget is split into two lists: left and right (in vertical orientation left is equivalent to top and right to bottom.) Bar Panel Widgets don't have a titlebar.
An example of a Bar Panel Widget is the TopBarPanelWidget
When creating a BarPanelWidget
, the configuration object specifies the widget type (PanelWidgetType
). Note, a Bar Panel Widget should not have a titlebar.
Widgets can be created in two ways.
<dji.ux.beta.core.panelwidget.topbar.TopBarPanelWidget
android:id="@+id/panel_top_bar"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.08"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:uxsdk_itemsMarginRight="@dimen/uxsdk_spacing_normal"
app:uxsdk_itemsSpacing="@dimen/uxsdk_spacing_normal" />
val systemStatusList = TopBarPanelWidget(context)
Bar Panel Widgets are manipulated by adding and removing widgets. You can retrieve the widget count, append widgets, insert widgets at a specific index, or remove widgets dynamically. To initialize the BarPanelWidget, pass a list of PanelItem by calling BarPanelWidget.addLeftWidgets
and/or BarPanelWidget.addRightWidgets
.
The Bar Panel Widget supports APIs from its parent PanelWidget. The following APIs are unique to the Bar Panel Widget:
List of APIs
-
fun size(): Int
- Total number ofPanelItem
inside thisBarPanelWidget
. Includes left and right lists. -
fun leftWidgetsSize(): Int
- Total number ofPanelItem
inside the left list of thisBarPanelWidget
. -
fun rightWidgetsSize(): Int
- Total number ofPanelItem
inside the right list of thisBarPanelWidget
.
List of APIs
-
fun addLeftWidgets(panelItems: Array<PanelItem>)
- Append an array ofPanelItem
to the left list of this BarPanelWidget. The items should be unique and not be present in this BarPanelWidget already. -
fun addLeftWidget(@IntRange(from = 0) index: Int, panelItem: PanelItem)
- Insert aPanelItem
at the given index to the left list of this BarPanelWidget.index
0, is the first position of the left list. -
fun addRightWidgets(panelItems: Array<PanelItem>)
- Appends an array ofPanelItem
to the right list of this BarPanelWidget. The items should be unique and not be present in this BarPanelWidget already. -
fun addRightWidget(@IntRange(from = 0) index: Int, panelItem: PanelItem)
- Insert aPanelItem
at the given index to the right list of this BarPanelWidget.index
0, is the first position of the right list.
List of APIs
-
fun removeLeftWidget(@IntRange(from = 0) index: Int): PanelItem?
- Remove aPanelItem
at the given index from the left list of this BarPanelWidget. Index 0, is the first position of the left list. -
fun removeAllLeftWidgets()
- Remove allPanelItem
from the left list of this BarPanelWidget. -
fun removeRightWidget(@IntRange(from = 0) index: Int): PanelItem?
- Remove aPanelItem
at the given index from the right list of this BarPanelWidget. Index 0, is the first position of the right list. -
fun removeAllRightWidgets()
- Remove allPanelItem
from the right list of this BarPanelWidget.
List of APIs
-
fun getLeftWidget(@IntRange(from = 0) index: Int): PanelItem?
- GetPanelItem
from the left list of this BarPanelWidget. Index 0, is the first position of the left list. -
fun getRightWidget(@IntRange(from = 0) index: Int): PanelItem?
- GetPanelItem
from the right list of this BarPanelWidget. Index 0, is the first position of the right list.
Encapsulates a View with properties used to define how it is laid out. A BarPanelWidget
is populated with this type of object.
Property | Description |
---|---|
var view: View |
The child view to add into a panel. |
val itemMarginLeft: Int? |
Left margin pixel size, null by default. |
val itemMarginTop: Int? |
Top margin pixel size, null by default. |
val itemMarginRight: Int? |
Right margin pixel size, null by default. |
val itemMarginBottom: Int? |
Bottom margin pixel size, null by default. |
desiredWidgetSizeDescription: WidgetSizeDescription? |
Widget size description, null by default. |
desiredRatioString: String? |
Desired ratio for the view of the width to height, null by default. |
The UI elements can be customized to match the style of the user's application. The customization can be done using attributes in XML or programmatically using the APIs.
List of the customizable XML attributes
-
uxsdk_itemsMarginLeft
- Margin for the left side of theBarPanelWidget
. -
uxsdk_itemsMarginTop
- Margin for the top side of theBarPanelWidget
. -
uxsdk_itemsMarginRight
- Margin for the right side of theBarPanelWidget
. -
uxsdk_itemsMarginBottom
- Margin for the bottom side of theBarPanelWidget
. -
uxsdk_itemsSpacing
- The spacing between thePanelItem
inserted. -
uxsdk_guidelinePercent
- The percentage between the left and the right. 0.5 distributes both sides equally. -
uxsdk_leftBias
- The bias for the left section of theBarPanelWidget
. 0 aligns items to the left/top. Left items are aligned to the left (0) by default. -
uxsdk_rightBias
- The bias for the right section of theBarPanelWidget
. 0 aligns items to the left/top. Right items are aligned to the right (1) by default. -
uxsdk_leftChainStyle
- The chain style for the left section of theBarPanelWidget
. Choose from:spread
,spread_inside
, orpacked
.packed
is used by default. -
uxsdk_rightChainStyle
- The chain style for the right section of theBarPanelWidget
. Choose from:spread
,spread_inside
, orpacked
.packed
is used by default.
List of the customization APIs
-
var itemsMarginLeft: Int
- Margin for the left side of theBarPanelWidget
. -
var itemsMarginTop: Int
- Margin for the top side of theBarPanelWidget
. -
var itemsMarginRight: Int
- Margin for the right side of theBarPanelWidget
. -
var itemsMarginBottom: Int
- Margin for the bottom side of theBarPanelWidget
. -
var itemSpacing: Int
- The spacing between thePanelItem
inserted. -
var leftBias: Float
- The bias for the left section of theBarPanelWidget
. 0 aligns items to the left/top. Left items are aligned to the left (0) by default. -
var rightBias: Float
- The bias for the right section of theBarPanelWidget
. 0 aligns items to the left/top. Right items are aligned to the right (1) by default. -
var leftChainStyle: Int
- The chain style for the left section of theBarPanelWidget
.ConstraintSet.CHAIN_PACKED
is used by default. -
var rightChainStyle: Int
- The chain style for the right section of theBarPanelWidget
.ConstraintSet.CHAIN_PACKED
is used by default. -
var guidelinePercent: Float
- The percentage between the left and the right. 0.5 distributes both sides equally.
DJI UX SDK Version 5 Beta 5
UX SDK 5.0 Overview
Core Module
Camera Core Module
Visual Cameras Module
- Camera Config