-
Notifications
You must be signed in to change notification settings - Fork 15
Travel Mode List Item Widget
The Travel Mode List Item Widget is a widget of type DUXBetaListItemLabelButtonWidget and is used to put DJI Inspire series aircraft into and out of travel mode with the landing gear extended and locked for transportation.
Following are examples of the widget states
The users will be presented with instructions in a confirmation dialog when they try to put the drone in travel mode.
To add the travel mode list item widget to your DUXBetaSmartListModel
class, override buildModelLists
and include DUXBetaTravelModeListItemWidget.duxbeta_className()
or [DUXBetaTravelModeListItemWidget duxbeta_className]
in your modelClassnameList. This widget is a good example of using the smart model to display only appropriate items in a list. The travel mode widget is only appropriate for DJI Inspire aircraft, and the smart model can prevent it from being shown for non-Inspire devices.
@objc open class MySmartListModel : DUXBetaSmartListModel {
@objc open override func buildModelLists() {
super.buildModelLists()
if isInspire {
modelClassnameList.append(DUXBetaTravelModeListItemWidget.duxbeta_className())
}
}
}
@interface DUXBetaTestSmartListModel : DUXBetaSmartListModel
@end
@implementation DUXBetaTestSmartListModel
- (void)buildModelLists {
[super buildModelLists];
if (isInspire) {
[self.modelClassnameList append:[DUXBetaTravelModeListItemWidget duxbeta_className]];
}
}
@end
The following are examples of simple instantiation and customizations of the confirmation dialog colors.
travelModeWidget.confirmTravelModeDialogAppearance.imageTintColor = UIColor.blue
travelModeWidget.confirmTravelModeDialogAppearance.backgroundColor = UIColor.lightGray
travelModeWidget.confirmTravelModeDialogAppearance.imageTintColor = [UIColor blueColor];
travelModeWidget.confirmTravelModeDialogAppearance.backgroundColor = [UIColor lightGrayColor];
The standard customizations for the DUXBetaListItemButtonLabelWidget are supported as well as customizations for the three dialogs shown by the travel mode widget as well as the icons for the on and off states for travel mode.
List of the travel mode customization APIs
-
confirmTravelModeDialogAppearance
- An instance of DUXBetaAlertViewAppearance pre-customized for list item dialog display. -
enterTravelModeDialogAppearance
- An instance of DUXBetaAlertViewAppearance pre-customized for list item dialog display. -
travelModeErrorDialogAppearance
- An instance of DUXBetaAlertViewAppearance pre-customized for list item dialog display. -
travelModeActiveIcon
- A UIImage which holds the icon for the travel mode activated state. -
travelModeInactiveIcon
- A UIImage which holds the icon for the travel mode deactivated state.
The widget provides hooks for the users to add functionality based on the state changes in the widget. The unit mode list item widget provides the following hooks:
-
TravelModeItemUIState
- Provides the hooks from ListItemLabelButtonUIState but does not add any new hooks. -
TravelModeItemModelState
- Provides hooks for events received by the widget from user interactions. It inherits from ListItemLabelButtonModelState and adds the following hooks:
-
+ (instancetype)travelModeStateUpdated:(BOOL)isInTravelMode;
- Event when the aircraft changes into travel mode (send YES as an NSNumber) or out of travel mode (sends NO as an NSNumber.)
DJI UX SDK Version 5 Beta 4.1