From 66ba763f21d3d6fe944149f218f0d27b387bea76 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Tue, 1 Nov 2022 19:50:42 +0800 Subject: [PATCH] feat: Icon Decoration --- .../ui/Adapters/DrawerLayoutAdapter.java | 141 +++++++++--------- .../settings/NekoGeneralSettingsActivity.java | 6 + .../kotlin/xyz/nextalone/nagram/NaConfig.kt | 6 + .../src/main/res/values-zh-rCN/strings_na.xml | 2 + .../src/main/res/values/strings_na.xml | 2 + 5 files changed, 87 insertions(+), 70 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java index ffd273d12..12c54b8bd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java @@ -49,6 +49,7 @@ import cn.hutool.core.util.StrUtil; import kotlin.jvm.functions.Function0; import tw.nekomimi.nekogram.NekoConfig; import tw.nekomimi.nekogram.NekoXConfig; +import xyz.nextalone.nagram.NaConfig; public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter implements NotificationCenter.NotificationCenterDelegate { @@ -285,80 +286,80 @@ public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter imple if (!UserConfig.getInstance(UserConfig.selectedAccount).isClientActivated()) { return; } -// int eventType = Theme.getEventType(); -// int newGroupIcon; -// int newSecretIcon; -// int newChannelIcon; -// int contactsIcon; -// int callsIcon; -// int savedIcon; -// int settingsIcon; -// int inviteIcon; -// int helpIcon; -// int peopleNearbyIcon; -// if (eventType == 0) { -// newGroupIcon = R.drawable.msg_groups_ny; -// //newSecretIcon = R.drawable.msg_secret_ny; -// //newChannelIcon = R.drawable.msg_channel_ny; -// contactsIcon = R.drawable.msg_contacts_ny; -// callsIcon = R.drawable.msg_calls_ny; -// savedIcon = R.drawable.msg_saved_ny; -// settingsIcon = R.drawable.msg_settings_ny; -// inviteIcon = R.drawable.msg_invite_ny; -// helpIcon = R.drawable.msg_help_ny; -// peopleNearbyIcon = R.drawable.msg_nearby_ny; -// } else if (eventType == 1) { -// newGroupIcon = R.drawable.msg_groups_14; -// //newSecretIcon = R.drawable.msg_secret_14; -// //newChannelIcon = R.drawable.msg_channel_14; -// contactsIcon = R.drawable.msg_contacts_14; -// callsIcon = R.drawable.msg_calls_14; -// savedIcon = R.drawable.msg_saved_14; -// settingsIcon = R.drawable.msg_settings_14; -// inviteIcon = R.drawable.msg_secret_ny; -// helpIcon = R.drawable.msg_help; -// peopleNearbyIcon = R.drawable.msg_secret_14; -// } else if (eventType == 2) { -// newGroupIcon = R.drawable.msg_groups_hw; -// //newSecretIcon = R.drawable.msg_secret_hw; -// //newChannelIcon = R.drawable.msg_channel_hw; -// contactsIcon = R.drawable.msg_contacts_hw; -// callsIcon = R.drawable.msg_calls_hw; -// savedIcon = R.drawable.msg_saved_hw; -// settingsIcon = R.drawable.msg_settings_hw; -// inviteIcon = R.drawable.msg_invite_hw; -// helpIcon = R.drawable.msg_help_hw; -// peopleNearbyIcon = R.drawable.msg_secret_hw; -// } else { -// newGroupIcon = R.drawable.msg_groups; -// //newSecretIcon = R.drawable.msg_secret; -// //newChannelIcon = R.drawable.msg_channel; -// contactsIcon = R.drawable.msg_contacts; -// callsIcon = R.drawable.msg_calls; -// savedIcon = R.drawable.msg_saved; -// settingsIcon = R.drawable.msg_settings_old; -// inviteIcon = R.drawable.msg_invite; -// helpIcon = R.drawable.msg_help; -// peopleNearbyIcon = R.drawable.msg_nearby; -// } -// UserConfig me = UserConfig.getInstance(UserConfig.selectedAccount); -// if (me != null && me.isPremium()) { -// if (me.getEmojiStatus() != null) { -// items.add(new Item(15, LocaleController.getString("ChangeEmojiStatus", R.string.ChangeEmojiStatus), 0, R.raw.emoji_status_change_to_set)); -// } else { -// items.add(new Item(15, LocaleController.getString("SetEmojiStatus", R.string.SetEmojiStatus), 0, R.raw.emoji_status_set_to_change)); -// } -// items.add(null); // divider -// } + int eventType = Theme.getEventType(); + int newGroupIcon; + int newSecretIcon; + int newChannelIcon; + int contactsIcon; + int callsIcon; + int savedIcon; + int settingsIcon; + int inviteIcon; + int helpIcon; + int peopleNearbyIcon; + if (eventType == 0 || NaConfig.INSTANCE.getIconDecoration().Int() == 1) { + newGroupIcon = R.drawable.msg_groups_ny; + //newSecretIcon = R.drawable.msg_secret_ny; + //newChannelIcon = R.drawable.msg_channel_ny; + contactsIcon = R.drawable.msg_contacts_ny; + callsIcon = R.drawable.msg_calls_ny; + savedIcon = R.drawable.msg_saved_ny; + settingsIcon = R.drawable.msg_settings_ny; + inviteIcon = R.drawable.msg_invite_ny; + helpIcon = R.drawable.msg_help_ny; + peopleNearbyIcon = R.drawable.msg_nearby_ny; + } else if (eventType == 1 || NaConfig.INSTANCE.getIconDecoration().Int() == 2) { + newGroupIcon = R.drawable.msg_groups_14; + //newSecretIcon = R.drawable.msg_secret_14; + //newChannelIcon = R.drawable.msg_channel_14; + contactsIcon = R.drawable.msg_contacts_14; + callsIcon = R.drawable.msg_calls_14; + savedIcon = R.drawable.msg_saved_14; + settingsIcon = R.drawable.msg_settings_14; + inviteIcon = R.drawable.msg_secret_ny; + helpIcon = R.drawable.msg_help; + peopleNearbyIcon = R.drawable.msg_secret_14; + } else if (eventType == 2 || NaConfig.INSTANCE.getIconDecoration().Int() == 3) { + newGroupIcon = R.drawable.msg_groups_hw; + //newSecretIcon = R.drawable.msg_secret_hw; + //newChannelIcon = R.drawable.msg_channel_hw; + contactsIcon = R.drawable.msg_contacts_hw; + callsIcon = R.drawable.msg_calls_hw; + savedIcon = R.drawable.msg_saved_hw; + settingsIcon = R.drawable.msg_settings_hw; + inviteIcon = R.drawable.msg_invite_hw; + helpIcon = R.drawable.msg_help_hw; + peopleNearbyIcon = R.drawable.msg_secret_hw; + } else { + newGroupIcon = R.drawable.msg_groups; + //newSecretIcon = R.drawable.msg_secret; + //newChannelIcon = R.drawable.msg_channel; + contactsIcon = R.drawable.msg_contacts; + callsIcon = R.drawable.msg_calls; + savedIcon = R.drawable.msg_saved; + settingsIcon = R.drawable.msg_settings_old; + inviteIcon = R.drawable.msg_invite; + helpIcon = R.drawable.msg_help; + peopleNearbyIcon = R.drawable.msg_nearby; + } + UserConfig me = UserConfig.getInstance(UserConfig.selectedAccount); + if (me != null && me.isPremium()) { + if (me.getEmojiStatus() != null) { + items.add(new Item(15, LocaleController.getString("ChangeEmojiStatus", R.string.ChangeEmojiStatus), 0, R.raw.emoji_status_change_to_set)); + } else { + items.add(new Item(15, LocaleController.getString("SetEmojiStatus", R.string.SetEmojiStatus), 0, R.raw.emoji_status_set_to_change)); + } + items.add(null); // divider + } // TODO: NekoX: Fix icon here - int newGroupIcon = R.drawable.baseline_group_24; +// int newGroupIcon = R.drawable.baseline_group_24; // int newSecretIcon = R.drawable.baseline_lock_24; // int newChannelIcon = R.drawable.baseline_chat_bubble_24; - int contactsIcon = R.drawable.baseline_perm_contact_calendar_24; - int savedIcon = R.drawable.baseline_bookmark_24; - int settingsIcon = R.drawable.baseline_settings_24; - int callsIcon = R.drawable.baseline_call_24; +// int contactsIcon = R.drawable.baseline_perm_contact_calendar_24; +// int savedIcon = R.drawable.baseline_bookmark_24; +// int settingsIcon = R.drawable.baseline_settings_24; +// int callsIcon = R.drawable.baseline_call_24; items.add(new Item(2, LocaleController.getString("NewGroup", R.string.NewGroup), newGroupIcon)); // items.add(new Item(3, LocaleController.getString("NewSecretChat", R.string.NewSecretChat), newSecretIcon)); diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoGeneralSettingsActivity.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoGeneralSettingsActivity.java index ef1941c6c..d3d0be827 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoGeneralSettingsActivity.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoGeneralSettingsActivity.java @@ -169,6 +169,12 @@ public class NekoGeneralSettingsActivity extends BaseFragment { LocaleController.getString("Snowflakes", R.string.Snowflakes), LocaleController.getString("Fireworks", R.string.Fireworks) }, null)); + private final AbstractConfigCell iconDecorationRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NaConfig.INSTANCE.getIconDecoration(), new String[]{ + LocaleController.getString("DependsOnDate", R.string.DependsOnDate), + LocaleController.getString("Christmas", R.string.Christmas), + LocaleController.getString("Valentine", R.string.Valentine), + LocaleController.getString("HalloWeen", R.string.HalloWeen) + }, null)); private final AbstractConfigCell tabletModeRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NekoConfig.tabletMode, new String[]{ LocaleController.getString("TabletModeDefault", R.string.TabletModeDefault), LocaleController.getString("Enable", R.string.Enable), diff --git a/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt b/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt index 5f6db9556..bd4ed4ad1 100644 --- a/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt +++ b/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt @@ -346,6 +346,12 @@ object NaConfig { ConfigItem.configTypeBool, false ) + val iconDecoration = + addConfig( + "IconDecoration", + ConfigItem.configTypeInt, + 0 + ) private fun addConfig( k: String, diff --git a/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml b/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml index 92f1ef37c..7301e8a9e 100644 --- a/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml +++ b/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml @@ -69,4 +69,6 @@ 切换皮套隐藏大会员专享 伪装高性能设备 解除 emoji 渲染上限 + 图标装饰 + 万圣节 diff --git a/TMessagesProj/src/main/res/values/strings_na.xml b/TMessagesProj/src/main/res/values/strings_na.xml index 8a257d56b..6a626d74c 100644 --- a/TMessagesProj/src/main/res/values/strings_na.xml +++ b/TMessagesProj/src/main/res/values/strings_na.xml @@ -70,4 +70,6 @@ Hide Premium Only Channel Fake High Performance Device Disable Emoji Draw Limit + Icon Decoration + HalloWeen