Skip to content

Commit

Permalink
Fixing opening an article text
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Nov 4, 2021
1 parent 8541ca2 commit 7200fa2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/luwrain/app/news/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public final class App extends AppBase<Strings> implements MonoApp
private MainLayout mainLayout = null;
private Conversations conv = null;
private NewsGroup group = null;
private boolean showAllGroups = false;
boolean showAllGroups = false;

final List<GroupWrapper> groups = new ArrayList<>();
final List<NewsArticle> articles = new ArrayList<>();
Expand Down
21 changes: 12 additions & 9 deletions src/main/java/org/luwrain/app/news/MainLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,9 @@ private boolean actMarkAsReadWholeGroup()
private boolean onGroupsClick(GroupWrapper group)
{
NullCheck.notNull(group, "group");
if (app.openGroup(group.group))
{
summaryArea.reset(false);
summaryArea.refresh();
}
app.openGroup(group.group);
summaryArea.reset(false);
summaryArea.refresh();
setActiveArea(summaryArea);
return true;
}
Expand All @@ -197,8 +195,15 @@ private boolean actNewGroup()
final NewsGroup group = new NewsGroup();
group.setName(name);
app.getStoring().getGroups().save(group);
app.showAllGroups = true;
app.loadGroups();
groupsArea.refresh();
for(GroupWrapper g: app.groups)
if (g.group.getName().equals(name))
{
groupsArea.select(g, true);
break;
}
return true;
}

Expand All @@ -220,6 +225,7 @@ private boolean openArticleUrl()
final NewsArticle article = summaryArea.selected();
if (article == null)
return false;
markAsRead(article);
final String url = article.getUrl();
if (url == null || url.trim().isEmpty())
return false;
Expand Down Expand Up @@ -273,11 +279,8 @@ private boolean onSummaryClick(NewsArticle article)
final Document doc = docBuilder.buildDoc(article.getContent(), props);
if (doc != null)
{
final Node root = doc.getRoot();
root.addSubnode(NodeBuilder.newParagraph(app.getStrings().articleUrl(article.getUrl())));
root.addSubnode(NodeBuilder.newParagraph(app.getStrings().articleTitle(article.getTitle())));
doc.commit();
viewArea.setDocument(doc, getLuwrain().getAreaVisibleWidth(viewArea));
viewArea.setDocument(doc, getAreaVisibleWidth(viewArea));
}
setActiveArea(viewArea);
return true;
Expand Down

0 comments on commit 7200fa2

Please sign in to comment.