[android] Use M3 background in dark mode

Signed-off-by: Jean-Baptiste <jeanbaptiste.charron@outlook.fr>
This commit is contained in:
Jean-Baptiste
2025-12-20 14:54:21 +01:00
parent 0eafe3482e
commit bba5173616
15 changed files with 21 additions and 18 deletions

View File

@@ -6,12 +6,10 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.XmlRes;
import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.recyclerview.widget.RecyclerView;
import app.organicmaps.R;
import app.organicmaps.util.Utils;
import app.organicmaps.util.WindowInsetUtils.ScrollableContentInsetsListener;
@@ -44,7 +42,6 @@ abstract class BaseXmlSettingsFragment extends PreferenceFragmentCompat
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);
view.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.bg_cards));
RecyclerView recyclerView = getListView();
ViewCompat.setOnApplyWindowInsetsListener(recyclerView, new ScrollableContentInsetsListener(recyclerView));
}

View File

@@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:background="?cardBackground">
<include
layout="@layout/toolbar_extended"/>
@@ -17,7 +18,8 @@
android:id="@+id/fragment_container"
style="@style/MwmWidget.FrameLayout.Elevation"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:background="?cardBackground"/>
</com.google.android.material.card.MaterialCardView>
</FrameLayout>

View File

@@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:background="?cardBackground">
<include
layout="@layout/toolbar_default"/>

View File

@@ -24,7 +24,7 @@
android:id="@+id/items_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?windowBackgroundForced">
android:background="?cardBackground">
<include
layout="@layout/item_missed_map"
android:layout_width="match_parent"

View File

@@ -26,7 +26,7 @@
android:id="@+id/items_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?windowBackgroundForced"
android:background="?cardBackground"
android:listSelector="?clickableBackground"
android:drawSelectorOnTop="true"/>

View File

@@ -4,7 +4,8 @@
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="?cardBackground">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:background="?cardBackground">
<include layout="@layout/toolbar_with_search" />
<androidx.recyclerview.widget.RecyclerView

View File

@@ -5,7 +5,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
android:orientation="vertical"
android:background="?cardBackground">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"

View File

@@ -9,7 +9,7 @@
style="@style/MwmWidget.FrameLayout.Elevation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?windowBackgroundForced"
android:background="?cardBackground"
android:layout_above="@+id/tv__mode_switch"
android:layout_below="@id/toolbar"/>

View File

@@ -5,7 +5,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?windowBackgroundForced">
android:background="?cardBackground">
<LinearLayout
android:layout_width="match_parent"

View File

@@ -4,7 +4,7 @@
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?windowBackgroundForced"
android:background="?cardBackground"
android:paddingStart="@dimen/margin_half"
android:paddingEnd="@dimen/margin_half"
android:scrollbars="vertical"/>

View File

@@ -5,7 +5,7 @@
style="@style/TextAppearance.Headline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?windowBackgroundForced"
android:background="?cardBackground"
android:gravity="start|center_vertical"
android:paddingStart="@dimen/margin_base"
android:paddingTop="@dimen/margin_base_plus"

View File

@@ -9,7 +9,7 @@ android:layout_marginHorizontal="@dimen/margin_base"
android:layout_marginTop="@dimen/margin_half"
app:strokeWidth="1dp"
app:strokeColor="@color/base_accent"
app:cardBackgroundColor="@color/bg_cards">
app:cardBackgroundColor="?cardBackground">
<LinearLayout
android:layout_width="match_parent"

View File

@@ -8,6 +8,6 @@
android:id="@+id/rw__phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?cardBackground"
android:background="?windowBackgroundForced"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>

View File

@@ -23,7 +23,7 @@
<item name="alertDialogTheme">@style/MwmTheme.AlertDialog</item>
<item name="windowBackgroundForced">@color/bg_window</item>
<item name="cardBackground">@color/bg_cards</item>
<item name="cardBackground">?android:attr/colorBackground</item>
<item name="titleDialogTheme">@color/white_primary</item>
<item name="textDialogTheme">@color/white_secondary</item>
<item name="fullscreenDialogTheme">@style/MwmTheme.DialogFragment.Fullscreen</item>