Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature updates #44

Merged
merged 11 commits into from
Nov 16, 2023
Merged
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "com.zoffcc.applications.trifa_material"
version = "1.0.0"
version = "1.0.1"
val appName = "trifa_material"

repositories {
Expand Down Expand Up @@ -36,10 +36,11 @@ dependencies {
implementation(compose.materialIconsExtended)
//
//
implementation("org.xerial:sqlite-jdbc:3.43.2.1")
implementation("org.xerial:sqlite-jdbc:3.44.0.0")
implementation("ca.gosyer:kotlin-multiplatform-appdirs:1.1.1")
implementation("com.sksamuel.scrimage:scrimage-core:4.1.1")
implementation("com.sksamuel.scrimage:scrimage-webp:4.1.1")
implementation("com.google.code.gson:gson:2.10.1")
}

compose.desktop {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ org.jetbrains.compose.experimental.uikit.enabled=true
android.defaults.buildfeatures.buildconfig=true
# Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental
kotlin.version=1.9.20
compose.version=1.5.10
kotlin.version=1.9.20
multiplatform.version=1.9.20
Binary file added resources/common/icon-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/main/java/com/exception/NotificationException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.exception;

public class NotificationException extends RuntimeException {
private static final long serialVersionUID = 1L;

public NotificationException(String exception) {
super(exception);
}
}
99 changes: 99 additions & 0 deletions src/main/java/com/notification/Notification.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package com.notification;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
* Provides the core methods that a Notification needs.
*/
public abstract class Notification {
private NotificationManager m_manager;
private List<NotificationListener> m_listeners;

public Notification() {
m_listeners = new CopyOnWriteArrayList<NotificationListener>();
}

/**
* Listens for events on the Notification (e.g., a click).
*
* @param listener
* the NotificationListener to add
*/
public void addNotificationListener(NotificationListener listener) {
m_listeners.add(listener);
}

/**
* Removes a listener for events on the Notification (e.g., a click).
*
* @param listener
* the NotificationListener to remove
*/
public void removeNotificationListener(NotificationListener listener) {
m_listeners.remove(listener);
}

/**
* @return whether or not this Notification has been added to a NotificationManager
*/
public boolean isManaged() {
return m_manager != null;
}

/**
* @return the NotificationManager managing this Notification
*/
public NotificationManager getNotificationManager() {
return m_manager;
}

protected void setNotificationManager(NotificationManager manager) {
m_manager = manager;
}

/**
* Removes the Notification from the Manager. In some cases, this has the same effect as calling hide(); however,
* hide() doesn't invoke Manager-related things like fading, etc.
*/
public void removeFromManager() {
m_manager.removeNotification(this);
}

protected void fireListeners(String action) {
for (NotificationListener nl : m_listeners) {
nl.actionCompleted(this, action);
}
}

public abstract int getX();

public abstract int getY();

public abstract void setLocation(int x, int y);

public abstract int getWidth();

public abstract int getHeight();

public abstract void setSize(int width, int height);

public abstract double getOpacity();

public abstract void setOpacity(double opacity);

/**
* Reveals the Notification on the desktop.
*/
public abstract void show();

/**
* Hides the Notification on the desktop.
*/
public abstract void hide();

/**
* @return whether the Notification is being shown
*/
public abstract boolean isShown();
}
22 changes: 22 additions & 0 deletions src/main/java/com/notification/NotificationBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.notification;

import com.theme.ThemePackage;

/**
* This interface is implemented for building custom Notifications.
*
* @param <T>
* the type to build
*/
public interface NotificationBuilder<T extends Notification> {
/**
* Builds a Notification in accordance with the ThemePackage.
*
* @param pack
* the ThemePackage to apply to the Notification
* @param args
* optional additional arguments passed to the NotificationBuilder
* @return the built Notification
*/
public T buildNotification(ThemePackage pack, Object... args);
}
Loading
Loading