diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index b2aa29a35..902a68afb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -12845,9 +12845,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not items.add(LocaleController.getString("NoQuoteForward", R.string.NoQuoteForward)); options.add(95); icons.add(R.drawable.msg_forward); - items.add(LocaleController.getString("AddToSavedMessages", R.string.AddToSavedMessages)); - options.add(93); - icons.add(R.drawable.menu_saved); + if (NekoConfig.showAddToSavedMessages) { + items.add(LocaleController.getString("AddToSavedMessages", R.string.AddToSavedMessages)); + options.add(93); + icons.add(R.drawable.menu_saved); + } boolean allowRepeat = currentUser != null || (currentChat != null && ChatObject.canSendMessages(currentChat)); boolean allowPrpr = currentUser != null @@ -12857,7 +12859,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not options.add(94); icons.add(R.drawable.msg_repeat); } - if (allowPrpr) { + if (allowPrpr && NekoConfig.showPrPr) { items.add(LocaleController.getString("Prpr", R.string.Prpr)); options.add(27); icons.add(R.drawable.msg_prpr); @@ -12882,7 +12884,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not options.add(102); icons.add(R.drawable.msg_schedule); } - if (!inScheduleMode && selectedObject.contentType == 0 && selectedObject.getId() > 0 && !selectedObject.isOut() && (currentChat != null || currentUser != null && currentUser.bot)) { + if (!inScheduleMode && selectedObject.contentType == 0 && selectedObject.getId() > 0 && !selectedObject.isOut() && (currentChat != null || currentUser != null && currentUser.bot) + && NekoConfig.showReport) { items.add(LocaleController.getString("ReportChat", R.string.ReportChat)); options.add(23); icons.add(R.drawable.msg_report); @@ -12985,7 +12988,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not editingAdmin = participant instanceof TLRPC.TL_chatParticipantAdmin; } - if (canEditAdmin) { + if (canEditAdmin && NekoConfig.showAdminActions) { items.add(editingAdmin ? LocaleController.getString("EditAdminRights", R.string.EditAdminRights) : LocaleController.getString("SetAsAdmin", R.string.SetAsAdmin)); options.add(97); if (editingAdmin) { @@ -12994,7 +12997,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not icons.add(R.drawable.add_admin); } } - if (canRestrict) { + if (canRestrict && NekoConfig.showChangePermissions) { items.add(LocaleController.getString("ChangePermissions", R.string.ChangePermissions)); options.add(98); icons.add(R.drawable.group_banned); diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java index bfc1ff7c8..fa154828f 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java @@ -20,6 +20,13 @@ public class NekoConfig { public static boolean navigationBarTint = true; public static int navigationBarColor = 2; public static boolean residentNotification = false; + + public static boolean showAddToSavedMessages = true; + public static boolean showReport = false; + public static boolean showPrPr = true; + public static boolean showAdminActions = true; + public static boolean showChangePermissions = true; + private static boolean configLoaded; static { @@ -41,6 +48,11 @@ public class NekoConfig { editor.putBoolean("navigationBarTint", navigationBarTint); editor.putInt("navigationBarColor", navigationBarColor); editor.putBoolean("residentNotification", residentNotification); + editor.putBoolean("showAddToSavedMessages", showAddToSavedMessages); + editor.putBoolean("showReport", showReport); + editor.putBoolean("showPrPr", showPrPr); + editor.putBoolean("showAdminActions", showAdminActions); + editor.putBoolean("showChangePermissions", showChangePermissions); editor.commit(); } catch (Exception e) { @@ -65,10 +77,57 @@ public class NekoConfig { navigationBarTint = preferences.getBoolean("navigationBarTint", true); navigationBarColor = preferences.getInt("navigationBarColor", 2); residentNotification = preferences.getBoolean("residentNotification", false); + showAddToSavedMessages = preferences.getBoolean("showAddToSavedMessages", true); + showReport = preferences.getBoolean("showReport", false); + showPrPr = preferences.getBoolean("showPrPr", true); + showAdminActions = preferences.getBoolean("showAdminActions", true); + showChangePermissions = preferences.getBoolean("showChangePermissions", true); configLoaded = true; } } + public static void toggleShowAddToSavedMessages() { + showAddToSavedMessages = !showAddToSavedMessages; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean("showAddToSavedMessages", showAddToSavedMessages); + editor.commit(); + } + + public static void toggleShowReport() { + showReport = !showReport; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean("showReport", showReport); + editor.commit(); + } + + + public static void toggleShowPrPr() { + showPrPr = !showPrPr; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean("showPrPr", showPrPr); + editor.commit(); + } + + public static void toggleShowAdminActions() { + showAdminActions = !showAdminActions; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean("showAdminActions", showAdminActions); + editor.commit(); + } + + public static void toggleShowChangePermissions() { + showChangePermissions = !showChangePermissions; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean("showChangePermissions", showChangePermissions); + editor.commit(); + } + + public static void toggleIPv6() { useIPv6 = !useIPv6; SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java index e953f38f5..2e96f7744 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java @@ -53,9 +53,13 @@ public class NekoSettingsActivity extends BaseFragment { private int ipv6Row; private int connection2Row; - private int emojiRow; - private int useSystemEmojiRow; - private int emoji2Row; + private int messageMenuRow; + private int showAddToSavedMessagesRow; + private int showReportRow; + private int showPrPrRow; + private int showAdminActionsRow; + private int showChangePermissionsRow; + private int messageMenu2Row; private int chatRow; private int ignoreBlockedRow; @@ -64,6 +68,7 @@ public class NekoSettingsActivity extends BaseFragment { private int settingsRow; private int hidePhoneRow; private int inappCameraRow; + private int useSystemEmojiRow; private int nameOrderRow; private int transparentStatusBarRow; private int navigationBarTintRow; @@ -138,6 +143,31 @@ public class NekoSettingsActivity extends BaseFragment { if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(SharedConfig.inappCamera); } + } else if (position == showAddToSavedMessagesRow) { + NekoConfig.toggleShowAddToSavedMessages(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(NekoConfig.showAddToSavedMessages); + } + } else if (position == showAdminActionsRow) { + NekoConfig.toggleShowAdminActions(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(NekoConfig.showAdminActions); + } + } else if (position == showChangePermissionsRow) { + NekoConfig.toggleShowChangePermissions(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(NekoConfig.showChangePermissions); + } + } else if (position == showPrPrRow) { + NekoConfig.toggleShowPrPr(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(NekoConfig.showPrPr); + } + } else if (position == showReportRow) { + NekoConfig.toggleShowReport(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(NekoConfig.showReport); + } } else if (position == forceTabletRow) { NekoConfig.toggleForceTablet(); if (view instanceof TextCheckCell) { @@ -219,15 +249,20 @@ public class NekoSettingsActivity extends BaseFragment { connectionRow = rowCount++; ipv6Row = rowCount++; connection2Row = rowCount++; - emojiRow = rowCount++; - useSystemEmojiRow = rowCount++; - emoji2Row = rowCount++; chatRow = rowCount++; ignoreBlockedRow = rowCount++; chat2Row = rowCount++; + messageMenuRow = rowCount++; + showAddToSavedMessagesRow = rowCount++; + showPrPrRow = rowCount++; + showReportRow = rowCount++; + showAdminActionsRow = rowCount++; + showChangePermissionsRow = rowCount++; + messageMenu2Row = rowCount++; settingsRow = rowCount++; hidePhoneRow = rowCount++; inappCameraRow = rowCount++; + useSystemEmojiRow = rowCount++; navigationBarTintRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ? rowCount++ : -1; transparentStatusBarRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? rowCount++ : -1; navigationBarColorRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ? rowCount++ : -1; @@ -333,6 +368,16 @@ public class NekoSettingsActivity extends BaseFragment { TextCheckCell textCell = (TextCheckCell) holder.itemView; if (position == ipv6Row) { textCell.setTextAndCheck(LocaleController.getString("IPv6", R.string.IPv6), NekoConfig.useIPv6, false); + } else if (position == showAddToSavedMessagesRow) { + textCell.setTextAndCheck(LocaleController.getString("AddToSavedMessages", R.string.AddToSavedMessages), NekoConfig.showAddToSavedMessages, true); + } else if (position == showPrPrRow) { + textCell.setTextAndCheck(LocaleController.getString("Prpr", R.string.Prpr), NekoConfig.showPrPr, true); + } else if (position == showReportRow) { + textCell.setTextAndCheck(LocaleController.getString("ReportChat", R.string.ReportChat), NekoConfig.showReport, true); + } else if (position == showAdminActionsRow) { + textCell.setTextAndCheck(LocaleController.getString("EditAdminRights", R.string.EditAdminRights), NekoConfig.showAdminActions, true); + } else if (position == showChangePermissionsRow) { + textCell.setTextAndCheck(LocaleController.getString("ChangePermissions", R.string.ChangePermissions), NekoConfig.showChangePermissions, false); } else if (position == hidePhoneRow) { textCell.setTextAndCheck(LocaleController.getString("HidePhone", R.string.HidePhone), NekoConfig.hidePhone, true); } else if (position == inappCameraRow) { @@ -342,7 +387,7 @@ public class NekoSettingsActivity extends BaseFragment { } else if (position == navigationBarTintRow) { textCell.setTextAndCheck(LocaleController.getString("NavigationBarTint", R.string.NavigationBarTint), NekoConfig.navigationBarTint, true); } else if (position == useSystemEmojiRow) { - textCell.setTextAndCheck(LocaleController.getString("EmojiUseDefault", R.string.EmojiUseDefault), SharedConfig.useSystemEmoji, false); + textCell.setTextAndCheck(LocaleController.getString("EmojiUseDefault", R.string.EmojiUseDefault), SharedConfig.useSystemEmoji, true); } else if (position == ignoreBlockedRow) { textCell.setTextAndCheck(LocaleController.getString("IgnoreBlocked", R.string.IgnoreBlocked), NekoConfig.ignoreBlocked, false); } else if (position == forceTabletRow) { @@ -354,8 +399,8 @@ public class NekoSettingsActivity extends BaseFragment { HeaderCell headerCell = (HeaderCell) holder.itemView; if (position == settingsRow) { headerCell.setText(LocaleController.getString("Settings", R.string.Settings)); - } else if (position == emojiRow) { - headerCell.setText(LocaleController.getString("Emoji", R.string.Emoji)); + } else if (position == messageMenuRow) { + headerCell.setText(LocaleController.getString("MessageMenu", R.string.MessageMenu)); } else if (position == connectionRow) { headerCell.setText(LocaleController.getString("Connection", R.string.Connection)); } else if (position == chatRow) { @@ -371,6 +416,8 @@ public class NekoSettingsActivity extends BaseFragment { int position = holder.getAdapterPosition(); return position == hidePhoneRow || position == inappCameraRow || position == ignoreBlockedRow || position == navigationBarTintRow || position == useSystemEmojiRow || position == ipv6Row || + position == showChangePermissionsRow || position == showAdminActionsRow || position == showReportRow || + position == showPrPrRow || position == showAddToSavedMessagesRow || position == nameOrderRow || position == forceTabletRow || (position == transparentStatusBarRow && (NekoConfig.navigationBarTint || Build.VERSION.SDK_INT < Build.VERSION_CODES.O)) || (position == navigationBarColorRow && NekoConfig.navigationBarTint); @@ -410,16 +457,18 @@ public class NekoSettingsActivity extends BaseFragment { @Override public int getItemViewType(int position) { - if (position == settings2Row || position == emoji2Row || position == connection2Row || position == chat2Row) { + if (position == settings2Row || position == messageMenu2Row || position == connection2Row || position == chat2Row) { return 1; } else if (position == nameOrderRow || position == navigationBarColorRow) { return 2; } else if (position == ipv6Row || position == hidePhoneRow || position == inappCameraRow || + position == showAddToSavedMessagesRow || position == showPrPrRow || position == showReportRow || + position == showAdminActionsRow || position == showChangePermissionsRow || position == transparentStatusBarRow || position == navigationBarTintRow || position == ignoreBlockedRow || position == useSystemEmojiRow || position == forceTabletRow) { return 3; - } else if (position == settingsRow || position == connectionRow || position == emojiRow || position == chatRow) { + } else if (position == settingsRow || position == connectionRow || position == messageMenuRow || position == chatRow) { return 4; } return 6; diff --git a/TMessagesProj/src/main/res/values-ja/strings_neko.xml b/TMessagesProj/src/main/res/values-ja/strings_neko.xml index 5da2ac194..a392ecf0e 100644 --- a/TMessagesProj/src/main/res/values-ja/strings_neko.xml +++ b/TMessagesProj/src/main/res/values-ja/strings_neko.xml @@ -3,6 +3,7 @@ 喵設定 IPv6 で接続することを優先する あなたの携帯電話番号を隠す + メッセージメニュー 隠す 送信したすべてのメッセージを削除する ボットログイン diff --git a/TMessagesProj/src/main/res/values-zh-rCN/strings_neko.xml b/TMessagesProj/src/main/res/values-zh-rCN/strings_neko.xml index 5dcd1f2e0..de10b58ee 100644 --- a/TMessagesProj/src/main/res/values-zh-rCN/strings_neko.xml +++ b/TMessagesProj/src/main/res/values-zh-rCN/strings_neko.xml @@ -3,6 +3,7 @@ 喵设置 优先尝试使用 IPv6 连接 隐藏咱的手机号 + 消息菜单 隐藏 删除全部自己的历史消息 机器人登录 @@ -14,7 +15,7 @@ 名字 姓氏 姓氏 名字 无引用转发 - 添加到自嗨 + 拿去自嗨 复读 创建\@ 假装是平板(重启生效) diff --git a/TMessagesProj/src/main/res/values-zh-rTW/strings_neko.xml b/TMessagesProj/src/main/res/values-zh-rTW/strings_neko.xml index 0eff44105..6ca253d60 100644 --- a/TMessagesProj/src/main/res/values-zh-rTW/strings_neko.xml +++ b/TMessagesProj/src/main/res/values-zh-rTW/strings_neko.xml @@ -3,6 +3,7 @@ 喵設定 優先嘗試透過 IPv6 連線 隱藏您的手機號碼 + 訊息菜單 隱藏 刪除所有您傳送的訊息 機器人登入 @@ -14,7 +15,7 @@ 名字 姓氏 姓氏 名字 無引用轉發 - 添加到自嗨 + 拿去自嗨 复讀 提及使用者 強制平板模式(重啟生效) diff --git a/TMessagesProj/src/main/res/values/strings_neko.xml b/TMessagesProj/src/main/res/values/strings_neko.xml index c3287999c..c741c9cd8 100644 --- a/TMessagesProj/src/main/res/values/strings_neko.xml +++ b/TMessagesProj/src/main/res/values/strings_neko.xml @@ -2,6 +2,7 @@ Neko Settings Try connecting through IPv6 + Message menu Hide my phone number Hide Delete all from yourself