/** * Factory method to create a {@link Builder} instance and initialize it with values * from supplied {@link SpannableTheme} * * @param copyFrom {@link SpannableTheme} to copy values from * @return {@link Builder} instance * @see #builderWithDefaults(Context) * @since 1.0.0 */ @NonNull public static Builder builder(@NonNull SpannableTheme copyFrom) { return new Builder(copyFrom); }
/** * Factory method to obtain an instance of {@link Builder}. Please note, that no default * values are set. This might be useful if you require a lot of special styling that differs * a lot with default one * * @return {@link Builder instance} * @see #builderWithDefaults(Context) * @see #builder(SpannableTheme) * @since 1.0.0 */ @NonNull public static Builder builder() { return new Builder(); }
/** * Factory method to obtain a {@link Builder} instance initialized with default values taken * from current application theme. * * @param context Context to obtain default styling values (colors, etc) * @return {@link Builder} instance * @since 1.0.0 */ @NonNull public static Builder builderWithDefaults(@NonNull Context context) { // by default we will be using link color for the checkbox color // & window background as a checkMark color final int linkColor = resolve(context, android.R.attr.textColorLink); final int backgroundColor = resolve(context, android.R.attr.colorBackground); // before 1.0.5 build had `linkColor` set, but in order for spans to use default link color // set directly in widget (or any caller), we should not pass it here final Dip dip = new Dip(context); return new Builder() .codeMultilineMargin(dip.toPx(8)) .blockMargin(dip.toPx(24)) .blockQuoteWidth(dip.toPx(4)) .bulletListItemStrokeWidth(dip.toPx(1)) .headingBreakHeight(dip.toPx(1)) .thematicBreakHeight(dip.toPx(4)) .tableCellPadding(dip.toPx(4)) .tableBorderWidth(dip.toPx(1)) .taskListDrawable(new TaskListDrawable(linkColor, linkColor, backgroundColor)); }