diff --git a/app/src/main/java/com/skydoves/balloondemo/factory/CustomListBalloonFactory.kt b/app/src/main/java/com/skydoves/balloondemo/factory/CustomListBalloonFactory.kt index 9b9b59f9..e39ef0d3 100644 --- a/app/src/main/java/com/skydoves/balloondemo/factory/CustomListBalloonFactory.kt +++ b/app/src/main/java/com/skydoves/balloondemo/factory/CustomListBalloonFactory.kt @@ -26,7 +26,7 @@ import com.skydoves.balloondemo.R class CustomListBalloonFactory : Balloon.Factory() { - override fun create(context: Context, lifecycleOwner: LifecycleOwner): Balloon { + override fun create(context: Context, lifecycle: LifecycleOwner): Balloon { return Balloon.Builder(context) .setLayout(R.layout.layout_custom_list) .setArrowSize(10) @@ -37,7 +37,7 @@ class CustomListBalloonFactory : Balloon.Factory() { .setCornerRadius(4f) .setBackgroundColor(ContextCompat.getColor(context, R.color.background800)) .setBalloonAnimation(BalloonAnimation.FADE) - .setLifecycleOwner(lifecycleOwner) + .setLifecycleOwner(lifecycle) .build() } } diff --git a/app/src/main/java/com/skydoves/balloondemo/factory/ProfileBalloonFactory.kt b/app/src/main/java/com/skydoves/balloondemo/factory/ProfileBalloonFactory.kt index 2dcf2526..d09dc281 100644 --- a/app/src/main/java/com/skydoves/balloondemo/factory/ProfileBalloonFactory.kt +++ b/app/src/main/java/com/skydoves/balloondemo/factory/ProfileBalloonFactory.kt @@ -22,22 +22,23 @@ import androidx.lifecycle.LifecycleOwner import com.skydoves.balloon.ArrowOrientation import com.skydoves.balloon.Balloon import com.skydoves.balloon.BalloonAnimation +import com.skydoves.balloon.createBalloon import com.skydoves.balloondemo.R class ProfileBalloonFactory : Balloon.Factory() { - override fun create(context: Context, lifecycleOwner: LifecycleOwner): Balloon { - return Balloon.Builder(context) - .setLayout(R.layout.layout_custom_profile) - .setArrowSize(10) - .setArrowOrientation(ArrowOrientation.TOP) - .setArrowPosition(0.5f) - .setWidthRatio(0.55f) - .setHeight(250) - .setCornerRadius(4f) - .setBackgroundColor(ContextCompat.getColor(context, R.color.background900)) - .setBalloonAnimation(BalloonAnimation.CIRCULAR) - .setLifecycleOwner(lifecycleOwner) - .build() + override fun create(context: Context, lifecycle: LifecycleOwner): Balloon { + return createBalloon(context) { + setLayout(R.layout.layout_custom_profile) + setArrowSize(10) + setArrowOrientation(ArrowOrientation.TOP) + setArrowPosition(0.5f) + setWidthRatio(0.55f) + setHeight(250) + setCornerRadius(4f) + setBackgroundColor(ContextCompat.getColor(context, R.color.background900)) + setBalloonAnimation(BalloonAnimation.CIRCULAR) + setLifecycleOwner(lifecycle) + } } } diff --git a/app/src/main/java/com/skydoves/balloondemo/factory/TagBalloonFactory.kt b/app/src/main/java/com/skydoves/balloondemo/factory/TagBalloonFactory.kt index ab30b1da..4d39d822 100644 --- a/app/src/main/java/com/skydoves/balloondemo/factory/TagBalloonFactory.kt +++ b/app/src/main/java/com/skydoves/balloondemo/factory/TagBalloonFactory.kt @@ -22,22 +22,23 @@ import androidx.lifecycle.LifecycleOwner import com.skydoves.balloon.ArrowOrientation import com.skydoves.balloon.Balloon import com.skydoves.balloon.BalloonAnimation +import com.skydoves.balloon.createBalloon import com.skydoves.balloondemo.R class TagBalloonFactory : Balloon.Factory() { - override fun create(context: Context, lifecycleOwner: LifecycleOwner): Balloon { - return Balloon.Builder(context) - .setLayout(R.layout.layout_custom_tag) - .setArrowSize(10) - .setArrowOrientation(ArrowOrientation.BOTTOM) - .setArrowPosition(0.5f) - .setWidth(90) - .setHeight(60) - .setCornerRadius(4f) - .setBackgroundColor(ContextCompat.getColor(context, R.color.white)) - .setBalloonAnimation(BalloonAnimation.ELASTIC) - .setLifecycleOwner(lifecycleOwner) - .build() + override fun create(context: Context, lifecycle: LifecycleOwner): Balloon { + return createBalloon(context) { + setLayout(R.layout.layout_custom_tag) + setArrowSize(10) + setArrowOrientation(ArrowOrientation.BOTTOM) + setArrowPosition(0.5f) + setWidth(90) + setHeight(60) + setCornerRadius(4f) + setBackgroundColor(ContextCompat.getColor(context, R.color.white)) + setBalloonAnimation(BalloonAnimation.ELASTIC) + setLifecycleOwner(lifecycle) + } } } diff --git a/balloon/src/main/java/com/skydoves/balloon/Balloon.kt b/balloon/src/main/java/com/skydoves/balloon/Balloon.kt index 684aec02..1a1084c8 100644 --- a/balloon/src/main/java/com/skydoves/balloon/Balloon.kt +++ b/balloon/src/main/java/com/skydoves/balloon/Balloon.kt @@ -485,6 +485,6 @@ class Balloon( abstract class Factory { /** returns an instance of [Balloon]. */ - abstract fun create(context: Context, lifecycleOwner: LifecycleOwner): Balloon + abstract fun create(context: Context, lifecycle: LifecycleOwner): Balloon } } diff --git a/dependencies.gradle b/dependencies.gradle index c330953a..f692243b 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,8 +1,8 @@ ext.versions = [ minSdk : 16, compileSdk : 29, - versionCode : 3, - versionName : '1.0.2', + versionCode : 4, + versionName : '1.0.3', gradleBuildTool : '3.4.2', spotlessGradle : '3.23.1',