Skip to content

Commit

Permalink
-fix for locale issue #91
Browse files Browse the repository at this point in the history
-Direction of movement branches off of the HQ staff when present
  • Loading branch information
Michael Spinelli committed Apr 8, 2019
1 parent 9706d9c commit c943953
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=0.1.45
version=0.1.46
android.enableBuildCache=true
org.gradle.jvmargs=-Xmx1536M
# android.enableAapt2=false
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public void drawSymbol(View view)
outline.setStrokeWidth(1);
//draw outline around symbol////////////////////////////////////////////////////////
//msCanvas.drawRect(ii.getSymbolBounds(), outline);
//msCanvas.drawRect(ii.getCenterPoint().x - 1, ii.getCenterPoint().y - 1, ii.getCenterPoint().x + 1, ii.getCenterPoint().y + 1, outline);//*/
msCanvas.drawRect(ii.getCenterPoint().x - 1, ii.getCenterPoint().y - 1, ii.getCenterPoint().x + 1, ii.getCenterPoint().y + 1, outline);//*/


Log.i(TAG, "SymbolBounds: " + ii.getSymbolBounds().toString());
Expand Down
75 changes: 65 additions & 10 deletions renderer/src/main/java/armyc2/c2sd/renderer/ModifierRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1170,11 +1170,24 @@ private static Point[] createDOMArrowPoints(String symbolID, Rect bounds, Point
Point pt2 = null;
Point pt3 = null;

char affiliation = symbolID.charAt(1);
int length = 40;
if (SymbolUtilities.isNBC(symbolID))
{
length = Math.round(bounds.height() / 2);
}
else if((SymbolUtilities.isHQ(symbolID)) &&
(affiliation==('F') ||
affiliation==('A') ||
affiliation==('D') ||
affiliation==('M') ||
affiliation==('J') ||
affiliation==('K') ||
affiliation==('N') ||
affiliation==('L')) == false)
{
length = (int)Math.round(bounds.height() * 0.7);
}
else
{
length = bounds.height();
Expand All @@ -1190,24 +1203,66 @@ private static Point[] createDOMArrowPoints(String symbolID, Rect bounds, Point

pt1 = new Point(x1, y1);
char scheme = symbolID.charAt(0);
if (SymbolUtilities.isNBC(symbolID)
if (SymbolUtilities.isHQ(symbolID)==false && SymbolUtilities.isNBC(symbolID)
|| (scheme == 'S' && symbolID.charAt(2) == ('G')) ||
scheme == 'O' || scheme == 'E')
{
y1 = bounds.top + bounds.height();
pt1 = new Point(x1, y1);

if (isY == true && SymbolUtilities.isNBC(symbolID))//make room for y modifier
//drawStaff = true;
if(SymbolUtilities.isHQ(symbolID)==false)//has HQ staff to start from
{
int yModifierOffset = (int) _modifierFontHeight;
y1 = bounds.top + bounds.height();
pt1 = new Point(x1, y1);

yModifierOffset += RS.getTextOutlineWidth();
if (isY == true && SymbolUtilities.isNBC(symbolID))//make room for y modifier
{
int yModifierOffset = (int) _modifierFontHeight;

yModifierOffset += RS.getTextOutlineWidth();

pt1.offset(0, yModifierOffset);
}

pt1.offset(0, yModifierOffset);
y1 = y1 + length;
pt2 = new Point(x1, y1);
}
else
{
x1 = bounds.left+1;
pt2 = new Point(x1, y1);
if(affiliation == 'F' ||
affiliation == 'A' ||
affiliation == 'D' ||
affiliation == 'M' ||
affiliation == 'J' ||
affiliation == 'K' ||
affiliation == 'N' ||
affiliation == 'L')
{
/*y1 = bounds.top + bounds.height();
pt1 = new Point(x1, y1);
y1 = y1 + length;
pt2 = new Point(x1, y1);//*/

pt1.x = x1;
y1 = bounds.top + (bounds.height());
pt1.y = y1;
x2 = x1;
pt2.x = x2;
y1 = pt1.y + bounds.height();
pt2.y = y1;//*/

y1 = y1 + length;
pt2 = new Point(x1, y1);
}
else
{
pt1.x = x1;
y1 = bounds.top + (bounds.height() / 2);
pt1.y = y1;
x2 = x1;
pt2.x = x2;
y1 = pt1.y + bounds.height();
pt2.y = y1;
}
}
}

//get endpoint given start point and an angle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import java.util.logging.Level;
import java.util.regex.Pattern;
Expand All @@ -17,11 +18,10 @@
public class SymbolUtilities
{

private static SimpleDateFormat dateFormatFront = new SimpleDateFormat("ddHHmmss");
private static SimpleDateFormat dateFormatBack = new SimpleDateFormat("MMMyy");
private static SimpleDateFormat dateFormatFull = new SimpleDateFormat("ddHHmmssZMMMyy");
private static SimpleDateFormat dateFormatZulu = new SimpleDateFormat("Z");

private static SimpleDateFormat dateFormatFront = new SimpleDateFormat("ddHHmmss", Locale.US);
private static SimpleDateFormat dateFormatBack = new SimpleDateFormat("MMMyy", Locale.US);
private static SimpleDateFormat dateFormatFull = new SimpleDateFormat("ddHHmmssZMMMyy", Locale.US);
private static SimpleDateFormat dateFormatZulu = new SimpleDateFormat("Z", Locale.US);

//this regex is from: https://docs.oracle.com/javase/7/docs/api/java/lang/Double.html
private static final String Digits = "(\\p{Digit}+)";
Expand Down

0 comments on commit c943953

Please sign in to comment.