forked from AdvancedProgramming1404/HW-07-JavaFX
completed
This commit is contained in:
@@ -30,6 +30,7 @@ public class Main extends Application {
|
||||
);
|
||||
|
||||
controller.setupListView(controller.musicsListView);
|
||||
controller.setupListView(controller.playlistListView);
|
||||
|
||||
Scene scene = new Scene(root, 500, 600);
|
||||
scene.getStylesheets().add(
|
||||
|
||||
@@ -37,6 +37,7 @@ public class MusicController {
|
||||
private boolean isDarkMode=true;
|
||||
private boolean isPlaying=false;
|
||||
private boolean isMute=false;
|
||||
private boolean isOpen=false;
|
||||
private Song currentSong = null;
|
||||
ImageView playIcon;
|
||||
ImageView pauseIcon;
|
||||
@@ -134,10 +135,7 @@ public class MusicController {
|
||||
}
|
||||
|
||||
public void changeTheme(){
|
||||
|
||||
|
||||
Scene scene = root.getScene();
|
||||
|
||||
scene.getStylesheets().clear();
|
||||
|
||||
if(isDarkMode){
|
||||
@@ -213,20 +211,53 @@ public class MusicController {
|
||||
|
||||
// TODO:This method should open a new window or change the current scene to display the "Playlist" page.
|
||||
|
||||
public void openPlaylistWindow() {
|
||||
//Create a new stage and show the playlist UI.
|
||||
musicsListView.setVisible(false);
|
||||
if(playlistListView!=null)
|
||||
playlistListView.setVisible(true);
|
||||
public void openPlaylistWindow(ActionEvent e) {
|
||||
|
||||
if(isPlaying)
|
||||
playPause(e);
|
||||
|
||||
if(!isOpen){
|
||||
|
||||
// باز کردن پلیلیست
|
||||
|
||||
if(playlistListView.getItems().isEmpty()){
|
||||
|
||||
else{
|
||||
Alert alert = new Alert(Alert.AlertType.WARNING);
|
||||
|
||||
alert.setTitle("Empty Playlist");
|
||||
alert.setHeaderText(null);
|
||||
alert.setContentText("Playlist is empty!");
|
||||
|
||||
alert.showAndWait();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
isOpen = true;
|
||||
|
||||
openPlaylistBtn.setText("Back");
|
||||
|
||||
musicsListView.setVisible(false);
|
||||
musicsListView.setManaged(false);
|
||||
|
||||
playlistListView.setVisible(true);
|
||||
playlistListView.setManaged(true);
|
||||
|
||||
} else {
|
||||
|
||||
// برگشت به صفحه اصلی
|
||||
|
||||
isOpen = false;
|
||||
|
||||
openPlaylistBtn.setText("Open Playlist");
|
||||
|
||||
musicsListView.setVisible(true);
|
||||
musicsListView.setManaged(true);
|
||||
|
||||
playlistListView.setVisible(false);
|
||||
playlistListView.setManaged(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
<ListView fx:id="musicsListView" VBox.vgrow="ALWAYS"/>
|
||||
|
||||
<!-- آهنگ های پلی لیست-->
|
||||
<ListView fx:id="playlistListView" visible="false"
|
||||
managed="false" VBox.vgrow="ALWAYS"/>
|
||||
<ListView fx:id="playlistListView"
|
||||
visible="false"
|
||||
managed="false"
|
||||
VBox.vgrow="ALWAYS"/>
|
||||
|
||||
<!-- باکس آهنگ در حال پخش -->
|
||||
<VBox alignment="CENTER" spacing="5">
|
||||
@@ -93,7 +95,8 @@
|
||||
</Button>
|
||||
|
||||
<Button fx:id="openPlaylistBtn"
|
||||
text="Playlist"
|
||||
onAction="#openPlaylistWindow"
|
||||
text="Open Playlist"
|
||||
style="-fx-background-radius: 15px;" />
|
||||
|
||||
</HBox>
|
||||
|
||||
Reference in New Issue
Block a user