From 662c58ab23d5f799f308377256d4aafb274e5792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Mart=C3=ADnez?= Date: Tue, 7 Nov 2017 19:05:34 +0100 Subject: [PATCH] Fixed bug with locale processing floats --- .../android/exoplayer2/demo/PlayerActivity.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/demo/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java b/demo/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java index 8b8b52d..921b5ca 100755 --- a/demo/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java +++ b/demo/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java @@ -701,8 +701,17 @@ protected void depictPlayerStats() { return; String buffer = DemoUtil.getFormattedDouble((bufferedDurationMs / Math.pow(10, 6)), 1); String brEstimate = DemoUtil.getFormattedDouble((bitrateEstimate / Math.pow(10, 3)), 1); - updateStatChart(player_stats_health_chart, Float.parseFloat(buffer), ColorTemplate.getHoloBlue(), "Buffer Health: " + buffer + " s"); - updateStatChart(player_stats_speed_chart, Float.parseFloat(brEstimate), Color.LTGRAY, "Conn Speed: " + DemoUtil.humanReadableByteCount( + float fBuffer = 0f; + float fBrEstimate = 0f; + try { + fBuffer = NumberFormat.getInstance().parse(buffer).floatValue(); + fBrEstimate = NumberFormat.getInstance().parse(brEstimate).floatValue(); + } catch (ParseException e) { + e.printStackTrace(); + } + + updateStatChart(player_stats_health_chart, fBuffer, ColorTemplate.getHoloBlue(), "Buffer Health: " + buffer + " s"); + updateStatChart(player_stats_speed_chart, fBrEstimate, Color.LTGRAY, "Conn Speed: " + DemoUtil.humanReadableByteCount( bitrateEstimate, true, true) + "ps"); player_stats_size.setText("Screen Dimensions: " + simpleExoPlayerView.getWidth() + " x " + simpleExoPlayerView.getHeight()); player_stats_res.setText("Video Resolution: " + (null != currentVideoFormat ? (currentVideoFormat.width + " x " + currentVideoFormat.height) : "NA"));