mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-02 02:13:33 +00:00
Add "Go to artist" button in playerBottomSheetFragment
This commit is contained in:
parent
1089512983
commit
b2b081947f
3 changed files with 26 additions and 3 deletions
|
|
@ -230,10 +230,14 @@ public class MainActivity extends BaseActivity {
|
|||
goToLogin();
|
||||
}
|
||||
|
||||
public void collapseBottomSheet() {
|
||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED)
|
||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
collapseBottomSheet();
|
||||
else
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
|
@ -77,6 +78,7 @@ public class PlayerBottomSheetFragment extends Fragment implements MusicServiceE
|
|||
initQueueRecyclerView();
|
||||
initFavoriteButtonClick();
|
||||
initMusicCommandButton();
|
||||
initArtistLabelButton();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
|
@ -249,6 +251,15 @@ public class PlayerBottomSheetFragment extends Fragment implements MusicServiceE
|
|||
headerBind.playerHeaderNextSongButton.setOnClickListener(v -> MusicPlayerRemote.playNextSong());
|
||||
}
|
||||
|
||||
private void initArtistLabelButton() {
|
||||
bodyBind.playerArtistNameLabel.setOnClickListener(view -> playerBottomSheetViewModel.getArtist().observe(requireActivity(), artist -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("artist_object", artist);
|
||||
NavHostFragment.findNavController(this).navigate(R.id.artistPageFragment, bundle);
|
||||
activity.collapseBottomSheet();
|
||||
}));
|
||||
}
|
||||
|
||||
private void initSeekBar() {
|
||||
bodyBind.playerBigSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue