Skip to content

Commit

Permalink
update lib
Browse files Browse the repository at this point in the history
  • Loading branch information
KunMinX committed Sep 12, 2023
1 parent 4902551 commit a507af3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -171,6 +172,16 @@ public PlayerInfoDispatcher<TestAlbum, TestAlbum.TestMusic, TestAlbum.TestArtist
return mController.getDispatcher();
}

@Override
public State<Integer> getCurrentPositionState() {
return mController.mCurrentPositionState;
}

@Override
public State<Integer> getDurationState() {
return mController.mDurationState;
}

@Override
public TestAlbum getAlbum() {
return mController.getAlbum();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -239,10 +236,6 @@ public static class PlayerStates extends StateHolder {

public final State<Drawable> placeHolder = new State<>(ResUtils.getDrawable(R.drawable.bg_album_default));

public final State<Integer> maxSeekDuration = new State<>(0);

public final State<Integer> currentSeekPosition = new State<>(0);

public final State<Boolean> isPlaying = new State<>(false, true);

public final State<MaterialDrawableBuilder.IconValue> playModeIcon
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/res/layout-land/fragment_player.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
name="vm"
type="com.kunminx.puremusic.ui.page.PlayerFragment.PlayerStates" />

<variable
name="player"
type="com.kunminx.puremusic.domain.proxy.PlayerManager" />
</data>

<androidx.coordinatorlayout.widget.CoordinatorLayout
Expand Down Expand Up @@ -116,10 +119,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"
android:visibility="visible"
Expand Down
11 changes: 7 additions & 4 deletions app/src/main/res/layout/fragment_player.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
name="panelVm"
type="com.kunminx.puremusic.ui.view.PlayerSlideListener.SlideAnimatorStates" />

<variable
name="player"
type="com.kunminx.puremusic.domain.proxy.PlayerManager" />
</data>

<androidx.coordinatorlayout.widget.CoordinatorLayout
Expand Down Expand Up @@ -110,9 +113,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:max="@{vm.maxSeekDuration}"
android:max="@{player.durationState}"
android:minHeight="4dp"
android:progress="@{vm.currentSeekPosition}"
android:progress="@{player.currentPositionState}"
android:progressDrawable="@drawable/progressbar_color"
android:progressTint="@color/transparent" />

Expand Down Expand Up @@ -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}" />
Expand Down

0 comments on commit a507af3

Please sign in to comment.