mirror of
https://gitlab.com/biskuteri-cafe/JKomasto2.git
synced 2024-11-20 06:34:49 +01:00
7ede5e1290
Added rendering of emojis. Added run script.
217 lines
3.1 KiB
Java
Executable File
217 lines
3.1 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 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));
|
|
|
|
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 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();
|
|
|
|
composeWindow.dispose();
|
|
autoViewWindow.dispose();
|
|
timelineWindow.dispose();
|
|
mediaWindow.dispose();
|
|
loginWindow.setLocationByPlatform(true);
|
|
loginWindow.setVisible(true);
|
|
|
|
timelineWindowUpdater = new TimelineWindowUpdater(this);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum
|
|
PostVisibility {
|
|
|
|
PUBLIC,
|
|
UNLISTED,
|
|
FOLLOWERS,
|
|
MENTIONED
|
|
|
|
}
|
|
|
|
enum
|
|
TimelineType {
|
|
|
|
FEDERATED,
|
|
LOCAL,
|
|
HOME,
|
|
NOTIFICATIONS,
|
|
CONVERSATIONS,
|
|
LIST
|
|
|
|
}
|
|
|
|
|
|
|
|
class
|
|
TimelinePage {
|
|
|
|
public TimelineType
|
|
type;
|
|
|
|
public String
|
|
accountNumId;
|
|
|
|
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
|
|
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;
|
|
|
|
}
|