-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use AlignmentApproach with HiddenHtmlSpan
- Loading branch information
Showing
3 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 18 additions & 3 deletions
21
aztec/src/main/kotlin/org/wordpress/aztec/spans/HiddenHtmlSpan.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
package org.wordpress.aztec.spans | ||
|
||
import android.text.Layout | ||
import org.wordpress.aztec.AlignmentApproach | ||
import org.wordpress.aztec.AztecAttributes | ||
|
||
class HiddenHtmlSpan(tag: String, | ||
override var attributes: AztecAttributes = AztecAttributes(), | ||
override var nestingLevel: Int) : IAztecAlignmentSpan, IAztecParagraphStyle { | ||
fun createHiddenHtmlSpan(tag: String, | ||
attributes: AztecAttributes = AztecAttributes(), | ||
nestingLevel: Int, | ||
alignmentApproach: AlignmentApproach | ||
) = when (alignmentApproach) { | ||
AlignmentApproach.SPAN_LEVEL -> HiddenHtmlSpanAligned(tag, attributes, nestingLevel) | ||
AlignmentApproach.VIEW_LEVEL -> HiddenHtmlSpan(tag, attributes, nestingLevel) | ||
} | ||
|
||
class HiddenHtmlSpanAligned(tag: String, | ||
attributes: AztecAttributes, | ||
nestingLevel: Int | ||
) : HiddenHtmlSpan(tag, attributes, nestingLevel), IAztecAlignmentSpan { | ||
override var align: Layout.Alignment? = null | ||
} | ||
|
||
open class HiddenHtmlSpan(tag: String, | ||
override var attributes: AztecAttributes, | ||
override var nestingLevel: Int) : IAztecParagraphStyle { | ||
override val TAG: String = tag | ||
} |