mirror of https://github.com/NekoX-Dev/NekoX.git
This commit is contained in:
parent
453778fcc0
commit
8832d06e0c
|
@ -138,10 +138,10 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import kotlin.text.StringsKt;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.NekoXConfig;
|
||||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||
import tw.nekomimi.nekogram.utils.StrUtil;
|
||||
|
||||
import static com.v2ray.ang.V2RayConfig.SSR_PROTOCOL;
|
||||
import static com.v2ray.ang.V2RayConfig.SS_PROTOCOL;
|
||||
|
@ -306,7 +306,7 @@ public class AndroidUtilities {
|
|||
Linkify.addLinks(text, Linkify.PHONE_NUMBERS);
|
||||
}
|
||||
//if ((mask & Linkify.WEB_URLS) != 0) {
|
||||
gatherLinks(links, text, LinkifyPort.WEB_URL, new String[]{"http://", "https://", "ton://", "tg://",VMESS_PROTOCOL,VMESS1_PROTOCOL,SS_PROTOCOL,SSR_PROTOCOL}, sUrlMatchFilter);
|
||||
gatherLinks(links, text, LinkifyPort.WEB_URL, new String[]{"http://", "https://", "ton://", "tg://", VMESS_PROTOCOL, VMESS1_PROTOCOL, SS_PROTOCOL, SSR_PROTOCOL}, sUrlMatchFilter);
|
||||
//}
|
||||
pruneOverlaps(links);
|
||||
if (links.size() == 0) {
|
||||
|
@ -382,7 +382,7 @@ public class AndroidUtilities {
|
|||
color = 1;
|
||||
} else if (name.contains(".pdf") || name.contains(".ppt") || name.contains(".key")) {
|
||||
color = 2;
|
||||
} else if (name.contains(".zip") || name.contains(".rar") || name.contains(".ai") || name.contains(".mp3") || name.contains(".mov") || name.contains(".avi")) {
|
||||
} else if (name.contains(".zip") || name.contains(".rar") || name.contains(".ai") || name.contains(".mp3") || name.contains(".mov") || name.contains(".avi")) {
|
||||
color = 3;
|
||||
}
|
||||
if (color == -1) {
|
||||
|
@ -1965,6 +1965,7 @@ public class AndroidUtilities {
|
|||
}
|
||||
|
||||
private static long lastUpdateCheckTime;
|
||||
|
||||
public static void checkForUpdates() {
|
||||
/*try {
|
||||
if (BuildVars.DEBUG_VERSION) {
|
||||
|
@ -2700,21 +2701,21 @@ public class AndroidUtilities {
|
|||
try {
|
||||
showVmessAlert(activity, new SharedConfig.VmessProxy(data.toString()));
|
||||
} catch (Exception ex) {
|
||||
AlertUtil.showToast(LocaleController.getString("BrokenLink",R.string.BrokenLink) + ": " + ex.getMessage());
|
||||
AlertUtil.showToast(LocaleController.getString("BrokenLink", R.string.BrokenLink) + ": " + ex.getMessage());
|
||||
}
|
||||
return true;
|
||||
} else if (scheme.equals("ss")) {
|
||||
try {
|
||||
showShadowsocksAlert(activity, new SharedConfig.ShadowsocksProxy(data.toString()));
|
||||
} catch (Exception ex) {
|
||||
AlertUtil.showToast(LocaleController.getString("BrokenLink",R.string.BrokenLink) + ": " + ex.getMessage());
|
||||
AlertUtil.showToast(LocaleController.getString("BrokenLink", R.string.BrokenLink) + ": " + ex.getMessage());
|
||||
}
|
||||
return true;
|
||||
} else if (scheme.equals("ssr")) {
|
||||
try {
|
||||
showShadowsocksRAlert(activity, new SharedConfig.ShadowsocksRProxy(data.toString()));
|
||||
} catch (Exception ex) {
|
||||
AlertUtil.showToast(LocaleController.getString("BrokenLink",R.string.BrokenLink) + ": " + ex.getMessage());
|
||||
AlertUtil.showToast(LocaleController.getString("BrokenLink", R.string.BrokenLink) + ": " + ex.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2881,14 +2882,14 @@ public class AndroidUtilities {
|
|||
if ("none".equals(text)) continue;
|
||||
detail = LocaleController.getString("VmessSecurity", R.string.VmessSecurity);
|
||||
} else if (a == 4) {
|
||||
text = info.bean.getNetwork() + (StringsKt.isBlank(info.bean.getStreamSecurity()) ? "" : ", tls");
|
||||
text = info.bean.getNetwork() + (StrUtil.isBlank(info.bean.getStreamSecurity()) ? "" : ", tls");
|
||||
detail = LocaleController.getString("VmessNetwork", R.string.VmessNetwork);
|
||||
} else if (a == 5) {
|
||||
text = info.bean.getHeaderType();
|
||||
if ("none".equals(text)) continue;
|
||||
detail = LocaleController.getString("VmessHeadType", R.string.VmessHeadType);
|
||||
} else if (a == 6) {
|
||||
text =info.bean.getRequestHost();
|
||||
text = info.bean.getRequestHost();
|
||||
detail = LocaleController.getString("VmessRequestHost", R.string.VmessRequestHost);
|
||||
} else {
|
||||
text = LocaleController.getString("Checking", R.string.Checking);
|
||||
|
@ -2916,7 +2917,7 @@ public class AndroidUtilities {
|
|||
cell.setTextAndValue(LocaleController.getString("Available", R.string.Available), LocaleController.formatString("Ping", R.string.Ping, time), true);
|
||||
colorKey = Theme.key_windowBackgroundWhiteGreenText;
|
||||
} else if (c < 2) {
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "", "", "", t -> AndroidUtilities.runOnUIThread(() -> run(t),500));
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "", "", "", t -> AndroidUtilities.runOnUIThread(() -> run(t), 500));
|
||||
colorKey = Theme.key_windowBackgroundWhiteGreenText;
|
||||
} else {
|
||||
info.stop();
|
||||
|
@ -2928,7 +2929,7 @@ public class AndroidUtilities {
|
|||
|
||||
};
|
||||
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "","","",time ->AndroidUtilities.runOnUIThread(()->callback.run(time)));
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "", "", "", time -> AndroidUtilities.runOnUIThread(() -> callback.run(time)));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3008,7 +3009,7 @@ public class AndroidUtilities {
|
|||
cell.setTextAndValue(LocaleController.getString("Available", R.string.Available), LocaleController.formatString("Ping", R.string.Ping, time), true);
|
||||
colorKey = Theme.key_windowBackgroundWhiteGreenText;
|
||||
} else if (c < 2) {
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "", "", "", t -> AndroidUtilities.runOnUIThread(() -> run(t),500));
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "", "", "", t -> AndroidUtilities.runOnUIThread(() -> run(t), 500));
|
||||
colorKey = Theme.key_windowBackgroundWhiteGreenText;
|
||||
} else {
|
||||
info.stop();
|
||||
|
@ -3020,7 +3021,7 @@ public class AndroidUtilities {
|
|||
|
||||
};
|
||||
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "","","",time ->AndroidUtilities.runOnUIThread(()->callback.run(time)));
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "", "", "", time -> AndroidUtilities.runOnUIThread(() -> callback.run(time)));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3078,13 +3079,13 @@ public class AndroidUtilities {
|
|||
detail = LocaleController.getString("SSMethod", R.string.SSMethod);
|
||||
} else if (a == 4) {
|
||||
text = info.bean.getProtocol();
|
||||
if (!StringsKt.isBlank(info.bean.getProtocol_param())) {
|
||||
if (!StrUtil.isBlank(info.bean.getProtocol_param())) {
|
||||
text += ", " + info.bean.getProtocol_param();
|
||||
}
|
||||
detail = LocaleController.getString("SSRProtocol", R.string.SSRProtocol);
|
||||
} else if (a == 5) {
|
||||
text = info.bean.getObfs();
|
||||
if (!StringsKt.isBlank(info.bean.getObfs_param())) {
|
||||
if (!StrUtil.isBlank(info.bean.getObfs_param())) {
|
||||
text += ", " + info.bean.getObfs_param();
|
||||
}
|
||||
detail = LocaleController.getString("SSRObfs", R.string.SSRObfs);
|
||||
|
@ -3113,7 +3114,7 @@ public class AndroidUtilities {
|
|||
cell.setTextAndValue(LocaleController.getString("Available", R.string.Available), LocaleController.formatString("Ping", R.string.Ping, time), true);
|
||||
colorKey = Theme.key_windowBackgroundWhiteGreenText;
|
||||
} else if (c < 2) {
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "", "", "", t -> AndroidUtilities.runOnUIThread(() -> run(t),500));
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "", "", "", t -> AndroidUtilities.runOnUIThread(() -> run(t), 500));
|
||||
colorKey = Theme.key_windowBackgroundWhiteGreenText;
|
||||
} else {
|
||||
info.stop();
|
||||
|
@ -3125,7 +3126,7 @@ public class AndroidUtilities {
|
|||
|
||||
};
|
||||
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "","","",time ->AndroidUtilities.runOnUIThread(()->callback.run(time)));
|
||||
ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(info.address, info.port, "", "", "", time -> AndroidUtilities.runOnUIThread(() -> callback.run(time)));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3484,7 +3485,7 @@ public class AndroidUtilities {
|
|||
return "";
|
||||
}
|
||||
|
||||
private static char[] characters = new char[] {' ', '!', '"', '#', '%', '&', '\'', '(', ')', '*', ',', '-', '.', '/', ':', ';', '?', '@', '[', '\\', ']', '_', '{', '}', '¡', '§', '«', '¶', '·', '»', '¿', ';', '·', '՚', '՛', '՜', '՝', '՞', '՟', '։', '֊', '־', '׀', '׃', '׆', '׳', '״', '؉', '؊', '،', '؍', '؛', '؞', '؟', '٪', '٫', '٬', '٭', '۔', '܀', '܁', '܂', '܃', '܄', '܅', '܆', '܇', '܈', '܉', '܊', '܋', '܌', '܍', '߷', '߸', '߹', '࠰', '࠱', '࠲', '࠳', '࠴', '࠵', '࠶', '࠷', '࠸', '࠹', '࠺', '࠻', '࠼', '࠽', '࠾', '࡞', '।', '॥', '॰', '৽', '੶', '૰', '౷', '಄', '෴', '๏', '๚', '๛', '༄', '༅', '༆', '༇', '༈', '༉', '༊', '་', '༌', '།', '༎', '༏', '༐', '༑', '༒', '༔', '༺', '༻', '༼', '༽', '྅', '࿐', '࿑', '࿒', '࿓', '࿔', '࿙', '࿚', '၊', '။', '၌', '၍', '၎', '၏', '჻', '፠', '፡', '።', '፣', '፤', '፥', '፦', '፧', '፨', '᐀', '᙮', '᚛', '᚜', '᛫', '᛬', '᛭', '᜵', '᜶', '។', '៕', '៖', '៘', '៙', '៚', '᠀', '᠁', '᠂', '᠃', '᠄', '᠅', '᠆', '᠇', '᠈', '᠉', '᠊', '᥄', '᥅', '᨞', '᨟', '᪠', '᪡', '᪢', '᪣', '᪤', '᪥', '᪦', '᪨', '᪩', '᪪', '᪫', '᪬', '᪭', '᭚', '᭛', '᭜', '᭝', '᭞', '᭟', '᭠', '᯼', '᯽', '᯾', '᯿', '᰻', '᰼', '᰽', '᰾', '᰿', '᱾', '᱿', '᳀', '᳁', '᳂', '᳃', '᳄', '᳅', '᳆', '᳇', '᳓', '‐', '‑', '‒', '–', '—', '―', '‖', '‗', '‘', '’', '‚', '‛', '“', '”', '„', '‟', '†', '‡', '•', '‣', '․', '‥', '…', '‧', '‰', '‱', '′', '″', '‴', '‵', '‶', '‷', '‸', '‹', '›', '※', '‼', '‽', '‾', '‿', '⁀', '⁁', '⁂', '⁃', '⁅', '⁆', '⁇', '⁈', '⁉', '⁊', '⁋', '⁌', '⁍', '⁎', '⁏', '⁐', '⁑', '⁓', '⁔', '⁕', '⁖', '⁗', '⁘', '⁙', '⁚', '⁛', '⁜', '⁝', '⁞', '⁽', '⁾', '₍', '₎', '⌈', '⌉', '⌊', '⌋', '〈', '〉', '❨', '❩', '❪', '❫', '❬', '❭', '❮', '❯', '❰', '❱', '❲', '❳', '❴', '❵', '⟅', '⟆', '⟦', '⟧', '⟨', '⟩', '⟪', '⟫', '⟬', '⟭', '⟮', '⟯', '⦃', '⦄', '⦅', '⦆', '⦇', '⦈', '⦉', '⦊', '⦋', '⦌', '⦍', '⦎', '⦏', '⦐', '⦑', '⦒', '⦓', '⦔', '⦕', '⦖', '⦗', '⦘', '⧘', '⧙', '⧚', '⧛', '⧼', '⧽', '⳹', '⳺', '⳻', '⳼', '⳾', '⳿', '⵰', '⸀', '⸁', '⸂', '⸃', '⸄', '⸅', '⸆', '⸇', '⸈', '⸉', '⸊', '⸋', '⸌', '⸍', '⸎', '⸏', '⸐', '⸑', '⸒', '⸓', '⸔', '⸕', '⸖', '⸗', '⸘', '⸙', '⸚', '⸛', '⸜', '⸝', '⸞', '⸟', '⸠', '⸡', '⸢', '⸣', '⸤', '⸥', '⸦', '⸧', '⸨', '⸩', '⸪', '⸫', '⸬', '⸭', '⸮', '⸰', '⸱', '⸲', '⸳', '⸴', '⸵', '⸶', '⸷', '⸸', '⸹', '⸺', '⸻', '⸼', '⸽', '⸾', '⸿', '⹀', '⹁', '⹂', '⹃', '⹄', '⹅', '⹆', '⹇', '⹈', '⹉', '⹊', '⹋', '⹌', '⹍', '⹎', '⹏', '、', '。', '〃', '〈', '〉', '《', '》', '「', '」', '『', '』', '【', '】', '〔', '〕', '〖', '〗', '〘', '〙', '〚', '〛', '〜', '〝', '〞', '〟', '〰', '〽', '゠', '・', '꓾', '꓿', '꘍', '꘎', '꘏', '꙳', '꙾', '꛲', '꛳', '꛴', '꛵', '꛶', '꛷', '꡴', '꡵', '꡶', '꡷', '꣎', '꣏', '꣸', '꣹', '꣺', '꣼', '꤮', '꤯', '꥟', '꧁', '꧂', '꧃', '꧄', '꧅', '꧆', '꧇', '꧈', '꧉', '꧊', '꧋', '꧌', '꧍', '꧞', '꧟', '꩜', '꩝', '꩞', '꩟', '꫞', '꫟', '꫰', '꫱', '꯫', '﴾', '﴿', '︐', '︑', '︒', '︓', '︔', '︕', '︖', '︗', '︘', '︙', '︰', '︱', '︲', '︳', '︴', '︵', '︶', '︷', '︸', '︹', '︺', '︻', '︼', '︽', '︾', '︿', '﹀', '﹁', '﹂', '﹃', '﹄', '﹅', '﹆', '﹇', '﹈', '﹉', '﹊', '﹋', '﹌', '﹍', '﹎', '﹏', '﹐', '﹑', '﹒', '﹔', '﹕', '﹖', '﹗', '﹘', '﹙', '﹚', '﹛', '﹜', '﹝', '﹞', '﹟', '﹠', '﹡', '﹣', '﹨', '﹪', '﹫', '!', '"', '#', '%', '&', ''', '(', ')', '*', ',', '-', '.', '/', ':', ';', '?', '@', '[', '\', ']', '_', '{', '}', '⦅', '⦆', '。', '「', '」', '、', '・'};
|
||||
private static char[] characters = new char[]{' ', '!', '"', '#', '%', '&', '\'', '(', ')', '*', ',', '-', '.', '/', ':', ';', '?', '@', '[', '\\', ']', '_', '{', '}', '¡', '§', '«', '¶', '·', '»', '¿', ';', '·', '՚', '՛', '՜', '՝', '՞', '՟', '։', '֊', '־', '׀', '׃', '׆', '׳', '״', '؉', '؊', '،', '؍', '؛', '؞', '؟', '٪', '٫', '٬', '٭', '۔', '܀', '܁', '܂', '܃', '܄', '܅', '܆', '܇', '܈', '܉', '܊', '܋', '܌', '܍', '߷', '߸', '߹', '࠰', '࠱', '࠲', '࠳', '࠴', '࠵', '࠶', '࠷', '࠸', '࠹', '࠺', '࠻', '࠼', '࠽', '࠾', '࡞', '।', '॥', '॰', '৽', '੶', '૰', '౷', '಄', '෴', '๏', '๚', '๛', '༄', '༅', '༆', '༇', '༈', '༉', '༊', '་', '༌', '།', '༎', '༏', '༐', '༑', '༒', '༔', '༺', '༻', '༼', '༽', '྅', '࿐', '࿑', '࿒', '࿓', '࿔', '࿙', '࿚', '၊', '။', '၌', '၍', '၎', '၏', '჻', '፠', '፡', '።', '፣', '፤', '፥', '፦', '፧', '፨', '᐀', '᙮', '᚛', '᚜', '᛫', '᛬', '᛭', '᜵', '᜶', '។', '៕', '៖', '៘', '៙', '៚', '᠀', '᠁', '᠂', '᠃', '᠄', '᠅', '᠆', '᠇', '᠈', '᠉', '᠊', '᥄', '᥅', '᨞', '᨟', '᪠', '᪡', '᪢', '᪣', '᪤', '᪥', '᪦', '᪨', '᪩', '᪪', '᪫', '᪬', '᪭', '᭚', '᭛', '᭜', '᭝', '᭞', '᭟', '᭠', '᯼', '᯽', '᯾', '᯿', '᰻', '᰼', '᰽', '᰾', '᰿', '᱾', '᱿', '᳀', '᳁', '᳂', '᳃', '᳄', '᳅', '᳆', '᳇', '᳓', '‐', '‑', '‒', '–', '—', '―', '‖', '‗', '‘', '’', '‚', '‛', '“', '”', '„', '‟', '†', '‡', '•', '‣', '․', '‥', '…', '‧', '‰', '‱', '′', '″', '‴', '‵', '‶', '‷', '‸', '‹', '›', '※', '‼', '‽', '‾', '‿', '⁀', '⁁', '⁂', '⁃', '⁅', '⁆', '⁇', '⁈', '⁉', '⁊', '⁋', '⁌', '⁍', '⁎', '⁏', '⁐', '⁑', '⁓', '⁔', '⁕', '⁖', '⁗', '⁘', '⁙', '⁚', '⁛', '⁜', '⁝', '⁞', '⁽', '⁾', '₍', '₎', '⌈', '⌉', '⌊', '⌋', '〈', '〉', '❨', '❩', '❪', '❫', '❬', '❭', '❮', '❯', '❰', '❱', '❲', '❳', '❴', '❵', '⟅', '⟆', '⟦', '⟧', '⟨', '⟩', '⟪', '⟫', '⟬', '⟭', '⟮', '⟯', '⦃', '⦄', '⦅', '⦆', '⦇', '⦈', '⦉', '⦊', '⦋', '⦌', '⦍', '⦎', '⦏', '⦐', '⦑', '⦒', '⦓', '⦔', '⦕', '⦖', '⦗', '⦘', '⧘', '⧙', '⧚', '⧛', '⧼', '⧽', '⳹', '⳺', '⳻', '⳼', '⳾', '⳿', '⵰', '⸀', '⸁', '⸂', '⸃', '⸄', '⸅', '⸆', '⸇', '⸈', '⸉', '⸊', '⸋', '⸌', '⸍', '⸎', '⸏', '⸐', '⸑', '⸒', '⸓', '⸔', '⸕', '⸖', '⸗', '⸘', '⸙', '⸚', '⸛', '⸜', '⸝', '⸞', '⸟', '⸠', '⸡', '⸢', '⸣', '⸤', '⸥', '⸦', '⸧', '⸨', '⸩', '⸪', '⸫', '⸬', '⸭', '⸮', '⸰', '⸱', '⸲', '⸳', '⸴', '⸵', '⸶', '⸷', '⸸', '⸹', '⸺', '⸻', '⸼', '⸽', '⸾', '⸿', '⹀', '⹁', '⹂', '⹃', '⹄', '⹅', '⹆', '⹇', '⹈', '⹉', '⹊', '⹋', '⹌', '⹍', '⹎', '⹏', '、', '。', '〃', '〈', '〉', '《', '》', '「', '」', '『', '』', '【', '】', '〔', '〕', '〖', '〗', '〘', '〙', '〚', '〛', '〜', '〝', '〞', '〟', '〰', '〽', '゠', '・', '꓾', '꓿', '꘍', '꘎', '꘏', '꙳', '꙾', '꛲', '꛳', '꛴', '꛵', '꛶', '꛷', '꡴', '꡵', '꡶', '꡷', '꣎', '꣏', '꣸', '꣹', '꣺', '꣼', '꤮', '꤯', '꥟', '꧁', '꧂', '꧃', '꧄', '꧅', '꧆', '꧇', '꧈', '꧉', '꧊', '꧋', '꧌', '꧍', '꧞', '꧟', '꩜', '꩝', '꩞', '꩟', '꫞', '꫟', '꫰', '꫱', '꯫', '﴾', '﴿', '︐', '︑', '︒', '︓', '︔', '︕', '︖', '︗', '︘', '︙', '︰', '︱', '︲', '︳', '︴', '︵', '︶', '︷', '︸', '︹', '︺', '︻', '︼', '︽', '︾', '︿', '﹀', '﹁', '﹂', '﹃', '﹄', '﹅', '﹆', '﹇', '﹈', '﹉', '﹊', '﹋', '﹌', '﹍', '﹎', '﹏', '﹐', '﹑', '﹒', '﹔', '﹕', '﹖', '﹗', '﹘', '﹙', '﹚', '﹛', '﹜', '﹝', '﹞', '﹟', '﹠', '﹡', '﹣', '﹨', '﹪', '﹫', '!', '"', '#', '%', '&', ''', '(', ')', '*', ',', '-', '.', '/', ':', ';', '?', '@', '[', '\', ']', '_', '{', '}', '⦅', '⦆', '。', '「', '」', '、', '・'};
|
||||
//private static String[] longCharacters = new String[] {"𐄀", "𐄁", "𐄂", "𐎟", "𐏐", "𐕯", "𐡗", "𐤟", "𐤿", "𐩐", "𐩑", "𐩒", "𐩓", "𐩔", "𐩕", "𐩖", "𐩗", "𐩘", "𐩿", "𐫰", "𐫱", "𐫲", "𐫳", "𐫴", "𐫵", "𐫶", "𐬹", "𐬺", "𐬻", "𐬼", "𐬽", "𐬾", "𐬿", "𐮙", "𐮚", "𐮛", "𐮜", "𐽕", "𐽖", "𐽗", "𐽘", "𐽙", "𑁇", "𑁈", "𑁉", "𑁊", "𑁋", "𑁌", "𑁍", "𑂻", "𑂼", "𑂾", "𑂿", "𑃀", "𑃁", "𑅀", "𑅁", "𑅂", "𑅃", "𑅴", "𑅵", "𑇅", "𑇆", "𑇇", "𑇈", "𑇍", "𑇛", "𑇝", "𑇞", "𑇟", "𑈸", "𑈹", "𑈺", "𑈻", "𑈼", "𑈽", "𑊩", "𑑋", "𑑌", "𑑍", "𑑎", "𑑏", "𑑛", "𑑝", "𑓆", "𑗁", "𑗂", "𑗃", "𑗄", "𑗅", "𑗆", "𑗇", "𑗈", "𑗉", "𑗊", "𑗋", "𑗌", "𑗍", "𑗎", "𑗏", "𑗐", "𑗑", "𑗒", "𑗓", "𑗔", "𑗕", "𑗖", "𑗗", "𑙁", "𑙂", "𑙃", "𑙠", "𑙡", "𑙢", "𑙣", "𑙤", "𑙥", "𑙦", "𑙧", "𑙨", "𑙩", "𑙪", "𑙫", "𑙬", "𑜼", "𑜽", "𑜾", "𑠻", "𑧢", "𑨿", "𑩀", "𑩁", "𑩂", "𑩃", "𑩄", "𑩅", "𑩆", "𑪚", "𑪛", "𑪜", "𑪞", "𑪟", "𑪠", "𑪡", "𑪢", "𑱁", "𑱂", "𑱃", "𑱄", "𑱅", "𑱰", "𑱱", "𑻷", "𑻸", "𑿿", "𒑰", "𒑱", "𒑲", "𒑳", "𒑴", "𖩮", "𖩯", "𖫵", "𖬷", "𖬸", "𖬹", "𖬺", "𖬻", "𖭄", "𖺗", "𖺘", "𖺙", "𖺚", "𖿢", "𛲟", "𝪇", "𝪈", "𝪉", "𝪊", "𝪋", "𞥞", "𞥟"};
|
||||
private static HashSet<Character> charactersMap;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import tw.nekomimi.nekogram.ProxyManager;
|
|||
import tw.nekomimi.nekogram.ShadowsocksLoader;
|
||||
import tw.nekomimi.nekogram.VmessLoader;
|
||||
import tw.nekomimi.nekogram.utils.FileUtil;
|
||||
import tw.nekomimi.nekogram.utils.StrUtil;
|
||||
import tw.nekomimi.nekogram.utils.UIUtil;
|
||||
|
||||
import static com.v2ray.ang.V2RayConfig.SSR_PROTOCOL;
|
||||
|
@ -184,7 +185,7 @@ public class SharedConfig {
|
|||
|
||||
public String getTitle() {
|
||||
|
||||
if (StringsKt.isBlank(remarks)) {
|
||||
if (StrUtil.isBlank(remarks)) {
|
||||
|
||||
return "[MTProto] " + address + ":" + port;
|
||||
|
||||
|
@ -202,7 +203,7 @@ public class SharedConfig {
|
|||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
if (StringsKt.isBlank(remarks)) {
|
||||
if (StrUtil.isBlank(remarks)) {
|
||||
remarks = null;
|
||||
}
|
||||
}
|
||||
|
@ -211,12 +212,12 @@ public class SharedConfig {
|
|||
|
||||
public String toUrl() {
|
||||
|
||||
HttpUrl.Builder builder = HttpUrl.parse(StringsKt.isBlank(secret) ?
|
||||
HttpUrl.Builder builder = HttpUrl.parse(StrUtil.isBlank(secret) ?
|
||||
"https://t.me/socks" : "https://t.me/proxy").newBuilder()
|
||||
.addQueryParameter("address", address)
|
||||
.addQueryParameter("port", port + "");
|
||||
|
||||
if (!StringsKt.isBlank(secret)) {
|
||||
if (!StrUtil.isBlank(secret)) {
|
||||
|
||||
builder.addQueryParameter("secret", secret);
|
||||
|
||||
|
@ -227,7 +228,7 @@ public class SharedConfig {
|
|||
|
||||
}
|
||||
|
||||
if (!StringsKt.isBlank(remarks)) {
|
||||
if (!StrUtil.isBlank(remarks)) {
|
||||
|
||||
builder.fragment(remarks);
|
||||
|
||||
|
@ -253,7 +254,7 @@ public class SharedConfig {
|
|||
|
||||
JSONObject obj = new JSONObject();
|
||||
|
||||
if (!StringsKt.isBlank(remarks)) {
|
||||
if (!StrUtil.isBlank(remarks)) {
|
||||
obj.put("remarks", remarks);
|
||||
}
|
||||
|
||||
|
@ -263,7 +264,7 @@ public class SharedConfig {
|
|||
|
||||
obj.put("address", address);
|
||||
obj.put("port", port);
|
||||
if (StringsKt.isBlank(secret)) {
|
||||
if (StrUtil.isBlank(secret)) {
|
||||
obj.put("type", "socks5");
|
||||
if (!username.isEmpty()) {
|
||||
obj.put("username", username);
|
||||
|
@ -298,7 +299,7 @@ public class SharedConfig {
|
|||
|
||||
info.remarks = obj.optString("remarks");
|
||||
|
||||
if (StringsKt.isBlank(info.remarks)) info.remarks = null;
|
||||
if (StrUtil.isBlank(info.remarks)) info.remarks = null;
|
||||
|
||||
info.group = obj.optInt("group", 0);
|
||||
|
||||
|
@ -316,7 +317,7 @@ public class SharedConfig {
|
|||
|
||||
info.remarks = obj.optString("remarks");
|
||||
|
||||
if (StringsKt.isBlank(info.remarks)) info.remarks = null;
|
||||
if (StrUtil.isBlank(info.remarks)) info.remarks = null;
|
||||
|
||||
info.group = obj.optInt("group", 0);
|
||||
|
||||
|
@ -414,7 +415,7 @@ public class SharedConfig {
|
|||
@Override
|
||||
public String getTitle() {
|
||||
|
||||
if (StringsKt.isBlank(getRemarks())) {
|
||||
if (StrUtil.isBlank(getRemarks())) {
|
||||
|
||||
return "[Vmess] " + bean.getAddress() + ":" + bean.getPort();
|
||||
|
||||
|
@ -499,7 +500,7 @@ public class SharedConfig {
|
|||
@Override
|
||||
public String getTitle() {
|
||||
|
||||
if (StringsKt.isBlank(getRemarks())) {
|
||||
if (StrUtil.isBlank(getRemarks())) {
|
||||
|
||||
return "[SS] " + bean.getHost() + ":" + bean.getRemotePort();
|
||||
|
||||
|
@ -585,7 +586,7 @@ public class SharedConfig {
|
|||
@Override
|
||||
public String getTitle() {
|
||||
|
||||
if (StringsKt.isBlank(getRemarks())) {
|
||||
if (StrUtil.isBlank(getRemarks())) {
|
||||
|
||||
return "[SSR] " + bean.getHost() + ":" + bean.getRemotePort();
|
||||
|
||||
|
|
|
@ -9,16 +9,36 @@
|
|||
package org.telegram.ui;
|
||||
|
||||
import android.Manifest;
|
||||
import android.animation.*;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.*;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.*;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.media.ThumbnailUtils;
|
||||
import android.net.Uri;
|
||||
|
@ -37,15 +57,35 @@ import android.text.style.CharacterStyle;
|
|||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.*;
|
||||
import android.view.*;
|
||||
import android.util.LongSparseArray;
|
||||
import android.util.Property;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.TextureView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.*;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.GridLayoutManagerFixed;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
@ -118,6 +158,7 @@ import org.telegram.ui.Cells.TextSelectionHelper;
|
|||
import org.telegram.ui.Components.AlertsCreator;
|
||||
import org.telegram.ui.Components.AnimatedFileDrawable;
|
||||
import org.telegram.ui.Components.AnimationProperties;
|
||||
import org.telegram.ui.Components.AvatarDrawable;
|
||||
import org.telegram.ui.Components.BackupImageView;
|
||||
import org.telegram.ui.Components.BlurBehindDrawable;
|
||||
import org.telegram.ui.Components.Bulletin;
|
||||
|
@ -151,7 +192,6 @@ import org.telegram.ui.Components.RecyclerAnimationScrollHelper;
|
|||
import org.telegram.ui.Components.RecyclerListView;
|
||||
import org.telegram.ui.Components.ShareAlert;
|
||||
import org.telegram.ui.Components.Size;
|
||||
import org.telegram.ui.Components.*;
|
||||
import org.telegram.ui.Components.SizeNotifierFrameLayout;
|
||||
import org.telegram.ui.Components.StickersAlert;
|
||||
import org.telegram.ui.Components.TextStyleSpan;
|
||||
|
@ -164,15 +204,6 @@ import org.telegram.ui.Components.URLSpanUserMention;
|
|||
import org.telegram.ui.Components.UndoView;
|
||||
import org.telegram.ui.Components.voip.VoIPHelper;
|
||||
|
||||
import kotlin.text.StringsKt;
|
||||
import tw.nekomimi.nekogram.MessageDetailsActivity;
|
||||
import tw.nekomimi.nekogram.MessageHelper;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.NekoXConfig;
|
||||
import tw.nekomimi.nekogram.translator.TranslateBottomSheet;
|
||||
import tw.nekomimi.nekogram.translator.Translator;
|
||||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -186,6 +217,15 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import tw.nekomimi.nekogram.MessageDetailsActivity;
|
||||
import tw.nekomimi.nekogram.MessageHelper;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.NekoXConfig;
|
||||
import tw.nekomimi.nekogram.translator.TranslateBottomSheet;
|
||||
import tw.nekomimi.nekogram.translator.Translator;
|
||||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||
import tw.nekomimi.nekogram.utils.StrUtil;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ChatActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate, LocationActivity.LocationActivityDelegate {
|
||||
|
||||
|
@ -14924,15 +14964,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
|
||||
showDialog(builder.create());
|
||||
}
|
||||
} else if (locFile.getName().toLowerCase().endsWith("json")) {
|
||||
} else if (locFile.getName().toLowerCase().endsWith(".nekox.json")) {
|
||||
|
||||
File finalLocFile = locFile;
|
||||
AlertUtil.showConfirm(getParentActivity(),
|
||||
LocaleController.getString("ImportProxyList", R.string.ImportProxyList),
|
||||
LocaleController.getString("ImportProxyList", R.string.ImportProxyListConfirm),
|
||||
LocaleController.getString("OK", R.string.OK), false, (d,v) -> {
|
||||
LocaleController.getString("OK", R.string.OK), false, (d, v) -> {
|
||||
String status = ProxyListActivity.processProxyListFile(getParentActivity(), finalLocFile);
|
||||
if (!StringsKt.isBlank(status)) {
|
||||
if (!StrUtil.isBlank(status)) {
|
||||
presentFragment(new ProxyListActivity(status));
|
||||
}
|
||||
});
|
||||
|
@ -15134,7 +15174,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (response != null) {
|
||||
TLRPC.TL_exportedMessageLink exportedMessageLink = (TLRPC.TL_exportedMessageLink) response;
|
||||
try {
|
||||
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipboardManager clipboard = (ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("label", exportedMessageLink.link);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
if (exportedMessageLink.link.contains("/c/")) {
|
||||
|
@ -15465,6 +15505,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}, null);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + option);
|
||||
}
|
||||
selectedObject = null;
|
||||
selectedObjectGroup = null;
|
||||
|
@ -16724,20 +16766,20 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
presentFragment(fragment);
|
||||
}
|
||||
} else if (message.type == 9 || message.type == 0) {
|
||||
File locFile = null;
|
||||
if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) {
|
||||
File f = new File(message.messageOwner.attachPath);
|
||||
if (f.exists()) {
|
||||
locFile = f;
|
||||
}
|
||||
}
|
||||
if (locFile == null) {
|
||||
File f = FileLoader.getPathToMessage(message.messageOwner);
|
||||
if (f.exists()) {
|
||||
locFile = f;
|
||||
}
|
||||
}
|
||||
if (message.getDocumentName().toLowerCase().endsWith("attheme")) {
|
||||
File locFile = null;
|
||||
if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) {
|
||||
File f = new File(message.messageOwner.attachPath);
|
||||
if (f.exists()) {
|
||||
locFile = f;
|
||||
}
|
||||
}
|
||||
if (locFile == null) {
|
||||
File f = FileLoader.getPathToMessage(message.messageOwner);
|
||||
if (f.exists()) {
|
||||
locFile = f;
|
||||
}
|
||||
}
|
||||
Theme.ThemeInfo themeInfo = Theme.applyThemeFile(locFile, message.getDocumentName(), null, true);
|
||||
if (themeInfo != null) {
|
||||
presentFragment(new ThemePreviewActivity(themeInfo));
|
||||
|
@ -16745,22 +16787,36 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
} else {
|
||||
scrollToPositionOnRecreate = -1;
|
||||
}
|
||||
}
|
||||
boolean handled = false;
|
||||
if (message.canPreviewDocument()) {
|
||||
PhotoViewer.getInstance().setParentActivity(getParentActivity());
|
||||
PhotoViewer.getInstance().openPhoto(message, message.type != 0 ? dialog_id : 0, message.type != 0 ? mergeDialogId : 0, photoViewerProvider);
|
||||
handled = true;
|
||||
}
|
||||
if (!handled) {
|
||||
try {
|
||||
AndroidUtilities.openForView(message, getParentActivity());
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
alertUserOpenError(message);
|
||||
boolean handled = false;
|
||||
if (message.canPreviewDocument()) {
|
||||
PhotoViewer.getInstance().setParentActivity(getParentActivity());
|
||||
PhotoViewer.getInstance().openPhoto(message, message.type != 0 ? dialog_id : 0, message.type != 0 ? mergeDialogId : 0, photoViewerProvider);
|
||||
handled = true;
|
||||
}
|
||||
if (!handled) {
|
||||
try {
|
||||
AndroidUtilities.openForView(message, getParentActivity());
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
alertUserOpenError(message);
|
||||
}
|
||||
}
|
||||
} else if (message.getDocumentName().toLowerCase().endsWith(".nekox.json")) {
|
||||
|
||||
File finalLocFile = locFile;
|
||||
AlertUtil.showConfirm(getParentActivity(),
|
||||
LocaleController.getString("ImportProxyList", R.string.ImportProxyList),
|
||||
LocaleController.getString("ImportProxyList", R.string.ImportProxyListConfirm),
|
||||
LocaleController.getString("OK", R.string.OK), false, (d, v) -> {
|
||||
String status = ProxyListActivity.processProxyListFile(getParentActivity(), finalLocFile);
|
||||
if (!StrUtil.isBlank(status)) {
|
||||
presentFragment(new ProxyListActivity(status));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16803,7 +16859,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
|
||||
@Override
|
||||
public TextSelectionHelper.ChatListTextSelectionHelper getTextSelectionHelper() {
|
||||
public TextSelectionHelper.ChatListTextSelectionHelper getTextSelectionHelper
|
||||
() {
|
||||
return textSelectionHelper;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ package org.telegram.ui;
|
|||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -41,12 +42,12 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.BuildConfig;
|
||||
import org.telegram.messenger.DownloadController;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.BuildConfig;
|
||||
import org.telegram.messenger.SendMessagesHelper;
|
||||
import org.telegram.messenger.SharedConfig;
|
||||
import org.telegram.messenger.browser.Browser;
|
||||
|
@ -75,7 +76,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import kotlin.text.StringsKt;
|
||||
import okhttp3.HttpUrl;
|
||||
import tw.nekomimi.nekogram.ShadowsocksRSettingsActivity;
|
||||
import tw.nekomimi.nekogram.ShadowsocksSettingsActivity;
|
||||
|
@ -83,6 +83,8 @@ import tw.nekomimi.nekogram.VmessSettingsActivity;
|
|||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||
import tw.nekomimi.nekogram.utils.FileUtil;
|
||||
import tw.nekomimi.nekogram.utils.ProxyUtil;
|
||||
import tw.nekomimi.nekogram.utils.StrUtil;
|
||||
import tw.nekomimi.nekogram.utils.UIUtil;
|
||||
|
||||
public class ProxyListActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
|
@ -166,6 +168,9 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
colorKey = Theme.key_windowBackgroundWhiteBlueText6;
|
||||
if (currentInfo.ping != 0) {
|
||||
valueTextView.setText(LocaleController.getString("Connected", R.string.Connected) + ", " + LocaleController.formatString("Ping", R.string.Ping, currentInfo.ping));
|
||||
} else if (currentInfo.checking) {
|
||||
valueTextView.setText(LocaleController.getString("Connected", R.string.Connected) + ", " + LocaleController.formatString("Checking", R.string.Checking));
|
||||
colorKey = Theme.key_windowBackgroundWhiteGrayText2;
|
||||
} else {
|
||||
valueTextView.setText(LocaleController.getString("Connected", R.string.Connected));
|
||||
}
|
||||
|
@ -259,10 +264,6 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
updateRows(true);
|
||||
|
||||
if (!StringsKt.isBlank(alert)) {
|
||||
AlertUtil.showSimpleAlert(getParentActivity(),alert);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -295,13 +296,13 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
File proxyListFile = new File(proxyListFilePath);
|
||||
|
||||
processProxyListFile(getParentActivity(),proxyListFile);
|
||||
processProxyListFile(getParentActivity(), proxyListFile);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String processProxyListFile(Context ctx,File proxyListFile) {
|
||||
public static String processProxyListFile(Context ctx, File proxyListFile) {
|
||||
|
||||
try {
|
||||
|
||||
|
@ -389,7 +390,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
if (imported.isEmpty()) {
|
||||
|
||||
AlertUtil.showSimpleAlert(ctx,status.toString());
|
||||
AlertUtil.showSimpleAlert(ctx, status.toString());
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -436,7 +437,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
updateRows(true);
|
||||
} else if (id == menu_export_json) {
|
||||
|
||||
File cacheFile = new File(ApplicationLoader.applicationContext.getExternalCacheDir(), "NekoX-Proxy-List-" + new Date().toLocaleString() + ".json");
|
||||
File cacheFile = new File(ApplicationLoader.applicationContext.getExternalCacheDir(), "Proxy-List-" + new Date().toLocaleString() + ".nekox.json");
|
||||
|
||||
try {
|
||||
|
||||
|
@ -463,6 +464,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
FileUtil.writeUtf8String(listRoot.toString(4), cacheFile);
|
||||
} catch (JSONException e) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("*/*");
|
||||
|
@ -787,7 +789,15 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
return false;
|
||||
});
|
||||
|
||||
if (alert != null) {
|
||||
|
||||
AlertUtil.showSimpleAlert(context,alert);
|
||||
alert = null;
|
||||
|
||||
}
|
||||
|
||||
return fragmentView;
|
||||
|
||||
}
|
||||
|
||||
private void addProxy() {
|
||||
|
@ -990,29 +1000,25 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
if (currentConnectionState != state) {
|
||||
currentConnectionState = state;
|
||||
if (listView != null && SharedConfig.currentProxy != null) {
|
||||
synchronized (SharedConfig.proxyList) {
|
||||
int idx = SharedConfig.proxyList.indexOf(SharedConfig.currentProxy);
|
||||
if (idx >= 0) {
|
||||
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForAdapterPosition(idx + proxyStartRow);
|
||||
if (holder != null) {
|
||||
TextDetailProxyCell cell = (TextDetailProxyCell) holder.itemView;
|
||||
cell.updateStatus();
|
||||
}
|
||||
int idx = SharedConfig.proxyList.indexOf(SharedConfig.currentProxy);
|
||||
if (idx >= 0) {
|
||||
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForAdapterPosition(idx + proxyStartRow);
|
||||
if (holder != null && holder.itemView instanceof TextDetailProxyCell) {
|
||||
TextDetailProxyCell cell = (TextDetailProxyCell) holder.itemView;
|
||||
cell.updateStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (id == NotificationCenter.proxyCheckDone) {
|
||||
if (listView != null) {
|
||||
synchronized (SharedConfig.proxyList) {
|
||||
SharedConfig.ProxyInfo proxyInfo = (SharedConfig.ProxyInfo) args[0];
|
||||
int idx = SharedConfig.proxyList.indexOf(proxyInfo);
|
||||
if (idx >= 0) {
|
||||
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForAdapterPosition(idx + proxyStartRow);
|
||||
if (holder != null) {
|
||||
TextDetailProxyCell cell = (TextDetailProxyCell) holder.itemView;
|
||||
cell.updateStatus();
|
||||
}
|
||||
SharedConfig.ProxyInfo proxyInfo = (SharedConfig.ProxyInfo) args[0];
|
||||
int idx = SharedConfig.proxyList.indexOf(proxyInfo);
|
||||
if (idx >= 0) {
|
||||
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForAdapterPosition(idx + proxyStartRow);
|
||||
if (holder != null && holder.itemView instanceof TextDetailProxyCell) {
|
||||
TextDetailProxyCell cell = (TextDetailProxyCell) holder.itemView;
|
||||
cell.updateStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ import org.telegram.ui.Components.LayoutHelper;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import kotlin.text.StringsKt;
|
||||
import tw.nekomimi.nekogram.utils.PopupBuilder;
|
||||
import tw.nekomimi.nekogram.utils.StrUtil;
|
||||
|
||||
public class ShadowsocksRSettingsActivity extends BaseFragment {
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class ShadowsocksRSettingsActivity extends BaseFragment {
|
|||
return;
|
||||
}
|
||||
|
||||
if (StringsKt.isBlank(ipField.getText())) {
|
||||
if (StrUtil.isBlank(ipField.getText())) {
|
||||
|
||||
ipField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(ipField);
|
||||
|
@ -176,7 +176,7 @@ public class ShadowsocksRSettingsActivity extends BaseFragment {
|
|||
|
||||
}
|
||||
|
||||
if (StringsKt.isBlank(portField.getText())) {
|
||||
if (StrUtil.isBlank(portField.getText())) {
|
||||
|
||||
portField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(portField);
|
||||
|
@ -185,7 +185,7 @@ public class ShadowsocksRSettingsActivity extends BaseFragment {
|
|||
|
||||
}
|
||||
|
||||
if (StringsKt.isBlank(passwordField.getText())) {
|
||||
if (StrUtil.isBlank(passwordField.getText())) {
|
||||
|
||||
passwordField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(passwordField);
|
||||
|
|
|
@ -43,8 +43,8 @@ import org.telegram.ui.Components.LayoutHelper;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import kotlin.text.StringsKt;
|
||||
import tw.nekomimi.nekogram.utils.PopupBuilder;
|
||||
import tw.nekomimi.nekogram.utils.StrUtil;
|
||||
|
||||
public class ShadowsocksSettingsActivity extends BaseFragment {
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class ShadowsocksSettingsActivity extends BaseFragment {
|
|||
return;
|
||||
}
|
||||
|
||||
if (StringsKt.isBlank(ipField.getText())) {
|
||||
if (StrUtil.isBlank(ipField.getText())) {
|
||||
|
||||
ipField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(ipField);
|
||||
|
@ -169,7 +169,7 @@ public class ShadowsocksSettingsActivity extends BaseFragment {
|
|||
|
||||
}
|
||||
|
||||
if (StringsKt.isBlank(portField.getText())) {
|
||||
if (StrUtil.isBlank(portField.getText())) {
|
||||
|
||||
portField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(portField);
|
||||
|
@ -178,7 +178,7 @@ public class ShadowsocksSettingsActivity extends BaseFragment {
|
|||
|
||||
}
|
||||
|
||||
if (StringsKt.isBlank(passwordField.getText())) {
|
||||
if (StrUtil.isBlank(passwordField.getText())) {
|
||||
|
||||
passwordField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(passwordField);
|
||||
|
|
|
@ -47,8 +47,8 @@ import org.telegram.ui.Components.LayoutHelper;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import kotlin.text.StringsKt;
|
||||
import tw.nekomimi.nekogram.utils.PopupBuilder;
|
||||
import tw.nekomimi.nekogram.utils.StrUtil;
|
||||
|
||||
public class VmessSettingsActivity extends BaseFragment {
|
||||
|
||||
|
@ -174,7 +174,7 @@ public class VmessSettingsActivity extends BaseFragment {
|
|||
return;
|
||||
}
|
||||
|
||||
if (StringsKt.isBlank(ipField.getText())) {
|
||||
if (StrUtil.isBlank(ipField.getText())) {
|
||||
|
||||
ipField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(ipField);
|
||||
|
@ -183,7 +183,7 @@ public class VmessSettingsActivity extends BaseFragment {
|
|||
|
||||
}
|
||||
|
||||
if (StringsKt.isBlank(portField.getText())) {
|
||||
if (StrUtil.isBlank(portField.getText())) {
|
||||
|
||||
portField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(portField);
|
||||
|
@ -192,7 +192,7 @@ public class VmessSettingsActivity extends BaseFragment {
|
|||
|
||||
}
|
||||
|
||||
if (StringsKt.isBlank(userIdField.getText())) {
|
||||
if (StrUtil.isBlank(userIdField.getText())) {
|
||||
|
||||
userIdField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(userIdField);
|
||||
|
@ -201,7 +201,7 @@ public class VmessSettingsActivity extends BaseFragment {
|
|||
|
||||
}
|
||||
|
||||
if (StringsKt.isBlank(alterIdField.getText())) {
|
||||
if (StrUtil.isBlank(alterIdField.getText())) {
|
||||
|
||||
alterIdField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(alterIdField);
|
||||
|
@ -386,7 +386,7 @@ public class VmessSettingsActivity extends BaseFragment {
|
|||
container = new FrameLayout(context);
|
||||
useTlsField = new TextCheckCell(context);
|
||||
useTlsField.setBackground(Theme.getSelectorDrawable(false));
|
||||
useTlsField.setTextAndCheck(LocaleController.getString("VmessTls", R.string.VmessTls), !StringsKt.isBlank(currentBean.getStreamSecurity()), false);
|
||||
useTlsField.setTextAndCheck(LocaleController.getString("VmessTls", R.string.VmessTls), !StrUtil.isBlank(currentBean.getStreamSecurity()), false);
|
||||
container.addView(useTlsField, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 0, 0, 0, 0));
|
||||
|
||||
useTlsField.setOnClickListener((v) -> useTlsField.setChecked(!useTlsField.isChecked()));
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package tw.nekomimi.nekogram.utils
|
||||
|
||||
object StrUtil {
|
||||
|
||||
@JvmStatic
|
||||
fun isBlank(string: CharSequence?) = string?.isBlank() ?: true
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ import android.os.Handler
|
|||
import android.os.Looper
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import okhttp3.Dispatcher
|
||||
|
||||
|
|
Loading…
Reference in New Issue