-
Notifications
You must be signed in to change notification settings - Fork 15
SSD Status List Item Widget
SSD Status List Item Widget is a DUXBetaListItemLabelAndButton type of widget which will display the remaining capacity of the SSD and SSDCardOperationState when an appropriate aircraft and camera combination is available.
Following are examples of the widget states:
Disconnected
Normal
Formatting
Not Inserted
It also provides an option to format the SSD. Tapping on the format button will show the format confirmation dialog.
Format confirmation dialog
Format success dialog
Format error dialog
To add the SSD status list item widget to your DUXBetaSmartListModel
class, override buildModelLists
and include DUXBetaSSDStatusListItemWidget.duxbeta_className()
or [DUXBetaSSDStatusListItemWidget duxbeta_className]
in your modelClassnameList:
@objc open class MySmartListModel : DUXBetaSmartListModel {
@objc open override func buildModelLists() {
super.buildModelLists()
self.modelClassnameList.append(DUXBetaSSDStatusListItemWidget.duxbeta_className())
}
}
@interface DUXBetaTestSmartListModel : DUXBetaSmartListModel
@end
@implementation DUXBetaTestSmartListModel
- (void)buildModelLists {
[super buildModelLists];
[self.modelClassnameList append:[DUXBetaSSDStatusListItemWidget 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, DUXBetaListItemLabelAndButton supports. An example of a customized SSD status list item widget in various states could look something like this:
To get this effect we would use the following code:
ssdWidget.setButtonColor(.blue, for: .normal)
ssdWidget.backgroundColor = UIColor.lightGray
ssdWidget.imageTintColor = UIColor.cyanColor
[ssdWidget setButtonBorderColor:UIColor.blueColor forUIControlState:UIControlStateNormal];
ssdWidget.backgroundColor = UIColor.lightGrayColor
ssdWidget.imageTintColor = UIColor.cyanColor
To customize the appearance of the dialogs presented when formatting the SSD, there are 3 different appearances of type DUXBetaAlertViewAppearance, one per dialog which can be customized.
List of the dialog properties for customization
-
ssdConfirmFormatAlertAppearance
- The customization object for the format confirmation dialog. -
ssdFormattingSuccessAlertAppearance
- The customization object for successful formatting completion dialog. -
ssdFormattingErrorAlertAppearance
- The customization object for the dialog shown when an error happens during formatting.
See Alerts Customization Overview for all the customizable properties.
To get this effect we would use the following code:
ssdWidget.ssdConfirmFormatAlertAppearance.backgroundColor = UIColor.lightGray;
ssdWidget.ssdConfirmFormatAlertAppearance.messageColor = UIColor.yellow;
ssdWidget.ssdConfirmFormatAlertAppearance.imageTintColor = UIColor.cyan;
ssdWidget.ssdConfirmFormatAlertAppearance.backgroundColor = UIColor.lightGrayColor;
ssdWidget.ssdConfirmFormatAlertAppearance.messageColor = UIColor.yellowColor;
ssdWidget.ssdConfirmFormatAlertAppearance.imageTintColor = UIColor.cyanColor;
The widget provides hooks for the users to add functionality based on the state changes in the widget.
The SSD Status List Item widget provides the following hooks:
-
SSDStatusItemModelState
- Provides hooks in events received by the widget from the widget model. It inherits from ListItemLabelButtonModelState and it adds the following hooks:
-
+ (instancetype)ssdStatusCapacityChanged:(NSInteger)freeStorageChanged;
- Event when the SSD's remaining capacity changes. -
+ (instancetype)ssdStateUpdated:(NSNumber *)operationState;
- Event when the SSDOperationState is updated.
-
SSDStatusItemUIState
- Provides hooks in events related to user interaction with the widget. It inherits from ListItemLabelButtonUIState and adds no other hooks.
DJI UX SDK Version 5 Beta 4.1