diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d49fde1..8e0d047 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -20,7 +20,7 @@ android { //noinspection OldTargetApi targetSdk = 34 versionCode = 25 - versionName = "1.2.0" + versionName = "1.3.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/foss/release/baselineProfiles/0/app-foss-release.dm b/app/foss/release/baselineProfiles/0/app-foss-release.dm index 497d7e7..677de3c 100644 Binary files a/app/foss/release/baselineProfiles/0/app-foss-release.dm and b/app/foss/release/baselineProfiles/0/app-foss-release.dm differ diff --git a/app/foss/release/baselineProfiles/1/app-foss-release.dm b/app/foss/release/baselineProfiles/1/app-foss-release.dm index 0e82948..de9a94c 100644 Binary files a/app/foss/release/baselineProfiles/1/app-foss-release.dm and b/app/foss/release/baselineProfiles/1/app-foss-release.dm differ diff --git a/app/foss/release/output-metadata.json b/app/foss/release/output-metadata.json index 3c53ae2..bc9d306 100644 --- a/app/foss/release/output-metadata.json +++ b/app/foss/release/output-metadata.json @@ -12,7 +12,7 @@ "filters": [], "attributes": [], "versionCode": 25, - "versionName": "1.2.0", + "versionName": "1.3.0", "outputFile": "app-foss-release.apk" } ], diff --git a/app/src/main/java/com/malopieds/innertune/constants/PreferenceKeys.kt b/app/src/main/java/com/malopieds/innertune/constants/PreferenceKeys.kt index fc6b5c7..d51fba8 100644 --- a/app/src/main/java/com/malopieds/innertune/constants/PreferenceKeys.kt +++ b/app/src/main/java/com/malopieds/innertune/constants/PreferenceKeys.kt @@ -227,6 +227,7 @@ enum class PlayerBackgroundStyle { DEFAULT, GRADIENT, BLUR, + BLURMOV, } diff --git a/app/src/main/java/com/malopieds/innertune/ui/player/Player.kt b/app/src/main/java/com/malopieds/innertune/ui/player/Player.kt index c70de57..a884f26 100644 --- a/app/src/main/java/com/malopieds/innertune/ui/player/Player.kt +++ b/app/src/main/java/com/malopieds/innertune/ui/player/Player.kt @@ -6,12 +6,16 @@ import android.text.format.Formatter import android.widget.Toast import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.core.FastOutSlowInEasing import androidx.compose.animation.core.LinearEasing import androidx.compose.animation.core.RepeatMode +import androidx.compose.animation.core.Spring import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.animateFloat +import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.infiniteRepeatable import androidx.compose.animation.core.rememberInfiniteTransition +import androidx.compose.animation.core.spring import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut @@ -72,6 +76,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.blur import androidx.compose.ui.draw.clip +import androidx.compose.ui.draw.rotate +import androidx.compose.ui.draw.scale import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color @@ -225,6 +231,9 @@ fun BottomSheetPlayer( if (useBlackBackground && playerBackground != PlayerBackgroundStyle.BLUR ) { gradientColors = listOf(Color.Black, Color.Black) } + if (useBlackBackground && playerBackground != PlayerBackgroundStyle.BLURMOV ) { + gradientColors = listOf(Color.Black, Color.Black) + } else if (playerBackground == PlayerBackgroundStyle.GRADIENT) { withContext(Dispatchers.IO) { val result = @@ -301,6 +310,19 @@ fun BottomSheetPlayer( MaterialTheme.colorScheme.onSurface } } + when (playerBackground) { + PlayerBackgroundStyle.BLURMOV -> MaterialTheme.colorScheme.onBackground + else -> + if (gradientColors.size >= 3 && + ColorUtils.calculateContrast(gradientColors.first().toArgb(), Color.White.toArgb()) < 1.5f + ) { + changeColor = true + Color.Black + } else { + changeColor = false + MaterialTheme.colorScheme.onSurface + } + } @@ -947,16 +969,24 @@ fun BottomSheetPlayer( .fillMaxWidth() .padding(horizontal = PlayerHorizontalPadding), ) { +// Box(modifier = Modifier.weight(1f)) { +// ResizableIconButton( +// icon = if (currentSong?.song?.liked == true) R.drawable.favorite else R.drawable.favorite_border, +// color = if (currentSong?.song?.liked == true) MaterialTheme.colorScheme.error else onBackgroundColor, +// modifier = +// Modifier +// .size(32.dp) +// .padding(4.dp) +// .align(Alignment.Center), +// onClick = playerConnection::toggleLike, +// ) +// } + // button to toggle like Box(modifier = Modifier.weight(1f)) { - ResizableIconButton( - icon = if (currentSong?.song?.liked == true) R.drawable.favorite else R.drawable.favorite_border, - color = if (currentSong?.song?.liked == true) MaterialTheme.colorScheme.error else onBackgroundColor, - modifier = - Modifier - .size(32.dp) - .padding(4.dp) - .align(Alignment.Center), - onClick = playerConnection::toggleLike, + LikeButton( + isLiked = currentSong?.song?.liked == true, + onLikeClick = playerConnection::toggleLike, + color = if (currentSong?.song?.liked == true) MaterialTheme.colorScheme.error else onBackgroundColor ) } @@ -1070,8 +1100,39 @@ fun BottomSheetPlayer( .blur(200.dp) .alpha(0.8f) .background(if (useBlackBackground) Color.Black.copy(alpha = 0.5f) else Color.Transparent) + + ) + } + else if (playerBackground == PlayerBackgroundStyle.BLURMOV) { + val infiniteTransition = rememberInfiniteTransition(label = "") + + + val rotation by infiniteTransition.animateFloat( + initialValue = 0f, + targetValue = 360f, + animationSpec = infiniteRepeatable( + animation = tween( + durationMillis = 100000, + easing = FastOutSlowInEasing // Easing suave + ), + repeatMode = RepeatMode.Restart + ), label = "" + ) + AsyncImage( + model = mediaMetadata?.thumbnailUrl, + contentDescription = null, + contentScale = ContentScale.FillBounds, + modifier = Modifier + .fillMaxSize() + .blur(200.dp) + .alpha(0.8f) + .background(if (useBlackBackground) Color.Black.copy(alpha = 0.5f) else Color.Transparent) + .rotate(rotation) + ) - } else if (useBlackBackground && playerBackground == PlayerBackgroundStyle.DEFAULT) { + } + + else if (useBlackBackground && playerBackground == PlayerBackgroundStyle.DEFAULT) { Box( modifier = Modifier .fillMaxSize() @@ -1162,3 +1223,32 @@ fun BottomSheetPlayer( } } + +@Composable +fun LikeButton( + isLiked: Boolean, + onLikeClick: () -> Unit, + color: Color +) { + var isLikedState by remember { mutableStateOf(isLiked) } + val scale by animateFloatAsState( + targetValue = if (isLikedState) 1.2f else 1f, + animationSpec = spring( + dampingRatio = Spring.DampingRatioMediumBouncy, + stiffness = Spring.StiffnessLow + ), label = "" + ) + + ResizableIconButton( + icon = if (isLikedState) R.drawable.favorite else R.drawable.favorite_border, + color = color, + modifier = Modifier + .size(32.dp) + .padding(4.dp) + .scale(scale), + onClick = { + isLikedState = !isLikedState + onLikeClick() + }, + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/malopieds/innertune/ui/screens/settings/AppearanceSettings.kt b/app/src/main/java/com/malopieds/innertune/ui/screens/settings/AppearanceSettings.kt index d823208..cb4bd41 100644 --- a/app/src/main/java/com/malopieds/innertune/ui/screens/settings/AppearanceSettings.kt +++ b/app/src/main/java/com/malopieds/innertune/ui/screens/settings/AppearanceSettings.kt @@ -308,6 +308,11 @@ fun AppearanceSettings( when (style) { PlayerBackgroundStyle.DEFAULT -> stringResource(R.string.follow_theme) PlayerBackgroundStyle.GRADIENT -> stringResource(R.string.gradient) + PlayerBackgroundStyle.BLURMOV -> if (isBlurSupported) { + stringResource(R.string.blurmv) + } else { + stringResource(R.string.blur_not_supported) + } PlayerBackgroundStyle.BLUR -> if (isBlurSupported) { stringResource(R.string.blur) } else { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d7b711d..2abcdbb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -400,4 +400,5 @@ It looks like you have no Internet connection. Please check your network. Go to downloads Blur not supported + Blur (Motion) \ No newline at end of file