mirror of
https://gitlab.com/biskuteri-cafe/JKomasto2.git
synced 2024-11-20 05:34:51 +01:00
251 lines
3.6 KiB
Java
Executable File
251 lines
3.6 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;
|
|
|
|
|
|
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 List<Post>
|
|
posts;
|
|
|
|
}
|
|
|
|
|
|
|
|
class
|
|
Post {
|
|
|
|
public String
|
|
text,
|
|
contentWarning,
|
|
html;
|
|
|
|
public String
|
|
authorId, authorName;
|
|
|
|
public Image
|
|
authorAvatar;
|
|
|
|
public String
|
|
authorNumId;
|
|
|
|
public String
|
|
boosterName;
|
|
|
|
public ZonedDateTime
|
|
date;
|
|
|
|
public PostVisibility
|
|
visibility;
|
|
|
|
public String
|
|
postId;
|
|
|
|
public boolean
|
|
boosted, favourited;
|
|
|
|
public Attachment[]
|
|
attachments;
|
|
|
|
public String[][]
|
|
emojiUrls;
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|