From 227ee5889645739319762311752f9aedfe47e924 Mon Sep 17 00:00:00 2001 From: Tim Parenti Date: Sun, 3 Mar 2019 20:00:20 -0500 Subject: [PATCH] Reformat integer game scores as locale-formatted strings. Resolves #16. --- .../com/acmetensortoys/ctfwstimer/CtFwSDisplayLocal.java | 5 +++-- .../acmetensortoys/ctfwstimer/MainServiceNotification.java | 3 ++- mobile/src/main/res/values/strings.xml | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) 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 -- 2.50.1