Skip to content

Commit

Permalink
Refactor builder extensions using inline keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Jan 23, 2021
1 parent aa981df commit 7fb9760
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion needs/src/main/java/com/skydoves/needs/NeedsItemTheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal annotation class NeedsItemThemeDsl
/** creates an instance of [NeedsItemTheme] by [NeedsItemTheme.Builder] using kotlin dsl. */
@JvmSynthetic
@NeedsItemThemeDsl
fun needsItemTheme(context: Context, block: NeedsItemTheme.Builder.() -> Unit): NeedsItemTheme =
inline fun needsItemTheme(context: Context, block: NeedsItemTheme.Builder.() -> Unit): NeedsItemTheme =
NeedsItemTheme.Builder(context).apply(block).build()

/** NeedsItemTheme is an attribute class for changing item theme easily. */
Expand Down
2 changes: 1 addition & 1 deletion needs/src/main/java/com/skydoves/needs/NeedsTheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal annotation class NeedsThemeDsl
/** creates an instance of [NeedsTheme] by [NeedsTheme.Builder] using kotlin dsl. */
@JvmSynthetic
@NeedsThemeDsl
fun needsTheme(context: Context, block: NeedsTheme.Builder.() -> Unit): NeedsTheme =
inline fun needsTheme(context: Context, block: NeedsTheme.Builder.() -> Unit): NeedsTheme =
NeedsTheme.Builder(context).apply(block).build()

/** NeedsTheme is an attribute class for changing [Needs] popup theme easily. */
Expand Down
4 changes: 3 additions & 1 deletion needs/src/main/java/com/skydoves/needs/TextForm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal annotation class TextFormDsl
/** creates an instance of [TextForm] from [TextForm.Builder] using kotlin dsl. */
@TextFormDsl
@JvmSynthetic
fun textForm(block: TextForm.Builder.() -> Unit): TextForm =
inline fun textForm(block: TextForm.Builder.() -> Unit): TextForm =
TextForm.Builder().apply(block).build()

/**
Expand All @@ -41,6 +41,8 @@ class TextForm(builder: Builder) {

@Sp
val textSize = builder.textSize

@ColorInt
val textColor = builder.textColor
val textStyle = builder.textStyle

Expand Down

0 comments on commit 7fb9760

Please sign in to comment.