[android] Add dark mode support to widget config activity

Signed-off-by: coderang-gk <coderang.gk@gmail.com>
This commit is contained in:
Gaurang Khatavkar 2025-03-09 16:58:53 +05:30
parent 28545429ac
commit f0deaa11c9
3 changed files with 17 additions and 5 deletions

View file

@ -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();
}
}
}
}

View file

@ -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" />
<LinearLayout
android:layout_width="match_parent"
@ -45,7 +45,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_window"
android:background="?android:attr/windowBackground"
android:minWidth="@dimen/bookmark_purchase_img_width"
android:orientation="vertical">
@ -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" />

View file

@ -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">
<TextView
android:id="@+id/name"
@ -15,6 +15,7 @@
android:layout_marginTop="@dimen/margin_base"
android:ellipsize="middle"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:layout_marginStart="16dp"
android:textAppearance="?fontBody1"
tools:text="Bookmark name looooooooooooooooooongasdasdasd" />
@ -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" />