From 78817bf4aea19fca5694e41bdaa35e8fb42389a7 Mon Sep 17 00:00:00 2001 From: jacobrein Date: Tue, 17 Dec 2024 07:55:51 -0700 Subject: [PATCH] - fixing the no view model found error --- gradle/libs.versions.toml | 2 +- .../workinspector/WorkInspectorActivity.kt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3a41d9e..d9be488 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,7 @@ activity = "1.9.3" constraintlayout = "2.2.0" room = "2.6.1" work = "2.10.0" -koin = "3.5.6" +koin = "4.0.0" koin_ksp = "1.3.1" [libraries] diff --git a/workinspector/src/main/java/org/koitharu/workinspector/WorkInspectorActivity.kt b/workinspector/src/main/java/org/koitharu/workinspector/WorkInspectorActivity.kt index 494dfaf..c9f3c5e 100644 --- a/workinspector/src/main/java/org/koitharu/workinspector/WorkInspectorActivity.kt +++ b/workinspector/src/main/java/org/koitharu/workinspector/WorkInspectorActivity.kt @@ -2,16 +2,32 @@ package org.koitharu.workinspector import android.os.Bundle import android.view.MenuItem +import android.view.ViewGroup.MarginLayoutParams +import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.updateLayoutParams import org.koitharu.workinspector.databinding.WiActivityWorkInspectorBinding public class WorkInspectorActivity : AppCompatActivity() { private lateinit var binding: WiActivityWorkInspectorBinding override fun onCreate(savedInstanceState: Bundle?) { + enableEdgeToEdge() super.onCreate(savedInstanceState) binding = WiActivityWorkInspectorBinding.inflate(layoutInflater) setContentView(binding.root) + ViewCompat.setOnApplyWindowInsetsListener(binding.appbar) { v, windowInsets -> + val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) + v.updateLayoutParams { + leftMargin = insets.left + bottomMargin = insets.bottom + rightMargin = insets.right + topMargin = insets.top + } + WindowInsetsCompat.CONSUMED + } setSupportActionBar(binding.toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) }