Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV][v100-beta3 is completed] #32

Merged
merged 2 commits into from
Oct 9, 2024
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v1.0.0-Beta3 (09.10.2024)
* [FIX] The version was upgraded due to an issue in the Explode module.
* [FIX] The player now opens without waiting for the music to load.

## v1.0.0-Beta2 (28.09.2024)

* [FIX] The explode error in the search has been resolved.
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {
applicationId = "com.snstudio.hyper"
minSdk = 26
targetSdk = 34
versionCode = 3
versionName = "1.0.0-Beta2"
versionCode = 4
versionName = "1.0.0-Beta3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/com/snstudio/hyper/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.snstudio.hyper.core.extension.click
import com.snstudio.hyper.core.extension.gone
import com.snstudio.hyper.core.extension.observe
import com.snstudio.hyper.core.extension.startColorAnimation
import com.snstudio.hyper.core.extension.visible
import com.snstudio.hyper.databinding.ActivityMainBinding
import com.snstudio.hyper.shared.MediaViewModel
import com.snstudio.hyper.shared.ProgressLiveData
Expand Down Expand Up @@ -78,7 +77,11 @@ class MainActivity : AppCompatActivity() {
binding.playerView.player = player
}
observe(playbackStateLiveData) {
binding.playerMenu.visible()
// binding.playerMenu.visible()
// moveSnack(380)
}
observe(showPlayerMenuLiveData) {
binding.playerMenu.isVisible = it
moveSnack(380)
}
observe(playerWhenReadyLiveData) { ready ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class LibraryFragment : BaseFragment<FragmentLibraryBinding, LibraryViewModel>()
.setMediaTitle(media.title)
.build()
with(mediaViewModel) {
showPLayerMenu(true)
playMediaItem(item)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class PlaylistDetailFragment : BaseFragment<FragmentPlaylistDetailBinding, Playl
.setMediaTitle(media.title)
.build()
}
mediaViewModel.showPLayerMenu(true)
mediaViewModel.setPlaylist(mediaItems, pos)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class SearchFragment :

private val mediaItemAdapter by lazy {
MediaItemAdapter(onClick = { media, _ ->
mediaViewModel.showPLayerMenu(true)
viewModel.invokeAudioUrl(media, SearchViewModel.AudioActionType.PLAY)
})
}
Expand Down Expand Up @@ -81,6 +82,7 @@ class SearchFragment :
val errorCode = data["errorCode"]
if (!errorCode.isNullOrEmpty()) {
showErrorDialog(errorCode)
mediaViewModel.showPLayerMenu(false)
return@observe
}
when (audioActionType) {
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/com/snstudio/hyper/shared/MediaViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class MediaViewModel(application: Application) : AndroidViewModel(application) {
private val playerWhenReadyMLiveData = MutableLiveData<Boolean>()
val playerWhenReadyLiveData: LiveData<Boolean> = playerWhenReadyMLiveData

private val showPlayerMenuMLiveData = MutableLiveData<Boolean>()
val showPlayerMenuLiveData: LiveData<Boolean> = showPlayerMenuMLiveData

private val playlist = mutableListOf<MediaItem>()

init {
Expand Down Expand Up @@ -68,9 +71,10 @@ class MediaViewModel(application: Application) : AndroidViewModel(application) {
}

override fun onPlaybackStateChanged(playbackState: Int) {
/*
if (playbackState == Player.STATE_READY) {
playbackStateMLiveData.postValue(Unit)
}
}*/
}
},
)
Expand All @@ -80,6 +84,10 @@ class MediaViewModel(application: Application) : AndroidViewModel(application) {

fun getMediaMetaData(): MediaMetadata = player.mediaMetadata

fun showPLayerMenu(show: Boolean) {
showPlayerMenuMLiveData.postValue(show)
}

fun playMediaItem(item: MediaItem) {
player.setMediaItem(item)
player.prepare()
Expand Down
4 changes: 2 additions & 2 deletions explode/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ packages:
dependency: "direct main"
description:
name: youtube_explode_dart
sha256: "133a65907e6cf839ac7643d92dc5c56b37fcebe4f0a8f0e67716dffa500c0ef0"
sha256: "28dca07fefb4b6518beab95f0c1ef81031f921ed0fe87ebcd9c51378546edfee"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
version: "2.2.3"
sdks:
dart: ">=3.2.5 <4.0.0"
2 changes: 1 addition & 1 deletion explode/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ environment:
dependencies:
flutter:
sdk: flutter
youtube_explode_dart: ^2.2.2
youtube_explode_dart: ^2.2.3

dev_dependencies:
flutter_test:
Expand Down
Loading