feat: Implemented continuous playing

This commit is contained in:
CappielloAntonio 2024-06-02 19:18:16 +02:00
parent 2c3aebc83b
commit 176db09662
9 changed files with 101 additions and 44 deletions

View file

@ -62,6 +62,8 @@ object Preferences {
private const val HOME_SECTOR_LIST = "home_sector_list"
private const val RATING_PER_ITEM = "rating_per_item"
private const val NEXT_UPDATE_CHECK = "next_update_check"
private const val CONTINUOUS_PLAY = "continuous_play"
private const val LAST_INSTANT_MIX = "last_instant_mix"
@JvmStatic
@ -476,4 +478,21 @@ object Preferences {
fun setTempoUpdateReminder() {
App.getInstance().preferences.edit().putLong(NEXT_UPDATE_CHECK, System.currentTimeMillis()).apply()
}
@JvmStatic
fun isContinuousPlayEnabled(): Boolean {
return App.getInstance().preferences.getBoolean(CONTINUOUS_PLAY, true)
}
@JvmStatic
fun setLastInstantMix() {
App.getInstance().preferences.edit().putLong(LAST_INSTANT_MIX, System.currentTimeMillis()).apply()
}
@JvmStatic
fun isInstantMixUsable(): Boolean {
return App.getInstance().preferences.getLong(
LAST_INSTANT_MIX, 0
) + 5000 < System.currentTimeMillis()
}
}