1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-27 02:09:41 +00:00

Prevent double name lookups

This commit is contained in:
M66B 2016-02-14 10:16:44 +01:00
parent bb3f4bf212
commit 46b054b9f8
2 changed files with 30 additions and 19 deletions

View file

@ -117,9 +117,13 @@ public class AdapterAccess extends CursorAdapter {
Util.getProtocolName(protocol, version, true) +
" " + daddr + (dport > 0 ? "/" + dport : ""));
if (Util.isNumericAddress(daddr)) {
tvDest.setTag(id);
if (Util.isNumericAddress(daddr) && tvDest.getTag() == null)
new AsyncTask<String, Object, String>() {
@Override
protected void onPreExecute() {
tvDest.setTag(id);
}
@Override
protected String doInBackground(String... args) {
try {
@ -135,9 +139,9 @@ public class AdapterAccess extends CursorAdapter {
tvDest.setText(
Util.getProtocolName(protocol, version, true) +
" " + addr + (dport > 0 ? "/" + dport : ""));
tvDest.setTag(null);
}
}.execute(daddr);
}
if (allowed < 0)
tvDest.setTextColor(colorText);

View file

@ -220,9 +220,14 @@ public class AdapterLog extends CursorAdapter {
if (resolve && !isKnownAddress(daddr))
if (dname == null) {
if (tvDaddr.getTag() == null) {
tvDaddr.setText(daddr);
tvDaddr.setTag(id);
new AsyncTask<String, Object, String>() {
@Override
protected void onPreExecute() {
tvDaddr.setTag(id);
}
@Override
protected String doInBackground(String... args) {
try {
@ -236,8 +241,10 @@ public class AdapterLog extends CursorAdapter {
protected void onPostExecute(String name) {
if ((Long) tvDaddr.getTag() == id)
tvDaddr.setText(name);
tvDaddr.setTag(null);
}
}.execute(daddr);
}
} else
tvDaddr.setText(dname);
else