Added NotificationsWindow as updatee
Changed font to MotoyaLMaru
0
ClipboardApi.java
Normal file → Executable file
0
ComposeWindow.java
Normal file → Executable file
0
ImageApi.java
Normal file → Executable file
0
ImageWindow.java
Normal file → Executable file
0
JKomasto.java
Normal file → Executable file
0
KDE_Dialog_Appear.wav
Normal file → Executable file
0
LoginWindow.java
Normal file → Executable file
0
MastodonApi.java
Normal file → Executable file
99
NotificationsWindow.java
Normal file → Executable file
@ -47,6 +47,56 @@ NotificationsWindow extends JFrame {
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
public void
|
||||
displayEntity(Tree<String> entity)
|
||||
{
|
||||
notifications = new ArrayList<>();
|
||||
for (Tree<String> t: entity)
|
||||
{
|
||||
Notification n = new Notification();
|
||||
|
||||
n.id = t.get("id").value;
|
||||
|
||||
String type = t.get("type").value;
|
||||
if (type.equals("favourite"))
|
||||
n.type = NotificationType.FAVOURITE;
|
||||
else if (type.equals("reblog"))
|
||||
n.type = NotificationType.BOOST;
|
||||
else if (type.equals("mention"))
|
||||
n.type = NotificationType.MENTION;
|
||||
else if (type.equals("follow"))
|
||||
n.type = NotificationType.FOLLOW;
|
||||
else if (type.equals("follow_request"))
|
||||
n.type = NotificationType.FOLLOWREQ;
|
||||
else if (type.equals("poll"))
|
||||
n.type = NotificationType.POLL;
|
||||
else if (type.equals("status"))
|
||||
n.type = NotificationType.ALERT;
|
||||
|
||||
Tree<String> actor = t.get("account");
|
||||
String aid, aname, adisp;
|
||||
aid = actor.get("id").value;
|
||||
aname = actor.get("username").value;
|
||||
adisp = actor.get("display_name").value;
|
||||
if (!adisp.isEmpty()) n.actorName = adisp;
|
||||
else n.actorName = aname;
|
||||
n.actorNumId = aid;
|
||||
|
||||
if (n.type != NotificationType.FOLLOW)
|
||||
{
|
||||
Tree<String> post = t.get("status");
|
||||
String pid, phtml, ptext;
|
||||
pid = post.get("id").value;
|
||||
phtml = post.get("content").value;
|
||||
ptext = TimelineComponent.textApproximation(phtml);
|
||||
n.postId = pid;
|
||||
n.postText = ptext;
|
||||
}
|
||||
|
||||
notifications.add(n);
|
||||
}
|
||||
}
|
||||
|
||||
public void
|
||||
showLatestPage()
|
||||
{
|
||||
@ -97,55 +147,8 @@ NotificationsWindow extends JFrame {
|
||||
public void
|
||||
requestSucceeded(Tree<String> json)
|
||||
{
|
||||
notifications = new ArrayList<>();
|
||||
for (Tree<String> t: json)
|
||||
{
|
||||
Notification n = new Notification();
|
||||
|
||||
n.id = t.get("id").value;
|
||||
|
||||
String type = t.get("type").value;
|
||||
if (type.equals("favourite"))
|
||||
n.type = NotificationType.FAVOURITE;
|
||||
else if (type.equals("reblog"))
|
||||
n.type = NotificationType.BOOST;
|
||||
else if (type.equals("mention"))
|
||||
n.type = NotificationType.MENTION;
|
||||
else if (type.equals("follow"))
|
||||
n.type = NotificationType.FOLLOW;
|
||||
else if (type.equals("follow_request"))
|
||||
n.type = NotificationType.FOLLOWREQ;
|
||||
else if (type.equals("poll"))
|
||||
n.type = NotificationType.POLL;
|
||||
else if (type.equals("status"))
|
||||
n.type = NotificationType.ALERT;
|
||||
|
||||
Tree<String> actor = t.get("account");
|
||||
String aid, aname, adisp;
|
||||
aid = actor.get("id").value;
|
||||
aname = actor.get("username").value;
|
||||
adisp = actor.get("display_name").value;
|
||||
if (!adisp.isEmpty()) n.actorName = adisp;
|
||||
else n.actorName = aname;
|
||||
n.actorNumId = aid;
|
||||
|
||||
if (n.type != NotificationType.FOLLOW)
|
||||
{
|
||||
Tree<String> post = t.get("status");
|
||||
String pid, phtml, ptext;
|
||||
pid = post.get("id").value;
|
||||
phtml = post.get("content").value;
|
||||
ptext =
|
||||
TimelineComponent
|
||||
.textApproximation(phtml);
|
||||
n.postId = pid;
|
||||
n.postText = ptext;
|
||||
}
|
||||
|
||||
notifications.add(n);
|
||||
}
|
||||
displayEntity(json);
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
display.setCursor(null);
|
||||
|
24
PostWindow.java
Normal file → Executable file
@ -703,24 +703,6 @@ implements ActionListener {
|
||||
if (s.y > maxY) maxY = s.y;
|
||||
}
|
||||
body.setPreferredSize(new Dimension(1, maxY + 10));
|
||||
|
||||
((java.awt.Graphics2D)g).setRenderingHint(
|
||||
java.awt.RenderingHints.KEY_ANTIALIASING,
|
||||
java.awt.RenderingHints.VALUE_ANTIALIAS_ON
|
||||
);
|
||||
/*
|
||||
* I suspect the reason why we are losing antialiasing,
|
||||
* is that the JScrollPane asks us to paint once and
|
||||
* then on scroll, it repaints from its capture of the
|
||||
* viewport contents, rather than ask us to repaint.
|
||||
* Then it wouldn't set the hint.
|
||||
*
|
||||
* We're scheduled to remove the scrolling functionality
|
||||
* in favour of pages, so, we don't need to intercept
|
||||
* the scroller for now. Though I feel like it would've
|
||||
* made more sense to allow setting a widget's rendering
|
||||
* hints.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -733,9 +715,9 @@ implements ActionListener {
|
||||
emojiUrls = new String[0][];
|
||||
|
||||
Border b = BorderFactory.createEmptyBorder(10, 10, 10, 10);
|
||||
Font f1 = new Font("Dialog", Font.PLAIN, 18);
|
||||
Font f2 = new Font("IPAGothic", Font.PLAIN, 14);
|
||||
Font f3 = new Font("Dialog", Font.PLAIN, 20);
|
||||
Font f1 = new Font("MotoyaLMaru", Font.PLAIN, 18);
|
||||
Font f2 = new Font("MotoyaLMaru", Font.PLAIN, 14);
|
||||
Font f3 = new Font("MotoyaLMaru", Font.PLAIN, 18);
|
||||
|
||||
profile = new RoundButton();
|
||||
favouriteBoost = new TwoToggleButton("favourite", "boost");
|
||||
|
0
RepliesWindow.java
Normal file → Executable file
0
RequestListener.java
Normal file → Executable file
5
RichTextPane.java
Normal file → Executable file
@ -71,6 +71,11 @@ implements MouseListener, MouseMotionListener, KeyListener {
|
||||
FontMetrics fm = g.getFontMetrics(getFont());
|
||||
g.clearRect(0, 0, getWidth(), getHeight());
|
||||
|
||||
((java.awt.Graphics2D)g).setRenderingHint(
|
||||
java.awt.RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON
|
||||
);
|
||||
|
||||
int o = 0;
|
||||
for (Segment segment: text)
|
||||
{
|
||||
|
0
RudimentaryHTMLParser.java
Normal file → Executable file
24
TimelineWindow.java
Normal file → Executable file
@ -85,6 +85,23 @@ implements ActionListener {
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
public void
|
||||
receive(Tree<String> pageEntity)
|
||||
{
|
||||
page.posts = pageEntity;
|
||||
display.displayEntities(page.posts);
|
||||
boolean full = pageEntity.size() >= PREVIEW_COUNT;
|
||||
display.setNextPageAvailable(full);
|
||||
display.setPreviousPageAvailable(true);
|
||||
display.resetFocus();
|
||||
}
|
||||
|
||||
public void
|
||||
refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void
|
||||
setTimelineType(TimelineType type)
|
||||
{
|
||||
@ -148,12 +165,7 @@ implements ActionListener {
|
||||
public void
|
||||
requestSucceeded(Tree<String> json)
|
||||
{
|
||||
page.posts = json;
|
||||
display.displayEntities(page.posts);
|
||||
boolean full = json.size() >= PREVIEW_COUNT;
|
||||
display.setNextPageAvailable(full);
|
||||
display.setPreviousPageAvailable(true);
|
||||
display.resetFocus();
|
||||
receive(json);
|
||||
}
|
||||
|
||||
}
|
||||
|
60
TimelineWindowUpdater.java
Normal file → Executable file
@ -22,7 +22,10 @@ TimelineWindowUpdater {
|
||||
// - -%- -
|
||||
|
||||
private List<TimelineWindow>
|
||||
updatees;
|
||||
timelineUpdatees;
|
||||
|
||||
private List<NotificationsWindow>
|
||||
notificationUpdatees;
|
||||
|
||||
private StringBuilder
|
||||
event, data;
|
||||
@ -33,39 +36,56 @@ TimelineWindowUpdater {
|
||||
// - -%- -
|
||||
|
||||
private Thread
|
||||
federated,
|
||||
local,
|
||||
home;
|
||||
spublic,
|
||||
user;
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
public void
|
||||
addWindow(TimelineWindow updatee)
|
||||
{
|
||||
updatees.add(updatee);
|
||||
timelineUpdatees.add(updatee);
|
||||
|
||||
Connection c = new Connection();
|
||||
c.type = updatee.getTimelineType();
|
||||
Thread t = new Thread(c);
|
||||
switch (c.type) {
|
||||
switch (c.type)
|
||||
{
|
||||
case FEDERATED:
|
||||
if (federated != null) return;
|
||||
federated = t; break;
|
||||
case LOCAL:
|
||||
if (local != null) return;
|
||||
local = t; break;
|
||||
if (spublic != null) return;
|
||||
spublic = new Thread(c);
|
||||
spublic.start();
|
||||
break;
|
||||
case HOME:
|
||||
if (home != null) return;
|
||||
home = t; break;
|
||||
default: return;
|
||||
if (user != null) return;
|
||||
user = new Thread(c);
|
||||
user.start();
|
||||
break;
|
||||
}
|
||||
t.start();
|
||||
}
|
||||
|
||||
public void
|
||||
addWindow(NotificationsWindow updatee)
|
||||
{
|
||||
notificationUpdatees.add(updatee);
|
||||
|
||||
Connection c = new Connection();
|
||||
c.type = TimelineType.HOME;
|
||||
if (user != null) return;
|
||||
user = new Thread(c);
|
||||
user.start();
|
||||
}
|
||||
|
||||
public void
|
||||
removeWindow(TimelineWindow updatee)
|
||||
{
|
||||
updatees.remove(updatee);
|
||||
timelineUpdatees.remove(updatee);
|
||||
}
|
||||
|
||||
public void
|
||||
removeWindow(NotificationsWindow updatee)
|
||||
{
|
||||
notificationUpdatees.remove(updatee);
|
||||
}
|
||||
|
||||
// - -%- -
|
||||
@ -83,6 +103,9 @@ TimelineWindowUpdater {
|
||||
for (TimelineWindow updatee: filter(type)) {
|
||||
updatee.showLatestPage();
|
||||
}
|
||||
for (NotificationsWindow updatee: notificationUpdatees) {
|
||||
updatee.showLatestPage();
|
||||
}
|
||||
|
||||
if (newNotif)
|
||||
{
|
||||
@ -95,7 +118,7 @@ TimelineWindowUpdater {
|
||||
filter(TimelineType type)
|
||||
{
|
||||
List<TimelineWindow> returnee = new ArrayList<>();
|
||||
for (TimelineWindow updatee: updatees)
|
||||
for (TimelineWindow updatee: timelineUpdatees)
|
||||
if (updatee.getTimelineType() == type)
|
||||
returnee.add(updatee);
|
||||
return returnee;
|
||||
@ -175,7 +198,8 @@ TimelineWindowUpdater {
|
||||
this.primaire = primaire;
|
||||
this.api = primaire.getMastodonApi();
|
||||
|
||||
this.updatees = new ArrayList<>();
|
||||
this.timelineUpdatees = new ArrayList<>();
|
||||
this.notificationUpdatees = new ArrayList<>();
|
||||
|
||||
loadNotificationSound();
|
||||
}
|
||||
|
0
TwoToggleButton.java
Normal file → Executable file
0
graphics/Federated.xcf
Normal file → Executable file
0
graphics/Flags.xcf
Normal file → Executable file
0
graphics/Hourglass.xcf
Normal file → Executable file
0
graphics/boostToggled.png
Normal file → Executable file
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
0
graphics/boostUntoggled.png
Normal file → Executable file
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
0
graphics/button.png
Normal file → Executable file
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
0
graphics/disabledOverlay.png
Normal file → Executable file
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
0
graphics/favouriteToggled.png
Normal file → Executable file
Before Width: | Height: | Size: 353 B After Width: | Height: | Size: 353 B |
0
graphics/favouriteUntoggled.png
Normal file → Executable file
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
0
graphics/federated.png
Normal file → Executable file
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
0
graphics/miscToggled.png
Normal file → Executable file
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
0
graphics/miscUntoggled.png
Normal file → Executable file
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
0
graphics/ref1.png
Normal file → Executable file
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
0
graphics/replyToggled.png
Normal file → Executable file
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
0
graphics/replyUntoggled.png
Normal file → Executable file
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
0
graphics/selectedOverlay.png
Normal file → Executable file
Before Width: | Height: | Size: 313 B After Width: | Height: | Size: 313 B |
0
graphics/test1.png
Normal file → Executable file
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
0
graphics/test2.png
Normal file → Executable file
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
0
graphics/test3.png
Normal file → Executable file
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
0
graphics/test4.png
Normal file → Executable file
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |