11package com.smarttoolfactory.cropper.model
22
3- import androidx.compose.runtime.Immutable
4-
53/* *
64 * Interface for containing multiple [CropOutline]s, currently selected item and index
75 * for displaying on settings UI
@@ -11,67 +9,62 @@ interface CropOutlineContainer<O : CropOutline> {
119 val outlines: List <O >
1210 val selectedItem: O
1311 get() = outlines[selectedIndex]
12+ val size: Int
13+ get() = outlines.size
1414}
1515
1616/* *
1717 * Container for [RectCropShape]
1818 */
19- @Immutable
20- class RectOutlineContainer (
19+ data class RectOutlineContainer (
2120 override var selectedIndex : Int = 0 ,
2221 override val outlines : List <RectCropShape >
2322) : CropOutlineContainer<RectCropShape>
2423
2524/* *
2625 * Container for [RoundedCornerCropShape]s
2726 */
28- @Immutable
29- class RoundedRectOutlineContainer (
27+ data class RoundedRectOutlineContainer (
3028 override var selectedIndex : Int = 0 ,
3129 override val outlines : List <RoundedCornerCropShape >
3230) : CropOutlineContainer<RoundedCornerCropShape>
3331
3432/* *
3533 * Container for [CutCornerCropShape]s
3634 */
37- @Immutable
38- class CutCornerRectOutlineContainer (
35+ data class CutCornerRectOutlineContainer (
3936 override var selectedIndex : Int = 0 ,
4037 override val outlines : List <CutCornerCropShape >
4138) : CropOutlineContainer<CutCornerCropShape>
4239
4340/* *
4441 * Container for [OvalCropShape]s
4542 */
46- @Immutable
47- class OvalOutlineContainer (
43+ data class OvalOutlineContainer (
4844 override var selectedIndex : Int = 0 ,
4945 override val outlines : List <OvalCropShape >
5046) : CropOutlineContainer<OvalCropShape>
5147
5248/* *
5349 * Container for [PolygonCropShape]s
5450 */
55- @Immutable
56- class PolygonOutlineContainer (
51+ data class PolygonOutlineContainer (
5752 override var selectedIndex : Int = 0 ,
5853 override val outlines : List <PolygonCropShape >
5954) : CropOutlineContainer<PolygonCropShape>
6055
6156/* *
6257 * Container for [CustomPathOutline]s
6358 */
64- @Immutable
65- class CustomOutlineContainer (
59+ data class CustomOutlineContainer (
6660 override var selectedIndex : Int = 0 ,
6761 override val outlines : List <CustomPathOutline >
6862) : CropOutlineContainer<CustomPathOutline>
6963
7064/* *
7165 * Container for [ImageMaskOutline]s
7266 */
73- @Immutable
74- class ImageMaskOutlineContainer (
67+ data class ImageMaskOutlineContainer (
7568 override var selectedIndex : Int = 0 ,
7669 override val outlines : List <ImageMaskOutline >
7770) : CropOutlineContainer<ImageMaskOutline>
0 commit comments