mirror of
https://gitlab.com/biskuteri-cafe/JKomasto2.git
synced 2024-11-20 05:04:51 +01:00
Added summary of steps for one page flipping algorithm..
It's a primitive one for paginating an infinite list.
This commit is contained in:
parent
1704a22847
commit
1fa1f4ea38
@ -16,9 +16,9 @@ JKomasto {
|
||||
public
|
||||
JKomasto()
|
||||
{
|
||||
//new TimelineWindow().setVisible(true);
|
||||
new TimelineWindow().setVisible(true);
|
||||
//new ComposeWindow().setVisible(true);
|
||||
new PostWindow().setVisible(true);
|
||||
//new PostWindow().setVisible(true);
|
||||
}
|
||||
|
||||
// - -%- -
|
||||
|
@ -19,6 +19,8 @@ import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedList;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
@ -48,6 +50,9 @@ implements ActionListener {
|
||||
private JMenuItem
|
||||
flipToNewestPost;
|
||||
|
||||
private Deque<Deque<String>>
|
||||
postIDsSeen;
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
public void
|
||||
@ -69,13 +74,36 @@ implements ActionListener {
|
||||
public void
|
||||
nextPage()
|
||||
{
|
||||
|
||||
/*
|
||||
* uhh, what if the ID we provide is invalid.
|
||||
* Or does Mastodon keep IDs as 'deleted'? That
|
||||
* would make things a lot simpler.
|
||||
*/
|
||||
}
|
||||
|
||||
public void
|
||||
previousPage()
|
||||
{
|
||||
if (postIDsSeen.isEmpty())
|
||||
{
|
||||
// Just request the latest first page.
|
||||
return;
|
||||
}
|
||||
|
||||
Deque<String> lastPagePostIDs = postIDsSeen.pop();
|
||||
|
||||
while (!lastPagePostIDs.isEmpty())
|
||||
{
|
||||
String idToTry = lastPagePostIDs.pop();
|
||||
|
||||
// Fetch page for this ID.
|
||||
// If successful, render and return.
|
||||
}
|
||||
|
||||
// Didn't return from above. Our current page "replaced"
|
||||
// the previous page, so the previous page's predecessor
|
||||
// is our previous page. Try to flip to that.
|
||||
previousPage();
|
||||
}
|
||||
|
||||
// - -%- -
|
||||
|
Loading…
Reference in New Issue
Block a user