@@ -8,6 +8,7 @@ import android.os.Bundle
88import android.view.View
99import android.view.ViewGroup
1010import android.view.WindowManager
11+ import android.widget.FrameLayout
1112import androidx.activity.addCallback
1213import androidx.appcompat.app.AlertDialog
1314import androidx.core.view.ViewCompat
@@ -23,12 +24,15 @@ import androidx.navigation.NavController
2324import androidx.navigation.NavGraph
2425import androidx.navigation.NavOptions
2526import androidx.navigation.fragment.NavHostFragment
27+ import com.google.android.material.appbar.MaterialToolbar
2628import io.snabble.sdk.InitializationState
2729import io.snabble.sdk.PaymentMethod
2830import io.snabble.sdk.Snabble
2931import io.snabble.sdk.checkout.Checkout
3032import io.snabble.sdk.checkout.CheckoutState
3133import io.snabble.sdk.ui.R
34+ import io.snabble.sdk.ui.remotetheme.onToolBarColorForProject
35+ import io.snabble.sdk.ui.remotetheme.toolBarColorForProject
3236import io.snabble.sdk.utils.Logger
3337
3438class CheckoutActivity : FragmentActivity () {
@@ -136,9 +140,24 @@ class CheckoutActivity : FragmentActivity() {
136140 private fun setUpToolBarAndStatusBar () {
137141 val showToolBar = resources.getBoolean(R .bool.showToolbarInCheckout)
138142 findViewById<View >(R .id.checkout_toolbar_spacer)?.isVisible = showToolBar
143+
139144 navController.addOnDestinationChangedListener { _, _, arguments ->
140- findViewById<View >(R .id.checkout_toolbar)?.isVisible = arguments?.getBoolean(" showToolbar" , false ) == true
145+ findViewById<View >(R .id.checkout_toolbar)?.isVisible =
146+ arguments?.getBoolean(" showToolbar" , false ) == true
147+
148+ val toolBarColor =
149+ this @CheckoutActivity.toolBarColorForProject(Snabble .checkedInProject.value)
150+ val onToolBarColor =
151+ this @CheckoutActivity.onToolBarColorForProject(Snabble .checkedInProject.value)
152+ this .findViewById<MaterialToolbar >(R .id.checkout_toolbar).apply {
153+ toolBarColor?.let (::setBackgroundColor)
154+ onToolBarColor?.let (::setTitleTextColor)
155+ }
156+ this .findViewById<FrameLayout >(R .id.checkout_toolbar_spacer).apply {
157+ toolBarColor?.let (::setBackgroundColor)
158+ }
141159 }
160+
142161 if (showToolBar) {
143162 applyInsets()
144163 }
0 commit comments