feat: Icon Decoration

This commit is contained in:
xtaodada 2022-11-01 19:50:42 +08:00
parent 44eec7a0f2
commit 66ba763f21
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
5 changed files with 87 additions and 70 deletions

View File

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

View File

@ -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),

View File

@ -346,6 +346,12 @@ object NaConfig {
ConfigItem.configTypeBool,
false
)
val iconDecoration =
addConfig(
"IconDecoration",
ConfigItem.configTypeInt,
0
)
private fun addConfig(
k: String,

View File

@ -69,4 +69,6 @@
<string name="HidePremiumOnlyChannel">切换皮套隐藏大会员专享</string>
<string name="FakeHighPerformanceDevice">伪装高性能设备</string>
<string name="DisableEmojiDrawLimit">解除 emoji 渲染上限</string>
<string name="IconDecoration">图标装饰</string>
<string name="HalloWeen">万圣节</string>
</resources>

View File

@ -70,4 +70,6 @@
<string name="HidePremiumOnlyChannel">Hide Premium Only Channel</string>
<string name="FakeHighPerformanceDevice">Fake High Performance Device</string>
<string name="DisableEmojiDrawLimit">Disable Emoji Draw Limit</string>
<string name="IconDecoration">Icon Decoration</string>
<string name="HalloWeen">HalloWeen</string>
</resources>