From 4d334929c9cb7b9898ead90fad5ad6539a252581 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:32:41 -0400 Subject: [PATCH] Update UI: complete change for dark mode --- .../kotlin/com/v2ray/ang/ui/ServerCustomConfigActivity.kt | 4 +++- V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt | 4 ++-- .../app/src/main/res/layout/item_recycler_bypass_list.xml | 3 ++- V2rayNG/app/src/main/res/layout/item_recycler_main.xml | 3 ++- .../app/src/main/res/layout/item_recycler_sub_setting.xml | 3 ++- V2rayNG/app/src/main/res/layout/item_recycler_user_asset.xml | 2 ++ V2rayNG/app/src/main/res/values-night/styles.xml | 5 +++-- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerCustomConfigActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerCustomConfigActivity.kt index 99a2c5d4..fabdccae 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerCustomConfigActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerCustomConfigActivity.kt @@ -39,7 +39,9 @@ class ServerCustomConfigActivity : BaseActivity() { setContentView(view) title = getString(R.string.title_server) - binding.editor.colorScheme = EditorTheme.INTELLIJ_LIGHT + if (!Utils.getDarkModeStatus(this)) { + binding.editor.colorScheme = EditorTheme.INTELLIJ_LIGHT + } binding.editor.language = JsonLanguage() val config = MmkvManager.decodeServerConfig(editGuid) if (config != null) { diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt index 69a92210..ae85000c 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt @@ -9,7 +9,7 @@ import android.content.ClipData import android.content.Intent import android.content.pm.PackageManager import android.content.res.Configuration.UI_MODE_NIGHT_MASK -import android.content.res.Configuration.UI_MODE_NIGHT_YES +import android.content.res.Configuration.UI_MODE_NIGHT_NO import android.net.Uri import android.os.Build import android.os.LocaleList @@ -356,7 +356,7 @@ object Utils { fun getDarkModeStatus(context: Context): Boolean { val mode = context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK - return mode == UI_MODE_NIGHT_YES + return mode != UI_MODE_NIGHT_NO } fun getIpv6Address(address: String): String { diff --git a/V2rayNG/app/src/main/res/layout/item_recycler_bypass_list.xml b/V2rayNG/app/src/main/res/layout/item_recycler_bypass_list.xml index 03ad10a7..6eb0ff19 100644 --- a/V2rayNG/app/src/main/res/layout/item_recycler_bypass_list.xml +++ b/V2rayNG/app/src/main/res/layout/item_recycler_bypass_list.xml @@ -3,7 +3,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" - android:background="?android:attr/selectableItemBackground" + android:background="@color/colorPrimary" + android:foreground="?android:attr/selectableItemBackground" android:clickable="true" android:focusable="true"> diff --git a/V2rayNG/app/src/main/res/layout/item_recycler_main.xml b/V2rayNG/app/src/main/res/layout/item_recycler_main.xml index 71a5e73d..24f54d7e 100644 --- a/V2rayNG/app/src/main/res/layout/item_recycler_main.xml +++ b/V2rayNG/app/src/main/res/layout/item_recycler_main.xml @@ -19,7 +19,8 @@ android:clickable="true" android:focusable="true" android:nextFocusRight="@+id/layout_share" - android:background="?android:attr/selectableItemBackground" + android:background="@color/colorPrimary" + android:foreground="?android:attr/selectableItemBackground" android:layout_width="match_parent" android:layout_height="@dimen/server_height" android:layout_gravity="center" diff --git a/V2rayNG/app/src/main/res/layout/item_recycler_sub_setting.xml b/V2rayNG/app/src/main/res/layout/item_recycler_sub_setting.xml index be456e49..cfc4a9f8 100644 --- a/V2rayNG/app/src/main/res/layout/item_recycler_sub_setting.xml +++ b/V2rayNG/app/src/main/res/layout/item_recycler_sub_setting.xml @@ -18,7 +18,8 @@ android:id="@+id/info_container" android:clickable="true" android:focusable="true" - android:background="?android:attr/selectableItemBackground" + android:background="@color/colorPrimary" + android:foreground="?android:attr/selectableItemBackground" android:nextFocusRight="@+id/layout_edit" android:layout_width="match_parent" android:layout_height="@dimen/server_height" diff --git a/V2rayNG/app/src/main/res/layout/item_recycler_user_asset.xml b/V2rayNG/app/src/main/res/layout/item_recycler_user_asset.xml index bab9b09d..7121c5fe 100644 --- a/V2rayNG/app/src/main/res/layout/item_recycler_user_asset.xml +++ b/V2rayNG/app/src/main/res/layout/item_recycler_user_asset.xml @@ -16,6 +16,8 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center" + android:background="@color/colorPrimary" + android:foreground="?android:attr/selectableItemBackground" android:padding="@dimen/nav_header_vertical_spacing"> @color/colorAccent @color/colorBg @color/colorText - @color/colorPrimary - @color/colorPrimary + @color/colorBg + @color/colorBg + @color/colorBg \ No newline at end of file