Improve the code yooo

This commit is contained in:
Anas Elgarhy 2022-11-02 23:06:04 +02:00
parent 580a522f98
commit 35d225b171
15 changed files with 47 additions and 48 deletions

View File

@ -12,7 +12,7 @@ repositories {
}
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.github.goxr3plus:java-stream-player:10.0.2")
implementation("com.googlecode.soundlibs:jlayer:1.0.1.4")

View File

@ -12,8 +12,8 @@ import org.jetbrains.annotations.NotNull;
import java.io.IOException;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/18/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/18/22
*/
public class AyahStartupActivity implements StartupActivity {
@Override

View File

@ -7,8 +7,8 @@ import org.jetbrains.annotations.NotNull;
import java.util.Timer;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/19/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/19/22
*/
public enum NotificationTimer {
INSTANCE

View File

@ -20,8 +20,8 @@ import java.util.TimerTask;
import java.util.logging.Logger;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/19/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/19/22
*/
public class NotificationTimerTask extends TimerTask implements PlayerListener {
private Project project;
@ -103,12 +103,12 @@ public class NotificationTimerTask extends TimerTask implements PlayerListener {
// Player listener methods.
@Override
public void onStarted(final PlaybackEvent event) {
public void onStarted() {
isPlaying = true;
}
@Override
public void onFinished(PlaybackEvent event) {
public void onFinished() {
isPlaying = false;
}
}

View File

@ -15,8 +15,8 @@ import java.net.URL;
import java.util.logging.Logger;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/19/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/19/22
*/
public class AudioPlayer {
private final String audioUrl;
@ -56,12 +56,12 @@ public class AudioPlayer {
player.setPlayBackListener(new PlaybackListener() {
@Override
public void playbackStarted(final PlaybackEvent evt) {
listener.onStarted(evt);
listener.onStarted();
}
@Override
public void playbackFinished(final PlaybackEvent evt) {
listener.onFinished(evt);
listener.onFinished();
}
});
}

View File

@ -3,10 +3,10 @@ package com.anas.intellij.plugins.ayah.audio;
import javazoom.jl.player.advanced.PlaybackEvent;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/22/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/22/22
*/
public interface PlayerListener {
void onStarted(final PlaybackEvent event);
void onFinished(final PlaybackEvent event);
void onStarted();
void onFinished();
}

View File

@ -12,6 +12,11 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
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 {
private JPanel contentPane;
private JButton playButton;
@ -138,13 +143,13 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
}
@Override
public void onStarted(final PlaybackEvent event) {
public void onStarted() {
playButton.setText("Stop");
isPlaying = true;
}
@Override
public void onFinished(final PlaybackEvent event) {
public void onFinished() {
if (autoPlayCheckBox.isSelected() && ayah.getNumber() <= Constants.AYAHS_COUNT) {
if (loadTheAyah(ayah.getNumber() + 1)) {
audioPlayer = new AudioPlayer(ayah.getAudioUrl()).setListener(this);

View File

@ -9,8 +9,8 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/19/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/19/22
*/
public class AyahSettingsConfigurable implements Configurable {

View File

@ -14,8 +14,8 @@ import org.jetbrains.annotations.Nullable;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/19/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/19/22
*/
@Getter
@Setter

View File

@ -1,17 +1,19 @@
package com.anas.intellij.plugins.ayah.settings;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/19/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/19/22
*/
@Getter
@Setter
public class BasmalhOnStart {
private boolean isActive;
private boolean isSoundActive;
@NonNull
private SelectedEdition edition;
public BasmalhOnStart() {

View File

@ -9,8 +9,8 @@ import lombok.Setter;
import java.io.IOException;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/21/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/21/22
*/
@AllArgsConstructor
@Getter

View File

@ -5,8 +5,8 @@ import javax.swing.border.Border;
import java.awt.*;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/19/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/19/22
*/
public class PanelBuilder {
private final JPanel panel;

View File

@ -1,26 +1,22 @@
package com.anas.intellij.plugins.ayah.settings.userinterface;
import com.anas.alqurancloudapi.edition.Edition;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/20/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/20/22
*/
@RequiredArgsConstructor
@Getter
public class ReadableEdition {
private Edition edition;
public ReadableEdition(final Edition edition) {
this.edition = edition;
}
private final Edition edition;
public ReadableEdition(final String identifier) {
this.edition = new Edition(identifier);
}
public Edition getEdition() {
return edition;
}
@Override
public String toString() {
return edition.getName() + " (" + edition.getLanguage() + ")";

View File

@ -19,8 +19,8 @@ import java.util.logging.Logger;
/**
* The settings UI.
*
* @author: <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @date: 8/19/22
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
* @since 8/19/22
*/
public class SettingsComponent {
private final JPanel panel;

View File

@ -41,11 +41,7 @@
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html -->
<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.
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html -->
<extensions defaultExtensionNs="com.intellij">
@ -62,4 +58,4 @@
<notificationGroup displayType="BALLOON" id="Basmalh on Start" />
<notificationGroup displayType="BALLOON" id="Random Ayah Notification" />
</extensions>
</idea-plugin>
</idea-plugin>