Skip to content

Commit

Permalink
General improvements
Browse files Browse the repository at this point in the history
Fixed drag on wavy timeline #362
  • Loading branch information
fast4x committed Jan 8, 2024
1 parent 01bce73 commit 12f2a12
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
2 changes: 0 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ dependencies {

implementation("com.github.therealbush:translator:1.0.2")

//implementation("androidx.hilt:hilt-navigation-fragment:1.0.0")

implementation("io.github.gautamchibde:audiovisualizer:2.2.7")

implementation("androidx.compose.material:material:1.1.0")
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/kotlin/it/vfsfitvnm/vimusic/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.vfsfitvnm.vimusic

import android.app.Activity
import android.content.ComponentName
import android.content.Context
import android.content.Intent
Expand Down Expand Up @@ -70,7 +71,6 @@ import androidx.media3.common.util.Log
import androidx.media3.common.util.UnstableApi
import com.valentinilk.shimmer.LocalShimmerTheme
import com.valentinilk.shimmer.defaultShimmerTheme
//import dagger.hilt.android.AndroidEntryPoint
import it.vfsfitvnm.compose.persist.PersistMap
import it.vfsfitvnm.compose.persist.PersistMapOwner
import it.vfsfitvnm.innertube.Innertube
Expand Down Expand Up @@ -134,7 +134,6 @@ import org.json.JSONException
import java.io.File


//@AndroidEntryPoint
@UnstableApi
class MainActivity : AppCompatActivity(), PersistMapOwner {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fun Controls(
easing = LinearEasing
))
}
val durationVisible by remember(isSeeking) { derivedStateOf { isSeeking } }
//val durationVisible by remember(isSeeking) { derivedStateOf { isSeeking } }



Expand Down Expand Up @@ -468,35 +468,49 @@ fun Controls(
position = { animatedPosition.value },
range = 0f..media.duration.toFloat(),
onSeekStarted = {
isSeeking = true
scrubbingPosition = it.toLong()

//isSeeking = true
scope.launch {
animatedPosition.animateTo(it)
}

},
onSeek = { delta ->
scrubbingPosition = if (duration != C.TIME_UNSET) {
scrubbingPosition?.plus(delta)?.coerceIn(0F, duration.toFloat())?.toLong()
} else {
null
}

if (media.duration != C.TIME_UNSET) {
isSeeking = true
//isSeeking = true
scope.launch {
animatedPosition.snapTo(
animatedPosition.value.plus(delta)
.coerceIn(0f, media.duration.toFloat())
)
}
}

},
onSeekFinished = {
scrubbingPosition?.let(binder.player::seekTo)
scrubbingPosition = null
/*
isSeeking = false
animatedPosition.let {
binder.player.seekTo(it.targetValue.toLong())
}
*/
},
color = colorPalette.collapsedPlayerProgressBar,
isActive = binder.player.isPlaying,
backgroundColor = colorPalette.textSecondary,
shape = RoundedCornerShape(8.dp)
)
}

/*
AnimatedVisibility(
durationVisible,
enter = fadeIn() + expandVertically { -it },
Expand All @@ -506,6 +520,7 @@ fun Controls(
Duration(animatedPosition.value, media.duration)
}
}
*/


Spacer(
Expand All @@ -514,7 +529,7 @@ fun Controls(
)


if (!durationVisible)
//if (!durationVisible)
Row(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,13 @@
<!-- Set the splash screen background, animated icon, and animation
duration. -->
<item name="windowSplashScreenBackground">#000000</item>

<!-- Use windowSplashScreenAnimatedIcon to add a drawable or an animated
drawable. One of these is required. -->
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_logo</item>
<!-- Required for animated icons. -->
<item name="windowSplashScreenAnimationDuration">1000</item>


<!-- Ready to future version
<item name="android:windowSplashScreenBrandingImage">@drawable/heart</item>-->
<item name="android:windowSplashScreenBrandingImage">@drawable/heart</item> -->

<!-- Set the theme of the Activity that directly follows your splash
screen. This is required. -->
Expand Down

0 comments on commit 12f2a12

Please sign in to comment.