feat: Custom Edited Message Notice

This commit is contained in:
xtaodada 2022-10-01 22:46:49 +08:00
parent 4bc5e20e4f
commit 29f4f48bf2
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
5 changed files with 15 additions and 4 deletions

View File

@ -10835,7 +10835,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else if (currentMessageObject.scheduled && currentMessageObject.messageOwner.date == 0x7FFFFFFE) {
timeString = "";
} else if (edited) {
timeString = LocaleController.getString("EditedMessage", R.string.EditedMessage) + " " + LocaleController.getInstance().formatterDay.format((long) (messageObject.messageOwner.date) * 1000);
String customStr = NaConfig.INSTANCE.getCustomEditedMessage().String();
timeString = (customStr.equals("") ? LocaleController.getString("EditedMessage", R.string.EditedMessage) : customStr) + " " + LocaleController.getInstance().formatterDay.format((long) (messageObject.messageOwner.date) * 1000);
} else if (LocaleController.getInstance().formatterDay != null && LocaleController.getInstance().formatterYear != null) {
timeString = LocaleController.getInstance().formatterDay.format((long) (messageObject.messageOwner.date) * 1000);
} else {
@ -16679,7 +16680,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
}
if (edited && !lastDrawingEdited && timeLayout != null) {
String editedStr = LocaleController.getString("EditedMessage", R.string.EditedMessage);
String customStr = NaConfig.INSTANCE.getCustomEditedMessage().String();
String editedStr = customStr.equals("") ? LocaleController.getString("EditedMessage", R.string.EditedMessage) : customStr;
String text = timeLayout.getText().toString();
int i = text.indexOf(editedStr);
if (i >= 0) {

View File

@ -84,7 +84,8 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
private final AbstractConfigCell showSpoilersDirectlyRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.showSpoilersDirectly));
private final AbstractConfigCell messageMenuRow = cellGroup.appendCell(new ConfigCellSelectBox(LocaleController.getString("MessageMenu"), null, null, this::showMessageMenuAlert));
private final AbstractConfigCell customGreatRow = cellGroup.appendCell(new ConfigCellTextInput(null, NaConfig.INSTANCE.getCustomGreat(), LocaleController.getString(R.string.CustomGreatHint), null,(input) -> input.isEmpty() ? (String) NaConfig.INSTANCE.getCustomGreat().defaultValue : input));
private final AbstractConfigCell CustomPoorRow = cellGroup.appendCell(new ConfigCellTextInput(null, NaConfig.INSTANCE.getCustomPoor(), LocaleController.getString(R.string.CustomPoorHint), null,(input) -> input.isEmpty() ? (String) NaConfig.INSTANCE.getCustomPoor().defaultValue : input));
private final AbstractConfigCell customPoorRow = cellGroup.appendCell(new ConfigCellTextInput(null, NaConfig.INSTANCE.getCustomPoor(), LocaleController.getString(R.string.CustomPoorHint), null,(input) -> input.isEmpty() ? (String) NaConfig.INSTANCE.getCustomPoor().defaultValue : input));
private final AbstractConfigCell customEditedMessageRow = cellGroup.appendCell(new ConfigCellTextInput(null, NaConfig.INSTANCE.getCustomEditedMessage(), "", null));
private final AbstractConfigCell showServicesTime = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowServicesTime()));
private final AbstractConfigCell combineMessageRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NaConfig.INSTANCE.getCombineMessage(), new String[]{
LocaleController.getString("combineMessageEnabledWithReply", R.string.CombineMessageEnabledWithReply),

View File

@ -316,6 +316,12 @@ object NaConfig {
)
)
val customEditedMessage =
addConfig(
"CustomEditedMessage",
ConfigItem.configTypeString,
""
)
private fun addConfig(
k: String,
@ -421,7 +427,7 @@ object NaConfig {
)
)
o.value =
ois.readObject() as HashMap<Int?, Int?>
ois.readObject() as HashMap<*, *>
if (o.value == null) {
o.value =
HashMap<Int, Int>()

View File

@ -65,4 +65,5 @@
<string name="CustomGreatHint">默认好耶</string>
<string name="CustomPoor">自定义长按快捷回复词</string>
<string name="CustomPoorHint">默认破烂</string>
<string name="CustomEditedMessage">自定义已编辑消息提示词</string>
</resources>

View File

@ -66,4 +66,5 @@
<string name="CustomGreatHint">Default great</string>
<string name="CustomPoor">Custom long click reply word</string>
<string name="CustomPoorHint">Default pool</string>
<string name="CustomEditedMessage">Custom Edited Message word</string>
</resources>