mirror of https://github.com/NekoX-Dev/NekoX.git
Merge remote-tracking branch 'nekogram/master'
This commit is contained in:
commit
e68969e2b9
|
@ -258,7 +258,7 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 10 * 1873
|
||||
defaultConfig.versionCode = 10 * 1875
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
|
|
|
@ -1069,10 +1069,10 @@ public class AndroidUtilities {
|
|||
synchronized (typefaceCache) {
|
||||
if (NekoConfig.typeface == 1) {
|
||||
if (assetPath.contains("medium") && assetPath.contains("italic")) {
|
||||
return Typeface.create((Typeface) null, Typeface.BOLD_ITALIC);
|
||||
return Typeface.create(Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP ? "sans-serif-medium" : "sans-serif", Typeface.ITALIC);
|
||||
}
|
||||
if (assetPath.contains("medium")) {
|
||||
return Typeface.create((Typeface) null, Typeface.BOLD);
|
||||
return Typeface.create(Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP ? "sans-serif-medium" : "sans-serif", Typeface.NORMAL);
|
||||
}
|
||||
if (assetPath.contains("italic")) {
|
||||
return Typeface.create((Typeface) null, Typeface.ITALIC);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class BuildVars {
|
|||
public static boolean USE_CLOUD_STRINGS = true;
|
||||
public static boolean CHECK_UPDATES = true;
|
||||
public static boolean TON_WALLET_STANDALONE = false;
|
||||
public static int BUILD_VERSION = 1873;
|
||||
public static int BUILD_VERSION = 1875;
|
||||
public static String BUILD_VERSION_STRING = "5.15.0.3";
|
||||
public static int APP_ID = 336779; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
|
||||
public static String APP_HASH = "b91eefacc86747c068c8d8a16b41500d"; //obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id
|
||||
|
|
|
@ -990,7 +990,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
|||
}
|
||||
}
|
||||
|
||||
public void processForwardFromMyName(MessageObject messageObject, long did) {
|
||||
public void processForwardFromMyName(MessageObject messageObject, long did, boolean nullReply) {
|
||||
if (messageObject == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -1001,18 +1001,18 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
|||
params.put("parentObject", "sent_" + messageObject.messageOwner.to_id.channel_id + "_" + messageObject.getId());
|
||||
}
|
||||
if (messageObject.messageOwner.media.photo instanceof TLRPC.TL_photo) {
|
||||
sendMessage((TLRPC.TL_photo) messageObject.messageOwner.media.photo, null, did, messageObject.replyMessageObject, messageObject.messageOwner.message, messageObject.messageOwner.entities, null, params, true, 0, messageObject.messageOwner.media.ttl_seconds, messageObject);
|
||||
sendMessage((TLRPC.TL_photo) messageObject.messageOwner.media.photo, null, did, nullReply ? null : messageObject.replyMessageObject, messageObject.messageOwner.message, messageObject.messageOwner.entities, null, params, true, 0, messageObject.messageOwner.media.ttl_seconds, messageObject);
|
||||
} else if (messageObject.messageOwner.media.document instanceof TLRPC.TL_document) {
|
||||
sendMessage((TLRPC.TL_document) messageObject.messageOwner.media.document, null, messageObject.messageOwner.attachPath, did, messageObject.replyMessageObject, messageObject.messageOwner.message, messageObject.messageOwner.entities, null, params, true, 0, messageObject.messageOwner.media.ttl_seconds, messageObject);
|
||||
sendMessage((TLRPC.TL_document) messageObject.messageOwner.media.document, null, messageObject.messageOwner.attachPath, did, nullReply ? null : messageObject.replyMessageObject, messageObject.messageOwner.message, messageObject.messageOwner.entities, null, params, true, 0, messageObject.messageOwner.media.ttl_seconds, messageObject);
|
||||
} else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaVenue || messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGeo) {
|
||||
sendMessage(messageObject.messageOwner.media, did, messageObject.replyMessageObject, null, null, true, 0);
|
||||
sendMessage(messageObject.messageOwner.media, did, nullReply ? null : messageObject.replyMessageObject, null, null, true, 0);
|
||||
} else if (messageObject.messageOwner.media.phone_number != null) {
|
||||
TLRPC.User user = new TLRPC.TL_userContact_old2();
|
||||
user.phone = messageObject.messageOwner.media.phone_number;
|
||||
user.first_name = messageObject.messageOwner.media.first_name;
|
||||
user.last_name = messageObject.messageOwner.media.last_name;
|
||||
user.id = messageObject.messageOwner.media.user_id;
|
||||
sendMessage(user, did, messageObject.replyMessageObject, null, null, true, 0);
|
||||
sendMessage(user, did, nullReply ? null : messageObject.replyMessageObject, null, null, true, 0);
|
||||
} else if ((int) did != 0) {
|
||||
ArrayList<MessageObject> arrayList = new ArrayList<>();
|
||||
arrayList.add(messageObject);
|
||||
|
@ -1039,7 +1039,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
|||
} else {
|
||||
entities = null;
|
||||
}
|
||||
sendMessage(messageObject.messageOwner.message, did, messageObject.replyMessageObject, webPage, true, entities, null, null, true, 0);
|
||||
sendMessage(messageObject.messageOwner.message, did, nullReply ? null : messageObject.replyMessageObject, webPage, true, entities, null, null, true, 0);
|
||||
} else if ((int) did != 0) {
|
||||
ArrayList<MessageObject> arrayList = new ArrayList<>();
|
||||
arrayList.add(messageObject);
|
||||
|
@ -1619,7 +1619,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
|||
}
|
||||
} else {
|
||||
for (int a = 0; a < messages.size(); a++) {
|
||||
processForwardFromMyName(messages.get(a), peer);
|
||||
processForwardFromMyName(messages.get(a), peer, false);
|
||||
}
|
||||
}
|
||||
return sendResult;
|
||||
|
|
|
@ -1703,7 +1703,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
stringBuilder = new SpannableStringBuilder(LocaleController.getString("Mono", R.string.Mono));
|
||||
stringBuilder.setSpan(new TypefaceSpan(Typeface.MONOSPACE), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
editTextItem.addSubItem(text_mono, stringBuilder);
|
||||
if (true || currentEncryptedChat == null || currentEncryptedChat != null && AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) >= 101) {
|
||||
if (currentEncryptedChat == null || currentEncryptedChat != null && AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) >= 101) {
|
||||
stringBuilder = new SpannableStringBuilder(LocaleController.getString("Strike", R.string.Strike));
|
||||
TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun();
|
||||
run.flags |= TextStyleSpan.FLAG_STYLE_STRIKE;
|
||||
|
@ -1812,8 +1812,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
actionModeViews.add(actionMode.addItemWithWidth(edit, R.drawable.msg_edit, AndroidUtilities.dp(54), LocaleController.getString("Edit", R.string.Edit)));
|
||||
actionModeViews.add(actionMode.addItemWithWidth(star, R.drawable.msg_fave, AndroidUtilities.dp(54), LocaleController.getString("AddToFavorites", R.string.AddToFavorites)));
|
||||
actionModeViews.add(actionMode.addItemWithWidth(copy, R.drawable.msg_copy, AndroidUtilities.dp(54), LocaleController.getString("Copy", R.string.Copy)));
|
||||
actionModeViews.add(actionMode.addItemWithWidth(forward_noquote, R.drawable.msg_forward, AndroidUtilities.dp(54), LocaleController.getString("NoQuoteForward", R.string.NoQuoteForward)));
|
||||
actionModeViews.add(actionMode.addItemWithWidth(forward, R.drawable.msg_forward_quote, AndroidUtilities.dp(54), LocaleController.getString("Forward", R.string.Forward)));
|
||||
actionModeViews.add(actionMode.addItemWithWidth(forward_noquote, R.drawable.msg_forward, AndroidUtilities.dp(54), LocaleController.getString("NoQuoteForward", R.string.NoQuoteForward)));
|
||||
actionModeViews.add(actionMode.addItemWithWidth(delete, R.drawable.msg_delete, AndroidUtilities.dp(54), LocaleController.getString("Delete", R.string.Delete)));
|
||||
} else {
|
||||
actionModeViews.add(actionMode.addItemWithWidth(edit, R.drawable.msg_edit, AndroidUtilities.dp(54), LocaleController.getString("Edit", R.string.Edit)));
|
||||
|
@ -7132,7 +7132,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
AlertsCreator.showSendMediaAlert(getSendMessagesHelper().sendMessage(arrayList, did == 0 ? dialog_id : did, notify, scheduleDate), this);
|
||||
} else {
|
||||
for (MessageObject object : arrayList) {
|
||||
getSendMessagesHelper().processForwardFromMyName(object, did == 0 ? dialog_id : did);
|
||||
getSendMessagesHelper().processForwardFromMyName(object, did == 0 ? dialog_id : did, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -927,6 +927,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
public boolean onFragmentCreate() {
|
||||
super.onFragmentCreate();
|
||||
|
||||
getMessagesController().getBlockedUsers(true);
|
||||
|
||||
if (getArguments() != null) {
|
||||
onlySelect = arguments.getBoolean("onlySelect", false);
|
||||
cantSendToChannels = arguments.getBoolean("cantSendToChannels", false);
|
||||
|
|
|
@ -1537,7 +1537,7 @@ public class LoginActivity extends BaseFragment {
|
|||
});
|
||||
}
|
||||
|
||||
if (NekoConfig.showTestBackend) {
|
||||
if (NekoConfig.showHiddenFeature) {
|
||||
testBackendCell = new CheckBoxCell(context, 2);
|
||||
testBackendCell.setText(LocaleController.getString("TestBackend", R.string.TestBackend), "", ConnectionsManager.native_isTestBackend(currentAccount) != 0, false);
|
||||
addView(testBackendCell, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 0, 0, 0, 0));
|
||||
|
|
|
@ -14,14 +14,14 @@ public class NekoConfig {
|
|||
|
||||
private static final Object sync = new Object();
|
||||
public static boolean useIPv6 = false;
|
||||
public static boolean showTestBackend = false;
|
||||
public static boolean showHiddenFeature = false;
|
||||
|
||||
public static boolean openFilterByActionBar = true;
|
||||
public static boolean openFilterByFab = false;
|
||||
|
||||
public static boolean ignoreBlocked = false;
|
||||
public static boolean hideProxySponsorChannel = false;
|
||||
public static boolean saveCacheToPrivateDirectory = Build.VERSION.SDK_INT >= 24;
|
||||
public static boolean saveCacheToPrivateDirectory = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
|
||||
public static boolean disablePhotoSideAction = true;
|
||||
public static int mapPreviewProvider = 0;
|
||||
public static float stickerSize = 14.0f;
|
||||
|
@ -39,7 +39,7 @@ public class NekoConfig {
|
|||
public static boolean showRepeat = true;
|
||||
|
||||
public static boolean hidePhone = true;
|
||||
public static int typeface = 0;
|
||||
public static int typeface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 1 : 0;
|
||||
public static boolean transparentStatusBar = false;
|
||||
public static boolean forceTablet = false;
|
||||
public static boolean openArchiveOnPull = false;
|
||||
|
@ -47,8 +47,8 @@ public class NekoConfig {
|
|||
public static int eventType = 0;
|
||||
public static boolean newYear = false;
|
||||
public static int actionBarDecoration = 0;
|
||||
public static boolean unlimitedFavedStickers = false;
|
||||
public static boolean unlimitedPinnedDialogs = false;
|
||||
public static boolean unlimitedFavedStickers = true;
|
||||
public static boolean unlimitedPinnedDialogs = true;
|
||||
|
||||
public static boolean residentNotification = false;
|
||||
|
||||
|
@ -58,7 +58,6 @@ public class NekoConfig {
|
|||
loadConfig();
|
||||
}
|
||||
|
||||
|
||||
public static void saveConfig() {
|
||||
synchronized (sync) {
|
||||
try {
|
||||
|
@ -89,7 +88,7 @@ public class NekoConfig {
|
|||
editor.putBoolean("openArchiveOnPull", openArchiveOnPull);
|
||||
editor.putBoolean("openFilterByActionBar", openFilterByActionBar);
|
||||
editor.putBoolean("openFilterByFab", openFilterByFab);
|
||||
editor.putBoolean("showTestBackend", showTestBackend);
|
||||
editor.putBoolean("showHiddenFeature", showHiddenFeature);
|
||||
editor.putFloat("stickerSize", stickerSize);
|
||||
editor.putInt("typeface", typeface);
|
||||
editor.putInt("nameOrder", nameOrder);
|
||||
|
@ -115,13 +114,13 @@ public class NekoConfig {
|
|||
hidePhone = preferences.getBoolean("hidePhone", true);
|
||||
ignoreBlocked = preferences.getBoolean("ignoreBlocked", false);
|
||||
forceTablet = preferences.getBoolean("forceTablet", false);
|
||||
typeface = preferences.getInt("typeface", 0);
|
||||
typeface = preferences.getInt("typeface", Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 1 : 0);
|
||||
nameOrder = preferences.getInt("nameOrder", 1);
|
||||
mapPreviewProvider = preferences.getInt("mapPreviewProvider", 0);
|
||||
transparentStatusBar = preferences.getBoolean("transparentStatusBar", false);
|
||||
residentNotification = preferences.getBoolean("residentNotification", false);
|
||||
hideProxySponsorChannel = preferences.getBoolean("hideProxySponsorChannel", false);
|
||||
saveCacheToPrivateDirectory = preferences.getBoolean("saveCacheToPrivateDirectory", Build.VERSION.SDK_INT >= 24);
|
||||
saveCacheToPrivateDirectory = preferences.getBoolean("saveCacheToPrivateDirectory", Build.VERSION.SDK_INT >= Build.VERSION_CODES.N);
|
||||
showAddToSavedMessages = preferences.getBoolean("showAddToSavedMessages", true);
|
||||
showReport = preferences.getBoolean("showReport", false);
|
||||
showPrPr = preferences.getBoolean("showPrPr", false);
|
||||
|
@ -136,14 +135,14 @@ public class NekoConfig {
|
|||
actionBarDecoration = preferences.getInt("actionBarDecoration", 0);
|
||||
newYear = preferences.getBoolean("newYear", false);
|
||||
stickerSize = preferences.getFloat("stickerSize", 14.0f);
|
||||
unlimitedFavedStickers = preferences.getBoolean("unlimitedFavedStickers", false);
|
||||
unlimitedPinnedDialogs = preferences.getBoolean("unlimitedPinnedDialogs", false);
|
||||
unlimitedFavedStickers = preferences.getBoolean("unlimitedFavedStickers", true);
|
||||
unlimitedPinnedDialogs = preferences.getBoolean("unlimitedPinnedDialogs", true);
|
||||
translationProvider = preferences.getInt("translationProvider", 1);
|
||||
disablePhotoSideAction = preferences.getBoolean("disablePhotoSideAction", true);
|
||||
openArchiveOnPull = preferences.getBoolean("openArchiveOnPull", false);
|
||||
openFilterByActionBar = preferences.getBoolean("openFilterByActionBar", true);
|
||||
openFilterByFab = preferences.getBoolean("openFilterByFab", false);
|
||||
showTestBackend = preferences.getBoolean("showTestBackend", false);
|
||||
showHiddenFeature = preferences.getBoolean("showHiddenFeature", false);
|
||||
configLoaded = true;
|
||||
}
|
||||
}
|
||||
|
@ -407,11 +406,11 @@ public class NekoConfig {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
public static void toggleShowTestBackend() {
|
||||
showTestBackend = !showTestBackend;
|
||||
public static void toggleShowHiddenFeature() {
|
||||
showHiddenFeature = !showHiddenFeature;
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("showTestBackend", showTestBackend);
|
||||
editor.putBoolean("showHiddenFeature", showHiddenFeature);
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -521,7 +521,8 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
((TextCheckCell) view).setChecked(NekoConfig.openFilterByFab);
|
||||
}
|
||||
} else if (position == connection2Row) {
|
||||
NekoConfig.toggleShowTestBackend();
|
||||
NekoConfig.toggleShowHiddenFeature();
|
||||
updateRows();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -552,7 +553,7 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
useSystemEmojiRow = rowCount++;
|
||||
ignoreBlockedRow = rowCount++;
|
||||
hideProxySponsorChannelRow = rowCount++;
|
||||
saveCacheToPrivateDirectoryRow = Build.VERSION.SDK_INT >= 24 ? rowCount++ : -1;
|
||||
saveCacheToPrivateDirectoryRow = NekoConfig.showHiddenFeature && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? rowCount++ : -1;
|
||||
pauseMusicOnRecordRow = rowCount++;
|
||||
disablePhotoSideActionRow = rowCount++;
|
||||
mapPreviewRow = rowCount++;
|
||||
|
@ -576,7 +577,7 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
disableFilteringRow = rowCount++;
|
||||
unlimitedFavedStickersRow = rowCount++;
|
||||
unlimitedPinnedDialogsRow = rowCount++;
|
||||
deleteAccountRow = rowCount++;
|
||||
deleteAccountRow = NekoConfig.showHiddenFeature ? rowCount++ : -1;
|
||||
experiment2Row = rowCount++;
|
||||
if (listAdapter != null) {
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
@ -1047,7 +1048,7 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
} else if (position == disablePhotoSideActionRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("DisablePhotoViewerSideAction", R.string.DisablePhotoViewerSideAction), NekoConfig.disablePhotoSideAction, true);
|
||||
} else if (position == unlimitedPinnedDialogsRow) {
|
||||
textCell.setTextAndValueAndCheck(LocaleController.getString("UnlimitedPinnedDialogs", R.string.UnlimitedPinnedDialogs), LocaleController.getString("UnlimitedPinnedDialogsAbout", R.string.UnlimitedPinnedDialogsAbout), NekoConfig.unlimitedPinnedDialogs, true, true);
|
||||
textCell.setTextAndValueAndCheck(LocaleController.getString("UnlimitedPinnedDialogs", R.string.UnlimitedPinnedDialogs), LocaleController.getString("UnlimitedPinnedDialogsAbout", R.string.UnlimitedPinnedDialogsAbout), NekoConfig.unlimitedPinnedDialogs, true, deleteAccountRow != -1);
|
||||
} else if (position == openArchiveOnPullRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("OpenArchiveOnPull", R.string.OpenArchiveOnPull), NekoConfig.openArchiveOnPull, true);
|
||||
} else if (position == openFilterByActionBarRow) {
|
||||
|
@ -1090,7 +1091,7 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
position == forceTabletRow || position == mapPreviewRow || position == newYearRow ||
|
||||
position == actionBarDecorationRow || position == eventTypeRow || position == transparentStatusBarRow ||
|
||||
position == hideProxySponsorChannelRow || position == saveCacheToPrivateDirectoryRow ||
|
||||
(position == disableFilteringRow && sensitiveCanChange) || position == stickerSizeRow ||
|
||||
position == disableFilteringRow || position == stickerSizeRow ||
|
||||
position == unlimitedFavedStickersRow || position == messageMenuRow || position == deleteAccountRow ||
|
||||
position == translationProviderRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
|
||||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow ||
|
||||
|
|
|
@ -175,7 +175,7 @@ public class StickerSizePreviewMessagesCell extends LinearLayout {
|
|||
int viewHeight = getMeasuredHeight();
|
||||
float scaleX = (float) getMeasuredWidth() / (float) drawable.getIntrinsicWidth();
|
||||
float scaleY = (float) (viewHeight) / (float) drawable.getIntrinsicHeight();
|
||||
float scale = scaleX < scaleY ? scaleY : scaleX;
|
||||
float scale = Math.max(scaleX, scaleY);
|
||||
int width = (int) Math.ceil(drawable.getIntrinsicWidth() * scale);
|
||||
int height = (int) Math.ceil(drawable.getIntrinsicHeight() * scale);
|
||||
int x = (getMeasuredWidth() - width) / 2;
|
||||
|
|
|
@ -23,7 +23,6 @@ public class UnreadCountBadgeView extends View {
|
|||
this.countString = countString;
|
||||
countWidth = Math.max(AndroidUtilities.dp(12), (int) Math.ceil(Theme.dialogs_countTextPaint.measureText(countString)));
|
||||
countLayout = new StaticLayout(countString, Theme.dialogs_countTextPaint, countWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,7 @@ public class GoogleWebTranslator extends Translator {
|
|||
"my", "hmn", "xh", "zu", "ne", "no", "pa", "pt", "ps", "ny", "ja", "sv", "sm",
|
||||
"sr", "st", "si", "eo", "sk", "sl", "sw", "gd", "ceb", "so", "tg", "te", "ta",
|
||||
"th", "tr", "cy", "ur", "uk", "uz", "es", "iw", "el", "haw", "sd", "hu", "sn",
|
||||
"hy", "ig", "it", "yi", "hi", "su", "id", "jw", "en", "yo", "vi", "zh-TW", "zh-CN");
|
||||
"hy", "ig", "it", "yi", "hi", "su", "id", "jw", "en", "yo", "vi", "zh-TW", "zh-CN", "zh");
|
||||
private long[] tkk;
|
||||
|
||||
static GoogleWebTranslator getInstance() {
|
||||
|
@ -67,20 +67,10 @@ public class GoogleWebTranslator extends Translator {
|
|||
return null;
|
||||
}
|
||||
String tk = Utils.signWeb(query, tkk[0], tkk[1]);
|
||||
String url;
|
||||
if (NekoConfig.translationProvider == 2) {
|
||||
url = "https://translate.google.cn/translate_a/single?client=webapp&dt=t" +
|
||||
"&sl=auto" +
|
||||
"&tl=" + tl +
|
||||
"&tk=" + tk +
|
||||
"&q=" + Utils.encodeURIComponent(query); // 不能用URLEncoder
|
||||
} else {
|
||||
url = "https://translate.google.com/translate_a/single?client=webapp&dt=t" +
|
||||
"&sl=" + "auto" +
|
||||
"&tl=" + tl +
|
||||
"&tk=" + tk +
|
||||
"&q=" + Utils.encodeURIComponent(query); // 不能用URLEncoder
|
||||
}
|
||||
String url = "https://translate.google." + (NekoConfig.translationProvider == 2 ? "cn" : "com") + "/translate_a/single?client=webapp&dt=t&sl=auto" +
|
||||
"&tl=" + tl +
|
||||
"&tk=" + tk +
|
||||
"&q=" + Utils.encodeURIComponent(query); // 不能用URLEncoder
|
||||
String response = request(url);
|
||||
if (TextUtils.isEmpty(response)) {
|
||||
return null;
|
||||
|
@ -103,12 +93,7 @@ public class GoogleWebTranslator extends Translator {
|
|||
}
|
||||
|
||||
private void initTkk() {
|
||||
String response;
|
||||
if (NekoConfig.translationProvider == 2) {
|
||||
response = request("https://translate.google.cn/");
|
||||
} else {
|
||||
response = request("https://translate.google.com/");
|
||||
}
|
||||
String response = request("https://translate.google." + (NekoConfig.translationProvider == 2 ? "cn" : "com"));
|
||||
if (TextUtils.isEmpty(response)) {
|
||||
FileLog.e("Tkk init failed");
|
||||
return;
|
||||
|
|
|
@ -45,7 +45,7 @@ abstract public class Translator {
|
|||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private class MyAsyncTask extends AsyncTask<Void, Integer, String> {
|
||||
TranslateCallBack translateCallBack; // 回调接口
|
||||
TranslateCallBack translateCallBack;
|
||||
String query;
|
||||
String tl;
|
||||
|
||||
|
|
Loading…
Reference in New Issue