Fixed some Sonar warnings

This commit is contained in:
TobiGr 2023-08-03 11:55:18 +02:00
parent 50d7d1b7b3
commit c69bcaafbb
2 changed files with 10 additions and 5 deletions

View file

@ -2,6 +2,7 @@ package org.schabi.newpipe.settings
import android.content.SharedPreferences import android.content.SharedPreferences
import android.util.Log import android.util.Log
import org.schabi.newpipe.MainActivity.DEBUG
import org.schabi.newpipe.streams.io.SharpOutputStream import org.schabi.newpipe.streams.io.SharpOutputStream
import org.schabi.newpipe.streams.io.StoredFileHelper import org.schabi.newpipe.streams.io.StoredFileHelper
import org.schabi.newpipe.util.ZipHelper import org.schabi.newpipe.util.ZipHelper
@ -32,7 +33,9 @@ class ContentSettingsManager(private val fileLocator: NewPipeFileLocator) {
output.flush() output.flush()
} }
} catch (e: IOException) { } 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") ZipHelper.addFileToZip(outZip, fileLocator.settings.path, "newpipe.settings")
@ -105,9 +108,13 @@ class ContentSettingsManager(private val fileLocator: NewPipeFileLocator) {
preferenceEditor.commit() preferenceEditor.commit()
} }
} catch (e: IOException) { } catch (e: IOException) {
Log.e(TAG, "Unable to loadSharedPreferences", e) if (DEBUG) {
Log.e(TAG, "Unable to loadSharedPreferences", e)
}
} catch (e: ClassNotFoundException) { } catch (e: ClassNotFoundException) {
Log.e(TAG, "Unable to loadSharedPreferences", e) if (DEBUG) {
Log.e(TAG, "Unable to loadSharedPreferences", e)
}
} }
} }
} }

View file

@ -4,7 +4,6 @@ import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.util.Log import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import androidx.annotation.NonNull
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.END import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.END
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID 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. * Determines if the playback should forward/rewind or do nothing.
*/ */
@NonNull
fun getFastSeekDirection(portion: DisplayPortion): FastSeekDirection fun getFastSeekDirection(portion: DisplayPortion): FastSeekDirection
fun seek(forward: Boolean) fun seek(forward: Boolean)