mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
[android] Fix camera cutout offset in navigation
Signed-off-by: Jean-Baptiste <jeanbaptiste.charron@outlook.fr>
This commit is contained in:
@@ -102,7 +102,7 @@ public class NavigationController implements TrafficManager.TrafficCallback, Nav
|
||||
final View navigationBarBackground = mFrame.findViewById(R.id.nav_bottom_sheet_nav_bar);
|
||||
final View nextTurnContainer = mFrame.findViewById(R.id.nav_next_turn_container);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(mStreetFrame, (v, windowInsets) -> {
|
||||
UiUtils.setViewInsetsPaddingNoBottom(v, windowInsets);
|
||||
UiUtils.setViewNavigationInsetsPaddingNoBottom(v, windowInsets);
|
||||
|
||||
final Insets safeDrawingInsets = windowInsets.getInsets(WindowInsetUtils.TYPE_SAFE_DRAWING);
|
||||
nextTurnContainer.setPadding(safeDrawingInsets.left, nextTurnContainer.getPaddingTop(),
|
||||
|
||||
@@ -281,6 +281,17 @@ public final class UiUtils
|
||||
view.setPadding(systemInsets.left, systemInsets.top, systemInsets.right, view.getPaddingBottom());
|
||||
}
|
||||
|
||||
public static void setViewNavigationInsetsPaddingNoBottom(View view, WindowInsetsCompat windowInsets)
|
||||
{
|
||||
final Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
|
||||
mlp.topMargin = insets.top;
|
||||
mlp.leftMargin = insets.left;
|
||||
mlp.bottomMargin = view.getPaddingBottom();
|
||||
mlp.rightMargin = insets.right;
|
||||
view.setLayoutParams(mlp);
|
||||
}
|
||||
|
||||
public static void setupNavigationIcon(@NonNull MaterialToolbar toolbar, @NonNull View.OnClickListener listener)
|
||||
{
|
||||
View customNavigationButton = toolbar.findViewById(R.id.back);
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/statutbar"
|
||||
android:layout_height="15dp"
|
||||
android:layout_height="1dp"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/street_frame"
|
||||
android:layout_width="500dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_half_plus_eight"
|
||||
android:layout_marginTop="@dimen/margin_quarter"
|
||||
android:layout_marginEnd="@dimen/margin_quarter"
|
||||
app:cardCornerRadius="@dimen/margin_half"
|
||||
android:elevation="@dimen/nav_elevation"
|
||||
@@ -52,7 +52,7 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/street_frame"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/statutbar"
|
||||
android:layout_marginTop="@dimen/margin_half_plus_eight"
|
||||
android:layout_marginTop="@dimen/margin_quarter"
|
||||
android:layout_marginStart="@dimen/margin_quarter"
|
||||
android:clickable="true"
|
||||
android:elevation="@dimen/nav_elevation">
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/statutbar"
|
||||
android:layout_height="25dp"
|
||||
android:layout_height="1dp"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/street_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_half_plus"
|
||||
android:layout_marginTop="@dimen/margin_quarter"
|
||||
android:layout_marginStart="@dimen/nav_street_left"
|
||||
android:layout_marginEnd="@dimen/margin_quarter"
|
||||
app:cardCornerRadius="@dimen/margin_half"
|
||||
@@ -55,7 +55,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/statutbar"
|
||||
android:layout_marginStart="@dimen/margin_half"
|
||||
android:layout_marginTop="@dimen/margin_half_plus"
|
||||
android:layout_marginTop="@dimen/margin_quarter"
|
||||
android:clickable="true"
|
||||
android:elevation="@dimen/nav_elevation">
|
||||
<LinearLayout
|
||||
|
||||
Reference in New Issue
Block a user