From: Tim Parenti Date: Mon, 4 Mar 2019 01:00:20 +0000 (-0500) Subject: Reformat integer game scores as locale-formatted strings. X-Git-Tag: release-1.4~18^2 X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=227ee5889645739319762311752f9aedfe47e924;p=acmetensortoys-ctfws-android Reformat integer game scores as locale-formatted strings. Resolves #16. --- diff --git a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/CtFwSDisplayLocal.java b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/CtFwSDisplayLocal.java index 0e8f923..ad72336 100644 --- a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/CtFwSDisplayLocal.java +++ b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/CtFwSDisplayLocal.java @@ -356,8 +356,9 @@ class CtFwSDisplayLocal implements CtFwSGameStateManager.Observer { Resources rs = mAct.getResources(); if (gs.getFlagsVisible()) { + NumberFormat nf = NumberFormat.getIntegerInstance(); h = AndroidResourceUtils.htmlFromStrResId(rs, R.string.flags_viz_fmt, - gs.getFlagsRed(), gs.getFlagsYel()); + nf.format(gs.getFlagsRed()), nf.format(gs.getFlagsYel())); } else { h = AndroidResourceUtils.htmlFromStrResId(rs, R.string.flags_noviz); } @@ -463,4 +464,4 @@ class CtFwSDisplayLocal implements CtFwSGameStateManager.Observer { st.ch.setVisibility(View.VISIBLE); st.pb.setVisibility(View.VISIBLE); } -} \ No newline at end of file +} diff --git a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainServiceNotification.java b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainServiceNotification.java index ecb84f4..225e956 100644 --- a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainServiceNotification.java +++ b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainServiceNotification.java @@ -139,9 +139,10 @@ class MainServiceNotification { || (game.getFlagsRed() + game.getFlagsYel() > 0))) { notifyUserSomehow(NotificationSource.FLAG); lastContextTextSource = LastContentTextSource.FLAG; + NumberFormat nf = NumberFormat.getIntegerInstance(); userNoteBuilder.setContentText( String.format(mService.getResources().getString(R.string.notify_flags), - game.getFlagsRed(), game.getFlagsYel())); + nf.format(game.getFlagsRed()), nf.format(game.getFlagsYel()))); refreshNotification(); } } diff --git a/mobile/src/main/res/values/strings.xml b/mobile/src/main/res/values/strings.xml index 7f4d5b6..6052a47 100644 --- a/mobile/src/main/res/values/strings.xml +++ b/mobile/src/main/res/values/strings.xml @@ -19,7 +19,7 @@ Default - Red: %1$d, Yellow: %2$d]]> + Red: %1$s, Yellow: %2$s]]> Flag scores hidden @@ -35,7 +35,7 @@ Start time in the future! Game over! Game not configured! - Flag captured! Red:%1$d Yellow:%2$d + Flag captured! Red:%1$s Yellow:%2$s Jailbreak %1$d of %2$d About