diff --git a/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/show/ShowHabitView.kt b/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/show/ShowHabitView.kt
index cbb85825e..aec96aed3 100644
--- a/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/show/ShowHabitView.kt
+++ b/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/show/ShowHabitView.kt
@@ -25,12 +25,14 @@ import android.widget.FrameLayout
import org.isoron.uhabits.core.ui.screens.habits.show.ShowHabitPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.ShowHabitState
import org.isoron.uhabits.databinding.ShowHabitBinding
+import org.isoron.uhabits.utils.applyToolbarInsets
import org.isoron.uhabits.utils.setupToolbar
class ShowHabitView(context: Context) : FrameLayout(context) {
private val binding = ShowHabitBinding.inflate(LayoutInflater.from(context))
init {
+ binding.toolbar.applyToolbarInsets()
addView(binding.root)
}
diff --git a/uhabits-android/src/main/java/org/isoron/uhabits/utils/ViewExtensions.kt b/uhabits-android/src/main/java/org/isoron/uhabits/utils/ViewExtensions.kt
index 4da816dbb..8086ddb93 100644
--- a/uhabits-android/src/main/java/org/isoron/uhabits/utils/ViewExtensions.kt
+++ b/uhabits-android/src/main/java/org/isoron/uhabits/utils/ViewExtensions.kt
@@ -251,7 +251,11 @@ fun View.getCenter(): PointF {
fun View.applyRootViewInsets() {
ViewCompat.setOnApplyWindowInsetsListener(this) { view, insets ->
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
- view.setPadding(systemBarsInsets.left, 0, systemBarsInsets.right, systemBarsInsets.bottom)
+ val displayCutoutInsets = insets.getInsets(WindowInsetsCompat.Type.displayCutout())
+ val left = maxOf(systemBarsInsets.left, displayCutoutInsets.left)
+ val right = maxOf(systemBarsInsets.right, displayCutoutInsets.right)
+ view.setPadding(left, 0, right, 0)
+ view.background = ColorDrawable(Color.BLACK)
insets
}
}
@@ -259,7 +263,9 @@ fun View.applyRootViewInsets() {
fun View.applyToolbarInsets() {
ViewCompat.setOnApplyWindowInsetsListener(this) { view, insets ->
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
- view.setPadding(0, systemBarsInsets.top, 0, 0)
+ val displayCutoutInsets = insets.getInsets(WindowInsetsCompat.Type.displayCutout())
+ val top = maxOf(systemBarsInsets.top, displayCutoutInsets.top)
+ view.setPadding(0, top, 0, 0)
insets
}
}
diff --git a/uhabits-android/src/main/res/layout/activity_edit_habit.xml b/uhabits-android/src/main/res/layout/activity_edit_habit.xml
index 75dddb551..32866f654 100644
--- a/uhabits-android/src/main/res/layout/activity_edit_habit.xml
+++ b/uhabits-android/src/main/res/layout/activity_edit_habit.xml
@@ -18,7 +18,8 @@
~ with this program. If not, see .
-->
-
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior"
+ android:background="?attr/contrast0">
-
+
diff --git a/uhabits-android/src/main/res/layout/automation.xml b/uhabits-android/src/main/res/layout/automation.xml
index 184a5ffcb..fde3ff2be 100644
--- a/uhabits-android/src/main/res/layout/automation.xml
+++ b/uhabits-android/src/main/res/layout/automation.xml
@@ -58,7 +58,10 @@
+ style="@style/dialogFormPanel"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="?attr/contrast0">