From 4b4f5d145be0d5dfa260307ec1e0c7f995ef9815 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Sun, 13 Aug 2023 15:01:07 -0400 Subject: [PATCH] Update UI: a concept for launching icon --- .../com/v2ray/ang/receiver/WidgetProvider.kt | 8 +++++++- .../kotlin/com/v2ray/ang/ui/MainActivity.kt | 10 ++++++++-- .../ic_qu_switch_24dp.xml} | 2 +- ...scan_black_24dp.xml => ic_qu_scan_24dp.xml} | 6 +++--- ..._black_24dp.xml => ic_qu_settings_24dp.xml} | 4 ++-- .../main/res/drawable/ic_qu_switch_24dp.xml | 18 ++++++++++++++++++ ..._theme.xml => ic_rounded_corner_active.xml} | 2 +- .../res/drawable/ic_rounded_corner_grey.xml | 2 +- .../res/drawable/ic_shortcut_background.xml | 2 +- .../app/src/main/res/layout/activity_main.xml | 2 +- .../app/src/main/res/layout/widget_switch.xml | 3 ++- .../app/src/main/res/values-night/colors.xml | 1 + V2rayNG/app/src/main/res/values/colors.xml | 1 + V2rayNG/app/src/main/res/xml/shortcuts.xml | 6 +++--- 14 files changed, 50 insertions(+), 17 deletions(-) rename V2rayNG/app/src/main/res/{drawable/ic_qu_switch_black_24dp.xml => drawable-night/ic_qu_switch_24dp.xml} (88%) rename V2rayNG/app/src/main/res/drawable/{ic_qu_scan_black_24dp.xml => ic_qu_scan_24dp.xml} (83%) rename V2rayNG/app/src/main/res/drawable/{ic_qu_settings_black_24dp.xml => ic_qu_settings_24dp.xml} (99%) create mode 100644 V2rayNG/app/src/main/res/drawable/ic_qu_switch_24dp.xml rename V2rayNG/app/src/main/res/drawable/{ic_rounded_corner_theme.xml => ic_rounded_corner_active.xml} (82%) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/receiver/WidgetProvider.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/receiver/WidgetProvider.kt index 826bf24f..42856ecf 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/receiver/WidgetProvider.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/receiver/WidgetProvider.kt @@ -38,12 +38,18 @@ class WidgetProvider : AppWidgetProvider() { }) remoteViews.setOnClickPendingIntent(R.id.layout_switch, pendingIntent) if (isRunning) { + if (!Utils.getDarkModeStatus(context)) { + remoteViews.setInt(R.id.image_switch, "setImageResource", R.drawable.ic_stat_name) + } remoteViews.setInt( R.id.layout_switch, "setBackgroundResource", - R.drawable.ic_rounded_corner_theme + R.drawable.ic_rounded_corner_active ) } else { + if (!Utils.getDarkModeStatus(context)) { + remoteViews.setInt(R.id.image_switch, "setImageResource", R.drawable.ic_stat_name_black) + } remoteViews.setInt( R.id.layout_switch, "setBackgroundResource", diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt index 7160055c..54a94b06 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt @@ -131,11 +131,17 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList mainViewModel.isRunning.observe(this) { isRunning -> adapter.isRunning = isRunning if (isRunning) { - binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.colorSelected)) + if (!Utils.getDarkModeStatus(this)) { + binding.fab.setImageResource(R.drawable.ic_stat_name) + } + binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.color_fab_orange)) setTestState(getString(R.string.connection_connected)) binding.layoutTest.isFocusable = true } else { - binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.colorUnselected)) + if (!Utils.getDarkModeStatus(this)) { + binding.fab.setImageResource(R.drawable.ic_stat_name_black) + } + binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.color_fab_grey)) setTestState(getString(R.string.connection_not_connected)) binding.layoutTest.isFocusable = false } diff --git a/V2rayNG/app/src/main/res/drawable/ic_qu_switch_black_24dp.xml b/V2rayNG/app/src/main/res/drawable-night/ic_qu_switch_24dp.xml similarity index 88% rename from V2rayNG/app/src/main/res/drawable/ic_qu_switch_black_24dp.xml rename to V2rayNG/app/src/main/res/drawable-night/ic_qu_switch_24dp.xml index a2faae56..97f8859d 100644 --- a/V2rayNG/app/src/main/res/drawable/ic_qu_switch_black_24dp.xml +++ b/V2rayNG/app/src/main/res/drawable-night/ic_qu_switch_24dp.xml @@ -9,7 +9,7 @@ android:bottom="2dp" /> diff --git a/V2rayNG/app/src/main/res/drawable/ic_qu_settings_black_24dp.xml b/V2rayNG/app/src/main/res/drawable/ic_qu_settings_24dp.xml similarity index 99% rename from V2rayNG/app/src/main/res/drawable/ic_qu_settings_black_24dp.xml rename to V2rayNG/app/src/main/res/drawable/ic_qu_settings_24dp.xml index 063171a3..d8b29fc4 100644 --- a/V2rayNG/app/src/main/res/drawable/ic_qu_settings_black_24dp.xml +++ b/V2rayNG/app/src/main/res/drawable/ic_qu_settings_24dp.xml @@ -4,10 +4,10 @@ android:viewportHeight="1024" android:viewportWidth="1024"> diff --git a/V2rayNG/app/src/main/res/drawable/ic_qu_switch_24dp.xml b/V2rayNG/app/src/main/res/drawable/ic_qu_switch_24dp.xml new file mode 100644 index 00000000..73d5e641 --- /dev/null +++ b/V2rayNG/app/src/main/res/drawable/ic_qu_switch_24dp.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/V2rayNG/app/src/main/res/drawable/ic_rounded_corner_theme.xml b/V2rayNG/app/src/main/res/drawable/ic_rounded_corner_active.xml similarity index 82% rename from V2rayNG/app/src/main/res/drawable/ic_rounded_corner_theme.xml rename to V2rayNG/app/src/main/res/drawable/ic_rounded_corner_active.xml index afc2118b..e486ba48 100644 --- a/V2rayNG/app/src/main/res/drawable/ic_rounded_corner_theme.xml +++ b/V2rayNG/app/src/main/res/drawable/ic_rounded_corner_active.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/V2rayNG/app/src/main/res/drawable/ic_rounded_corner_grey.xml b/V2rayNG/app/src/main/res/drawable/ic_rounded_corner_grey.xml index 50af166d..5b8ac8bd 100644 --- a/V2rayNG/app/src/main/res/drawable/ic_rounded_corner_grey.xml +++ b/V2rayNG/app/src/main/res/drawable/ic_rounded_corner_grey.xml @@ -1,6 +1,6 @@ - + diff --git a/V2rayNG/app/src/main/res/drawable/ic_shortcut_background.xml b/V2rayNG/app/src/main/res/drawable/ic_shortcut_background.xml index a62b720b..1ce21f0a 100644 --- a/V2rayNG/app/src/main/res/drawable/ic_shortcut_background.xml +++ b/V2rayNG/app/src/main/res/drawable/ic_shortcut_background.xml @@ -2,6 +2,6 @@ - + \ No newline at end of file diff --git a/V2rayNG/app/src/main/res/layout/activity_main.xml b/V2rayNG/app/src/main/res/layout/activity_main.xml index 3bb3aaa2..2bfe6128 100644 --- a/V2rayNG/app/src/main/res/layout/activity_main.xml +++ b/V2rayNG/app/src/main/res/layout/activity_main.xml @@ -91,7 +91,7 @@ android:clickable="true" android:focusable="true" android:nextFocusLeft="@+id/layout_test" - android:src="@drawable/ic_stat_name_grey" + android:src="@drawable/ic_stat_name" app:layout_anchorGravity="bottom|right|end" /> diff --git a/V2rayNG/app/src/main/res/layout/widget_switch.xml b/V2rayNG/app/src/main/res/layout/widget_switch.xml index 209489d2..84d65952 100644 --- a/V2rayNG/app/src/main/res/layout/widget_switch.xml +++ b/V2rayNG/app/src/main/res/layout/widget_switch.xml @@ -8,8 +8,9 @@ android:orientation="vertical"> + android:src="@drawable/ic_stat_name" /> diff --git a/V2rayNG/app/src/main/res/values-night/colors.xml b/V2rayNG/app/src/main/res/values-night/colors.xml index 82982116..b23a1aef 100644 --- a/V2rayNG/app/src/main/res/values-night/colors.xml +++ b/V2rayNG/app/src/main/res/values-night/colors.xml @@ -1,5 +1,6 @@ + #424242 #BDBDBD #FFFFFF #222222 diff --git a/V2rayNG/app/src/main/res/values/colors.xml b/V2rayNG/app/src/main/res/values/colors.xml index 7dcdab0a..9daf3d36 100644 --- a/V2rayNG/app/src/main/res/values/colors.xml +++ b/V2rayNG/app/src/main/res/values/colors.xml @@ -4,6 +4,7 @@ #FF0099 #f97910 + #EDEDED #727272 #000000 #FFFFFF diff --git a/V2rayNG/app/src/main/res/xml/shortcuts.xml b/V2rayNG/app/src/main/res/xml/shortcuts.xml index 3e5f3656..9db1e36f 100644 --- a/V2rayNG/app/src/main/res/xml/shortcuts.xml +++ b/V2rayNG/app/src/main/res/xml/shortcuts.xml @@ -2,7 +2,7 @@