small code refactor within player fragments
This commit is contained in:
parent
d6b4b67230
commit
2054f712be
2 changed files with 4 additions and 11 deletions
|
|
@ -305,18 +305,15 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
|||
public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
|
||||
switch (newState) {
|
||||
case COLLAPSED:
|
||||
onPanelCollapsed(panel);
|
||||
resetToCurrentPosition();
|
||||
break;
|
||||
case ANCHORED:
|
||||
binding.playerSlidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); // this fixes a bug where the panel would get stuck for some reason
|
||||
// this fixes a bug where the panel would get stuck for some reason
|
||||
binding.playerSlidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onPanelCollapsed(View panel) {
|
||||
resetToCurrentPosition();
|
||||
}
|
||||
|
||||
private void resetToCurrentPosition() {
|
||||
binding.playerRecyclerView.stopScroll();
|
||||
layoutManager.scrollToPositionWithOffset(MusicPlayerRemote.getPosition() + 1, 0);
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
|||
public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
|
||||
switch (newState) {
|
||||
case COLLAPSED:
|
||||
onPanelCollapsed(panel);
|
||||
resetToCurrentPosition();
|
||||
break;
|
||||
case ANCHORED:
|
||||
// this fixes a bug where the panel would get stuck for some reason
|
||||
|
|
@ -312,10 +312,6 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
|||
}
|
||||
}
|
||||
|
||||
public void onPanelCollapsed(View panel) {
|
||||
resetToCurrentPosition();
|
||||
}
|
||||
|
||||
private void resetToCurrentPosition() {
|
||||
binding.playerRecyclerView.stopScroll();
|
||||
layoutManager.scrollToPositionWithOffset(MusicPlayerRemote.getPosition() + 1, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue