Update shield res icon

This commit is contained in:
Victor Shcherb 2015-04-28 22:36:04 +02:00
parent 5ccb27a421
commit e5b6bbe32d
2 changed files with 31 additions and 22 deletions

View file

@ -239,11 +239,11 @@ collectExternalResources.dependsOn collectVoiceAssets,
collectMiscResources,
copyStyleIcons,
updateNoTranslate
tasks.whenTaskAdded { task ->
if (task.name.startsWith("generate") && task.name.endsWith("Resources")) {
task.dependsOn collectExternalResources
}
}
// tasks.whenTaskAdded { task ->
// if (task.name.startsWith("generate") && task.name.endsWith("Resources")) {
// task.dependsOn collectExternalResources
// }
// }
// Legacy core build
import org.apache.tools.ant.taskdefs.condition.Os

View file

@ -57,6 +57,7 @@ public class TextRenderer {
int textWrap = 0;
boolean bold = false;
String shieldRes = null;
String shieldResIcon = null;
int textOrder = 100;
int textShadowColor = Color.WHITE;
@ -81,6 +82,9 @@ public class TextRenderer {
if (render.isSpecified(render.ALL.R_TEXT_SHIELD)) {
shieldRes = render.getStringPropertyValue(render.ALL.R_TEXT_SHIELD);
}
if (render.isSpecified(render.ALL.R_ICON)) {
shieldResIcon = render.getStringPropertyValue(render.ALL.R_ICON);
}
textOrder = render.getIntPropertyValue(render.ALL.R_TEXT_ORDER, 100);
}
}
@ -251,9 +255,20 @@ public class TextRenderer {
cv.drawTextOnPath(text.text, text.drawOnPath, 0,
text.vOffset - ( paintText.ascent()/2 + paintText.descent()), paintText);
} else {
if (text.shieldRes != null) {
drawShieldIcon(rc, cv, text, text.shieldRes);
drawShieldIcon(rc, cv, text, text.shieldResIcon);
drawWrappedText(cv, text, textSize);
}
}
}
}
}
private void drawShieldIcon(RenderingContext rc, Canvas cv, TextDrawInfo text, String sr) {
if (sr != null) {
float coef = rc.getDensityValue(rc.screenDensityRatio * rc.textScale);
Bitmap ico = RenderingIcons.getIcon(context, text.shieldRes);
Bitmap ico = RenderingIcons.getIcon(context, sr);
if (ico != null) {
float left = text.centerX - ico.getWidth() / 2 * coef - 0.5f;
float top = text.centerY - ico.getHeight() / 2 * coef - paintText.descent() - 0.5f;
@ -268,12 +283,6 @@ public class TextRenderer {
}
}
}
drawWrappedText(cv, text, textSize);
}
}
}
}
}
private void drawWrappedText(Canvas cv, TextDrawInfo text, float textSize) {