зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1325488 - Deduplicate subdomain removal in IconGenerator. r=ahunt
This commit is contained in:
Родитель
acb94fc181
Коммит
348fb50602
|
@ -21,6 +21,7 @@ import android.util.TypedValue;
|
||||||
import org.mozilla.gecko.R;
|
import org.mozilla.gecko.R;
|
||||||
import org.mozilla.gecko.icons.IconRequest;
|
import org.mozilla.gecko.icons.IconRequest;
|
||||||
import org.mozilla.gecko.icons.IconResponse;
|
import org.mozilla.gecko.icons.IconResponse;
|
||||||
|
import org.mozilla.gecko.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This loader will generate an icon in case no icon could be loaded. In order to do so this needs
|
* This loader will generate an icon in case no icon could be loaded. In order to do so this needs
|
||||||
|
@ -43,14 +44,6 @@ public class IconGenerator implements IconLoader {
|
||||||
0xFFea385e,
|
0xFFea385e,
|
||||||
};
|
};
|
||||||
|
|
||||||
// List of common prefixes of host names. Those prefixes will be striped before a prepresentative
|
|
||||||
// character for an URL is determined.
|
|
||||||
private static final String[] COMMON_PREFIXES = {
|
|
||||||
"www.",
|
|
||||||
"m.",
|
|
||||||
"mobile.",
|
|
||||||
};
|
|
||||||
|
|
||||||
private static final int TEXT_SIZE_DP = 12;
|
private static final int TEXT_SIZE_DP = 12;
|
||||||
@Override
|
@Override
|
||||||
public IconResponse load(IconRequest request) {
|
public IconResponse load(IconRequest request) {
|
||||||
|
@ -156,12 +149,8 @@ public class IconGenerator implements IconLoader {
|
||||||
return "?";
|
return "?";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip common prefixes that we do not want to use to determine the representative character
|
// Strip common prefixes that we do not want to use to determine the representative characterS
|
||||||
for (String prefix : COMMON_PREFIXES) {
|
snippet = StringUtils.stripCommonSubdomains(snippet);
|
||||||
if (snippet.startsWith(prefix)) {
|
|
||||||
snippet = snippet.substring(prefix.length());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return snippet;
|
return snippet;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче