diff --git a/KtExt/build.gradle b/KtExt/build.gradle index 99c5e5c..75e1ccf 100644 --- a/KtExt/build.gradle +++ b/KtExt/build.gradle @@ -35,7 +35,5 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.0" - implementation "androidx.appcompat:appcompat:1.3.0" - implementation 'com.google.android.material:material:1.3.0' - implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-alpha02" + implementation "androidx.appcompat:appcompat:1.3.1" } \ No newline at end of file diff --git a/KtExt/src/main/java/com/thuanpx/ktext/context/ActivityExt.kt b/KtExt/src/main/java/com/thuanpx/ktext/context/ActivityExt.kt index 2a2d0db..0c917c4 100644 --- a/KtExt/src/main/java/com/thuanpx/ktext/context/ActivityExt.kt +++ b/KtExt/src/main/java/com/thuanpx/ktext/context/ActivityExt.kt @@ -17,37 +17,15 @@ import androidx.annotation.NonNull import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.LifecycleOwner -import androidx.lifecycle.lifecycleScope -import androidx.lifecycle.repeatOnLifecycle import com.thuanpx.ktext.AnimationType import com.thuanpx.ktext.Constant import com.thuanpx.ktext.SLIDE_TO_LEFT -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.launch import kotlin.reflect.KClass /** * Created by ThuanPx on 3/15/20. */ -/** - * Launches a new coroutine and repeats `block` every time the Activity's viewLifecycleOwner - * is in and out of `minActiveState` lifecycle state. - * Source: https://medium.com/androiddevelopers/repeatonlifecycle-api-design-story-8670d1a7d333 - */ -inline fun FragmentActivity.launchAndRepeatWithViewLifecycle( - minActiveState: Lifecycle.State = Lifecycle.State.STARTED, - crossinline block: suspend CoroutineScope.() -> Unit -) { - this.lifecycleScope.launch { - this@launchAndRepeatWithViewLifecycle.lifecycle.repeatOnLifecycle(minActiveState) { - block() - } - } -} fun FragmentActivity.goTo( cls: KClass, diff --git a/KtExt/src/main/java/com/thuanpx/ktext/context/FragmentExt.kt b/KtExt/src/main/java/com/thuanpx/ktext/context/FragmentExt.kt index a198e29..a4e1633 100644 --- a/KtExt/src/main/java/com/thuanpx/ktext/context/FragmentExt.kt +++ b/KtExt/src/main/java/com/thuanpx/ktext/context/FragmentExt.kt @@ -8,32 +8,12 @@ import androidx.annotation.IdRes import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentTransaction -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.lifecycleScope -import androidx.lifecycle.repeatOnLifecycle import com.thuanpx.ktext.* -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch /** * Created by ThuanPx on 3/15/20. */ -/** - * Launches a new coroutine and repeats `block` every time the Fragment's viewLifecycleOwner - * is in and out of `minActiveState` lifecycle state.* - * Source: https://medium.com/androiddevelopers/repeatonlifecycle-api-design-story-8670d1a7d333 - */ -inline fun Fragment.launchAndRepeatWithViewLifecycle( - minActiveState: Lifecycle.State = Lifecycle.State.STARTED, - crossinline block: suspend CoroutineScope.() -> Unit -) { - viewLifecycleOwner.lifecycleScope.launch { - viewLifecycleOwner.lifecycle.repeatOnLifecycle(minActiveState) { - block() - } - } -} fun Fragment.replaceFragment( @IdRes containerId: Int, diff --git a/app/build.gradle b/app/build.gradle index 937f6c9..2c227e1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,6 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.0" - implementation "androidx.appcompat:appcompat:1.3.0" - implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-alpha02" + implementation "androidx.appcompat:appcompat:1.3.1" implementation project(':KtExt') } \ No newline at end of file