Small improvements

This commit is contained in:
M66B
2019-10-05 11:57:54 +02:00
parent ad9199df68
commit 90fd7b440f
4 changed files with 20 additions and 14 deletions

View File

@@ -234,7 +234,7 @@ class ImageHelper {
}
// Data URI
if (data && (show || inline))
if (data && (show || inline || a.tracking))
try {
Drawable d = getDataDrawable(context, a.source);
if (view != null)
@@ -459,6 +459,7 @@ class ImageHelper {
private String source;
private int width = 0;
private int height = 0;
private boolean tracking = false;
// Encapsulate some ugliness
@@ -469,24 +470,25 @@ class ImageHelper {
int pos = source.substring(0, source.length() - 3).lastIndexOf("###");
if (pos > 0) {
int x = source.indexOf("x", pos + 3);
if (x > 0)
int s = source.indexOf(":", pos + 3);
if (x > 0 && s > x)
try {
this.width = Integer.parseInt(source.substring(pos + 3, x));
this.height = Integer.parseInt(source.substring(x + 1, source.length() - 3));
this.height = Integer.parseInt(source.substring(x + 1, s));
this.tracking = Boolean.parseBoolean(source.substring(s + 1, source.length() - 3));
this.source = source.substring(0, pos);
} catch (NumberFormatException ex) {
Log.e(ex);
this.width = 0;
this.height = 0;
}
}
}
}
AnnotatedSource(String source, int width, int height) {
AnnotatedSource(String source, int width, int height, boolean tracking) {
this.source = source;
this.width = width;
this.height = height;
this.tracking = tracking;
}
public String getSource() {
@@ -496,7 +498,7 @@ class ImageHelper {
String getAnnotated() {
return (width == 0 && height == 0
? source
: source + "###" + width + "x" + height + "###");
: source + "###" + width + "x" + height + ":" + tracking + "###");
}
}
}