Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-04-28 22:36:43 +02:00
commit ec3dcdd1bb
2 changed files with 31 additions and 22 deletions

View file

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

View file

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