mirror of
https://github.com/anas-elgarhy/Ayah-intellij.git
synced 2024-08-15 00:43:43 +00:00
Improve the code yooo
This commit is contained in:
parent
580a522f98
commit
35d225b171
15 changed files with 47 additions and 48 deletions
|
@ -12,7 +12,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.github.anas-elgarhy:alquran-cloud-api:0.4.0-v1")
|
implementation("com.github.anas-elgarhy:alquran-cloud-api:0.4.0-v1") // TODO: fix this
|
||||||
implementation("com.miglayout:miglayout-swing:11.0")
|
implementation("com.miglayout:miglayout-swing:11.0")
|
||||||
// implementation("com.github.goxr3plus:java-stream-player:10.0.2")
|
// implementation("com.github.goxr3plus:java-stream-player:10.0.2")
|
||||||
implementation("com.googlecode.soundlibs:jlayer:1.0.1.4")
|
implementation("com.googlecode.soundlibs:jlayer:1.0.1.4")
|
||||||
|
|
|
@ -12,8 +12,8 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/18/22
|
* @since 8/18/22
|
||||||
*/
|
*/
|
||||||
public class AyahStartupActivity implements StartupActivity {
|
public class AyahStartupActivity implements StartupActivity {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,8 +7,8 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/19/22
|
* @since 8/19/22
|
||||||
*/
|
*/
|
||||||
public enum NotificationTimer {
|
public enum NotificationTimer {
|
||||||
INSTANCE
|
INSTANCE
|
||||||
|
|
|
@ -20,8 +20,8 @@ import java.util.TimerTask;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/19/22
|
* @since 8/19/22
|
||||||
*/
|
*/
|
||||||
public class NotificationTimerTask extends TimerTask implements PlayerListener {
|
public class NotificationTimerTask extends TimerTask implements PlayerListener {
|
||||||
private Project project;
|
private Project project;
|
||||||
|
@ -103,12 +103,12 @@ public class NotificationTimerTask extends TimerTask implements PlayerListener {
|
||||||
|
|
||||||
// Player listener methods.
|
// Player listener methods.
|
||||||
@Override
|
@Override
|
||||||
public void onStarted(final PlaybackEvent event) {
|
public void onStarted() {
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinished(PlaybackEvent event) {
|
public void onFinished() {
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ import java.net.URL;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/19/22
|
* @since 8/19/22
|
||||||
*/
|
*/
|
||||||
public class AudioPlayer {
|
public class AudioPlayer {
|
||||||
private final String audioUrl;
|
private final String audioUrl;
|
||||||
|
@ -56,12 +56,12 @@ public class AudioPlayer {
|
||||||
player.setPlayBackListener(new PlaybackListener() {
|
player.setPlayBackListener(new PlaybackListener() {
|
||||||
@Override
|
@Override
|
||||||
public void playbackStarted(final PlaybackEvent evt) {
|
public void playbackStarted(final PlaybackEvent evt) {
|
||||||
listener.onStarted(evt);
|
listener.onStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playbackFinished(final PlaybackEvent evt) {
|
public void playbackFinished(final PlaybackEvent evt) {
|
||||||
listener.onFinished(evt);
|
listener.onFinished();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,10 @@ package com.anas.intellij.plugins.ayah.audio;
|
||||||
import javazoom.jl.player.advanced.PlaybackEvent;
|
import javazoom.jl.player.advanced.PlaybackEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/22/22
|
* @since 8/22/22
|
||||||
*/
|
*/
|
||||||
public interface PlayerListener {
|
public interface PlayerListener {
|
||||||
void onStarted(final PlaybackEvent event);
|
void onStarted();
|
||||||
void onFinished(final PlaybackEvent event);
|
void onFinished();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,11 @@ import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
|
* @since 8/19/22
|
||||||
|
*/
|
||||||
|
|
||||||
public class AyahDetailsDialog extends JDialog implements PlayerListener {
|
public class AyahDetailsDialog extends JDialog implements PlayerListener {
|
||||||
private JPanel contentPane;
|
private JPanel contentPane;
|
||||||
private JButton playButton;
|
private JButton playButton;
|
||||||
|
@ -138,13 +143,13 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStarted(final PlaybackEvent event) {
|
public void onStarted() {
|
||||||
playButton.setText("Stop");
|
playButton.setText("Stop");
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinished(final PlaybackEvent event) {
|
public void onFinished() {
|
||||||
if (autoPlayCheckBox.isSelected() && ayah.getNumber() <= Constants.AYAHS_COUNT) {
|
if (autoPlayCheckBox.isSelected() && ayah.getNumber() <= Constants.AYAHS_COUNT) {
|
||||||
if (loadTheAyah(ayah.getNumber() + 1)) {
|
if (loadTheAyah(ayah.getNumber() + 1)) {
|
||||||
audioPlayer = new AudioPlayer(ayah.getAudioUrl()).setListener(this);
|
audioPlayer = new AudioPlayer(ayah.getAudioUrl()).setListener(this);
|
||||||
|
|
|
@ -9,8 +9,8 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/19/22
|
* @since 8/19/22
|
||||||
*/
|
*/
|
||||||
public class AyahSettingsConfigurable implements Configurable {
|
public class AyahSettingsConfigurable implements Configurable {
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/19/22
|
* @since 8/19/22
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
package com.anas.intellij.plugins.ayah.settings;
|
package com.anas.intellij.plugins.ayah.settings;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/19/22
|
* @since 8/19/22
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class BasmalhOnStart {
|
public class BasmalhOnStart {
|
||||||
private boolean isActive;
|
private boolean isActive;
|
||||||
private boolean isSoundActive;
|
private boolean isSoundActive;
|
||||||
|
@NonNull
|
||||||
private SelectedEdition edition;
|
private SelectedEdition edition;
|
||||||
|
|
||||||
public BasmalhOnStart() {
|
public BasmalhOnStart() {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import lombok.Setter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/21/22
|
* @since 8/21/22
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
|
|
|
@ -5,8 +5,8 @@ import javax.swing.border.Border;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/19/22
|
* @since 8/19/22
|
||||||
*/
|
*/
|
||||||
public class PanelBuilder {
|
public class PanelBuilder {
|
||||||
private final JPanel panel;
|
private final JPanel panel;
|
||||||
|
|
|
@ -1,26 +1,22 @@
|
||||||
package com.anas.intellij.plugins.ayah.settings.userinterface;
|
package com.anas.intellij.plugins.ayah.settings.userinterface;
|
||||||
|
|
||||||
import com.anas.alqurancloudapi.edition.Edition;
|
import com.anas.alqurancloudapi.edition.Edition;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/20/22
|
* @since 8/20/22
|
||||||
*/
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Getter
|
||||||
public class ReadableEdition {
|
public class ReadableEdition {
|
||||||
private Edition edition;
|
private final Edition edition;
|
||||||
|
|
||||||
public ReadableEdition(final Edition edition) {
|
|
||||||
this.edition = edition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReadableEdition(final String identifier) {
|
public ReadableEdition(final String identifier) {
|
||||||
this.edition = new Edition(identifier);
|
this.edition = new Edition(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Edition getEdition() {
|
|
||||||
return edition;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return edition.getName() + " (" + edition.getLanguage() + ")";
|
return edition.getName() + " (" + edition.getLanguage() + ")";
|
||||||
|
|
|
@ -19,8 +19,8 @@ import java.util.logging.Logger;
|
||||||
/**
|
/**
|
||||||
* The settings UI.
|
* The settings UI.
|
||||||
*
|
*
|
||||||
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
|
||||||
* @date: 8/19/22
|
* @since 8/19/22
|
||||||
*/
|
*/
|
||||||
public class SettingsComponent {
|
public class SettingsComponent {
|
||||||
private final JPanel panel;
|
private final JPanel panel;
|
||||||
|
|
|
@ -41,11 +41,7 @@
|
||||||
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html -->
|
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html -->
|
||||||
<depends>com.intellij.modules.platform</depends>
|
<depends>com.intellij.modules.platform</depends>
|
||||||
|
|
||||||
<applicationListeners>
|
|
||||||
<listener class="com.anas.intellij.plugins.ayah.listeners.AyahExecutionListener"
|
|
||||||
topic="com.intellij.execution.ExecutionListener" />
|
|
||||||
</applicationListeners>
|
|
||||||
|
|
||||||
<!-- Extension points defined by the plugin.
|
<!-- Extension points defined by the plugin.
|
||||||
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html -->
|
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html -->
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
@ -62,4 +58,4 @@
|
||||||
<notificationGroup displayType="BALLOON" id="Basmalh on Start" />
|
<notificationGroup displayType="BALLOON" id="Basmalh on Start" />
|
||||||
<notificationGroup displayType="BALLOON" id="Random Ayah Notification" />
|
<notificationGroup displayType="BALLOON" id="Random Ayah Notification" />
|
||||||
</extensions>
|
</extensions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
|
Loading…
Reference in a new issue