Paragraph text can now explicitly be spanned (#58)

Paragraph text can now explicitly be spanned
This commit is contained in:
Cyrus Bakhtiari-Haftlang 2018-08-14 10:07:50 +02:00 committed by Dimitry
parent 6a9f85146b
commit 692ce7ac40
3 changed files with 11 additions and 1 deletions

View File

@ -56,6 +56,9 @@ public interface SpannableFactory {
boolean isHeader, boolean isHeader,
boolean isOdd); boolean isOdd);
@Nullable
Object paragraph(boolean inTightList);
@Nullable @Nullable
Object image( Object image(
@NonNull SpannableTheme theme, @NonNull SpannableTheme theme,

View File

@ -103,6 +103,12 @@ public class SpannableFactoryDef implements SpannableFactory {
return new TableRowSpan(theme, cells, isHeader, isOdd); return new TableRowSpan(theme, cells, isHeader, isOdd);
} }
@Nullable
@Override
public Object paragraph(boolean inTightList) {
return null;
}
@Nullable @Nullable
@Override @Override
public Object image(@NonNull SpannableTheme theme, @NonNull String destination, @NonNull AsyncDrawable.Loader loader, @NonNull ImageSizeResolver imageSizeResolver, @Nullable ImageSize imageSize, boolean replacementTextIsLink) { public Object image(@NonNull SpannableTheme theme, @NonNull String destination, @NonNull AsyncDrawable.Loader loader, @NonNull ImageSizeResolver imageSizeResolver, @Nullable ImageSize imageSize, boolean replacementTextIsLink) {

View File

@ -380,14 +380,15 @@ public class SpannableMarkdownVisitor extends AbstractVisitor {
@Override @Override
public void visit(Paragraph paragraph) { public void visit(Paragraph paragraph) {
final boolean inTightList = isInTightList(paragraph); final boolean inTightList = isInTightList(paragraph);
if (!inTightList) { if (!inTightList) {
newLine(); newLine();
} }
final int length = builder.length();
visitChildren(paragraph); visitChildren(paragraph);
setSpan(length, factory.paragraph(inTightList));
if (!inTightList) { if (!inTightList) {
newLine(); newLine();