mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-05 03:21:39 +00:00
Deleted all references from the adapters and dialogs to the old queue management system
This commit is contained in:
parent
4e968a8c4b
commit
a32c39867f
18 changed files with 286 additions and 292 deletions
|
|
@ -12,15 +12,12 @@ import androidx.lifecycle.ViewModelProvider;
|
|||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
import androidx.navigation.ui.NavigationUI;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.broadcast.receiver.ConnectivityStatusBroadcastReceiver;
|
||||
import com.cappielloantonio.play.databinding.ActivityMainBinding;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.QueueRepository;
|
||||
import com.cappielloantonio.play.service.MusicPlayerRemote;
|
||||
import com.cappielloantonio.play.ui.activity.base.BaseActivity;
|
||||
import com.cappielloantonio.play.ui.dialog.ConnectionAlertDialog;
|
||||
import com.cappielloantonio.play.ui.dialog.ServerUnreachableDialog;
|
||||
|
|
@ -76,6 +73,14 @@ public class MainActivity extends BaseActivity {
|
|||
bind = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED)
|
||||
collapseBottomSheet();
|
||||
else
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
fragmentManager = getSupportFragmentManager();
|
||||
|
||||
|
|
@ -159,7 +164,7 @@ public class MainActivity extends BaseActivity {
|
|||
|
||||
switch (state) {
|
||||
case BottomSheetBehavior.STATE_HIDDEN:
|
||||
MusicPlayerRemote.quitPlaying();
|
||||
resetMusicSession();
|
||||
break;
|
||||
case BottomSheetBehavior.STATE_COLLAPSED:
|
||||
if (playerBottomSheetFragment != null) {
|
||||
|
|
@ -193,17 +198,6 @@ public class MainActivity extends BaseActivity {
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Scroll on top del bottom sheet quando chiudo
|
||||
* In questo modo non mi ritrovo al posto dell'header una parte centrale del player
|
||||
*/
|
||||
public void setBottomSheetMusicInfo(Song song) {
|
||||
PlayerBottomSheetFragment playerBottomSheetFragment = (PlayerBottomSheetFragment) getSupportFragmentManager().findFragmentByTag("PlayerBottomSheet");
|
||||
if (playerBottomSheetFragment == null) return;
|
||||
|
||||
playerBottomSheetFragment.setSongInfo(song);
|
||||
}
|
||||
|
||||
public void collapseBottomSheet() {
|
||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
|
|
@ -255,21 +249,13 @@ public class MainActivity extends BaseActivity {
|
|||
private void resetMusicSession() {
|
||||
QueueRepository queueRepository = new QueueRepository(App.getInstance());
|
||||
queueRepository.deleteAll();
|
||||
MusicPlayerRemote.quitPlaying();
|
||||
// MusicPlayerRemote.quitPlaying();
|
||||
}
|
||||
|
||||
private void resetViewModel() {
|
||||
this.getViewModelStore().clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED)
|
||||
collapseBottomSheet();
|
||||
else
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
// CONNECTION
|
||||
private void connectivityStatusReceiverManager(boolean isActive) {
|
||||
if (isActive) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue