-
Notifications
You must be signed in to change notification settings - Fork 15
Max Altitude List Item Widget
Max Altitude List Item Widget is a DUXBetaListItemOnlyEdit type widget which will display the current value of the maximum altitude that the drone is restricted to fly at. The widget also provides functionality to modify this value. The user can tap on the value and edit it in the permitted range. The permitted range is shown next to the edit field as a hint.
Following are examples of the widget states:
Disconnected
Normal
The modification of the maximum altitude value depends on the mode of the drone and flight restrictions at the current location.
-
Flight Restriction
- If there is no flight restriction at the location the maximum altitude value can be modified over 120m / 400ft. The user will, however, be shown a dialog to accept responsibility for flying above the FAA 400-foot flight ceiling.
If the user modifies the maximum altitude value to a value lower than the current Failsafe Return To Home Altitude
, the Failsafe Return To Home Altitude
will also be modified to that value. The user will be shown a dialog to confirm this action.
To add the max altitude list item widget to your DUXBetaSmartListModel
class, override buildModelLists
and include DUXBetaMaxAltitudeListItemWidget.duxbeta_className()
or [DUXBetaMaxAltitudeListItemWidget duxbeta_className]
in your modelClassnameList:
@objc open class MySmartListModel : DUXBetaSmartListModel {
@objc open override func buildModelLists() {
super.buildModelLists()
self.modelClassnameList.append(DUXBetaMaxAltitudeListItemWidget.duxbeta_className())
}
}
@interface DUXBetaTestSmartListModel : DUXBetaSmartListModel
@end
@implementation DUXBetaTestSmartListModel
- (void)buildModelLists {
[super buildModelLists];
[self.modelClassnameList append:[DUXBetaMaxAltitudeListItemWidget duxbeta_className]];
}
@end
The UI elements can be customized to match the style of the user's application. The widget supports all the customizations that its parent, DUXBetaListItemOnlyEdit supports. An example of a customized max altitude list item widget in various states could look something like this:
To get this effect we would use the following code:
maxHeightWidget.backgroundColor = .darkGray
maxHeightWidget.titleColor = .black
maxHeightWidget.backgroundColor = UIColor.darkGrayColor;
maxHeightWidget.titleColor = UIColor.blackColor;
The widget provides hooks for the users to add functionality based on the state changes in the widget. The max altitude list item widget provides the following hooks:
-
MaxAltitudeListItemModelState
- Provides hooks for events received by the widget from the widget model. It inherits from ListItemEditTextModelState and adds the following hooks:
-
+ (instancetype)setMaxAltitudeSucceeded;
- Event when setting the max altitude value is successful. -
+ (instancetype)setMaxAltitudeFailed:(NSInteger)maxAltitude;
- Event when setting the max altitude value fails. -
+ (instancetype)maxAltitudeChanged:(NSInteger)maxAltitude;
- Event when the max altitude level state is updated.
-
MaxAltitudeListItemUIState
- Provides hooks for events received by the widget from user interactions. It inherits from ListItemEditTextUIState and adds no aditional hooks.
DJI UX SDK Version 5 Beta 4.1