Skip to content

Commit 0e45077

Browse files
committed
Added text color support to quote.
1 parent 833eebf commit 0e45077

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecQuoteSpan.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ import androidx.core.view.ViewCompat
2828
import android.text.Editable
2929
import android.text.Layout
3030
import android.text.Spanned
31+
import android.text.TextPaint
32+
import android.text.style.CharacterStyle
33+
import android.text.style.LeadingMarginSpan
3134
import android.text.style.LineBackgroundSpan
3235
import android.text.style.LineHeightSpan
33-
import android.text.style.QuoteSpan
36+
import android.text.style.UpdateAppearance
3437
import android.text.style.UpdateLayout
3538
import androidx.collection.ArrayMap
3639
import org.wordpress.aztec.AlignmentRendering
@@ -44,7 +47,7 @@ fun createAztecQuoteSpan(
4447
nestingLevel: Int,
4548
attributes: AztecAttributes = AztecAttributes(),
4649
alignmentRendering: AlignmentRendering,
47-
quoteStyle: BlockFormatter.QuoteStyle = BlockFormatter.QuoteStyle(0, 0, 0f, 0, 0, 0, 0)
50+
quoteStyle: BlockFormatter.QuoteStyle = BlockFormatter.QuoteStyle(0, 0, 0, 0f, 0, 0, 0, 0)
4851
) = when (alignmentRendering) {
4952
AlignmentRendering.SPAN_LEVEL -> AztecQuoteSpanAligned(nestingLevel, attributes, quoteStyle, null)
5053
AlignmentRendering.VIEW_LEVEL -> AztecQuoteSpan(nestingLevel, attributes, quoteStyle)
@@ -69,11 +72,12 @@ open class AztecQuoteSpan(
6972
override var nestingLevel: Int,
7073
override var attributes: AztecAttributes,
7174
var quoteStyle: BlockFormatter.QuoteStyle
72-
) : QuoteSpan(),
75+
) : CharacterStyle(), LeadingMarginSpan,
7376
LineBackgroundSpan,
7477
IAztecBlockSpan,
7578
LineHeightSpan,
76-
UpdateLayout {
79+
UpdateLayout,
80+
UpdateAppearance {
7781

7882
override var endBeforeBleed: Int = -1
7983
override var startBeforeCollapse: Int = -1
@@ -199,4 +203,8 @@ open class AztecQuoteSpan(
199203
}
200204

201205
override val textFormat: ITextFormat = AztecTextFormat.FORMAT_QUOTE
206+
207+
override fun updateDrawState(tp: TextPaint?) {
208+
tp?.color = quoteStyle.quoteTextColor
209+
}
202210
}

0 commit comments

Comments
 (0)