|
|
@ -597,16 +597,11 @@ public class ContactInfo {
|
|
|
|
if (t != 0)
|
|
|
|
if (t != 0)
|
|
|
|
return t;
|
|
|
|
return t;
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: multiple sizes
|
|
|
|
int s1 = getSize(img1.attr("sizes"));
|
|
|
|
String[] s1 = img1.attr("sizes").split("[x|X]");
|
|
|
|
int s2 = getSize(img2.attr("sizes"));
|
|
|
|
String[] s2 = img2.attr("sizes").split("[x|X]");
|
|
|
|
|
|
|
|
Integer w1 = Helper.parseInt(s1.length == 2 ? s1[0] : null);
|
|
|
|
|
|
|
|
Integer h1 = Helper.parseInt(s1.length == 2 ? s1[1] : null);
|
|
|
|
|
|
|
|
Integer w2 = Helper.parseInt(s2.length == 2 ? s2[0] : null);
|
|
|
|
|
|
|
|
Integer h2 = Helper.parseInt(s2.length == 2 ? s2[1] : null);
|
|
|
|
|
|
|
|
return Integer.compare(
|
|
|
|
return Integer.compare(
|
|
|
|
Math.abs(Math.min(w1 == null ? 0 : w1, h1 == null ? 0 : h1) - scaleToPixels),
|
|
|
|
Math.abs(s1 - scaleToPixels),
|
|
|
|
Math.abs(Math.min(w2 == null ? 0 : w2, h2 == null ? 0 : h2) - scaleToPixels));
|
|
|
|
Math.abs(s2 - scaleToPixels));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -648,6 +643,25 @@ public class ContactInfo {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static int getSize(String sizes) {
|
|
|
|
|
|
|
|
int max = 0;
|
|
|
|
|
|
|
|
for (String size : sizes.split(" ")) {
|
|
|
|
|
|
|
|
int min = Integer.MAX_VALUE;
|
|
|
|
|
|
|
|
for (String p : size.trim().split("[x|X]"))
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
int x = Integer.parseInt(p);
|
|
|
|
|
|
|
|
if (x < min)
|
|
|
|
|
|
|
|
min = x;
|
|
|
|
|
|
|
|
} catch (NumberFormatException ex) {
|
|
|
|
|
|
|
|
Log.w(ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (min != Integer.MAX_VALUE && min > max)
|
|
|
|
|
|
|
|
max = min;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return max;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
@NonNull
|
|
|
|
private static Bitmap getFavicon(URL url, String type, int scaleToPixels, Context context) throws IOException {
|
|
|
|
private static Bitmap getFavicon(URL url, String type, int scaleToPixels, Context context) throws IOException {
|
|
|
|
Log.i("GET favicon " + url);
|
|
|
|
Log.i("GET favicon " + url);
|
|
|
|