From 98cd54657a583d4246fca65c3358cbc5e715f7c6 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Fri, 17 Aug 2018 00:25:48 +0200 Subject: [PATCH] Avoid unnecessary boxing --- .../gadgetbridge/externalevents/MusicPlaybackReceiver.java | 6 +++--- .../gadgetbridge/externalevents/OmniJawsObserver.java | 2 +- .../freeyourgadget/gadgetbridge/util/AndroidUtils.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/MusicPlaybackReceiver.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/MusicPlaybackReceiver.java index 88193d7ef..7224232d7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/MusicPlaybackReceiver.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/MusicPlaybackReceiver.java @@ -76,11 +76,11 @@ public class MusicPlaybackReceiver extends BroadcastReceiver { stateSpec.state = (byte) (((Boolean) incoming) ? MusicStateSpec.STATE_PLAYING : MusicStateSpec.STATE_PAUSED); stateSpec.playRate = (byte) (((Boolean) incoming) ? 100 : 0); } else if (incoming instanceof String && "duration".equals(key)) { - musicSpec.duration = Integer.valueOf((String) incoming) / 1000; + musicSpec.duration = Integer.parseInt((String) incoming) / 1000; } else if (incoming instanceof String && "trackno".equals(key)) { - musicSpec.trackNr = Integer.valueOf((String) incoming); + musicSpec.trackNr = Integer.parseInt((String) incoming); } else if (incoming instanceof String && "totaltrack".equals(key)) { - musicSpec.trackCount = Integer.valueOf((String) incoming); + musicSpec.trackCount = Integer.parseInt((String) incoming); } else if (incoming instanceof Integer && "pos".equals(key)) { stateSpec.position = (Integer) incoming; } else if (incoming instanceof Integer && "repeat".equals(key)) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/OmniJawsObserver.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/OmniJawsObserver.java index 83b21a2e9..d978f4e0a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/OmniJawsObserver.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/OmniJawsObserver.java @@ -121,7 +121,7 @@ public class OmniJawsObserver extends ContentObserver { weatherSpec.windSpeed = toKmh(c.getFloat(11)); weatherSpec.windDirection = c.getInt(12); - weatherSpec.timestamp = (int) (Long.valueOf(c.getString(9)) / 1000); + weatherSpec.timestamp = (int) (Long.parseLong(c.getString(9)) / 1000); } else if (i == 1) { weatherSpec.todayMinTemp = toKelvin(c.getFloat(5)); weatherSpec.todayMaxTemp = toKelvin(c.getFloat(6)); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/AndroidUtils.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/AndroidUtils.java index 7bf8b9cfb..ddbbb100c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/AndroidUtils.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/AndroidUtils.java @@ -181,7 +181,7 @@ public class AndroidUtils { return id.replaceFirst("raw:", ""); } uri = ContentUris.withAppendedId( - Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); + Uri.parse("content://downloads/public_downloads"), Long.parseLong(id)); } } else if ("com.android.providers.media.documents".equals(uri.getAuthority())) { final String docId = DocumentsContract.getDocumentId(uri);