From f0deaa11c923c97e9fc8cbc79190739468aa9563 Mon Sep 17 00:00:00 2001 From: coderang-gk Date: Sun, 9 Mar 2025 16:58:53 +0530 Subject: [PATCH] [android] Add dark mode support to widget config activity Signed-off-by: coderang-gk --- .../FavoriteBookmarkWidgetConfigActivity.java | 13 +++++++++++-- .../src/main/res/layout/activity_widget_config.xml | 5 +++-- .../app/src/main/res/layout/item_widget_list.xml | 4 +++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/android/app/src/main/java/app/organicmaps/bookmarks/FavoriteBookmarkWidgetConfigActivity.java b/android/app/src/main/java/app/organicmaps/bookmarks/FavoriteBookmarkWidgetConfigActivity.java index d4408c01d8..6914cc30ff 100644 --- a/android/app/src/main/java/app/organicmaps/bookmarks/FavoriteBookmarkWidgetConfigActivity.java +++ b/android/app/src/main/java/app/organicmaps/bookmarks/FavoriteBookmarkWidgetConfigActivity.java @@ -19,6 +19,8 @@ import app.organicmaps.bookmarks.data.BookmarkInfo; import app.organicmaps.bookmarks.data.BookmarkManager; import app.organicmaps.content.DataSource; import app.organicmaps.MwmApplication; +import app.organicmaps.util.Config; +import app.organicmaps.util.ThemeUtils; import java.io.IOException; import java.util.ArrayList; @@ -26,7 +28,6 @@ import java.util.List; public class FavoriteBookmarkWidgetConfigActivity extends AppCompatActivity { - private static final String TAG = "BookmarkWidgetConfig"; private int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID; @@ -42,6 +43,8 @@ public class FavoriteBookmarkWidgetConfigActivity extends AppCompatActivity @Override protected void onCreate(@Nullable Bundle savedInstanceState) { + applyTheme(); + super.onCreate(savedInstanceState); setContentView(R.layout.activity_widget_config); @@ -92,6 +95,12 @@ public class FavoriteBookmarkWidgetConfigActivity extends AppCompatActivity } } + private void applyTheme() + { + String currentTheme = Config.getCurrentUiTheme(this); + setTheme(ThemeUtils.getCardBgThemeResourceId(this, currentTheme)); + } + private void loadCategories() { mShowingCategories = true; @@ -187,4 +196,4 @@ public class FavoriteBookmarkWidgetConfigActivity extends AppCompatActivity super.onBackPressed(); } } -} \ No newline at end of file +} diff --git a/android/app/src/main/res/layout/activity_widget_config.xml b/android/app/src/main/res/layout/activity_widget_config.xml index 2a915c802a..394443dd48 100644 --- a/android/app/src/main/res/layout/activity_widget_config.xml +++ b/android/app/src/main/res/layout/activity_widget_config.xml @@ -12,7 +12,7 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" - app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> + app:popupTheme="@style/ThemeOverlay.AppCompat.DayNight" /> @@ -60,6 +60,7 @@ android:lineSpacingExtra="@dimen/text_size_banner" android:text="@string/select_list" android:textAppearance="?android:textAppearanceLarge" + android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/text_size_toolbar" android:textStyle="normal" tools:text="Select list" /> diff --git a/android/app/src/main/res/layout/item_widget_list.xml b/android/app/src/main/res/layout/item_widget_list.xml index cf9e5363c9..570446c008 100644 --- a/android/app/src/main/res/layout/item_widget_list.xml +++ b/android/app/src/main/res/layout/item_widget_list.xml @@ -6,7 +6,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/white_primary"> + android:background="?android:attr/windowBackground"> @@ -35,6 +36,7 @@ android:layout_gravity="center_vertical" android:ellipsize="end" android:singleLine="true" + android:textColor="?android:attr/textColorPrimary" android:textAppearance="@style/MwmTextAppearance.Body3" tools:text="42000000" />