From c69bcaafbb80ddc736e0bf14e1fb01e592d7d464 Mon Sep 17 00:00:00 2001 From: TobiGr Date: Thu, 3 Aug 2023 11:55:18 +0200 Subject: [PATCH] Fixed some Sonar warnings --- .../newpipe/settings/ContentSettingsManager.kt | 13 ++++++++++--- .../newpipe/views/player/PlayerFastSeekOverlay.kt | 2 -- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsManager.kt b/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsManager.kt index 92be93a29..df56de516 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsManager.kt +++ b/app/src/main/java/org/schabi/newpipe/settings/ContentSettingsManager.kt @@ -2,6 +2,7 @@ package org.schabi.newpipe.settings import android.content.SharedPreferences import android.util.Log +import org.schabi.newpipe.MainActivity.DEBUG import org.schabi.newpipe.streams.io.SharpOutputStream import org.schabi.newpipe.streams.io.StoredFileHelper import org.schabi.newpipe.util.ZipHelper @@ -32,7 +33,9 @@ class ContentSettingsManager(private val fileLocator: NewPipeFileLocator) { output.flush() } } catch (e: IOException) { - Log.e(TAG, "Unable to exportDatabase", e) + if (DEBUG) { + Log.e(TAG, "Unable to exportDatabase", e) + } } ZipHelper.addFileToZip(outZip, fileLocator.settings.path, "newpipe.settings") @@ -105,9 +108,13 @@ class ContentSettingsManager(private val fileLocator: NewPipeFileLocator) { preferenceEditor.commit() } } catch (e: IOException) { - Log.e(TAG, "Unable to loadSharedPreferences", e) + if (DEBUG) { + Log.e(TAG, "Unable to loadSharedPreferences", e) + } } catch (e: ClassNotFoundException) { - Log.e(TAG, "Unable to loadSharedPreferences", e) + if (DEBUG) { + Log.e(TAG, "Unable to loadSharedPreferences", e) + } } } } diff --git a/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt b/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt index d0782e1a1..877070a91 100644 --- a/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt +++ b/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt @@ -4,7 +4,6 @@ import android.content.Context import android.util.AttributeSet import android.util.Log import android.view.LayoutInflater -import androidx.annotation.NonNull import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.END import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID @@ -127,7 +126,6 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) : /** * Determines if the playback should forward/rewind or do nothing. */ - @NonNull fun getFastSeekDirection(portion: DisplayPortion): FastSeekDirection fun seek(forward: Boolean)