Skip to content

Commit

Permalink
Add a new dimens and style parameter to change heading vertical space
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme committed Nov 12, 2019
1 parent 9aabad7 commit a24a227
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
var widthMeasureSpec: Int = 0

var verticalParagraphMargin: Int = 0
var verticalHeadingMargin: Int = 0

var maxImagesWidth: Int = 0
var minImagesWidth: Int = 0
Expand Down Expand Up @@ -388,6 +389,7 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
commentsVisible = styles.getBoolean(R.styleable.AztecText_commentsVisible, commentsVisible)

verticalParagraphMargin = styles.getDimensionPixelSize(R.styleable.AztecText_blockVerticalPadding, 0)
verticalHeadingMargin = styles.getDimensionPixelSize(R.styleable.AztecText_headingVerticalPadding, 0)

inlineFormatter = InlineFormatter(this,
InlineFormatter.CodeStyle(
Expand All @@ -410,8 +412,7 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
styles.getDimensionPixelSize(R.styleable.AztecText_quotePadding, 0),
styles.getDimensionPixelSize(R.styleable.AztecText_quoteWidth, 0),
verticalParagraphMargin),
BlockFormatter.HeaderStyle(
verticalParagraphMargin),
BlockFormatter.HeaderStyle(verticalHeadingMargin),
BlockFormatter.PreformatStyle(
styles.getColor(R.styleable.AztecText_preformatBackground, 0),
styles.getFraction(R.styleable.AztecText_preformatBackgroundAlpha, 1, 1, 0f),
Expand Down
1 change: 1 addition & 0 deletions aztec/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<declare-styleable name="AztecText">
<attr name="backgroundColor" format="reference|color" />
<attr name="blockVerticalPadding" format="reference|dimension" />
<attr name="headingVerticalPadding" format="reference|dimension" />
<attr name="bulletColor" format="reference|color" />
<attr name="bulletMargin" format="reference|dimension" />
<attr name="bulletPadding" format="reference|dimension" />
Expand Down
1 change: 1 addition & 0 deletions aztec/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<dimen name="quote_margin">16dp</dimen>
<dimen name="quote_width">2dp</dimen>
<dimen name="block_vertical_padding">8dp</dimen>
<dimen name="heading_vertical_padding">8dp</dimen>
<dimen name="spacing_extra">0dp</dimen>
<item type="dimen" format="string" name="spacing_multiplier">1.0</item>

Expand Down
1 change: 1 addition & 0 deletions aztec/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<item name="android:textCursorDrawable">?attr/textColor</item>
<item name="backgroundColor">@android:color/transparent</item>
<item name="blockVerticalPadding">@dimen/block_vertical_padding</item>
<item name="headingVerticalPadding">@dimen/heading_vertical_padding</item>
<item name="bulletColor">@color/blue_medium</item>
<item name="bulletMargin">@dimen/bullet_margin</item>
<item name="bulletPadding">@dimen/bullet_padding</item>
Expand Down

0 comments on commit a24a227

Please sign in to comment.