This commit is contained in:
世界 2020-04-01 15:34:45 +08:00
parent 0c24f4a240
commit b345ec6784
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
4 changed files with 36 additions and 14 deletions

View File

@ -1769,6 +1769,9 @@ public class MessagesStorage extends BaseController {
int idx2 = muted ? 1 : 0;
if (muted) {
mutedDialogs.put(user.id, true);
if (NekoXConfig.ignoreMutedCount) {
continue;
}
}
if (user.bot) {
bots[idx1][idx2]++;
@ -1802,6 +1805,9 @@ public class MessagesStorage extends BaseController {
int idx2 = muted ? 1 : 0;
if (muted) {
mutedDialogs.put(user.id, true);
if (NekoXConfig.ignoreMutedCount) {
continue;
}
}
if (user.self || user.contact) {
contacts[idx1][idx2]++;
@ -1827,6 +1833,9 @@ public class MessagesStorage extends BaseController {
int idx2 = muted && dialogsWithMentions.indexOfKey(-chat.id) < 0 ? 1 : 0;
if (muted) {
mutedDialogs.put(-chat.id, true);
if (NekoXConfig.ignoreMutedCount) {
continue;
}
}
if (ChatObject.isChannel(chat) && !chat.megagroup) {
channels[idx1][idx2]++;
@ -1870,13 +1879,13 @@ public class MessagesStorage extends BaseController {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) != 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_ONLY_ARCHIVED) == 0) {
unreadCount += contacts[0][0];
if (!NekoXConfig.ignoreMutedCount && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
unreadCount += contacts[0][1];
}
}
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0) {
unreadCount += contacts[1][0];
if (!NekoXConfig.ignoreMutedCount && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
unreadCount += contacts[1][1];
}
}
@ -1884,13 +1893,13 @@ public class MessagesStorage extends BaseController {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) != 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_ONLY_ARCHIVED) == 0) {
unreadCount += nonContacts[0][0];
if (!NekoXConfig.ignoreMutedCount && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
unreadCount += nonContacts[0][1];
}
}
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0) {
unreadCount += nonContacts[1][0];
if (!NekoXConfig.ignoreMutedCount && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
unreadCount += nonContacts[1][1];
}
}
@ -1898,13 +1907,13 @@ public class MessagesStorage extends BaseController {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_GROUPS) != 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_ONLY_ARCHIVED) == 0) {
unreadCount += groups[0][0];
if (!NekoXConfig.ignoreMutedCount && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
unreadCount += groups[0][1];
}
}
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0) {
unreadCount += groups[1][0];
if (!NekoXConfig.ignoreMutedCount && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
unreadCount += groups[1][1];
}
}
@ -1912,13 +1921,13 @@ public class MessagesStorage extends BaseController {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CHANNELS) != 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_ONLY_ARCHIVED) == 0) {
unreadCount += channels[0][0];
if (!NekoXConfig.ignoreMutedCount && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
unreadCount += channels[0][1];
}
}
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0) {
unreadCount += channels[1][0];
if (!NekoXConfig.ignoreMutedCount && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
unreadCount += channels[1][1];
}
}
@ -1926,13 +1935,13 @@ public class MessagesStorage extends BaseController {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) != 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_ONLY_ARCHIVED) == 0) {
unreadCount += bots[0][0];
if (!NekoXConfig.ignoreMutedCount && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
unreadCount += bots[0][1];
}
}
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0) {
unreadCount += bots[1][0];
if (!NekoXConfig.ignoreMutedCount && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
unreadCount += bots[1][1];
}
}

View File

@ -88,6 +88,8 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
private int callsRow;
private int callsDetailRow;
private ActionBarMenuItem otherItem;
public class TextDetailProxyCell extends FrameLayout {
private TextView textView;
@ -249,6 +251,8 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
private int menu_add_input_ssr = 8;
private int menu_add_import_from_clipboard = 5;
private int menu_add_scan_qr = 6;
private int menu_other = 9;
private int menu_retest_ping = 10;
@Override
public View createView(Context context) {
@ -263,6 +267,8 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
} else if (id == menu_retest_ping) {
checkProxyList(true);
}
}
});
@ -355,6 +361,10 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
}
otherItem = menu.addItem(menu_other, R.drawable.ic_ab_other);
otherItem.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
otherItem.addSubItem(menu_retest_ping, LocaleController.getString("RetestPing", R.string.RetestPing));
listAdapter = new ListAdapter(context);
fragmentView = new FrameLayout(context);
@ -675,20 +685,22 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
listAdapter.notifyItemRangeRemoved(proxyDetailRow + 1, 2);
}
}
checkProxyList();
checkProxyList(false);
if (notify && listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
}
private void checkProxyList() {
private void checkProxyList(boolean force) {
for (int a = 0, count = SharedConfig.proxyList.size(); a < count; a++) {
final SharedConfig.ProxyInfo proxyInfo = SharedConfig.proxyList.get(a);
if (proxyInfo.checking || SystemClock.elapsedRealtime() - proxyInfo.availableCheckTime < 2 * 60 * 1000L) {
if (proxyInfo.checking || (SystemClock.elapsedRealtime() - proxyInfo.availableCheckTime < 2 * 60 * 1000L && !force)) {
continue;
}
proxyInfo.checking = true;
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxyCheckDone, proxyInfo);
if (proxyInfo instanceof SharedConfig.ExternalSocks5Proxy && proxyInfo != SharedConfig.currentProxy) {
((SharedConfig.ExternalSocks5Proxy) proxyInfo).start();
}

View File

@ -126,7 +126,7 @@ class ShadowsocksLoader {
}
val methodAndPswd = Utils.decode(link.username)
val methodAndPswd = Utils.decodeUrlSafe(link.username)
return Bean(
link.host,

View File

@ -98,6 +98,7 @@
<string name="SSRObfsParam">Obfs Param</string>
<string name="ProxyRemarks">Remarks</string>
<string name="RetestPing">Retest ping for all servers</string>
<string name="MinApi21Required">Sorry, you need at least Android 5 (API21).</string>