From b391d4a449021cccf6fb6214b61e0556eb8409d6 Mon Sep 17 00:00:00 2001 From: tornaco Date: Sun, 26 Dec 2021 18:05:04 +0800 Subject: [PATCH] [app] new nav icon --- .../thanos/main/NavDataBindingAdapters.java | 32 +++++++ .../android/thanos/main/NavViewModel.java | 83 ++++++++----------- .../drawable/ic_nav_activity_replacement.xml | 15 ++++ .../main/res/drawable/ic_nav_app_clone.xml | 15 ++++ .../src/main/res/drawable/ic_nav_app_lock.xml | 15 ++++ .../main/res/drawable/ic_nav_app_manager.xml | 15 ++++ .../main/res/drawable/ic_nav_bg_restrict.xml | 15 ++++ .../src/main/res/drawable/ic_nav_bg_start.xml | 15 ++++ .../src/main/res/drawable/ic_nav_boost.xml | 15 ++++ .../app/src/main/res/drawable/ic_nav_nr.xml | 15 ++++ .../main/res/drawable/ic_nav_op_remind.xml | 15 ++++ .../app/src/main/res/drawable/ic_nav_ops.xml | 15 ++++ .../src/main/res/drawable/ic_nav_plugins.xml | 15 ++++ .../main/res/drawable/ic_nav_priv_cheat.xml | 15 ++++ .../src/main/res/drawable/ic_nav_profile.xml | 15 ++++ .../ic_nav_screen_on_notification.xml | 15 ++++ .../main/res/drawable/ic_nav_smart_freeze.xml | 15 ++++ .../res/drawable/ic_nav_smart_standby.xml | 15 ++++ .../main/res/drawable/ic_nav_task_blur.xml | 15 ++++ .../main/res/drawable/ic_nav_task_removal.xml | 15 ++++ .../item_feature_dashboard_tile_of_card.xml | 8 +- android/app/src/main/res/values/colors.xml | 22 +++++ .../common/CommonDataBindingAdapters.java | 13 --- 23 files changed, 362 insertions(+), 66 deletions(-) create mode 100644 android/app/src/main/java/github/tornaco/android/thanos/main/NavDataBindingAdapters.java create mode 100644 android/app/src/main/res/drawable/ic_nav_activity_replacement.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_app_clone.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_app_lock.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_app_manager.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_bg_restrict.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_bg_start.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_boost.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_nr.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_op_remind.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_ops.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_plugins.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_priv_cheat.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_profile.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_screen_on_notification.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_smart_freeze.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_smart_standby.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_task_blur.xml create mode 100644 android/app/src/main/res/drawable/ic_nav_task_removal.xml create mode 100644 android/app/src/main/res/values/colors.xml diff --git a/android/app/src/main/java/github/tornaco/android/thanos/main/NavDataBindingAdapters.java b/android/app/src/main/java/github/tornaco/android/thanos/main/NavDataBindingAdapters.java new file mode 100644 index 000000000..15e38e4d4 --- /dev/null +++ b/android/app/src/main/java/github/tornaco/android/thanos/main/NavDataBindingAdapters.java @@ -0,0 +1,32 @@ +package github.tornaco.android.thanos.main; + +import android.graphics.drawable.Drawable; +import android.graphics.drawable.LayerDrawable; +import android.widget.ImageView; + +import androidx.appcompat.content.res.AppCompatResources; +import androidx.core.content.ContextCompat; +import androidx.databinding.BindingAdapter; + +import java.util.Objects; + +import github.tornaco.android.thanos.R; +import github.tornaco.android.thanos.dashboard.Tile; + +public class NavDataBindingAdapters { + + @BindingAdapter("android:navTile") + public static void setCircleBgTint(ImageView imageView, Tile tile) { + try { + LayerDrawable layerDrawable = (LayerDrawable) AppCompatResources.getDrawable(imageView.getContext(), tile.getIconRes()); + Drawable findDrawableByLayerId = Objects.requireNonNull(layerDrawable).findDrawableByLayerId(R.id.settings_ic_foreground); + if (findDrawableByLayerId != null) { + findDrawableByLayerId.setTint(ContextCompat.getColor(imageView.getContext(), tile.getThemeColor())); + layerDrawable.setDrawableByLayerId(R.id.settings_ic_foreground, findDrawableByLayerId); + } + imageView.setImageDrawable(layerDrawable); + } catch (Throwable ignored) { + + } + } +} diff --git a/android/app/src/main/java/github/tornaco/android/thanos/main/NavViewModel.java b/android/app/src/main/java/github/tornaco/android/thanos/main/NavViewModel.java index cfc1635be..d433c9d10 100644 --- a/android/app/src/main/java/github/tornaco/android/thanos/main/NavViewModel.java +++ b/android/app/src/main/java/github/tornaco/android/thanos/main/NavViewModel.java @@ -201,54 +201,54 @@ private void loadPrebuiltFeatures() { Arrays.asList( Tile.builder() .id(R.id.id_one_key_clear) - .iconRes(R.drawable.ic_rocket_fill) + .iconRes(R.drawable.ic_nav_boost) .title(resources.getString(R.string.feature_title_one_key_boost)) .requiredFeature(BuildProp.THANOX_FEATURE_BG_TASK_CLEAN) - .themeColor(R.color.md_green_500) + .themeColor(R.color.nav_icon_boost) .build(), Tile.builder() .id(R.id.id_background_start) - .iconRes(R.drawable.ic_forbid_fill) + .iconRes(R.drawable.ic_nav_bg_start) .title(resources.getString(R.string.feature_title_start_restrict)) .category(resources.getString(R.string.feature_category_start_manage)) .requiredFeature(BuildProp.THANOX_FEATURE_START_BLOCKER) - .themeColor(R.color.md_indigo_a400) + .themeColor(R.color.nav_icon_bg_start) .build(), Tile.builder() - .iconRes(R.drawable.ic_refresh_fill) + .iconRes(R.drawable.ic_nav_bg_restrict) .id(R.id.id_background_restrict) .title(resources.getString(R.string.feature_title_bg_restrict)) .summary(resources.getString(R.string.feature_desc_bg_restrict_brief)) .requiredFeature(BuildProp.THANOX_FEATURE_BG_TASK_CLEAN) - .themeColor(R.color.md_amber_800) + .themeColor(R.color.nav_icon_bg_restrict) .build(), Tile.builder() .id(R.id.id_clean_task_removal) - .iconRes(R.drawable.ic_clear_all_black_24dp) + .iconRes(R.drawable.ic_nav_task_removal) .title(resources.getString(R.string.feature_title_clean_when_task_removed)) .requiredFeature(BuildProp.THANOX_FEATURE_RECENT_TASK_REMOVAL) .summary( resources.getString( R.string.feature_desc_clean_when_task_removed_brief)) .category(resources.getString(R.string.feature_category_app_clean_up)) - .themeColor(R.color.md_grey_500) + .themeColor(R.color.nav_icon_task_removal) .build(), Tile.builder() .id(R.id.id_smart_freeze) - .iconRes(R.drawable.ic_ac_unit_black_24dp) + .iconRes(R.drawable.ic_nav_smart_freeze) .title(resources.getString(R.string.feature_title_smart_app_freeze)) .summary(resources.getString(R.string.feature_summary_smart_app_freeze)) .requiredFeature(BuildProp.THANOX_FEATURE_EXT_APP_SMART_FREEZE) - .themeColor(R.color.md_blue_grey_500) + .themeColor(R.color.nav_icon_smart_freeze) .build(), Tile.builder() .id(R.id.id_apps_manager) - .iconRes(R.drawable.ic_apps_fill) + .iconRes(R.drawable.ic_nav_app_manager) .title(resources.getString(R.string.feature_title_apps_manager)) .summary(resources.getString(R.string.feature_summary_apps_manager)) .requiredFeature(BuildProp.THANOX_FEATURE_COMPONENT_MANAGER) .category(resources.getString(R.string.feature_category_app_manage)) - .themeColor(R.color.md_pink_600) + .themeColor(R.color.nav_icon_apps_manager) .build()))); TileGroup secure = @@ -258,58 +258,47 @@ private void loadPrebuiltFeatures() { Arrays.asList( Tile.builder() .id(R.id.id_privacy_cheat) - .iconRes(R.drawable.ic_spy_fill) + .iconRes(R.drawable.ic_nav_priv_cheat) .title(resources.getString(R.string.feature_title_data_cheat)) .category(resources.getString(R.string.feature_category_privacy)) .requiredFeature(BuildProp.THANOX_FEATURE_PRIVACY_DATA_CHEAT) - .themeColor(R.color.md_grey_700) - .build(), - Tile.builder() - .id(R.id.id_ops_by_app) - .iconRes(R.drawable.ic_shield_star_fill) - .requiredFeature(BuildProp.THANOX_FEATURE_PRIVACY_OPS) - .title(resources.getString(R.string.module_ops_feature_title_app_ops_list)) - .summary( - resources.getString(R.string.module_ops_feature_summary_app_ops_list)) - .themeColor(R.color.md_lime_600) - // Dup with apps manager. - .disabled(true) + .themeColor(R.color.nav_icon_priv_cheat) .build(), Tile.builder() .id(R.id.id_ops_by_ops) - .iconRes(R.drawable.ic_shield_star_fill) + .iconRes(R.drawable.ic_nav_ops) .requiredFeature(BuildProp.THANOX_FEATURE_PRIVACY_OPS) .title(resources.getString(R.string.module_ops_feature_title_ops_app_list)) .summary( resources.getString(R.string.module_ops_feature_summary_ops_app_list)) - .themeColor(R.color.md_blue_700) + .themeColor(R.color.nav_icon_ops) .build(), Tile.builder() .id(R.id.id_app_lock) - .iconRes(R.drawable.ic_baseline_phonelink_lock_24) + .iconRes(R.drawable.ic_nav_app_lock) .title(resources.getString(R.string.feature_title_app_lock)) .summary(resources.getString(R.string.feature_summary_app_lock)) - .themeColor(R.color.md_deep_orange_500) + .themeColor(R.color.nav_icon_app_lock) .requiredFeature(BuildProp.THANOX_FEATURE_PRIVACY_APPLOCK) .build(), Tile.builder() .id(R.id.id_task_blur) - .iconRes(R.drawable.ic_paint_brush_fill) + .iconRes(R.drawable.ic_nav_task_blur) .title(resources.getString(R.string.feature_title_recent_task_blur)) .summary(resources.getString(R.string.feature_summary_recent_task_blur)) .requiredFeature(BuildProp.THANOX_FEATURE_PRIVACY_TASK_BLUR) - .themeColor(R.color.md_teal_800) + .themeColor(R.color.nav_icon_task_blur) .build(), Tile.builder() .id(R.id.id_op_remind) - .iconRes(R.drawable.module_ops_ic_alarm_warning_fill) + .iconRes(R.drawable.ic_nav_op_remind) .requiredFeature(BuildProp.THANOX_FEATURE_PRIVACY_OPS_REMINDER) .category(resources.getString(R.string.feature_category_remind)) .title( resources.getString(R.string.module_ops_feature_title_ops_remind_list)) .summary( resources.getString(R.string.module_ops_feature_summary_ops_remind)) - .themeColor(R.color.md_amber_800) + .themeColor(R.color.nav_icon_op_remind) .build()))); TileGroup ext = @@ -319,65 +308,65 @@ private void loadPrebuiltFeatures() { Arrays.asList( Tile.builder() .id(R.id.id_screen_on_notification) - .iconRes(R.drawable.ic_notification_badge_fill) + .iconRes(R.drawable.ic_nav_screen_on_notification) .title(resources.getString(R.string.feature_title_light_on_notification)) .summary( resources.getString(R.string.feature_summary_light_on_notification)) .category(resources.getString(R.string.feature_category_notification)) .requiredFeature(BuildProp.THANOX_FEATURE_EXT_N_UP) - .themeColor(R.color.md_red_500) + .themeColor(R.color.nav_icon_screen_on_notification) .build(), Tile.builder() .id(R.id.id_notification_recorder) - .iconRes(R.drawable.ic_chat_1_fill) + .iconRes(R.drawable.ic_nav_nr) .title( resources.getString( R.string .module_notification_recorder_feature_title_notification_recorder)) .requiredFeature(BuildProp.THANOX_FEATURE_EXT_N_RECORDER) - .themeColor(R.color.md_cyan_600) + .themeColor(R.color.nav_icon_nr) .build(), Tile.builder() .id(R.id.id_trampoline) - .iconRes(R.drawable.ic_guide_fill) + .iconRes(R.drawable.ic_nav_activity_replacement) .category(resources.getString(R.string.feature_category_ext)) .title(resources.getString(R.string.module_activity_trampoline_app_name)) .requiredFeature(BuildProp.THANOX_FEATURE_APP_TRAMPOLINE) .summary("\uD83C\uDF6D \uD83C\uDF6D \uD83C\uDF6D") - .themeColor(R.color.md_green_a700) + .themeColor(R.color.nav_icon_activity_replacement) .build(), Tile.builder() .id(R.id.id_profile) - .iconRes(R.drawable.module_profile_ic_thunderstorms_fill) + .iconRes(R.drawable.ic_nav_profile) .title(resources.getString(R.string.module_profile_feature_name)) .summary(resources.getString(R.string.module_profile_feature_summary)) - .themeColor(R.color.md_indigo_300) + .themeColor(R.color.nav_icon_profile) .requiredFeature(BuildProp.THANOX_FEATURE_PROFILE) .build(), Tile.builder() .id(R.id.id_smart_standby) - .iconRes(R.drawable.ic_mickey_fill) + .iconRes(R.drawable.ic_nav_smart_standby) .category(resources.getString(R.string.feature_category_apps)) .title(resources.getString(R.string.feature_title_smart_app_standby)) .summary( resources.getString(R.string.feature_summary_smart_app_standby_brief)) .requiredFeature(BuildProp.THANOX_FEATURE_APP_SMART_STAND_BY) - .themeColor(R.color.md_deep_orange_300) + .themeColor(R.color.nav_icon_smart_standby) .build(), Tile.builder() .id(R.id.id_plugins) - .iconRes(R.drawable.ic_store_fill) + .iconRes(R.drawable.ic_nav_plugins) .title(resources.getString(R.string.nav_title_plugin)) .requiredFeature(BuildProp.THANOX_FEATURE_PLUGIN_SUPPORT) .summary(resources.getString(R.string.card_message_plugin_available)) - .themeColor(R.color.md_grey_400) + .themeColor(R.color.nav_icon_plugin) .build(), Tile.builder() .id(R.id.id_infinite_z) - .iconRes(R.drawable.ic_baseline_work_fill_24) + .iconRes(R.drawable.ic_nav_app_clone) .title(resources.getString(R.string.feature_title_infinite_z)) .disabled(!BuildProp.THANOS_BUILD_DEBUG) - .themeColor(R.color.md_deep_purple_700) + .themeColor(R.color.nav_icon_app_clone) .build()))); tileGroups.add(new TileGroup(loadStatusHeaderInfo())); diff --git a/android/app/src/main/res/drawable/ic_nav_activity_replacement.xml b/android/app/src/main/res/drawable/ic_nav_activity_replacement.xml new file mode 100644 index 000000000..e75453f59 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_activity_replacement.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_app_clone.xml b/android/app/src/main/res/drawable/ic_nav_app_clone.xml new file mode 100644 index 000000000..e034cc4eb --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_app_clone.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_app_lock.xml b/android/app/src/main/res/drawable/ic_nav_app_lock.xml new file mode 100644 index 000000000..4a5dc7e93 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_app_lock.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_app_manager.xml b/android/app/src/main/res/drawable/ic_nav_app_manager.xml new file mode 100644 index 000000000..e8349d8e8 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_app_manager.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_bg_restrict.xml b/android/app/src/main/res/drawable/ic_nav_bg_restrict.xml new file mode 100644 index 000000000..ddee5ec03 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_bg_restrict.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_bg_start.xml b/android/app/src/main/res/drawable/ic_nav_bg_start.xml new file mode 100644 index 000000000..04a93c718 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_bg_start.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_boost.xml b/android/app/src/main/res/drawable/ic_nav_boost.xml new file mode 100644 index 000000000..f25e31481 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_boost.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_nr.xml b/android/app/src/main/res/drawable/ic_nav_nr.xml new file mode 100644 index 000000000..86a7ff423 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_nr.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_op_remind.xml b/android/app/src/main/res/drawable/ic_nav_op_remind.xml new file mode 100644 index 000000000..6d2205b08 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_op_remind.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_ops.xml b/android/app/src/main/res/drawable/ic_nav_ops.xml new file mode 100644 index 000000000..0404a7e58 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_ops.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_plugins.xml b/android/app/src/main/res/drawable/ic_nav_plugins.xml new file mode 100644 index 000000000..799d02f18 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_plugins.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_priv_cheat.xml b/android/app/src/main/res/drawable/ic_nav_priv_cheat.xml new file mode 100644 index 000000000..4d97dde48 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_priv_cheat.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_profile.xml b/android/app/src/main/res/drawable/ic_nav_profile.xml new file mode 100644 index 000000000..a8aac3d2e --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_profile.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_screen_on_notification.xml b/android/app/src/main/res/drawable/ic_nav_screen_on_notification.xml new file mode 100644 index 000000000..0056ba03b --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_screen_on_notification.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_smart_freeze.xml b/android/app/src/main/res/drawable/ic_nav_smart_freeze.xml new file mode 100644 index 000000000..a28516433 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_smart_freeze.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_smart_standby.xml b/android/app/src/main/res/drawable/ic_nav_smart_standby.xml new file mode 100644 index 000000000..b7094979c --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_smart_standby.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_task_blur.xml b/android/app/src/main/res/drawable/ic_nav_task_blur.xml new file mode 100644 index 000000000..780bb14b4 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_task_blur.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_nav_task_removal.xml b/android/app/src/main/res/drawable/ic_nav_task_removal.xml new file mode 100644 index 000000000..f10bc9390 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_nav_task_removal.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/item_feature_dashboard_tile_of_card.xml b/android/app/src/main/res/layout/item_feature_dashboard_tile_of_card.xml index edfc0776e..79ddc5edb 100644 --- a/android/app/src/main/res/layout/item_feature_dashboard_tile_of_card.xml +++ b/android/app/src/main/res/layout/item_feature_dashboard_tile_of_card.xml @@ -34,12 +34,8 @@ android:layout_height="@dimen/dashboard_tile_image_size_large" android:layout_centerHorizontal="true" android:layout_marginTop="@dimen/dashboard_tile_image_margin_end" - android:background="@drawable/circle_bg_blue" - android:featureIcon="@{tile.iconRes}" - android:padding="10dp" - android:tint="@color/md_white" - android:circleBgTint="@{tile.themeColor}" - tools:src="@drawable/ic_rocket_fill" /> + android:navTile="@{tile}" + tools:src="@drawable/ic_nav_boost" /> + + + #4caf50 + #f36352 + #ffa800 + #be5ee7 + #2c8aff + #ffa800 + #8262ff + #f36352 + #90ce02 + #e9244a + #939393 + #51b4cd + #8262ff + #5d4037 + #e91e63 + #ffa800 + #939393 + #f36352 + \ No newline at end of file diff --git a/android/modules/module_common/src/main/java/github/tornaco/android/thanos/common/CommonDataBindingAdapters.java b/android/modules/module_common/src/main/java/github/tornaco/android/thanos/common/CommonDataBindingAdapters.java index 4e12e23fa..26ce4d0a4 100644 --- a/android/modules/module_common/src/main/java/github/tornaco/android/thanos/common/CommonDataBindingAdapters.java +++ b/android/modules/module_common/src/main/java/github/tornaco/android/thanos/common/CommonDataBindingAdapters.java @@ -39,19 +39,6 @@ public static void setIconTint(ImageView imageView, @ColorRes int res) { imageView.setColorFilter(ContextCompat.getColor(imageView.getContext(), res)); } - @BindingAdapter("android:circleBgTint") - public static void setCircleBgTint(ImageView imageView, @ColorRes int res) { - if (res == 0) return; - Drawable bg = AppCompatResources.getDrawable(imageView.getContext(), R.drawable.module_common_circle_bg_blue); - if (bg == null) return; - int iconColor = imageView.getContext().getColor(res); - int lColor = ColorUtils.INSTANCE.lightenColor(iconColor, 0.5f); - - imageView.setColorFilter(iconColor); - bg.setColorFilter(new PorterDuffColorFilter(lColor, PorterDuff.Mode.SRC_IN)); - imageView.setBackground(bg); - } - @BindingAdapter("android:appIcon") public static void setAppIcon(ImageView imageView, AppInfo appInfo) { if (appInfo != null && appInfo.getIconDrawable() > 0) {