621 lines
20 KiB
Kotlin
621 lines
20 KiB
Kotlin
package code.name.monkey.retromusic.util
|
|
|
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
|
import android.net.ConnectivityManager
|
|
import android.net.NetworkInfo
|
|
import androidx.core.content.ContextCompat
|
|
import androidx.core.content.edit
|
|
import androidx.preference.PreferenceManager
|
|
import androidx.viewpager.widget.ViewPager
|
|
import code.name.monkey.appthemehelper.util.VersionUtils
|
|
import code.name.monkey.retromusic.*
|
|
import code.name.monkey.retromusic.extensions.getIntRes
|
|
import code.name.monkey.retromusic.extensions.getStringOrDefault
|
|
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
|
|
import code.name.monkey.retromusic.fragments.NowPlayingScreen
|
|
import code.name.monkey.retromusic.fragments.folder.FoldersFragment
|
|
import code.name.monkey.retromusic.helper.SortOrder.*
|
|
import code.name.monkey.retromusic.model.CategoryInfo
|
|
import code.name.monkey.retromusic.transform.*
|
|
import code.name.monkey.retromusic.util.theme.ThemeMode
|
|
import com.google.android.material.bottomnavigation.BottomNavigationView
|
|
import com.google.gson.Gson
|
|
import com.google.gson.JsonSyntaxException
|
|
import com.google.gson.reflect.TypeToken
|
|
import java.io.File
|
|
|
|
|
|
object PreferenceUtil {
|
|
private val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(App.getContext())
|
|
|
|
val defaultCategories = listOf(
|
|
CategoryInfo(CategoryInfo.Category.Home, true),
|
|
CategoryInfo(CategoryInfo.Category.Songs, true),
|
|
CategoryInfo(CategoryInfo.Category.Albums, true),
|
|
CategoryInfo(CategoryInfo.Category.Artists, true),
|
|
CategoryInfo(CategoryInfo.Category.Playlists, true),
|
|
CategoryInfo(CategoryInfo.Category.Genres, false),
|
|
CategoryInfo(CategoryInfo.Category.Folder, false)
|
|
)
|
|
|
|
var libraryCategory: List<CategoryInfo>
|
|
get() {
|
|
val gson = Gson()
|
|
val collectionType = object : TypeToken<List<CategoryInfo>>() {}.type
|
|
|
|
val data = sharedPreferences.getStringOrDefault(
|
|
LIBRARY_CATEGORIES,
|
|
gson.toJson(defaultCategories, collectionType)
|
|
)
|
|
return try {
|
|
Gson().fromJson(data, collectionType)
|
|
} catch (e: JsonSyntaxException) {
|
|
e.printStackTrace()
|
|
return defaultCategories
|
|
}
|
|
}
|
|
set(value) {
|
|
val collectionType = object : TypeToken<List<CategoryInfo?>?>() {}.type
|
|
sharedPreferences.edit {
|
|
putString(LIBRARY_CATEGORIES, Gson().toJson(value, collectionType))
|
|
}
|
|
}
|
|
|
|
fun registerOnSharedPreferenceChangedListener(
|
|
listener: OnSharedPreferenceChangeListener
|
|
) = sharedPreferences.registerOnSharedPreferenceChangeListener(listener)
|
|
|
|
|
|
fun unregisterOnSharedPreferenceChangedListener(
|
|
changeListener: OnSharedPreferenceChangeListener
|
|
) = sharedPreferences.unregisterOnSharedPreferenceChangeListener(changeListener)
|
|
|
|
|
|
val baseTheme get() = sharedPreferences.getStringOrDefault(GENERAL_THEME, "auto")
|
|
|
|
fun getGeneralThemeValue(isSystemDark: Boolean): ThemeMode {
|
|
val themeMode: String =
|
|
sharedPreferences.getStringOrDefault(GENERAL_THEME, "auto")
|
|
return if (isBlackMode && isSystemDark) {
|
|
ThemeMode.BLACK
|
|
} else {
|
|
if (isBlackMode && themeMode == "dark") {
|
|
ThemeMode.BLACK
|
|
} else {
|
|
when (themeMode) {
|
|
"light" -> ThemeMode.LIGHT
|
|
"dark" -> ThemeMode.DARK
|
|
"auto" -> ThemeMode.AUTO
|
|
else -> ThemeMode.AUTO
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
val languageCode: String get() = sharedPreferences.getString(LANGUAGE_NAME, "auto") ?: "auto"
|
|
|
|
var userName
|
|
get() = sharedPreferences.getString(
|
|
USER_NAME,
|
|
App.getContext().getString(R.string.user_name)
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putString(USER_NAME, value)
|
|
}
|
|
|
|
var safSdCardUri
|
|
get() = sharedPreferences.getStringOrDefault(SAF_SDCARD_URI, "")
|
|
set(value) = sharedPreferences.edit {
|
|
putString(SAF_SDCARD_URI, value)
|
|
}
|
|
|
|
val autoDownloadImagesPolicy
|
|
get() = sharedPreferences.getStringOrDefault(
|
|
AUTO_DOWNLOAD_IMAGES_POLICY,
|
|
"only_wifi"
|
|
)
|
|
|
|
var albumArtistsOnly
|
|
get() = sharedPreferences.getBoolean(
|
|
ALBUM_ARTISTS_ONLY,
|
|
false
|
|
)
|
|
set(value) = sharedPreferences.edit { putBoolean(ALBUM_ARTISTS_ONLY, value) }
|
|
|
|
var albumDetailSongSortOrder
|
|
get() = sharedPreferences.getStringOrDefault(
|
|
ALBUM_DETAIL_SONG_SORT_ORDER,
|
|
AlbumSongSortOrder.SONG_TRACK_LIST
|
|
)
|
|
set(value) = sharedPreferences.edit { putString(ALBUM_DETAIL_SONG_SORT_ORDER, value) }
|
|
|
|
var songSortOrder
|
|
get() = sharedPreferences.getStringOrDefault(
|
|
SONG_SORT_ORDER,
|
|
SongSortOrder.SONG_A_Z
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putString(SONG_SORT_ORDER, value)
|
|
}
|
|
|
|
var albumSortOrder
|
|
get() = sharedPreferences.getStringOrDefault(
|
|
ALBUM_SORT_ORDER,
|
|
AlbumSortOrder.ALBUM_A_Z
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putString(ALBUM_SORT_ORDER, value)
|
|
}
|
|
|
|
|
|
var artistSortOrder
|
|
get() = sharedPreferences.getStringOrDefault(
|
|
ARTIST_SORT_ORDER,
|
|
ArtistSortOrder.ARTIST_A_Z
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putString(ARTIST_SORT_ORDER, value)
|
|
}
|
|
|
|
val albumSongSortOrder
|
|
get() = sharedPreferences.getStringOrDefault(
|
|
ALBUM_SONG_SORT_ORDER,
|
|
AlbumSongSortOrder.SONG_TRACK_LIST
|
|
)
|
|
|
|
val artistSongSortOrder
|
|
get() = sharedPreferences.getStringOrDefault(
|
|
ARTIST_SONG_SORT_ORDER,
|
|
AlbumSongSortOrder.SONG_TRACK_LIST
|
|
)
|
|
|
|
val artistAlbumSortOrder
|
|
get() = sharedPreferences.getStringOrDefault(
|
|
ARTIST_ALBUM_SORT_ORDER,
|
|
ArtistAlbumSortOrder.ALBUM_A_Z
|
|
)
|
|
|
|
var playlistSortOrder
|
|
get() = sharedPreferences.getStringOrDefault(
|
|
PLAYLIST_SORT_ORDER,
|
|
PlaylistSortOrder.PLAYLIST_A_Z
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putString(PLAYLIST_SORT_ORDER, value)
|
|
}
|
|
|
|
val genreSortOrder
|
|
get() = sharedPreferences.getStringOrDefault(
|
|
GENRE_SORT_ORDER,
|
|
GenreSortOrder.GENRE_A_Z
|
|
)
|
|
|
|
val isIgnoreMediaStoreArtwork
|
|
get() = sharedPreferences.getBoolean(
|
|
IGNORE_MEDIA_STORE_ARTWORK,
|
|
false
|
|
)
|
|
|
|
val isVolumeVisibilityMode
|
|
get() = sharedPreferences.getBoolean(
|
|
TOGGLE_VOLUME, false
|
|
)
|
|
|
|
var isInitializedBlacklist
|
|
get() = sharedPreferences.getBoolean(
|
|
INITIALIZED_BLACKLIST, false
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putBoolean(INITIALIZED_BLACKLIST, value)
|
|
}
|
|
|
|
private val isBlackMode
|
|
get() = sharedPreferences.getBoolean(
|
|
BLACK_THEME, false
|
|
)
|
|
|
|
val isExtraControls
|
|
get() = sharedPreferences.getBoolean(
|
|
TOGGLE_ADD_CONTROLS, false
|
|
)
|
|
|
|
val isHomeBanner
|
|
get() = sharedPreferences.getBoolean(
|
|
TOGGLE_HOME_BANNER, false
|
|
)
|
|
var isClassicNotification
|
|
get() = sharedPreferences.getBoolean(CLASSIC_NOTIFICATION, false)
|
|
set(value) = sharedPreferences.edit { putBoolean(CLASSIC_NOTIFICATION, value) }
|
|
|
|
val isScreenOnEnabled get() = sharedPreferences.getBoolean(KEEP_SCREEN_ON, false)
|
|
|
|
val isShuffleModeOn get() = sharedPreferences.getBoolean(TOGGLE_SHUFFLE, false)
|
|
|
|
val isSongInfo get() = sharedPreferences.getBoolean(EXTRA_SONG_INFO, false)
|
|
|
|
val isPauseOnZeroVolume get() = sharedPreferences.getBoolean(PAUSE_ON_ZERO_VOLUME, false)
|
|
|
|
var isSleepTimerFinishMusic
|
|
get() = sharedPreferences.getBoolean(
|
|
SLEEP_TIMER_FINISH_SONG, false
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putBoolean(SLEEP_TIMER_FINISH_SONG, value)
|
|
}
|
|
|
|
val isExpandPanel get() = sharedPreferences.getBoolean(EXPAND_NOW_PLAYING_PANEL, false)
|
|
|
|
val isHeadsetPlugged
|
|
get() = sharedPreferences.getBoolean(
|
|
TOGGLE_HEADSET, false
|
|
)
|
|
|
|
val isAlbumArtOnLockScreen
|
|
get() = sharedPreferences.getBoolean(
|
|
ALBUM_ART_ON_LOCK_SCREEN, false
|
|
)
|
|
|
|
val isAudioDucking
|
|
get() = sharedPreferences.getBoolean(
|
|
AUDIO_DUCKING, true
|
|
)
|
|
|
|
val isBluetoothSpeaker
|
|
get() = sharedPreferences.getBoolean(
|
|
BLUETOOTH_PLAYBACK, false
|
|
)
|
|
|
|
val isBlurredAlbumArt
|
|
get() = sharedPreferences.getBoolean(
|
|
BLURRED_ALBUM_ART, false
|
|
)
|
|
|
|
val blurAmount get() = sharedPreferences.getInt(NEW_BLUR_AMOUNT, 25)
|
|
|
|
val isCarouselEffect
|
|
get() = sharedPreferences.getBoolean(
|
|
CAROUSEL_EFFECT, false
|
|
)
|
|
|
|
var isColoredAppShortcuts
|
|
get() = sharedPreferences.getBoolean(
|
|
COLORED_APP_SHORTCUTS, true
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putBoolean(COLORED_APP_SHORTCUTS, value)
|
|
}
|
|
|
|
var isColoredNotification
|
|
get() = sharedPreferences.getBoolean(
|
|
COLORED_NOTIFICATION, true
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putBoolean(COLORED_NOTIFICATION, value)
|
|
}
|
|
|
|
var isDesaturatedColor
|
|
get() = sharedPreferences.getBoolean(
|
|
DESATURATED_COLOR, false
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putBoolean(DESATURATED_COLOR, value)
|
|
}
|
|
|
|
val isGapLessPlayback
|
|
get() = sharedPreferences.getBoolean(
|
|
GAP_LESS_PLAYBACK, false
|
|
)
|
|
|
|
val isAdaptiveColor
|
|
get() = sharedPreferences.getBoolean(
|
|
ADAPTIVE_COLOR_APP, false
|
|
)
|
|
|
|
val isFullScreenMode
|
|
get() = sharedPreferences.getBoolean(
|
|
TOGGLE_FULL_SCREEN, false
|
|
)
|
|
|
|
val isLockScreen get() = sharedPreferences.getBoolean(LOCK_SCREEN, false)
|
|
|
|
fun isAllowedToDownloadMetadata(): Boolean {
|
|
return when (autoDownloadImagesPolicy) {
|
|
"always" -> true
|
|
"only_wifi" -> {
|
|
val connectivityManager = ContextCompat.getSystemService(
|
|
App.getContext(),
|
|
ConnectivityManager::class.java
|
|
)
|
|
var netInfo: NetworkInfo? = null
|
|
if (connectivityManager != null) {
|
|
netInfo = connectivityManager.activeNetworkInfo
|
|
}
|
|
netInfo != null && netInfo.type == ConnectivityManager.TYPE_WIFI && netInfo.isConnectedOrConnecting
|
|
}
|
|
"never" -> false
|
|
else -> false
|
|
}
|
|
}
|
|
|
|
|
|
var lyricsOption
|
|
get() = sharedPreferences.getInt(LYRICS_OPTIONS, 1)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(LYRICS_OPTIONS, value)
|
|
}
|
|
|
|
var songGridStyle
|
|
get() = sharedPreferences.getInt(SONG_GRID_STYLE, R.layout.item_grid)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(SONG_GRID_STYLE, value)
|
|
}
|
|
|
|
var albumGridStyle
|
|
get() = sharedPreferences.getInt(ALBUM_GRID_STYLE, R.layout.item_grid)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(ALBUM_GRID_STYLE, value)
|
|
}
|
|
|
|
var artistGridStyle
|
|
get() = sharedPreferences.getInt(ARTIST_GRID_STYLE, R.layout.item_grid_circle)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(ARTIST_GRID_STYLE, value)
|
|
}
|
|
|
|
val filterLength get() = sharedPreferences.getInt(FILTER_SONG, 20)
|
|
|
|
var lastVersion
|
|
get() = sharedPreferences.getInt(LAST_CHANGELOG_VERSION, 0)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(LAST_CHANGELOG_VERSION, value)
|
|
}
|
|
|
|
var lastSleepTimerValue
|
|
get() = sharedPreferences.getInt(
|
|
LAST_SLEEP_TIMER_VALUE,
|
|
30
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(LAST_SLEEP_TIMER_VALUE, value)
|
|
}
|
|
|
|
|
|
var nextSleepTimerElapsedRealTime
|
|
get() = sharedPreferences.getInt(
|
|
NEXT_SLEEP_TIMER_ELAPSED_REALTIME,
|
|
-1
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(NEXT_SLEEP_TIMER_ELAPSED_REALTIME, value)
|
|
}
|
|
|
|
fun themeResFromPrefValue(themePrefValue: String): Int {
|
|
return when (themePrefValue) {
|
|
"light" -> R.style.Theme_RetroMusic_Light
|
|
"dark" -> R.style.Theme_RetroMusic
|
|
else -> R.style.Theme_RetroMusic
|
|
}
|
|
}
|
|
|
|
val homeArtistGridStyle: Int
|
|
get() {
|
|
val position = sharedPreferences.getStringOrDefault(
|
|
HOME_ARTIST_GRID_STYLE, "0"
|
|
).toInt()
|
|
val typedArray = App.getContext()
|
|
.resources.obtainTypedArray(R.array.pref_home_grid_style_layout)
|
|
val layoutRes = typedArray.getResourceId(position, 0)
|
|
typedArray.recycle()
|
|
return if (layoutRes == 0) {
|
|
R.layout.item_artist
|
|
} else layoutRes
|
|
}
|
|
|
|
val homeAlbumGridStyle: Int
|
|
get() {
|
|
val position = sharedPreferences.getStringOrDefault(
|
|
HOME_ALBUM_GRID_STYLE, "4"
|
|
).toInt()
|
|
val typedArray = App.getContext()
|
|
.resources.obtainTypedArray(R.array.pref_home_grid_style_layout)
|
|
val layoutRes = typedArray.getResourceId(position, 0)
|
|
typedArray.recycle()
|
|
return if (layoutRes == 0) {
|
|
R.layout.item_image
|
|
} else layoutRes
|
|
}
|
|
|
|
val tabTitleMode: Int
|
|
get() {
|
|
return when (sharedPreferences.getStringOrDefault(
|
|
TAB_TEXT_MODE, "1"
|
|
).toInt()) {
|
|
1 -> BottomNavigationView.LABEL_VISIBILITY_LABELED
|
|
0 -> BottomNavigationView.LABEL_VISIBILITY_AUTO
|
|
2 -> BottomNavigationView.LABEL_VISIBILITY_SELECTED
|
|
3 -> BottomNavigationView.LABEL_VISIBILITY_UNLABELED
|
|
else -> BottomNavigationView.LABEL_VISIBILITY_LABELED
|
|
}
|
|
}
|
|
|
|
|
|
var songGridSize
|
|
get() = sharedPreferences.getInt(
|
|
SONG_GRID_SIZE,
|
|
App.getContext().getIntRes(R.integer.default_list_columns)
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(SONG_GRID_SIZE, value)
|
|
}
|
|
|
|
var songGridSizeLand
|
|
get() = sharedPreferences.getInt(
|
|
SONG_GRID_SIZE_LAND,
|
|
App.getContext().getIntRes(R.integer.default_grid_columns_land)
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(SONG_GRID_SIZE_LAND, value)
|
|
}
|
|
|
|
|
|
var albumGridSize: Int
|
|
get() = sharedPreferences.getInt(
|
|
ALBUM_GRID_SIZE,
|
|
App.getContext().getIntRes(R.integer.default_grid_columns)
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(ALBUM_GRID_SIZE, value)
|
|
}
|
|
|
|
|
|
var albumGridSizeLand
|
|
get() = sharedPreferences.getInt(
|
|
ALBUM_GRID_SIZE_LAND,
|
|
App.getContext().getIntRes(R.integer.default_grid_columns_land)
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(ALBUM_GRID_SIZE_LAND, value)
|
|
}
|
|
|
|
|
|
var artistGridSize
|
|
get() = sharedPreferences.getInt(
|
|
ARTIST_GRID_SIZE,
|
|
App.getContext().getIntRes(R.integer.default_grid_columns)
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(ARTIST_GRID_SIZE, value)
|
|
}
|
|
|
|
|
|
var artistGridSizeLand
|
|
get() = sharedPreferences.getInt(
|
|
ARTIST_GRID_SIZE_LAND,
|
|
App.getContext().getIntRes(R.integer.default_grid_columns_land)
|
|
)
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(ALBUM_GRID_SIZE_LAND, value)
|
|
}
|
|
|
|
|
|
var albumCoverStyle: AlbumCoverStyle
|
|
get() {
|
|
val id: Int = sharedPreferences.getInt(ALBUM_COVER_STYLE, 0)
|
|
for (albumCoverStyle in AlbumCoverStyle.values()) {
|
|
if (albumCoverStyle.id == id) {
|
|
return albumCoverStyle
|
|
}
|
|
}
|
|
return AlbumCoverStyle.Card
|
|
}
|
|
set(value) = sharedPreferences.edit { putInt(ALBUM_COVER_STYLE, value.id) }
|
|
|
|
|
|
var nowPlayingScreen: NowPlayingScreen
|
|
get() {
|
|
val id: Int = sharedPreferences.getInt(NOW_PLAYING_SCREEN_ID, 0)
|
|
for (nowPlayingScreen in NowPlayingScreen.values()) {
|
|
if (nowPlayingScreen.id == id) {
|
|
return nowPlayingScreen
|
|
}
|
|
}
|
|
return NowPlayingScreen.Adaptive
|
|
}
|
|
set(value) = sharedPreferences.edit {
|
|
putInt(NOW_PLAYING_SCREEN_ID, value.id)
|
|
}
|
|
|
|
val albumCoverTransform: ViewPager.PageTransformer
|
|
get() {
|
|
val style = sharedPreferences.getStringOrDefault(
|
|
ALBUM_COVER_TRANSFORM,
|
|
"0"
|
|
).toInt()
|
|
return when (style) {
|
|
0 -> NormalPageTransformer()
|
|
1 -> CascadingPageTransformer()
|
|
2 -> DepthTransformation()
|
|
3 -> HorizontalFlipTransformation()
|
|
4 -> VerticalFlipTransformation()
|
|
5 -> HingeTransformation()
|
|
6 -> VerticalStackTransformer()
|
|
else -> NormalPageTransformer()
|
|
}
|
|
}
|
|
|
|
var startDirectory: File
|
|
get() {
|
|
val folderPath = FoldersFragment.defaultStartDirectory.path
|
|
val filePath: String = sharedPreferences.getStringOrDefault(START_DIRECTORY, folderPath)
|
|
return File(filePath)
|
|
}
|
|
set(value) = sharedPreferences.edit {
|
|
putString(
|
|
START_DIRECTORY,
|
|
FileUtil.safeGetCanonicalPath(value)
|
|
)
|
|
}
|
|
|
|
fun getRecentlyPlayedCutoffTimeMillis(): Long {
|
|
val calendarUtil = CalendarUtil()
|
|
val interval: Long = when (sharedPreferences.getString(RECENTLY_PLAYED_CUTOFF, "")) {
|
|
"today" -> calendarUtil.elapsedToday
|
|
"this_week" -> calendarUtil.elapsedWeek
|
|
"past_seven_days" -> calendarUtil.getElapsedDays(7)
|
|
"past_three_months" -> calendarUtil.getElapsedMonths(3)
|
|
"this_year" -> calendarUtil.elapsedYear
|
|
"this_month" -> calendarUtil.elapsedMonth
|
|
else -> calendarUtil.elapsedMonth
|
|
}
|
|
return System.currentTimeMillis() - interval
|
|
}
|
|
|
|
val lastAddedCutoff: Long
|
|
get() {
|
|
val calendarUtil = CalendarUtil()
|
|
val interval =
|
|
when (sharedPreferences.getStringOrDefault(LAST_ADDED_CUTOFF, "this_month")) {
|
|
"today" -> calendarUtil.elapsedToday
|
|
"this_week" -> calendarUtil.elapsedWeek
|
|
"past_three_months" -> calendarUtil.getElapsedMonths(3)
|
|
"this_year" -> calendarUtil.elapsedYear
|
|
"this_month" -> calendarUtil.elapsedMonth
|
|
else -> calendarUtil.elapsedMonth
|
|
}
|
|
return (System.currentTimeMillis() - interval) / 1000
|
|
}
|
|
|
|
val homeSuggestions: Boolean
|
|
get() = sharedPreferences.getBoolean(
|
|
TOGGLE_SUGGESTIONS,
|
|
true
|
|
)
|
|
|
|
var audioFadeDuration
|
|
get() = sharedPreferences
|
|
.getInt(AUDIO_FADE_DURATION, 0)
|
|
set(value) = sharedPreferences.edit { putInt(AUDIO_FADE_DURATION, value) }
|
|
|
|
var showLyrics: Boolean
|
|
get() = sharedPreferences.getBoolean(SHOW_LYRICS, false)
|
|
set(value) = sharedPreferences.edit { putBoolean(SHOW_LYRICS, value) }
|
|
|
|
val rememberLastTab: Boolean
|
|
get() = sharedPreferences.getBoolean(REMEMBER_LAST_TAB, true)
|
|
|
|
var lastTab: Int
|
|
get() = sharedPreferences
|
|
.getInt(LAST_USED_TAB, 0)
|
|
set(value) = sharedPreferences.edit { putInt(LAST_USED_TAB, value) }
|
|
|
|
val isWhiteList: Boolean
|
|
get() = sharedPreferences.getBoolean(WHITELIST_MUSIC, false)
|
|
|
|
val crossFadeDuration
|
|
get() = sharedPreferences
|
|
.getInt(CROSS_FADE_DURATION, 0)
|
|
|
|
val materialYou
|
|
get() = sharedPreferences.getBoolean(MATERIAL_YOU, VersionUtils.hasS())
|
|
}
|