From 58b328d6d0ee1dca53941743d85dcb03c777a1c1 Mon Sep 17 00:00:00 2001 From: skydoves Date: Thu, 8 Aug 2019 20:32:02 +0900 Subject: [PATCH] removes lazy delegate extsionsion via argument --- .../java/com/skydoves/balloondemo/MainActivity.kt | 5 ++--- .../java/com/skydoves/balloon/BalloonExtension.kt | 12 ------------ 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/skydoves/balloondemo/MainActivity.kt b/app/src/main/java/com/skydoves/balloondemo/MainActivity.kt index ecfa7f52..efb127b9 100644 --- a/app/src/main/java/com/skydoves/balloondemo/MainActivity.kt +++ b/app/src/main/java/com/skydoves/balloondemo/MainActivity.kt @@ -22,7 +22,6 @@ import androidx.appcompat.app.AppCompatActivity import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.skydoves.balloon.OnBalloonClickListener -import com.skydoves.balloon.balloon import com.skydoves.balloon.showAlignTop import com.skydoves.balloondemo.recycler.ItemUtils import com.skydoves.balloondemo.recycler.SampleAdapter @@ -33,8 +32,8 @@ import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity(), SampleViewHolder.Delegate, OnBalloonClickListener { private val adapter by lazy { SampleAdapter(this) } - private val profileBalloon by balloon(BalloonUtils.getProfileBalloon(this, this)) - private val navigationBalloon by balloon(BalloonUtils.getNavigationBalloon(this, this, this)) + private val profileBalloon by lazy { BalloonUtils.getProfileBalloon(this, this) } + private val navigationBalloon by lazy { BalloonUtils.getNavigationBalloon(this, this, this) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/balloon/src/main/java/com/skydoves/balloon/BalloonExtension.kt b/balloon/src/main/java/com/skydoves/balloon/BalloonExtension.kt index 4f6311b0..2e1eaba3 100644 --- a/balloon/src/main/java/com/skydoves/balloon/BalloonExtension.kt +++ b/balloon/src/main/java/com/skydoves/balloon/BalloonExtension.kt @@ -103,22 +103,10 @@ inline fun ComponentActivity.balloon( return lazy { balloonProducer() } } -/** returns a [Lazy] delegate to access the [ComponentActivity]'s Balloon. */ -@MainThread -fun ComponentActivity.balloon(balloon: Balloon): Lazy { - return lazy { balloon } -} - /** returns a [Lazy] delegate to access the [Fragment]'s Balloon. */ @MainThread inline fun Fragment.balloon( crossinline balloonProducer: (() -> Balloon) ): Lazy { return lazy { balloonProducer() } -} - -/** returns a [Lazy] delegate to access the [Fragment]'s Balloon. */ -@MainThread -fun Fragment.balloon(balloon: Balloon): Lazy { - return lazy { balloon } } \ No newline at end of file