BlazeDeepCopy - Android
blazeDeepCopy
The blazeDeepCopy function is designed to create a deep copy of any Blaze customization object. This method returns a new instance of the object that is a deep copy of the original. It's particularly useful when you need to modify a nested class within a base customization class while keeping the original base class unchanged.
For instance, if you have a base customization class that you want to use with some minor tweaks, you can utilize the blazeDeepCopy method to create a duplicate of the base class. You can then make the necessary modifications to the nested class properties on the duplicate without affecting the original base class.
This approach ensures that the original configuration remains intact while allowing you to experiment with different settings or configurations on the copied instance. It's a convenient and safe way to handle modifications without the risk of unintentional changes to the base class.
Throws CloneFailureException If there's an issue during the process.
Example
// Original base customization class
val originalStyle = BlazeWidgetLayout.Presets.MomentsWidget.Row.verticalRectangles
// Create a deep copy of the original style
val modifiedStyle1 = originalStyle.blazeDeepCopy().apply {
widgetItemStyle.titleStyle.blazeDeepCopy().apply {
// Modify properties as needed
isVisible = true
}
// Any further customizations...
}
// Create a deep copy of the original style
val modifiedStyle2 = originalStyle.blazeDeepCopy().apply {
maxDisplayItemsCount = 4
// Any further customizations...
}
// Use the modified style as needed, originalStyle remains unchangedUpdated 16 days ago
