-
Notifications
You must be signed in to change notification settings - Fork 15
SD Card Remaining Capacity List Item Widget
SD Card Status List Item Widget is a DUXListItemLabelAndButton type of widget which will display the remaining capacity of the SD card and SDCardOperationState.
Following are examples of the widget states:
Disconnected
CurrentSDCardState: Normal
CurrentSDCardState: Full
CurrentSDCardState: Not Inserted
It also provides an option to format the SD card. Tapping on the format button will show the format confirmation dialogs.
Format confirmation dialog
Format success dialog
/Images/SDCardStatusListItemWidget/SDCardFormatAreUSure.png
Format error dialog
To add the SD card remaining capacity list item widget to your DUXSmartListModel
class, override buildModelLists
and include DUXSDCardRemainingCapacityListItemWidget.dux_className()
or [DUXSDCardRemainingCapacityListItemWidget dux_className]
in your modelClassnameList:
@objc open class MySmartListModel : DUXSmartListModel {
@objc open override func buildModelLists() {
super.buildModelLists()
self.modelClassnameList.append(DUXSDCardRemainingCapacityListItemWidget.dux_className())
}
}
@interface DUXTestSmartListModel : DUXSmartListModel
@end
@implementation DUXTestSmartListModel
- (void)buildModelLists {
[super buildModelLists];
[self.modelClassnameList append:[DUXSDCardRemainingCapacityListItemWidget dux_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, DUXListItemLabelAndButton supports. An example of a customized SD card remaining capacity list item widget in various states could look something like this:
To get this effect we would use the following code:
sdCardWidget.setButtonColor(.red, for: .normal)
sdCardWidget.backgroundColor = .darkGray
sdCardWidget.titleColor = .black
[sdCardWidget setButtonColor:UIColor.redColor forUIControlState:UIControlStateNormal];
sdCardWidget.backgroundColor = UIColor.darkGrayColor;
sdCardWidget.titleColor = UIColor.blackColor;
The widget provides hooks for the users to add functionality based on the state changes in the widget.
The SD Card Remaining Capacity List Item widget provides the following hooks:
-
SDCardRemainingCapacityListWidgetModelState
- Provides hooks in events received by the widget from the widget model. It inherits from ListItemLabelButtonModelState and it adds the following hooks:
-
+ (instancetype)sdCardRemainingCapacityChanged:(NSInteger)freeStorageChanged;
- Event when the SD card's remaining capacity changes. -
+ (instancetype)sdCardRemainingCapacityCardInserted:(BOOL)cardInserted;
- Sends a boolean value as an NSInteger when an SD card is inserted or removed. YES indicates insertion, NO indicates removal. -
+ (instancetype)sdCardRemainingCapacityOperatingStatusChanged:(NSNumber *)operationState;
- Event when the SDCardOperationState is updated.
-
SDCardRemainingCapacityListWidgetUIState
- 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