Skip to content

Commit d34ee7d

Browse files
committed
Upgrade various androidx versions.
1 parent b11e1d0 commit d34ee7d

File tree

3 files changed

+27
-30
lines changed

3 files changed

+27
-30
lines changed

buildSrc/src/main/java/Dependencies.kt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ object Dependencies {
1313
const val android_gradle_plugin = "com.android.tools.build:gradle:7.0.0"
1414

1515
object AndroidX {
16-
const val activity = "androidx.activity:activity:1.3.0"
17-
const val activityKtx = "androidx.activity:activity-ktx:1.3.0"
18-
const val appcompat = "androidx.appcompat:appcompat:1.3.1"
16+
const val activity = "androidx.activity:activity:1.4.0"
17+
const val activityKtx = "androidx.activity:activity-ktx:1.4.0"
18+
const val appcompat = "androidx.appcompat:appcompat:1.4.1"
1919

2020
object Compose {
21-
const val activity = "androidx.activity:activity-compose:1.3.1"
21+
const val activity = "androidx.activity:activity-compose:1.4.0"
2222
const val foundation = "androidx.compose.foundation:foundation:1.1.0-rc01"
2323
const val material = "androidx.compose.material:material:1.1.0-rc01"
2424
const val tooling = "androidx.compose.ui:ui-tooling:1.1.0-rc01"
2525
const val ui = "androidx.compose.ui:ui:1.1.0-rc01"
2626
}
2727

28-
const val constraint_layout = "androidx.constraintlayout:constraintlayout:2.1.0"
29-
const val fragment = "androidx.fragment:fragment:1.3.6"
30-
const val fragmentKtx = "androidx.fragment:fragment-ktx:1.3.6"
28+
const val constraint_layout = "androidx.constraintlayout:constraintlayout:2.1.2"
29+
const val fragment = "androidx.fragment:fragment:1.4.0"
30+
const val fragmentKtx = "androidx.fragment:fragment-ktx:1.4.0"
3131
const val gridlayout = "androidx.gridlayout:gridlayout:1.0.0"
3232

3333
object Lifecycle {
34-
const val ktx = "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
35-
const val viewModel = "androidx.lifecycle:lifecycle-viewmodel:2.3.1"
36-
const val viewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
34+
const val ktx = "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
35+
const val viewModel = "androidx.lifecycle:lifecycle-viewmodel:2.4.0"
36+
const val viewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
3737
const val viewModelSavedState = "androidx.lifecycle:lifecycle-viewmodel-savedstate:1.1.0"
3838
}
3939

@@ -126,17 +126,17 @@ object Dependencies {
126126
object AndroidX {
127127
const val compose = "androidx.compose.ui:ui-test-junit4:1.0.1"
128128
const val core = "androidx.test:core:1.3.0"
129-
const val lifecycle = "androidx.lifecycle:lifecycle-runtime-testing:2.3.1"
129+
const val lifecycle = "androidx.lifecycle:lifecycle-runtime-testing:2.4.0"
130130

131131
object Espresso {
132-
const val core = "androidx.test.espresso:espresso-core:3.3.0"
133-
const val idlingResource = "androidx.test.espresso:espresso-idling-resource:3.3.0"
134-
const val intents = "androidx.test.espresso:espresso-intents:3.3.0"
132+
const val core = "androidx.test.espresso:espresso-core:3.4.0"
133+
const val idlingResource = "androidx.test.espresso:espresso-idling-resource:3.4.0"
134+
const val intents = "androidx.test.espresso:espresso-intents:3.4.0"
135135
}
136136

137-
const val junitExt = "androidx.test.ext:junit:1.1.2"
138-
const val runner = "androidx.test:runner:1.3.0"
139-
const val truthExt = "androidx.test.ext:truth:1.3.0"
137+
const val junitExt = "androidx.test.ext:junit:1.1.3"
138+
const val runner = "androidx.test:runner:1.4.0"
139+
const val truthExt = "androidx.test.ext:truth:1.4.0"
140140
const val uiautomator = "androidx.test.uiautomator:uiautomator:2.2.0"
141141
}
142142

workflow-ui/container-android/src/main/java/com/squareup/workflow1/ui/modal/ModalContainer.kt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ import android.view.View
1111
import android.view.ViewGroup
1212
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
1313
import android.widget.FrameLayout
14+
import androidx.lifecycle.DefaultLifecycleObserver
1415
import androidx.lifecycle.Lifecycle
15-
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
16-
import androidx.lifecycle.LifecycleObserver
17-
import androidx.lifecycle.OnLifecycleEvent
16+
import androidx.lifecycle.LifecycleOwner
1817
import com.squareup.workflow1.ui.Compatible
1918
import com.squareup.workflow1.ui.ViewEnvironment
20-
import com.squareup.workflow1.ui.androidx.WorkflowLifecycleOwner
2119
import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
2220
import com.squareup.workflow1.ui.WorkflowViewStub
21+
import com.squareup.workflow1.ui.androidx.WorkflowLifecycleOwner
2322
import com.squareup.workflow1.ui.backstack.withBackStackStateKeyPrefix
2423
import com.squareup.workflow1.ui.compatible
2524

@@ -79,19 +78,21 @@ public abstract class ModalContainer<ModalRenderingT : Any> @JvmOverloads constr
7978

8079
dialogView.addOnAttachStateChangeListener(
8180
object : OnAttachStateChangeListener {
82-
val onDestroy = OnDestroy { ref.dismiss() }
81+
val dismissOnDestroy = object : DefaultLifecycleObserver {
82+
override fun onDestroy(owner: LifecycleOwner) = ref.dismiss()
83+
}
8384
var lifecycle: Lifecycle? = null
8485
override fun onViewAttachedToWindow(v: View) {
8586
// Note this is a different lifecycle than the WorkflowLifecycleOwner – it will
8687
// probably be the owning AppCompatActivity.
8788
lifecycle = parentLifecycleOwner?.lifecycle
8889
// Android makes a lot of logcat noise if it has to close the window for us. :/
8990
// https://github.com/square/workflow/issues/51
90-
lifecycle?.addObserver(onDestroy)
91+
lifecycle?.addObserver(dismissOnDestroy)
9192
}
9293

9394
override fun onViewDetachedFromWindow(v: View) {
94-
lifecycle?.removeObserver(onDestroy)
95+
lifecycle?.removeObserver(dismissOnDestroy)
9596
lifecycle = null
9697
}
9798
}
@@ -246,10 +247,5 @@ public abstract class ModalContainer<ModalRenderingT : Any> @JvmOverloads constr
246247
}
247248
}
248249

249-
private class OnDestroy(private val block: () -> Unit) : LifecycleObserver {
250-
@OnLifecycleEvent(ON_DESTROY)
251-
fun onDestroy() = block()
252-
}
253-
254250
private val Dialog.decorView: View?
255251
get() = window?.decorView

workflow-ui/core-android/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ dependencies {
2727
implementation(Dependencies.AndroidX.activity)
2828
implementation(Dependencies.AndroidX.fragment)
2929
implementation(Dependencies.AndroidX.Lifecycle.ktx)
30+
implementation(Dependencies.AndroidX.Lifecycle.viewModel)
31+
implementation(Dependencies.AndroidX.Lifecycle.viewModelKtx)
3032
implementation(Dependencies.AndroidX.savedstate)
3133
implementation(Dependencies.Kotlin.Coroutines.android)
3234
implementation(Dependencies.Kotlin.Coroutines.core)
@@ -41,6 +43,5 @@ dependencies {
4143
testImplementation(Dependencies.Test.robolectric)
4244

4345
androidTestImplementation(Dependencies.AndroidX.appcompat)
44-
androidTestImplementation(Dependencies.AndroidX.Lifecycle.viewModel)
4546
androidTestImplementation(Dependencies.Test.truth)
4647
}

0 commit comments

Comments
 (0)