-
Notifications
You must be signed in to change notification settings - Fork 15
eMMC Status List Item Widget
The eMMC Status List Item Widget is a DUXBetaListItemLabelAndButton type of widget which will display the remaining capacity of the internal storage (an SD Card) and SDCardOperationState. By default, this widget only shows in the System Status List when connected to aircraft with internal storage capability or if no aircraft is connected.
Following are examples of the widget states:
Disconnected
Current eMMC State: Normal
Current eMMC State: Formatting
Current eMMC State: Not Supported
It also provides an option to format the internal storage media. Tapping on the format button will show the format confirmation dialogs.
Format confirmation dialog
Format success dialog
Format error dialog
To add the EMCC status list item widget to your DUXBetaSmartListModel
class, override buildModelLists
and include DUXBetaEMMCStatusListItemWidget.duxbeta_className()
or [DUXBetaEMMCStatusListItemWidget duxbeta_className]
in your modelClassnameList:
@objc open class MySmartListModel : DUXBetaSmartListModel {
@objc open override func buildModelLists() {
super.buildModelLists()
self.modelClassnameList.append(DUXBetaEMMCStatusListItemWidget.duxbeta_className())
}
}
@interface DUXBetaTestSmartListModel : DUXBetaSmartListModel
@end
@implementation DUXBetaTestSmartListModel
- (void)buildModelLists {
[super buildModelLists];
[self.modelClassnameList append:[DUXBetaEMMCStatusListItemWidget 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 eMMC status list item widget with a different background and button color could look something like this:
To get this effect we would use the following code:
emmcWidget.setButtonColor(.red, for: .normal)
emmcWidget.backgroundColor = .darkGray
emmcWidget.titleColor = .black
[emmcWidget setButtonColor:UIColor.redColor forUIControlState:UIControlStateNormal];
emmcWidget.backgroundColor = UIColor.darkGrayColor;
emmcWidget.titleColor = UIColor.blackColor;
To customize the appearance of the dialogs presented when formatting the internal storage, there are 3 different appearances of type DUXBetaAlertViewAppearance, one per dialog which can be customized.
List of the dialog properties for customization
-
emmcConfirmFormatAlertAppearance
- The customization object for the format confirmation dialog. -
emmcFormattingSuccessAlertAppearance
- The customization object for successful formatting completion dialog. -
emmcFormattingErrorAlertAppearance
- 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:
emmcWidget.emmcConfirmFormatAlertAppearance.backgroundColor = .duxbeta_grayColor
emmcWidget.emmcConfirmFormatAlertAppearance.backgroundColor = [UIColor duxbeta_grayColor];
The widget provides hooks for the users to add functionality based on the state changes in the widget.
The EMCC Status List Item widget provides the following hooks:
-
EMMCStatusListWidgetModelState
- Provides hooks in events received by the widget from the widget model. It inherits from ListItemLabelButtonModelState and it adds the following hooks:
-
+ (instancetype)emmcStatusCapacityChanged:(NSInteger)freeStorageChanged;
- Event when the internal storage remaining capacity changes. -
+ (instancetype)emmcStateUpdated:(NSNumber *)operationState;
- Event when the SDCardOperationState is updated.
-
EMCCStatusListWidgetUIState
- 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