Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions app/src/main/java/com/theveloper/pixelplay/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,8 @@ class MainActivity : ComponentActivity() {
val useSmoothCorners by playerViewModel.useSmoothCorners.collectAsStateWithLifecycle()
val isMiniPlayerDismissing by playerViewModel.isMiniPlayerDismissing.collectAsStateWithLifecycle()
val hapticsEnabled by playerViewModel.hapticsEnabled.collectAsStateWithLifecycle()
val disableBlurAllOver by playerViewModel.disableBlurAllOver.collectAsStateWithLifecycle()
val predictiveBackCollapseFraction by playerViewModel.predictiveBackCollapseFraction.collectAsStateWithLifecycle()
val rootView = LocalView.current
val platformHapticFeedback = LocalHapticFeedback.current
val appHapticsConfig = remember(hapticsEnabled) {
Expand Down Expand Up @@ -942,12 +944,17 @@ class MainActivity : ComponentActivity() {
.fillMaxSize()
.graphicsLayer {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val fraction = expansionFractionProvider()
// Quantize to 4px steps: rebuild the RenderEffect only
// when the blur crosses a step, reuse the cached object
// every other frame.
val quantizedBlurPx = (fraction * 100f / 4f).roundToInt() * 4f
renderEffect = blurEffectCache.get(quantizedBlurPx)
if (disableBlurAllOver) {
renderEffect = null
} else {
val expansion = expansionFractionProvider()
val fraction = (expansion * (1f - predictiveBackCollapseFraction)).coerceIn(0f, 1f)
// Quantize to 2px steps: rebuild the RenderEffect only
// when the blur crosses a step, reuse the cached object
// every other frame.
val quantizedBlurPx = (fraction * 120f / 2f).roundToInt() * 2f
renderEffect = blurEffectCache.get(quantizedBlurPx)
}
}
}
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ constructor(
val USE_ANIMATED_LYRICS = booleanPreferencesKey("use_animated_lyrics")
val ANIMATED_LYRICS_BLUR_ENABLED = booleanPreferencesKey("animated_lyrics_blur_enabled")
val ANIMATED_LYRICS_BLUR_STRENGTH = androidx.datastore.preferences.core.floatPreferencesKey("animated_lyrics_blur_strength")
val DISABLE_BLUR_ALL_OVER = booleanPreferencesKey("disable_blur_all_over")

// Genre View Preference
val IS_GENRE_GRID_VIEW = booleanPreferencesKey("is_genre_grid_view")
Expand Down Expand Up @@ -1422,6 +1423,17 @@ constructor(
}
}

val disableBlurAllOverFlow: Flow<Boolean> = dataStore.data
.map { preferences ->
preferences[PreferencesKeys.DISABLE_BLUR_ALL_OVER] ?: false
}

suspend fun setDisableBlurAllOver(disabled: Boolean) {
dataStore.edit { preferences ->
preferences[PreferencesKeys.DISABLE_BLUR_ALL_OVER] = disabled
}
}

val libraryTabsOrderFlow: Flow<String?> = dataStore.data
.map { preferences ->
preferences[PreferencesKeys.LIBRARY_TABS_ORDER]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ fun LyricsSheet(
}
val animatedLyricsBlurEnabled by animatedLyricsBlurEnabledFlow.collectAsStateWithLifecycle(initialValue = true)

val disableBlurAllOverFlow = remember(context) {
context.dataStore.data.map { it[booleanPreferencesKey("disable_blur_all_over")] ?: false }
}
val disableBlurAllOver by disableBlurAllOverFlow.collectAsStateWithLifecycle(initialValue = false)

val animatedLyricsBlurStrengthFlow = remember(context) {
context.dataStore.data.map { it[androidx.datastore.preferences.core.floatPreferencesKey("animated_lyrics_blur_strength")] ?: 2.5f }
}
Expand Down Expand Up @@ -790,7 +795,7 @@ fun LyricsSheet(
highlightOffsetDp = highlightOffsetDp,
autoscrollAnimationSpec = resolvedAutoscrollSpec,
useAnimatedLyrics = useAnimatedLyrics,
animatedLyricsBlurEnabled = animatedLyricsBlurEnabled,
animatedLyricsBlurEnabled = animatedLyricsBlurEnabled && !disableBlurAllOver,
animatedLyricsBlurStrength = animatedLyricsBlurStrength,
immersiveMode = immersiveMode,
lyricsAlignment = lyricsAlignment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import androidx.compose.material.icons.outlined.PlayCircle
import androidx.compose.material.icons.outlined.Style
import androidx.compose.material.icons.outlined.Warning
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.rounded.BlurOff
import androidx.compose.material.icons.rounded.Check
import androidx.compose.material.icons.rounded.ChevronRight
import androidx.compose.material.icons.rounded.Close
Expand Down Expand Up @@ -552,6 +553,13 @@ fun SettingsCategoryScreen(
onCheckedChange = settingsViewModel::setUseSmoothCorners,
leadingIcon = { Icon(painterResource(R.drawable.rounded_rounded_corner_24), null, tint = MaterialTheme.colorScheme.secondary) }
)
SwitchSettingItem(
title = stringResource(R.string.setcat_disable_blur_all_over_title),
subtitle = stringResource(R.string.setcat_disable_blur_all_over_subtitle),
checked = uiState.disableBlurAllOver,
onCheckedChange = { settingsViewModel.setDisableBlurAllOver(it) },
leadingIcon = { Icon(Icons.Rounded.BlurOff, null, tint = MaterialTheme.colorScheme.secondary) }
)
}

SettingsSubsection(title = stringResource(R.string.setcat_now_playing)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,13 @@ class PlayerViewModel @Inject constructor(
initialValue = true
)

val disableBlurAllOver: StateFlow<Boolean> = userPreferencesRepository.disableBlurAllOverFlow
.stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(5000),
initialValue = false
)



private val _isInitialThemePreloadComplete = MutableStateFlow(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ data class SettingsUiState(
val useAnimatedLyrics: Boolean = false,
val animatedLyricsBlurEnabled: Boolean = true,
val animatedLyricsBlurStrength: Float = 2.5f,
val disableBlurAllOver: Boolean = false,
val backupInfoDismissed: Boolean = false,
val isDataTransferInProgress: Boolean = false,
val restorePlan: RestorePlan? = null,
Expand Down Expand Up @@ -166,7 +167,8 @@ private sealed interface SettingsUiUpdate {
val immersiveLyricsEnabled: Boolean,
val immersiveLyricsTimeout: Long,
val animatedLyricsBlurEnabled: Boolean,
val animatedLyricsBlurStrength: Float
val animatedLyricsBlurStrength: Float,
val disableBlurAllOver: Boolean
) : SettingsUiUpdate
}

Expand Down Expand Up @@ -559,7 +561,8 @@ class SettingsViewModel @Inject constructor(
userPreferencesRepository.immersiveLyricsEnabledFlow,
userPreferencesRepository.immersiveLyricsTimeoutFlow,
userPreferencesRepository.animatedLyricsBlurEnabledFlow,
userPreferencesRepository.animatedLyricsBlurStrengthFlow
userPreferencesRepository.animatedLyricsBlurStrengthFlow,
userPreferencesRepository.disableBlurAllOverFlow
) { values ->
SettingsUiUpdate.Group2(
keepPlayingInBackground = values[0] as Boolean,
Expand All @@ -578,7 +581,8 @@ class SettingsViewModel @Inject constructor(
immersiveLyricsEnabled = values[13] as Boolean,
immersiveLyricsTimeout = values[14] as Long,
animatedLyricsBlurEnabled = values[15] as Boolean,
animatedLyricsBlurStrength = values[16] as Float
animatedLyricsBlurStrength = values[16] as Float,
disableBlurAllOver = values[17] as Boolean
)
}.collect { update ->
_uiState.update { state ->
Expand All @@ -599,7 +603,8 @@ class SettingsViewModel @Inject constructor(
immersiveLyricsEnabled = update.immersiveLyricsEnabled,
immersiveLyricsTimeout = update.immersiveLyricsTimeout,
animatedLyricsBlurEnabled = update.animatedLyricsBlurEnabled,
animatedLyricsBlurStrength = update.animatedLyricsBlurStrength
animatedLyricsBlurStrength = update.animatedLyricsBlurStrength,
disableBlurAllOver = update.disableBlurAllOver
)
}
}
Expand Down Expand Up @@ -993,6 +998,12 @@ class SettingsViewModel @Inject constructor(
}
}

fun setDisableBlurAllOver(disabled: Boolean) {
viewModelScope.launch {
userPreferencesRepository.setDisableBlurAllOver(disabled)
}
}

fun refreshLibrary() {
viewModelScope.launch {
if (isSyncing.value) return@launch
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-tr/strings_presentation_batch_a.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

<!-- Google Drive folder setup -->
<string name="auth_gdrive_setting_up">Google Drive kuruluyor…</string>
<string name="auth_gdrive_connect_title">Google Drive'ı Bağla</string>
<string name="auth_gdrive_connect_subtitle">Müzik dosyalarını doğrudan Google Drive'ınızdan yayınlayın</string>
<string name="auth_gdrive_connect_title">Google Drive\'ı Bağla</string>
<string name="auth_gdrive_connect_subtitle">Müzik dosyalarını doğrudan Google Drive\'ınızdan yayınlayın</string>
<string name="auth_gdrive_sign_in_with_google">Google ile oturum açın</string>
<string name="auth_gdrive_select_music_folder_title">Bir müzik klasörü seçin</string>
<string name="auth_gdrive_select_music_folder_subtitle">Müzik kaynağınız olarak kullanmak için bir klasör seçin veya oluşturun</string>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@
<string
name="setcat_smooth_corners_subtitle"
>Use complex shaped corners effectively improving aesthetics but may affect performance on low-end devices</string>
<string name="setcat_disable_blur_all_over_title">Disable Blur Effects</string>
<string
name="setcat_disable_blur_all_over_subtitle"
>Turn off blur effects across the app to save battery and resources.</string>
<string name="setcat_now_playing">Now Playing</string>
<string name="setcat_player_theme_label">Player Theme</string>
<string
Expand Down
Loading