Skip to content

Commit 21cd730

Browse files
committed
Add a constructor with an AnnotatedString parameter for OUDS annotated strings
1 parent 21041fe commit 21cd730

6 files changed

Lines changed: 45 additions & 16 deletions

File tree

core/src/main/java/com/orange/ouds/core/component/common/text/OudsAnnotatedAlertMessageBulletListLabel.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ class OudsAnnotatedAlertMessageBulletListLabel internal constructor(annotatedStr
7575
append(text)
7676
}
7777

78+
/**
79+
* Creates a builder initialized with an existing annotated text.
80+
*
81+
* @param text The initial annotated text to copy.
82+
*/
83+
constructor(text: AnnotatedString) : this() {
84+
append(text)
85+
}
86+
7887
override fun addStrong(start: Int, end: Int) = addStrongImpl(start, end)
7988

8089
override fun pushStrong(): Int = pushStrongImpl()

core/src/main/java/com/orange/ouds/core/component/common/text/OudsAnnotatedAlertMessageDescription.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ class OudsAnnotatedAlertMessageDescription internal constructor(annotatedString:
7272
append(text)
7373
}
7474

75+
/**
76+
* Creates a builder initialized with an existing annotated text.
77+
*
78+
* @param text The initial annotated text to copy.
79+
*/
80+
constructor(text: AnnotatedString) : this() {
81+
append(text)
82+
}
83+
7584
override fun addStrong(start: Int, end: Int) = addStrongImpl(start, end)
7685

7786
override fun pushStrong(): Int = pushStrongImpl()

core/src/main/java/com/orange/ouds/core/component/common/text/OudsAnnotatedBulletListLabel.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ class OudsAnnotatedBulletListLabel internal constructor(annotatedString: Annotat
7070
append(text)
7171
}
7272

73+
/**
74+
* Creates a builder initialized with an existing annotated text.
75+
*
76+
* @param text The initial annotated text to copy.
77+
*/
78+
constructor(text: AnnotatedString) : this() {
79+
append(text)
80+
}
81+
7382
override fun addStrong(start: Int, end: Int) = addStrongImpl(start, end)
7483

7584
override fun pushStrong(): Int = pushStrongImpl()

core/src/main/java/com/orange/ouds/core/component/common/text/OudsAnnotatedErrorMessage.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ class OudsAnnotatedErrorMessage internal constructor(annotatedString: AnnotatedS
6868
append(text)
6969
}
7070

71+
/**
72+
* Creates a builder initialized with an existing annotated text.
73+
*
74+
* @param text The initial annotated text to copy.
75+
*/
76+
constructor(text: AnnotatedString) : this() {
77+
append(text)
78+
}
79+
7180
override fun addStrong(start: Int, end: Int) = addStrongImpl(start, end)
7281

7382
override fun pushStrong(): Int = pushStrongImpl()

core/src/main/java/com/orange/ouds/core/component/common/text/OudsAnnotatedHelperText.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ class OudsAnnotatedHelperText internal constructor(annotatedString: AnnotatedStr
6666
append(text)
6767
}
6868

69+
/**
70+
* Creates a builder initialized with an existing annotated text.
71+
*
72+
* @param text The initial annotated text to copy.
73+
*/
74+
constructor(text: AnnotatedString) : this() {
75+
append(text)
76+
}
77+
6978
override fun addStrong(start: Int, end: Int) = addStrongImpl(start, end)
7079

7180
override fun pushStrong(): Int = pushStrongImpl()

core/src/main/java/com/orange/ouds/core/component/common/text/OudsAnnotatedString.kt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -262,22 +262,6 @@ open class OudsAnnotatedString<T> internal constructor(annotatedString: Annotate
262262
*/
263263
fun append(text: String): Unit = builder.append(text)
264264

265-
/**
266-
* Appends an annotated string to this builder, preserving its formatting.
267-
*
268-
* @param text The annotated string to append.
269-
*/
270-
fun append(text: T): Unit = builder.append(text._annotatedString)
271-
272-
/**
273-
* Appends a portion of an annotated string to this builder, preserving its formatting.
274-
*
275-
* @param text The annotated string to append from.
276-
* @param start The starting index (inclusive).
277-
* @param end The ending index (exclusive).
278-
*/
279-
fun append(text: T, start: Int, end: Int): Unit = builder.append(text._annotatedString, start, end)
280-
281265
/**
282266
* Constructs an [OudsAnnotatedString] based on the configurations applied to the [Builder].
283267
*

0 commit comments

Comments
 (0)