Allow disable number rounding

This commit is contained in:
世界 2020-05-18 10:30:44 +08:00
parent d6530b13eb
commit 18b6cc5135
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
6 changed files with 39 additions and 4 deletions

View File

@ -54,7 +54,7 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
implementation "com.squareup.okhttp3:okhttp-dnsoverhttps:$okHttpVersion"
implementation 'dnsjava:dnsjava:3.0.2'
implementation 'dnsjava:dnsjava:3.1.0'
implementation 'org.dizitart:nitrite:3.4.1'
implementation 'net.lingala.zip4j:zip4j:2.5.2'
@ -134,6 +134,12 @@ android {
}
bundle {
language {
enableSplit = false
}
}
externalNativeBuild {
ndkBuild {
path "jni/Android.mk"

View File

@ -43,6 +43,7 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.TimeZone;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.utils.FileUtil;
public class LocaleController {
@ -353,7 +354,7 @@ public class LocaleController {
localeInfo.name = "简体中文 ( NekoX )";
localeInfo.nameEnglish = "Simplified Chinese ( NekoX )";
localeInfo.shortName = "nekox_zh_cn";
localeInfo.baseLangCode = "zh_hans";
localeInfo.baseLangCode = "zh_hans_raw";
localeInfo.isRtl = false;
localeInfo.pathToFile = "unofficial";
localeInfo.pluralLangCode = "zh_cn";
@ -367,7 +368,7 @@ public class LocaleController {
localeInfo.name = "瓜体中文 \uD83D\uDE36";
localeInfo.nameEnglish = "Duangified Chinese (Simplified)";
localeInfo.shortName = "duang_zh_hans";
localeInfo.baseLangCode = "zh_hans";
localeInfo.baseLangCode = "zh_hans_raw";
localeInfo.isRtl = false;
localeInfo.pathToFile = "unofficial";
localeInfo.pluralLangCode = "zh_duang";
@ -1692,6 +1693,12 @@ public class LocaleController {
}
public static String formatShortNumber(int number, int[] rounded) {
if (NekoConfig.disableNumberRounding) {
if (rounded != null) {
rounded[0] = number;
}
return String.valueOf(number);
}
StringBuilder K = new StringBuilder();
int lastDec = 0;
int KCount = 0;

View File

@ -5012,6 +5012,9 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
file.close();
} catch (Exception e) {
FileLog.e(e);
try {
BitmapFactory.decodeFile(path, bmOptions);
} catch (Exception ignore) { }
}
if (bmOptions.outWidth != 0 && bmOptions.outHeight != 0 && bmOptions.outWidth <= 800 && bmOptions.outHeight <= 800) {
TLRPC.TL_documentAttributeSticker attributeSticker = new TLRPC.TL_documentAttributeSticker();

View File

@ -1912,6 +1912,8 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
ClipDescription description = inputContentInfo.getDescription();
if (description.hasMimeType("image/gif")) {
SendMessagesHelper.prepareSendingDocument(accountInstance, null, null, inputContentInfo.getContentUri(), null, "image/gif", dialog_id, replyingMessageObject, inputContentInfo, null, notify, 0);
} else if (description.hasMimeType("image/png")) {
SendMessagesHelper.prepareSendingDocument(accountInstance, null, null, inputContentInfo.getContentUri(), null, "image/webp", dialog_id, replyingMessageObject, inputContentInfo, null, notify, 0);
} else {
SendMessagesHelper.prepareSendingPhoto(accountInstance, null, inputContentInfo.getContentUri(), dialog_id, replyingMessageObject, null, null, null, inputContentInfo, 0, null, notify, 0);
}

View File

@ -35,6 +35,7 @@ public class NekoConfig {
public static boolean hideAllTab;
public static boolean confirmAVMessage;
public static boolean askBeforeCall;
public static boolean disableNumberRounding;
public static int mapPreviewProvider;
public static float stickerSize;
public static int translationProvider;
@ -200,6 +201,7 @@ public class NekoConfig {
tabsTitleType = preferences.getInt("tabsTitleType", TITLE_TYPE_TEXT);
confirmAVMessage = preferences.getBoolean("confirmAVMessage", false);
askBeforeCall = preferences.getBoolean("askBeforeCall", false);
disableNumberRounding = preferences.getBoolean("disableNumberRounding", false);
hideProxyByDefault = preferences.getBoolean("hide_proxy_by_default", BuildVars.isMini);
useProxyItem = preferences.getBoolean("use_proxy_item",false);
@ -682,4 +684,10 @@ public class NekoConfig {
}
public static void toggleDisableNumberRounding() {
preferences.edit().putBoolean("disableNumberRounding",disableNumberRounding = !disableNumberRounding).apply();
}
}

View File

@ -101,6 +101,7 @@ public class NekoSettingsActivity extends BaseFragment {
private int hideAllTabRow;
private int confirmAVRow;
private int askBeforeCallRow;
private int disableNumberRoundingRow;
private int mapPreviewRow;
private int stickerSizeRow;
private int messageMenuRow;
@ -682,6 +683,11 @@ public class NekoSettingsActivity extends BaseFragment {
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.askBeforeCall);
}
} else if (position == disableNumberRoundingRow) {
NekoConfig.toggleDisableNumberRounding();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.disableNumberRounding);
}
}
});
@ -727,6 +733,7 @@ public class NekoSettingsActivity extends BaseFragment {
hideAllTabRow = rowCount++;
confirmAVRow = rowCount++;
askBeforeCallRow = rowCount++;
disableNumberRoundingRow = rowCount++;
mapPreviewRow = rowCount++;
stickerSizeRow = rowCount++;
messageMenuRow = rowCount++;
@ -1385,6 +1392,8 @@ public class NekoSettingsActivity extends BaseFragment {
textCell.setTextAndCheck(LocaleController.getString("ConfirmAVMessage", R.string.ConfirmAVMessage), NekoConfig.confirmAVMessage, true);
} else if (position == askBeforeCallRow) {
textCell.setTextAndCheck(LocaleController.getString("AskBeforeCalling", R.string.AskBeforeCalling), NekoConfig.askBeforeCall, true);
} else if (position == disableNumberRoundingRow) {
textCell.setTextAndValueAndCheck(LocaleController.getString("DisableNumberRounding", R.string.DisableNumberRounding), "4.8K -> 4777", NekoConfig.disableNumberRounding, true, true);
}
break;
}
@ -1482,7 +1491,7 @@ public class NekoSettingsActivity extends BaseFragment {
position == removeTitleEmojiRow || position == ignoreMutedCountRow ||
position == useDefaultThemeRow || position == showIdAndDcRow || position == showTabsOnForwardRow ||
position == chatMessageAnimationRow || position == rearVideoMessagesRow || position == hideAllTabRow ||
position == confirmAVRow || position == askBeforeCallRow) {
position == confirmAVRow || position == askBeforeCallRow || position == disableNumberRoundingRow) {
return 3;
} else if (position == settingsRow || position == connectionRow || position == chatRow || position == transRow || position == experimentRow || position == dialogsRow || position == privacyRow) {
return 4;