From 45d368547ffad72e9c2400b765b3f6d2c16697a5 Mon Sep 17 00:00:00 2001 From: James Fenn <18jafenn90@gmail.com> Date: Tue, 14 Jun 2016 16:18:28 -0400 Subject: [PATCH] fixed some small issues in the PlayerService --- app/build.gradle | 4 ++-- app/src/main/java/pasta/streamer/PlayerService.java | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 51706e7..e987426 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "pasta.streamer" minSdkVersion 16 targetSdkVersion 23 - versionCode 3 - versionName "1.2" + versionCode 4 + versionName "1.3" renderscriptTargetApi 19 renderscriptSupportModeEnabled true vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/pasta/streamer/PlayerService.java b/app/src/main/java/pasta/streamer/PlayerService.java index d3e8377..adc6b63 100644 --- a/app/src/main/java/pasta/streamer/PlayerService.java +++ b/app/src/main/java/pasta/streamer/PlayerService.java @@ -155,14 +155,11 @@ public void onConnectionMessage(String s) { private void onError(String message) { if (spotifyPlayer != null) { errorCount++; - if (errorCount < 5) { - if (spotifyPlayer.isShutdown()) { - Toast.makeText(getApplicationContext(), message + ", please restart the app.", Toast.LENGTH_SHORT).show(); - } else { - Toast.makeText(getApplicationContext(), message + ", attempting to restart...", Toast.LENGTH_SHORT).show(); - stopService(new Intent(this, PlayerService.class)); - startService(new Intent(this, PlayerService.class)); - } + if (errorCount > 5 && errorCount < 20) { + Toast.makeText(getApplicationContext(), message + ", attempting to restart...", Toast.LENGTH_SHORT).show(); + stopService(new Intent(this, PlayerService.class)); + startService(new Intent(this, PlayerService.class)); + errorCount = 20; } else Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show(); } }