Enable StrictMode logging, rm unused prefs
This commit is contained in:
parent
3691428a68
commit
69c78f4c37
|
@ -1,6 +1,7 @@
|
||||||
package org.moire.ultrasonic.app
|
package org.moire.ultrasonic.app
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.StrictMode
|
||||||
import androidx.multidex.MultiDexApplication
|
import androidx.multidex.MultiDexApplication
|
||||||
import org.koin.android.ext.koin.androidContext
|
import org.koin.android.ext.koin.androidContext
|
||||||
import org.koin.core.context.startKoin
|
import org.koin.core.context.startKoin
|
||||||
|
@ -25,6 +26,8 @@ class UApp : MultiDexApplication() {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
instance = this
|
instance = this
|
||||||
|
if (BuildConfig.DEBUG)
|
||||||
|
StrictMode.enableDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import androidx.preference.CheckBoxPreference
|
||||||
import androidx.preference.EditTextPreference
|
import androidx.preference.EditTextPreference
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceCategory
|
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
@ -112,10 +111,6 @@ class SettingsFragment :
|
||||||
chatRefreshInterval = findPreference(Constants.PREFERENCES_KEY_CHAT_REFRESH_INTERVAL)
|
chatRefreshInterval = findPreference(Constants.PREFERENCES_KEY_CHAT_REFRESH_INTERVAL)
|
||||||
directoryCacheTime = findPreference(Constants.PREFERENCES_KEY_DIRECTORY_CACHE_TIME)
|
directoryCacheTime = findPreference(Constants.PREFERENCES_KEY_DIRECTORY_CACHE_TIME)
|
||||||
mediaButtonsEnabled = findPreference(Constants.PREFERENCES_KEY_MEDIA_BUTTONS)
|
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 =
|
sharingDefaultDescription =
|
||||||
findPreference(Constants.PREFERENCES_KEY_DEFAULT_SHARE_DESCRIPTION)
|
findPreference(Constants.PREFERENCES_KEY_DEFAULT_SHARE_DESCRIPTION)
|
||||||
sharingDefaultGreeting = findPreference(Constants.PREFERENCES_KEY_DEFAULT_SHARE_GREETING)
|
sharingDefaultGreeting = findPreference(Constants.PREFERENCES_KEY_DEFAULT_SHARE_GREETING)
|
||||||
|
@ -128,21 +123,6 @@ class SettingsFragment :
|
||||||
sharingDefaultGreeting!!.text = shareGreeting
|
sharingDefaultGreeting!!.text = shareGreeting
|
||||||
setupClearSearchPreference()
|
setupClearSearchPreference()
|
||||||
setupCacheLocationPreference()
|
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?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
|
@ -208,9 +188,6 @@ class SettingsFragment :
|
||||||
Constants.PREFERENCES_KEY_HIDE_MEDIA -> {
|
Constants.PREFERENCES_KEY_HIDE_MEDIA -> {
|
||||||
setHideMedia(sharedPreferences.getBoolean(key, false))
|
setHideMedia(sharedPreferences.getBoolean(key, false))
|
||||||
}
|
}
|
||||||
Constants.PREFERENCES_KEY_SEND_BLUETOOTH_NOTIFICATIONS -> {
|
|
||||||
setBluetoothPreferences(sharedPreferences.getBoolean(key, true))
|
|
||||||
}
|
|
||||||
Constants.PREFERENCES_KEY_DEBUG_LOG_TO_FILE -> {
|
Constants.PREFERENCES_KEY_DEBUG_LOG_TO_FILE -> {
|
||||||
setDebugLogToFile(sharedPreferences.getBoolean(key, false))
|
setDebugLogToFile(sharedPreferences.getBoolean(key, false))
|
||||||
}
|
}
|
||||||
|
@ -351,10 +328,6 @@ class SettingsFragment :
|
||||||
toast(activity, R.string.settings_hide_media_toast, false)
|
toast(activity, R.string.settings_hide_media_toast, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setBluetoothPreferences(enabled: Boolean) {
|
|
||||||
sendBluetoothAlbumArt!!.isEnabled = enabled
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setCacheLocation(path: String) {
|
private fun setCacheLocation(path: String) {
|
||||||
if (path != "") {
|
if (path != "") {
|
||||||
val uri = Uri.parse(path)
|
val uri = Uri.parse(path)
|
||||||
|
|
|
@ -74,9 +74,6 @@ object Constants {
|
||||||
const val PREFERENCES_KEY_WIFI_REQUIRED_FOR_DOWNLOAD = "wifiRequiredForDownload"
|
const val PREFERENCES_KEY_WIFI_REQUIRED_FOR_DOWNLOAD = "wifiRequiredForDownload"
|
||||||
const val PREFERENCES_KEY_BUFFER_LENGTH = "bufferLength"
|
const val PREFERENCES_KEY_BUFFER_LENGTH = "bufferLength"
|
||||||
const val PREFERENCES_KEY_NETWORK_TIMEOUT = "networkTimeout"
|
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_ALBUMS = "maxAlbums"
|
||||||
const val PREFERENCES_KEY_MAX_SONGS = "maxSongs"
|
const val PREFERENCES_KEY_MAX_SONGS = "maxSongs"
|
||||||
const val PREFERENCES_KEY_MAX_ARTISTS = "maxArtists"
|
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_SONGS = "defaultSongs"
|
||||||
const val PREFERENCES_KEY_DEFAULT_ARTISTS = "defaultArtists"
|
const val PREFERENCES_KEY_DEFAULT_ARTISTS = "defaultArtists"
|
||||||
const val PREFERENCES_KEY_SHOW_NOW_PLAYING = "showNowPlaying"
|
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_CLEAR_SEARCH_HISTORY = "clearSearchHistory"
|
||||||
const val PREFERENCES_KEY_DOWNLOAD_TRANSITION = "transitionToDownloadOnPlay"
|
const val PREFERENCES_KEY_DOWNLOAD_TRANSITION = "transitionToDownloadOnPlay"
|
||||||
const val PREFERENCES_KEY_INCREMENT_TIME = "incrementTime"
|
const val PREFERENCES_KEY_INCREMENT_TIME = "incrementTime"
|
||||||
const val PREFERENCES_KEY_SHOW_NOW_PLAYING_DETAILS = "showNowPlayingDetails"
|
const val PREFERENCES_KEY_SHOW_NOW_PLAYING_DETAILS = "showNowPlayingDetails"
|
||||||
const val PREFERENCES_KEY_ID3_TAGS = "useId3Tags"
|
const val PREFERENCES_KEY_ID3_TAGS = "useId3Tags"
|
||||||
const val PREFERENCES_KEY_SHOW_ARTIST_PICTURE = "showArtistPicture"
|
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_CHAT_REFRESH_INTERVAL = "chatRefreshInterval"
|
||||||
const val PREFERENCES_KEY_DIRECTORY_CACHE_TIME = "directoryCacheTime"
|
const val PREFERENCES_KEY_DIRECTORY_CACHE_TIME = "directoryCacheTime"
|
||||||
const val PREFERENCES_KEY_CLEAR_BOOKMARK = "clearBookmark"
|
const val PREFERENCES_KEY_CLEAR_BOOKMARK = "clearBookmark"
|
||||||
const val PREFERENCES_KEY_DISC_SORT = "discAndTrackSort"
|
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_ASK_FOR_SHARE_DETAILS = "sharingAlwaysAskForDetails"
|
||||||
const val PREFERENCES_KEY_DEFAULT_SHARE_DESCRIPTION = "sharingDefaultDescription"
|
const val PREFERENCES_KEY_DEFAULT_SHARE_DESCRIPTION = "sharingDefaultDescription"
|
||||||
const val PREFERENCES_KEY_DEFAULT_SHARE_GREETING = "sharingDefaultGreeting"
|
const val PREFERENCES_KEY_DEFAULT_SHARE_GREETING = "sharingDefaultGreeting"
|
||||||
|
|
|
@ -183,12 +183,6 @@ object Settings {
|
||||||
var shouldClearBookmark
|
var shouldClearBookmark
|
||||||
by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_BOOKMARK, false)
|
by BooleanSetting(Constants.PREFERENCES_KEY_CLEAR_BOOKMARK, false)
|
||||||
|
|
||||||
// Inverted for readability
|
|
||||||
var shouldSendBluetoothNotifications by BooleanSetting(
|
|
||||||
Constants.PREFERENCES_KEY_SEND_BLUETOOTH_NOTIFICATIONS,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
|
|
||||||
var shouldAskForShareDetails
|
var shouldAskForShareDetails
|
||||||
by BooleanSetting(Constants.PREFERENCES_KEY_ASK_FOR_SHARE_DETAILS, true)
|
by BooleanSetting(Constants.PREFERENCES_KEY_ASK_FOR_SHARE_DETAILS, true)
|
||||||
|
|
||||||
|
|
|
@ -113,42 +113,6 @@
|
||||||
a:summary="@string/settings.show_now_playing_summary"
|
a:summary="@string/settings.show_now_playing_summary"
|
||||||
a:title="@string/settings.show_now_playing"
|
a:title="@string/settings.show_now_playing"
|
||||||
app:iconSpaceReserved="false"/>
|
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>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
a:title="@string/settings.sharing_title"
|
a:title="@string/settings.sharing_title"
|
||||||
|
|
Loading…
Reference in New Issue