biskuteri-cafe-JKomasto2/JKomasto.java
Snowyfox 26d4e8c97a Removed debug printing from TimelineWindowUpdater.
Thread should survive now after system sleep
2022-04-27 06:12:10 -04:00

211 lines
3.2 KiB
Java
Executable File

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JComponent;
import java.awt.Dimension;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Image;
import java.util.List;
import java.time.ZonedDateTime;
import cafe.biskuteri.hinoki.Tree;
class
JKomasto {
private TimelineWindow
timelineWindow;
private ComposeWindow
composeWindow;
private PostWindow
autoViewWindow;
private LoginWindow
loginWindow;
private ImageWindow
mediaWindow;
private NotificationsWindow
notificationsWindow;
private TimelineWindowUpdater
timelineWindowUpdater;
private MastodonApi
api;
// ---%-@-%---
public MastodonApi
getMastodonApi() { return api; }
public void
finishedLogin()
{
autoViewWindow.setCursor(new Cursor(Cursor.WAIT_CURSOR));
timelineWindow.setCursor(new Cursor(Cursor.WAIT_CURSOR));
notificationsWindow.showLatestPage();
timelineWindow.showLatestPage();
timelineWindow.setLocationByPlatform(true);
timelineWindow.setVisible(true);
autoViewWindow.setTitle("Auto view - JKomasto");
//autoViewWindow.setVisible(true);
loginWindow.dispose();
autoViewWindow.setCursor(null);
timelineWindow.setCursor(null);
timelineWindowUpdater.addWindow(timelineWindow);
}
public PostWindow
getAutoViewWindow() { return autoViewWindow; }
public ComposeWindow
getComposeWindow() { return composeWindow; }
public ImageWindow
getMediaWindow() { return mediaWindow; }
public NotificationsWindow
getNotificationsWindow() { return notificationsWindow; }
// ---%-@-%---
public static void
main(String... args) { new JKomasto(); }
// ---%-@-%---
public
JKomasto()
{
api = new MastodonApi();
timelineWindow = new TimelineWindow(this);
composeWindow = new ComposeWindow(this);
autoViewWindow = new PostWindow(this);
loginWindow = new LoginWindow(this);
mediaWindow = new ImageWindow();
notificationsWindow = new NotificationsWindow(this);
composeWindow.dispose();
autoViewWindow.dispose();
timelineWindow.dispose();
mediaWindow.dispose();
notificationsWindow.dispose();
loginWindow.setLocationByPlatform(true);
loginWindow.setVisible(true);
timelineWindowUpdater = new TimelineWindowUpdater(this);
}
}
enum
PostVisibility {
PUBLIC,
UNLISTED,
FOLLOWERS,
MENTIONED
}
enum
TimelineType {
FEDERATED,
LOCAL,
HOME,
LIST
}
enum
NotificationType {
MENTION,
BOOST,
FAVOURITE,
FOLLOW,
FOLLOWREQ,
POLL,
ALERT
}
class
TimelinePage {
public TimelineType
type;
public String
accountNumId, listId;
public Tree<String>
posts;
}
class
Notification {
public NotificationType
type;
public String
id;
public String
postId, postText, actorNumId, actorName;
}
class
Attachment {
public String
type;
public String
url;
public String
description;
public Image
image;
}
class
Composition {
public String
text,
contentWarning;
public PostVisibility
visibility;
public String
replyToPostId;
}