From 570e085d8e842e833d8ab7f7698dbabea35edc06 Mon Sep 17 00:00:00 2001 From: Jake Wharton Date: Fri, 29 Sep 2023 19:41:17 -0400 Subject: [PATCH] Define ID in resources --- .../cash/redwood/treehouse/TreehouseLayout.kt | 6 +++--- .../src/androidMain/res/values/ids.xml | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 redwood-treehouse-host/src/androidMain/res/values/ids.xml diff --git a/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/TreehouseLayout.kt b/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/TreehouseLayout.kt index 25e7a30da5..272ac269c9 100644 --- a/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/TreehouseLayout.kt +++ b/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/TreehouseLayout.kt @@ -25,6 +25,7 @@ import androidx.activity.OnBackPressedDispatcher as AndroidOnBackPressedDispatch import app.cash.redwood.treehouse.TreehouseView.ReadyForContentChangeListener import app.cash.redwood.treehouse.TreehouseView.WidgetSystem import app.cash.redwood.widget.RedwoodLayout +import app.cash.treehouse.host.R import java.util.UUID @Deprecated( @@ -58,9 +59,8 @@ public class TreehouseLayout( override var saveCallback: TreehouseView.SaveCallback? = null init { - // The view needs to have an id for Android to populate saved data back - @SuppressLint("ResourceType") - id = 9000 + // The view needs to have an ID to participate in instance state saving. + id = R.id.treehouse_layout } override fun onAttachedToWindow() { diff --git a/redwood-treehouse-host/src/androidMain/res/values/ids.xml b/redwood-treehouse-host/src/androidMain/res/values/ids.xml new file mode 100644 index 0000000000..677db48916 --- /dev/null +++ b/redwood-treehouse-host/src/androidMain/res/values/ids.xml @@ -0,0 +1,18 @@ + + + +