mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-11-16 19:57:09 +01:00
Message menu settings
This commit is contained in:
parent
76e54cbd9a
commit
b7c9dd2e32
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -3,6 +3,7 @@
|
||||
<string name="NekoSettings">喵設定</string>
|
||||
<string name="IPv6">IPv6 で接続することを優先する</string>
|
||||
<string name="HidePhone">あなたの携帯電話番号を隠す</string>
|
||||
<string name="MessageMenu">メッセージメニュー</string>
|
||||
<string name="Hide">隠す</string>
|
||||
<string name="DeleteAllFromSelf">送信したすべてのメッセージを削除する</string>
|
||||
<string name="BotLogin">ボットログイン</string>
|
||||
|
@ -3,6 +3,7 @@
|
||||
<string name="NekoSettings">喵设置</string>
|
||||
<string name="IPv6">优先尝试使用 IPv6 连接</string>
|
||||
<string name="HidePhone">隐藏咱的手机号</string>
|
||||
<string name="MessageMenu">消息菜单</string>
|
||||
<string name="Hide">隐藏</string>
|
||||
<string name="DeleteAllFromSelf">删除全部自己的历史消息</string>
|
||||
<string name="BotLogin">机器人登录</string>
|
||||
@ -14,7 +15,7 @@
|
||||
<string name="FirstLast">名字 姓氏</string>
|
||||
<string name="LastFirst">姓氏 名字</string>
|
||||
<string name="NoQuoteForward">无引用转发</string>
|
||||
<string name="AddToSavedMessages">添加到自嗨</string>
|
||||
<string name="AddToSavedMessages">拿去自嗨</string>
|
||||
<string name="Repeat">复读</string>
|
||||
<string name="CreateMention">创建\@</string>
|
||||
<string name="ForceTabletMode">假装是平板(重启生效)</string>
|
||||
|
@ -3,6 +3,7 @@
|
||||
<string name="NekoSettings">喵設定</string>
|
||||
<string name="IPv6">優先嘗試透過 IPv6 連線</string>
|
||||
<string name="HidePhone">隱藏您的手機號碼</string>
|
||||
<string name="MessageMenu">訊息菜單</string>
|
||||
<string name="Hide">隱藏</string>
|
||||
<string name="DeleteAllFromSelf">刪除所有您傳送的訊息</string>
|
||||
<string name="BotLogin">機器人登入</string>
|
||||
@ -14,7 +15,7 @@
|
||||
<string name="FirstLast">名字 姓氏</string>
|
||||
<string name="LastFirst">姓氏 名字</string>
|
||||
<string name="NoQuoteForward">無引用轉發</string>
|
||||
<string name="AddToSavedMessages">添加到自嗨</string>
|
||||
<string name="AddToSavedMessages">拿去自嗨</string>
|
||||
<string name="Repeat">复讀</string>
|
||||
<string name="CreateMention">提及使用者</string>
|
||||
<string name="ForceTabletMode">強制平板模式(重啟生效)</string>
|
||||
|
@ -2,6 +2,7 @@
|
||||
<resources>
|
||||
<string name="NekoSettings">Neko Settings</string>
|
||||
<string name="IPv6">Try connecting through IPv6</string>
|
||||
<string name="MessageMenu">Message menu</string>
|
||||
<string name="HidePhone">Hide my phone number</string>
|
||||
<string name="Hide">Hide</string>
|
||||
<string name="DeleteAllFromSelf">Delete all from yourself</string>
|
||||
|
Loading…
Reference in New Issue
Block a user