Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/libadblockplus/Notification.java

Issue 5327480814567424: Issue 1108 - Support notifications (Closed)
Patch Set: Only one Notification displayed now Created Feb. 18, 2015, 3:42 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/org/adblockplus/libadblockplus/FilterEngine.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/org/adblockplus/libadblockplus/Notification.java
diff --git a/src/org/adblockplus/libadblockplus/EventCallback.java b/src/org/adblockplus/libadblockplus/Notification.java
similarity index 54%
copy from src/org/adblockplus/libadblockplus/EventCallback.java
copy to src/org/adblockplus/libadblockplus/Notification.java
index 83a5e985085cd1d26a01b777a99f8866fed93f23..b131fcbf6d6300591ffe556d32f3d6ddb3d0a6a8 100644
--- a/src/org/adblockplus/libadblockplus/EventCallback.java
+++ b/src/org/adblockplus/libadblockplus/Notification.java
@@ -17,52 +17,60 @@
package org.adblockplus.libadblockplus;
-import java.util.List;
-
-public abstract class EventCallback implements Disposable
+public class Notification extends JsValue
{
- private final Disposer disposer;
- protected final long ptr;
-
static
{
System.loadLibrary("adblockplus-jni");
registerNatives();
}
- public EventCallback()
+ private Notification(final long ptr)
{
- this.ptr = ctor(this);
- this.disposer = new Disposer(this, new DisposeWrapper(this.ptr));
+ super(ptr);
}
- public abstract void eventCallback(List<JsValue> params);
+ public static enum Type
+ {
+ INFORMATION,
+ QUESTION,
+ CRITICAL,
+ INVALID
+ }
- @Override
- public void dispose()
+ public String getMessageString()
{
- this.disposer.dispose();
+ return getMessageString(this.ptr);
}
- private final static class DisposeWrapper implements Disposable
+ public String getTitle()
{
- private final long ptr;
+ return getTitle(this.ptr);
+ }
- public DisposeWrapper(final long ptr)
- {
- this.ptr = ptr;
- }
+ public Type getType()
+ {
+ return getType(this.ptr);
+ }
- @Override
- public void dispose()
- {
- dtor(this.ptr);
- }
+ public void markAsShown()
+ {
+ markAsShown(this.ptr);
+ }
+
+ @Override
+ public String toString()
+ {
+ return this.getTitle() + " - " + this.getMessageString();
}
private final static native void registerNatives();
- private final static native long ctor(Object obj);
+ private final static native String getMessageString(long ptr);
+
+ private final static native String getTitle(long ptr);
+
+ private final static native Type getType(long ptr);
- private final static native void dtor(long ptr);
+ private final static native void markAsShown(long ptr);
}
« no previous file with comments | « src/org/adblockplus/libadblockplus/FilterEngine.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld