diff --git a/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.form b/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.form
index ce5d260..8d28764 100644
--- a/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.form
+++ b/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.form
@@ -3,7 +3,7 @@
-
+
@@ -18,7 +18,7 @@
-
+
@@ -60,77 +60,25 @@
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -159,7 +107,7 @@
-
+
@@ -189,25 +137,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.java b/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.java
index c1d08f4..a0f8a1b 100644
--- a/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.java
+++ b/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.java
@@ -2,19 +2,15 @@ package com.anas.intellij.plugins.ayah.dialogs;
import com.anas.alqurancloudapi.Ayah;
import com.anas.alqurancloudapi.consts.Constants;
-import com.anas.alqurancloudapi.edition.Edition;
-import com.anas.alqurancloudapi.edition.EditionFormat;
import com.anas.intellij.plugins.ayah.audio.AudioPlayer;
import com.anas.intellij.plugins.ayah.audio.PlayerListener;
-import com.anas.intellij.plugins.ayah.settings.userinterface.ReadableEdition;
+import javazoom.jl.player.advanced.PlaybackEvent;
import javax.swing.*;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
-import java.util.Arrays;
-import java.util.Objects;
/**
* @author Anas Elgarhy
@@ -32,9 +28,6 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
private JButton previousButton;
private JButton nextButton;
private JCheckBox autoPlayCheckBox;
- private JTextArea tafseerTextArea;
- private JComboBox tafseerAndTranslationComboBox;
- private JComboBox editionComboBox;
private boolean isPlaying;
private AudioPlayer audioPlayer;
private Ayah ayah;
@@ -44,55 +37,21 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
setContentPane(contentPane);
setModal(true);
- setSize(520, 320);
+ setSize(500, 300);
setResizable(false);
setLocationRelativeTo(null);
getRootPane().setDefaultButton(playButton);
- try {
- setupTheUI();
- } catch (final IOException e) {
- e.printStackTrace();
- JOptionPane.showMessageDialog(this, "Error while loading the ayah details",
- "Error", JOptionPane.ERROR_MESSAGE);
- }
+ updateAhaDetails();
addListeners();
}
- private void setupTheUI() throws IOException {
- previousButton.setEnabled(ayah.getNumber() != 1 && ayah.getSurah().getNumber() != 1);
- nextButton.setEnabled(ayah.getNumber() != Constants.AYAHS_COUNT && ayah.getSurah().getNumber() != Constants.SURAS_COUNT);
-
-
- final var tafserAndTranslationComboBoxModel = new DefaultComboBoxModel();
- final var editionComboBoxModel = new DefaultComboBoxModel();
-
- Arrays.stream(Edition.getEditions()).forEach(edition -> {
- if (edition.getFormat() == EditionFormat.AUDIO) {
- editionComboBoxModel.addElement(new ReadableEdition(edition));
- } else {
- tafserAndTranslationComboBoxModel.addElement(new ReadableEdition(edition));
- }
- });
-
- tafseerAndTranslationComboBox.setModel(tafserAndTranslationComboBoxModel);
- editionComboBox.setModel(editionComboBoxModel);
-
- // Set the default selected item for the editionComboBox
- editionComboBoxModel.setSelectedItem(new ReadableEdition(ayah.getEdition()));
- // Set the actual information about the ayah in the UI
- updateAyahDetails();
- }
-
- private void updateAyahDetails() {
- // Update the ayah details
+ private void updateAhaDetails() {
ayahTextArea.setText(ayah.getText());
surahNameLabel.setText(ayah.getSurah().getName());
numberOfAyahInSuarhLabel.setText("آية رقم: " + ayah.getNumberInSurah());
ayahRevelationType.setText(ayah.getSurah().getRevelationType().getArabicName());
- // Update the tafseer or translation
- updateTheTauseerTextArea();
}
private void addListeners() {
@@ -133,24 +92,6 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
}
});
- tafseerAndTranslationComboBox.addActionListener(e -> {
- updateTheTauseerTextArea();
- });
-
- editionComboBox.addActionListener(e -> {
- final var selectedEdition = ((ReadableEdition) Objects.requireNonNull(
- editionComboBox.getSelectedItem())).getEdition();
- try {
- ayah = Ayah.getAyah(ayah.getNumber(), selectedEdition);
- updateAyahDetails();
- } catch (final IOException ioException) {
- ioException.printStackTrace();
- JOptionPane.showMessageDialog(this,
- "Error while loading the ayah - check your internet connection",
- "Error", JOptionPane.ERROR_MESSAGE);
- }
- });
-
buttonCancel.addActionListener(l -> close());
// call onCancel() when cross is clicked
@@ -167,19 +108,6 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
}
- private void updateTheTauseerTextArea() {
- final var selectedEdition = ((ReadableEdition) Objects.requireNonNull(
- tafseerAndTranslationComboBox.getSelectedItem())).getEdition();
- try {
- tafseerTextArea.setText(Ayah.getAyah(ayah.getNumber(), selectedEdition).getText());
- } catch (final IOException ioException) {
- ioException.printStackTrace();
- JOptionPane.showMessageDialog(this,
- "Error while loading the tafseer - check your internet connection",
- "Error", JOptionPane.ERROR_MESSAGE);
- }
- }
-
private void close() {
if (audioPlayer != null) {
audioPlayer.stop();
@@ -204,7 +132,7 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
try {
ayah = Ayah.getAyah(ayhNumber,
ayah.getEdition().getIdentifier());
- updateAyahDetails();
+ updateAhaDetails();
return true;
} catch (final IOException ex) {
JOptionPane.showMessageDialog(this,