Enable StrictMode logging, rm unused prefs

This commit is contained in:
tzugen 2022-04-20 13:15:22 +02:00
parent 3691428a68
commit 69c78f4c37
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
5 changed files with 3 additions and 76 deletions

View File

@ -1,6 +1,7 @@
package org.moire.ultrasonic.app
import android.content.Context
import android.os.StrictMode
import androidx.multidex.MultiDexApplication
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin
@ -25,6 +26,8 @@ class UApp : MultiDexApplication() {
init {
instance = this
if (BuildConfig.DEBUG)
StrictMode.enableDefaults()
}
override fun onCreate() {

View File

@ -17,7 +17,6 @@ import androidx.preference.CheckBoxPreference
import androidx.preference.EditTextPreference
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat
import java.io.File
import kotlin.math.ceil
@ -112,10 +111,6 @@ class SettingsFragment :
chatRefreshInterval = findPreference(Constants.PREFERENCES_KEY_CHAT_REFRESH_INTERVAL)
directoryCacheTime = findPreference(Constants.PREFERENCES_KEY_DIRECTORY_CACHE_TIME)
mediaButtonsEnabled = findPreference(Constants.PREFERENCES_KEY_MEDIA_BUTTONS)
lockScreenEnabled = findPreference(Constants.PREFERENCES_KEY_SHOW_LOCK_SCREEN_CONTROLS)
sendBluetoothAlbumArt = findPreference(Constants.PREFERENCES_KEY_SEND_BLUETOOTH_ALBUM_ART)
sendBluetoothNotifications =
findPreference(Constants.PREFERENCES_KEY_SEND_BLUETOOTH_NOTIFICATIONS)
sharingDefaultDescription =
findPreference(Constants.PREFERENCES_KEY_DEFAULT_SHARE_DESCRIPTION)
sharingDefaultGreeting = findPreference(Constants.PREFERENCES_KEY_DEFAULT_SHARE_GREETING)
@ -128,21 +123,6 @@ class SettingsFragment :
sharingDefaultGreeting!!.text = shareGreeting
setupClearSearchPreference()
setupCacheLocationPreference()
// After API26 foreground services must be used for music playback, and they must have a notification
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val notificationsCategory =
findPreference<PreferenceCategory>(Constants.PREFERENCES_KEY_CATEGORY_NOTIFICATIONS)
var preferenceToRemove =
findPreference<Preference>(Constants.PREFERENCES_KEY_SHOW_NOTIFICATION)
if (preferenceToRemove != null) notificationsCategory!!.removePreference(
preferenceToRemove
)
preferenceToRemove = findPreference(Constants.PREFERENCES_KEY_ALWAYS_SHOW_NOTIFICATION)
if (preferenceToRemove != null) notificationsCategory!!.removePreference(
preferenceToRemove
)
}
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
@ -208,9 +188,6 @@ class SettingsFragment :
Constants.PREFERENCES_KEY_HIDE_MEDIA -> {
setHideMedia(sharedPreferences.getBoolean(key, false))
}
Constants.PREFERENCES_KEY_SEND_BLUETOOTH_NOTIFICATIONS -> {
setBluetoothPreferences(sharedPreferences.getBoolean(key, true))
}
Constants.PREFERENCES_KEY_DEBUG_LOG_TO_FILE -> {
setDebugLogToFile(sharedPreferences.getBoolean(key, false))
}
@ -351,10 +328,6 @@ class SettingsFragment :
toast(activity, R.string.settings_hide_media_toast, false)
}
private fun setBluetoothPreferences(enabled: Boolean) {
sendBluetoothAlbumArt!!.isEnabled = enabled
}
private fun setCacheLocation(path: String) {
if (path != "") {
val uri = Uri.parse(path)

View File

@ -74,9 +74,6 @@ object Constants {
const val PREFERENCES_KEY_WIFI_REQUIRED_FOR_DOWNLOAD = "wifiRequiredForDownload"
const val PREFERENCES_KEY_BUFFER_LENGTH = "bufferLength"
const val PREFERENCES_KEY_NETWORK_TIMEOUT = "networkTimeout"
const val PREFERENCES_KEY_SHOW_NOTIFICATION = "showNotification"
const val PREFERENCES_KEY_ALWAYS_SHOW_NOTIFICATION = "alwaysShowNotification"
const val PREFERENCES_KEY_SHOW_LOCK_SCREEN_CONTROLS = "showLockScreen"
const val PREFERENCES_KEY_MAX_ALBUMS = "maxAlbums"
const val PREFERENCES_KEY_MAX_SONGS = "maxSongs"
const val PREFERENCES_KEY_MAX_ARTISTS = "maxArtists"
@ -84,20 +81,16 @@ object Constants {
const val PREFERENCES_KEY_DEFAULT_SONGS = "defaultSongs"
const val PREFERENCES_KEY_DEFAULT_ARTISTS = "defaultArtists"
const val PREFERENCES_KEY_SHOW_NOW_PLAYING = "showNowPlaying"
const val PREFERENCES_KEY_PLAYBACK_CONTROL_SETTINGS = "playbackControlSettings"
const val PREFERENCES_KEY_CLEAR_SEARCH_HISTORY = "clearSearchHistory"
const val PREFERENCES_KEY_DOWNLOAD_TRANSITION = "transitionToDownloadOnPlay"
const val PREFERENCES_KEY_INCREMENT_TIME = "incrementTime"
const val PREFERENCES_KEY_SHOW_NOW_PLAYING_DETAILS = "showNowPlayingDetails"
const val PREFERENCES_KEY_ID3_TAGS = "useId3Tags"
const val PREFERENCES_KEY_SHOW_ARTIST_PICTURE = "showArtistPicture"
const val PREFERENCES_KEY_TEMP_LOSS = "tempLoss"
const val PREFERENCES_KEY_CHAT_REFRESH_INTERVAL = "chatRefreshInterval"
const val PREFERENCES_KEY_DIRECTORY_CACHE_TIME = "directoryCacheTime"
const val PREFERENCES_KEY_CLEAR_BOOKMARK = "clearBookmark"
const val PREFERENCES_KEY_DISC_SORT = "discAndTrackSort"
const val PREFERENCES_KEY_SEND_BLUETOOTH_NOTIFICATIONS = "sendBluetoothNotifications"
const val PREFERENCES_KEY_SEND_BLUETOOTH_ALBUM_ART = "sendBluetoothAlbumArt"
const val PREFERENCES_KEY_ASK_FOR_SHARE_DETAILS = "sharingAlwaysAskForDetails"
const val PREFERENCES_KEY_DEFAULT_SHARE_DESCRIPTION = "sharingDefaultDescription"
const val PREFERENCES_KEY_DEFAULT_SHARE_GREETING = "sharingDefaultGreeting"

View File

@ -183,12 +183,6 @@ object Settings {
var shouldClearBookmark
by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_BOOKMARK, false)
// Inverted for readability
var shouldSendBluetoothNotifications by BooleanSetting(
Constants.PREFERENCES_KEY_SEND_BLUETOOTH_NOTIFICATIONS,
true
)
var shouldAskForShareDetails
by BooleanSetting(Constants.PREFERENCES_KEY_ASK_FOR_SHARE_DETAILS, true)

View File

@ -113,42 +113,6 @@
a:summary="@string/settings.show_now_playing_summary"
a:title="@string/settings.show_now_playing"
app:iconSpaceReserved="false"/>
<CheckBoxPreference
a:defaultValue="true"
a:key="showNotification"
a:summary="@string/settings.show_notification_summary"
a:title="@string/settings.show_notification"
app:iconSpaceReserved="false"/>
<CheckBoxPreference
a:defaultValue="true"
a:key="alwaysShowNotification"
a:summary="@string/settings.show_notification_always_summary"
a:title="@string/settings.show_notification_always"
app:iconSpaceReserved="false"/>
<CheckBoxPreference
a:defaultValue="true"
a:key="showLockScreen"
a:summary="@string/settings.show_lockscreen_controls_summary"
a:title="@string/settings.show_lockscreen_controls"
app:iconSpaceReserved="false"/>
<CheckBoxPreference
a:defaultValue="true"
a:key="sendBluetoothNotifications"
a:summary="@string/settings.send_bluetooth_notification_summary"
a:title="@string/settings.send_bluetooth_notification"
app:iconSpaceReserved="false"/>
<CheckBoxPreference
a:defaultValue="false"
a:key="sendBluetoothAlbumArt"
a:summary="@string/settings.send_bluetooth_album_art_summary"
a:title="@string/settings.send_bluetooth_album_art"
app:iconSpaceReserved="false"/>
<CheckBoxPreference
a:defaultValue="false"
a:key="disableNowPlayingListSending"
a:summary="@string/settings.disable_send_now_playing_list_summary"
a:title="@string/settings.disable_send_now_playing_list"
app:iconSpaceReserved="false"/>
</PreferenceCategory>
<PreferenceCategory
a:title="@string/settings.sharing_title"