Add version information to the new code

This commit is contained in:
Dimitry Ivanov 2018-05-22 11:02:57 +03:00
parent 78ddacbe1a
commit 0da475d3ca

View File

@ -306,15 +306,18 @@ public class SpannableTheme {
return width; return width;
} }
/**
* Modified in 1.0.5 to accept `multiline` argument
*/
public void applyCodeTextStyle(@NonNull Paint paint, boolean multiline) { public void applyCodeTextStyle(@NonNull Paint paint, boolean multiline) {
if (multiline && codeBlockTextColor != 0) { // @since 1.0.5 added handling of multiline code blocks
if (multiline
&& codeBlockTextColor != 0) {
paint.setColor(codeBlockTextColor); paint.setColor(codeBlockTextColor);
} else { } else if (codeTextColor != 0) {
if (codeTextColor != 0) {
paint.setColor(codeTextColor); paint.setColor(codeTextColor);
} }
}
// custom typeface was set // custom typeface was set
if (codeTypeface != null) { if (codeTypeface != null) {
@ -344,15 +347,23 @@ public class SpannableTheme {
return codeMultilineMargin; return codeMultilineMargin;
} }
/**
* Modified in 1.0.5 to accept `multiline` argument
*/
public int getCodeBackgroundColor(@NonNull Paint paint, boolean multiline) { public int getCodeBackgroundColor(@NonNull Paint paint, boolean multiline) {
final int color; final int color;
if (multiline && codeBlockBackgroundColor != 0) {
// @since 1.0.5 added handling of multiline code blocks
if (multiline
&& codeBlockBackgroundColor != 0) {
color = codeBlockBackgroundColor; color = codeBlockBackgroundColor;
} else if (codeBackgroundColor != 0) { } else if (codeBackgroundColor != 0) {
color = codeBackgroundColor; color = codeBackgroundColor;
} else { } else {
color = ColorUtils.applyAlpha(paint.getColor(), CODE_DEF_BACKGROUND_COLOR_ALPHA); color = ColorUtils.applyAlpha(paint.getColor(), CODE_DEF_BACKGROUND_COLOR_ALPHA);
} }
return color; return color;
} }
@ -461,6 +472,7 @@ public class SpannableTheme {
return taskListDrawable; return taskListDrawable;
} }
@SuppressWarnings("unused")
public static class Builder { public static class Builder {
private int linkColor; private int linkColor;
@ -471,9 +483,9 @@ public class SpannableTheme {
private int bulletListItemStrokeWidth; private int bulletListItemStrokeWidth;
private int bulletWidth; private int bulletWidth;
private int codeTextColor; private int codeTextColor;
private int codeBlockTextColor; private int codeBlockTextColor; // @since 1.0.5
private int codeBackgroundColor; private int codeBackgroundColor;
private int codeBlockBackgroundColor; private int codeBlockBackgroundColor; // @since 1.0.5
private int codeMultilineMargin; private int codeMultilineMargin;
private Typeface codeTypeface; private Typeface codeTypeface;
private int codeTextSize; private int codeTextSize;
@ -536,6 +548,7 @@ public class SpannableTheme {
return this; return this;
} }
@SuppressWarnings("SameParameterValue")
@NonNull @NonNull
public Builder blockQuoteColor(@ColorInt int blockQuoteColor) { public Builder blockQuoteColor(@ColorInt int blockQuoteColor) {
this.blockQuoteColor = blockQuoteColor; this.blockQuoteColor = blockQuoteColor;
@ -566,18 +579,25 @@ public class SpannableTheme {
return this; return this;
} }
/**
* @since 1.0.5
*/
@NonNull @NonNull
public Builder codeBlockTextColor(@ColorInt int codeBlockTextColor) { public Builder codeBlockTextColor(@ColorInt int codeBlockTextColor) {
this.codeBlockTextColor = codeBlockTextColor; this.codeBlockTextColor = codeBlockTextColor;
return this; return this;
} }
@SuppressWarnings("SameParameterValue")
@NonNull @NonNull
public Builder codeBackgroundColor(@ColorInt int codeBackgroundColor) { public Builder codeBackgroundColor(@ColorInt int codeBackgroundColor) {
this.codeBackgroundColor = codeBackgroundColor; this.codeBackgroundColor = codeBackgroundColor;
return this; return this;
} }
/**
* @since 1.0.5
*/
@NonNull @NonNull
public Builder codeBlockBackgroundColor(@ColorInt int codeBlockBackgroundColor) { public Builder codeBlockBackgroundColor(@ColorInt int codeBlockBackgroundColor) {
this.codeBlockBackgroundColor = codeBlockBackgroundColor; this.codeBlockBackgroundColor = codeBlockBackgroundColor;