Merge branch 'master' of github.com:noties/Markwon
This commit is contained in:
commit
c5a5086a68
@ -12,9 +12,9 @@
|
||||
|
||||
## Installation
|
||||
```groovy
|
||||
compile 'ru.noties:markwon:1.0.1'
|
||||
compile 'ru.noties:markwon-image-loader:1.0.1' // optional
|
||||
compile 'ru.noties:markwon-view:1.0.1' // optional
|
||||
compile 'ru.noties:markwon:1.0.3'
|
||||
compile 'ru.noties:markwon-image-loader:1.0.3' // optional
|
||||
compile 'ru.noties:markwon-view:1.0.3' // optional
|
||||
```
|
||||
|
||||
## Supported markdown features:
|
||||
|
@ -6,7 +6,7 @@ org.gradle.configureondemand=true
|
||||
android.enableBuildCache=true
|
||||
android.buildCacheDir=build/pre-dex-cache
|
||||
|
||||
VERSION_NAME=1.0.2
|
||||
VERSION_NAME=1.0.3
|
||||
|
||||
GROUP=ru.noties
|
||||
POM_DESCRIPTION=Markwon
|
||||
|
@ -11,6 +11,11 @@ public class OrderedListItemSpan implements LeadingMarginSpan {
|
||||
private final SpannableTheme theme;
|
||||
private final String number;
|
||||
|
||||
// we will use this variable to check if our order number text exceeds block margin,
|
||||
// so we will use it instead of block margin
|
||||
// @since 1.0.3
|
||||
private int margin;
|
||||
|
||||
public OrderedListItemSpan(
|
||||
@NonNull SpannableTheme theme,
|
||||
@NonNull String number
|
||||
@ -21,7 +26,8 @@ public class OrderedListItemSpan implements LeadingMarginSpan {
|
||||
|
||||
@Override
|
||||
public int getLeadingMargin(boolean first) {
|
||||
return theme.getBlockMargin();
|
||||
// @since 1.0.3
|
||||
return margin > 0 ? margin : theme.getBlockMargin();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -35,9 +41,17 @@ public class OrderedListItemSpan implements LeadingMarginSpan {
|
||||
|
||||
theme.applyListItemStyle(p);
|
||||
|
||||
final int width = theme.getBlockMargin();
|
||||
final int numberWidth = (int) (p.measureText(number) + .5F);
|
||||
|
||||
// @since 1.0.3
|
||||
int width = theme.getBlockMargin();
|
||||
if (numberWidth > width) {
|
||||
width = numberWidth;
|
||||
margin = numberWidth;
|
||||
} else {
|
||||
margin = 0;
|
||||
}
|
||||
|
||||
final int left;
|
||||
if (dir > 0) {
|
||||
left = x + (width * dir) - numberWidth;
|
||||
|
Loading…
x
Reference in New Issue
Block a user