From a507af3aa81e366d1561e4cf9230670987fe3cc9 Mon Sep 17 00:00:00 2001 From: kunminx Date: Tue, 12 Sep 2023 13:49:02 +0800 Subject: [PATCH] update lib --- app/build.gradle | 2 +- .../kunminx/puremusic/domain/proxy/PlayerManager.java | 11 +++++++++++ .../com/kunminx/puremusic/ui/page/PlayerFragment.java | 9 +-------- app/src/main/res/layout-land/fragment_player.xml | 7 +++++-- app/src/main/res/layout/fragment_player.xml | 11 +++++++---- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 730c6e26..5a047c80 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -48,7 +48,7 @@ dependencies { implementation "org.slf4j:slf4j-android:1.7.36" implementation "com.sothree.slidinguppanel:library:3.4.0" - implementation 'com.github.KunMinX:Jetpack-MusicPlayer:4.2.0' + implementation 'com.github.KunMinX:Jetpack-MusicPlayer:4.3.0' implementation 'com.github.KunMinX.KeyValueX:keyvalue:3.7.0-beta' annotationProcessor 'com.github.KunMinX.KeyValueX:keyvalue-compiler:3.7.0-beta' } diff --git a/app/src/main/java/com/kunminx/puremusic/domain/proxy/PlayerManager.java b/app/src/main/java/com/kunminx/puremusic/domain/proxy/PlayerManager.java index baa29044..76c8bb6d 100644 --- a/app/src/main/java/com/kunminx/puremusic/domain/proxy/PlayerManager.java +++ b/app/src/main/java/com/kunminx/puremusic/domain/proxy/PlayerManager.java @@ -20,6 +20,7 @@ import android.content.Intent; import com.danikula.videocache.HttpProxyCacheServer; +import com.kunminx.architecture.ui.state.State; import com.kunminx.player.PlayerController; import com.kunminx.player.PlayingInfoManager; import com.kunminx.player.contract.ICacheProxy; @@ -171,6 +172,16 @@ public PlayerInfoDispatcher getCurrentPositionState() { + return mController.mCurrentPositionState; + } + + @Override + public State getDurationState() { + return mController.mDurationState; + } + @Override public TestAlbum getAlbum() { return mController.getAlbum(); diff --git a/app/src/main/java/com/kunminx/puremusic/ui/page/PlayerFragment.java b/app/src/main/java/com/kunminx/puremusic/ui/page/PlayerFragment.java index 40b3d571..29e942c4 100755 --- a/app/src/main/java/com/kunminx/puremusic/ui/page/PlayerFragment.java +++ b/app/src/main/java/com/kunminx/puremusic/ui/page/PlayerFragment.java @@ -82,6 +82,7 @@ protected DataBindingConfig getDataBindingConfig() { return new DataBindingConfig(R.layout.fragment_player, BR.vm, mStates) .addBindingParam(BR.panelVm, mAnimatorStates) + .addBindingParam(BR.player, PlayerManager.getInstance()) .addBindingParam(BR.click, new ClickProxy()) .addBindingParam(BR.listener, new ListenerHandler()); } @@ -164,10 +165,6 @@ public void onPanelStateChanged( mStates.coverImg.set(playerEvent.changeMusic.getImg()); if (mListener != null) view.post(mListener::calculateTitleAndArtist); break; - case PlayerEvent.EVENT_PROGRESS: - mStates.maxSeekDuration.set(playerEvent.playingMusic.getDuration()); - mStates.currentSeekPosition.set(playerEvent.playingMusic.getPlayerPosition()); - break; case PlayerEvent.EVENT_PLAY_STATUS: mStates.isPlaying.set(!playerEvent.toPause); break; @@ -239,10 +236,6 @@ public static class PlayerStates extends StateHolder { public final State placeHolder = new State<>(ResUtils.getDrawable(R.drawable.bg_album_default)); - public final State maxSeekDuration = new State<>(0); - - public final State currentSeekPosition = new State<>(0); - public final State isPlaying = new State<>(false, true); public final State playModeIcon diff --git a/app/src/main/res/layout-land/fragment_player.xml b/app/src/main/res/layout-land/fragment_player.xml index a05d7fe0..a25e6e70 100755 --- a/app/src/main/res/layout-land/fragment_player.xml +++ b/app/src/main/res/layout-land/fragment_player.xml @@ -32,6 +32,9 @@ name="vm" type="com.kunminx.puremusic.ui.page.PlayerFragment.PlayerStates" /> + + @@ -246,10 +249,10 @@ android:background="@color/transparent" android:clickable="true" android:focusable="true" - android:max="@{vm.maxSeekDuration}" + android:max="@{player.durationState}" android:minHeight="6dp" android:paddingTop="24dp" - android:progress="@{vm.currentSeekPosition}" + android:progress="@{player.currentPositionState}" android:progressDrawable="@drawable/progressbar_color" android:thumb="@null" app:onSeekBarChangeListener="@{listener}" />