SlideShare a Scribd company logo
Creating a Facebook Clone - Part XIV
public class Notification implements PropertyBusinessObject {
public final Property<String, Notification> id = new Property<>("id");
public final Property<User, Notification> user =
new Property<>("user", User.class);
public final Property<String, Notification> text =
new Property<>("text");
public final Property<String, Notification> reaction =
new Property<>("reaction");
public final IntProperty<Notification> reactionColor =
new IntProperty<>("reactionColor");
public final LongProperty<Notification> date =
new LongProperty<>("date");
public final BooleanProperty<Notification> wasRead =
new BooleanProperty<>("wasRead");
private final PropertyIndex idx=new PropertyIndex(this,"Notification",
id, user, text, reaction, reactionColor, date, wasRead);
@Override
public PropertyIndex getPropertyIndex() {
return idx;
}
}
FriendsContainer
public class Notification implements PropertyBusinessObject {
public final Property<String, Notification> id = new Property<>("id");
public final Property<User, Notification> user =
new Property<>("user", User.class);
public final Property<String, Notification> text =
new Property<>("text");
public final Property<String, Notification> reaction =
new Property<>("reaction");
public final IntProperty<Notification> reactionColor =
new IntProperty<>("reactionColor");
public final LongProperty<Notification> date =
new LongProperty<>("date");
public final BooleanProperty<Notification> wasRead =
new BooleanProperty<>("wasRead");
private final PropertyIndex idx=new PropertyIndex(this,"Notification",
id, user, text, reaction, reactionColor, date, wasRead);
@Override
public PropertyIndex getPropertyIndex() {
return idx;
}
}
FriendsContainer
public class Notification implements PropertyBusinessObject {
public final Property<String, Notification> id = new Property<>("id");
public final Property<User, Notification> user =
new Property<>("user", User.class);
public final Property<String, Notification> text =
new Property<>("text");
public final Property<String, Notification> reaction =
new Property<>("reaction");
public final IntProperty<Notification> reactionColor =
new IntProperty<>("reactionColor");
public final LongProperty<Notification> date =
new LongProperty<>("date");
public final BooleanProperty<Notification> wasRead =
new BooleanProperty<>("wasRead");
private final PropertyIndex idx=new PropertyIndex(this,"Notification",
id, user, text, reaction, reactionColor, date, wasRead);
@Override
public PropertyIndex getPropertyIndex() {
return idx;
}
}
FriendsContainer
public class Notification implements PropertyBusinessObject {
public final Property<String, Notification> id = new Property<>("id");
public final Property<User, Notification> user =
new Property<>("user", User.class);
public final Property<String, Notification> text =
new Property<>("text");
public final Property<String, Notification> reaction =
new Property<>("reaction");
public final IntProperty<Notification> reactionColor =
new IntProperty<>("reactionColor");
public final LongProperty<Notification> date =
new LongProperty<>("date");
public final BooleanProperty<Notification> wasRead =
new BooleanProperty<>("wasRead");
private final PropertyIndex idx=new PropertyIndex(this,"Notification",
id, user, text, reaction, reactionColor, date, wasRead);
@Override
public PropertyIndex getPropertyIndex() {
return idx;
}
}
FriendsContainer
return null;
}
public static List<Notification> fetchNotifications(
long since, int amount) {
if(since < initTime - UIUtils.DAY) {
return null;
}
List<Notification> response = new ArrayList<>();
response.add(new Notification().id.set("Notify-1").
user.set(dummyUsers[0]).
text.set("liked Your Post").
date.set(initTime - 60000).
reaction.set("" + FontImage.MATERIAL_FAVORITE).
reactionColor.set(0xff0000));
response.add(new Notification().id.set("Notify-2").
user.set(dummyUsers[1]).
text.set("commented on your post").
date.set(initTime - 600000000).
reaction.set("" + FontImage.MATERIAL_CHAT).
reactionColor.set(0xff00));
return response;
}
ServerAPI
return null;
}
public static List<Notification> fetchNotifications(
long since, int amount) {
if(since < initTime - UIUtils.DAY) {
return null;
}
List<Notification> response = new ArrayList<>();
response.add(new Notification().id.set("Notify-1").
user.set(dummyUsers[0]).
text.set("liked Your Post").
date.set(initTime - 60000).
reaction.set("" + FontImage.MATERIAL_FAVORITE).
reactionColor.set(0xff0000));
response.add(new Notification().id.set("Notify-2").
user.set(dummyUsers[1]).
text.set("commented on your post").
date.set(initTime - 600000000).
reaction.set("" + FontImage.MATERIAL_CHAT).
reactionColor.set(0xff00));
return response;
}
ServerAPI
return null;
}
public static List<Notification> fetchNotifications(
long since, int amount) {
if(since < initTime - UIUtils.DAY) {
return null;
}
List<Notification> response = new ArrayList<>();
response.add(new Notification().id.set("Notify-1").
user.set(dummyUsers[0]).
text.set("liked Your Post").
date.set(initTime - 60000).
reaction.set("" + FontImage.MATERIAL_FAVORITE).
reactionColor.set(0xff0000));
response.add(new Notification().id.set("Notify-2").
user.set(dummyUsers[1]).
text.set("commented on your post").
date.set(initTime - 600000000).
reaction.set("" + FontImage.MATERIAL_CHAT).
reactionColor.set(0xff00));
return response;
}
ServerAPI
© Codename One 2017 all rights reserved
public class NotificationsContainer extends InfiniteContainer {
private long lastTime;
@Override
public Component[] fetchComponents(int index, int amount) {
if(index == 0) {
lastTime = System.currentTimeMillis();
}
List<Notification> response = ServerAPI.fetchNotifications(lastTime,
amount);
if(response == null) {
return null;
}
Component[] notifications = new Component[response.size()];
int iter = 0;
for(Notification n : response) {
lastTime = n.date.getLong();
notifications[iter] = createNotificationEntry(n);
iter++;
}
NotificationsContainer
public class NotificationsContainer extends InfiniteContainer {
private long lastTime;
@Override
public Component[] fetchComponents(int index, int amount) {
if(index == 0) {
lastTime = System.currentTimeMillis();
}
List<Notification> response = ServerAPI.fetchNotifications(lastTime,
amount);
if(response == null) {
return null;
}
Component[] notifications = new Component[response.size()];
int iter = 0;
for(Notification n : response) {
lastTime = n.date.getLong();
notifications[iter] = createNotificationEntry(n);
iter++;
}
NotificationsContainer
notifications[iter] = createNotificationEntry(n);
iter++;
}
return notifications;
}
private Container createNotificationEntry(Notification n) {
Image avatar = n.user.get().getAvatar(13);
Label icon = new Label("", "SmallBlueCircle");
icon.getAllStyles().setBorder(RoundBorder.create().
color(n.reactionColor.get()));
FontImage.setMaterialIcon(icon, n.reaction.get().charAt(0), 2);
Container avatarContainer = LayeredLayout.encloseIn(
new Label(avatar, "HalfPaddedContainer"),
FlowLayout.encloseRightBottom(icon));
RichTextView rt = new RichTextView("<b>" + n.user.get().fullName() +
"</b> " + n.text.get());
Label time = new Label(UIUtils.formatTimeAgo(n.date.get()),
"SmallBlueLabel");
Container yContainer = BoxLayout.encloseY(rt, time);
yContainer.setUIID("HalfPaddedContainer");
return BorderLayout.
centerEastWest(yContainer, null, avatarContainer);
}
NotificationsContainer
notifications[iter] = createNotificationEntry(n);
iter++;
}
return notifications;
}
private Container createNotificationEntry(Notification n) {
Image avatar = n.user.get().getAvatar(13);
Label icon = new Label("", "SmallBlueCircle");
icon.getAllStyles().setBorder(RoundBorder.create().
color(n.reactionColor.get()));
FontImage.setMaterialIcon(icon, n.reaction.get().charAt(0), 2);
Container avatarContainer = LayeredLayout.encloseIn(
new Label(avatar, "HalfPaddedContainer"),
FlowLayout.encloseRightBottom(icon));
RichTextView rt = new RichTextView("<b>" + n.user.get().fullName() +
"</b> " + n.text.get());
Label time = new Label(UIUtils.formatTimeAgo(n.date.get()),
"SmallBlueLabel");
Container yContainer = BoxLayout.encloseY(rt, time);
yContainer.setUIID("HalfPaddedContainer");
return BorderLayout.
centerEastWest(yContainer, null, avatarContainer);
}
NotificationsContainer
notifications[iter] = createNotificationEntry(n);
iter++;
}
return notifications;
}
private Container createNotificationEntry(Notification n) {
Image avatar = n.user.get().getAvatar(13);
Label icon = new Label("", "SmallBlueCircle");
icon.getAllStyles().setBorder(RoundBorder.create().
color(n.reactionColor.get()));
FontImage.setMaterialIcon(icon, n.reaction.get().charAt(0), 2);
Container avatarContainer = LayeredLayout.encloseIn(
new Label(avatar, "HalfPaddedContainer"),
FlowLayout.encloseRightBottom(icon));
RichTextView rt = new RichTextView("<b>" + n.user.get().fullName() +
"</b> " + n.text.get());
Label time = new Label(UIUtils.formatTimeAgo(n.date.get()),
"SmallBlueLabel");
Container yContainer = BoxLayout.encloseY(rt, time);
yContainer.setUIID("HalfPaddedContainer");
return BorderLayout.
centerEastWest(yContainer, null, avatarContainer);
}
NotificationsContainer
notifications[iter] = createNotificationEntry(n);
iter++;
}
return notifications;
}
private Container createNotificationEntry(Notification n) {
Image avatar = n.user.get().getAvatar(13);
Label icon = new Label("", "SmallBlueCircle");
icon.getAllStyles().setBorder(RoundBorder.create().
color(n.reactionColor.get()));
FontImage.setMaterialIcon(icon, n.reaction.get().charAt(0), 2);
Container avatarContainer = LayeredLayout.encloseIn(
new Label(avatar, "HalfPaddedContainer"),
FlowLayout.encloseRightBottom(icon));
RichTextView rt = new RichTextView("<b>" + n.user.get().fullName() +
"</b> " + n.text.get());
Label time = new Label(UIUtils.formatTimeAgo(n.date.get()),
"SmallBlueLabel");
Container yContainer = BoxLayout.encloseY(rt, time);
yContainer.setUIID("HalfPaddedContainer");
return BorderLayout.
centerEastWest(yContainer, null, avatarContainer);
}
NotificationsContainer
SmallBlueLabel {
color: blue;
font-size: 2mm;
padding: 1mm;
font-family: "native:MainLight";
}
theme.css

More Related Content

PDF
Creating a Facebook Clone - Part XIV - Transcript.pdf
PDF
Creating a Facebook Clone - Part XII.pdf
PDF
Creating a Facebook Clone - Part XI.pdf
PDF
Creating a Facebook Clone - Part XII - Transcript.pdf
PDF
Creating a Facebook Clone - Part XXIX.pdf
PDF
Creating a Facebook Clone - Part XXIX - Transcript.pdf
PDF
Creating a Facebook Clone - Part XI - Transcript.pdf
PDF
Creating a Facebook Clone - Part XXXVII.pdf
Creating a Facebook Clone - Part XIV - Transcript.pdf
Creating a Facebook Clone - Part XII.pdf
Creating a Facebook Clone - Part XI.pdf
Creating a Facebook Clone - Part XII - Transcript.pdf
Creating a Facebook Clone - Part XXIX.pdf
Creating a Facebook Clone - Part XXIX - Transcript.pdf
Creating a Facebook Clone - Part XI - Transcript.pdf
Creating a Facebook Clone - Part XXXVII.pdf

Similar to Creating a Facebook Clone - Part XIV.pdf (13)

PDF
Creating a Facebook Clone - Part XIII.pdf
PDF
Creating a Facebook Clone - Part XXIII - Transcript.pdf
PDF
Creating a Facebook Clone - Part XIII - Transcript.pdf
PDF
Creating a Facebook Clone - Part XXXIV.pdf
PDF
Creating a Facebook Clone - Part XXVIII.pdf
PDF
Creating a Facebook Clone - Part XXVIII - Transcript.pdf
PDF
Creating a Facebook Clone - Part XXIV - Transcript.pdf
PDF
Creating a Facebook Clone - Part XX - Transcript.pdf
PDF
Creating a Facebook Clone - Part XXIV.pdf
PDF
Creating a Facebook Clone - Part XXII.pdf
PDF
Creating a Facebook Clone - Part XX.pdf
PDF
Creating a Facebook Clone - Part X.pdf
PDF
Creating a Facebook Clone - Part XXXVII - Transcript.pdf
Creating a Facebook Clone - Part XIII.pdf
Creating a Facebook Clone - Part XXIII - Transcript.pdf
Creating a Facebook Clone - Part XIII - Transcript.pdf
Creating a Facebook Clone - Part XXXIV.pdf
Creating a Facebook Clone - Part XXVIII.pdf
Creating a Facebook Clone - Part XXVIII - Transcript.pdf
Creating a Facebook Clone - Part XXIV - Transcript.pdf
Creating a Facebook Clone - Part XX - Transcript.pdf
Creating a Facebook Clone - Part XXIV.pdf
Creating a Facebook Clone - Part XXII.pdf
Creating a Facebook Clone - Part XX.pdf
Creating a Facebook Clone - Part X.pdf
Creating a Facebook Clone - Part XXXVII - Transcript.pdf
Ad

More from ShaiAlmog1 (20)

PDF
The Duck Teaches Learn to debug from the masters. Local to production- kill ...
PDF
create-netflix-clone-06-client-ui.pdf
PDF
create-netflix-clone-01-introduction_transcript.pdf
PDF
create-netflix-clone-02-server_transcript.pdf
PDF
create-netflix-clone-04-server-continued_transcript.pdf
PDF
create-netflix-clone-01-introduction.pdf
PDF
create-netflix-clone-06-client-ui_transcript.pdf
PDF
create-netflix-clone-03-server.pdf
PDF
create-netflix-clone-04-server-continued.pdf
PDF
create-netflix-clone-05-client-model_transcript.pdf
PDF
create-netflix-clone-03-server_transcript.pdf
PDF
create-netflix-clone-02-server.pdf
PDF
create-netflix-clone-05-client-model.pdf
PDF
Creating a Whatsapp Clone - Part II.pdf
PDF
Creating a Whatsapp Clone - Part IX - Transcript.pdf
PDF
Creating a Whatsapp Clone - Part II - Transcript.pdf
PDF
Creating a Whatsapp Clone - Part V - Transcript.pdf
PDF
Creating a Whatsapp Clone - Part IV - Transcript.pdf
PDF
Creating a Whatsapp Clone - Part IV.pdf
PDF
Creating a Whatsapp Clone - Part I - Transcript.pdf
The Duck Teaches Learn to debug from the masters. Local to production- kill ...
create-netflix-clone-06-client-ui.pdf
create-netflix-clone-01-introduction_transcript.pdf
create-netflix-clone-02-server_transcript.pdf
create-netflix-clone-04-server-continued_transcript.pdf
create-netflix-clone-01-introduction.pdf
create-netflix-clone-06-client-ui_transcript.pdf
create-netflix-clone-03-server.pdf
create-netflix-clone-04-server-continued.pdf
create-netflix-clone-05-client-model_transcript.pdf
create-netflix-clone-03-server_transcript.pdf
create-netflix-clone-02-server.pdf
create-netflix-clone-05-client-model.pdf
Creating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part IX - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part V - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part I - Transcript.pdf
Ad

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Empathic Computing: Creating Shared Understanding
PDF
Electronic commerce courselecture one. Pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation_ Review paper, used for researhc scholars
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Review of recent advances in non-invasive hemoglobin estimation
Empathic Computing: Creating Shared Understanding
Electronic commerce courselecture one. Pdf
MYSQL Presentation for SQL database connectivity
The Rise and Fall of 3GPP – Time for a Sabbatical?
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Spectral efficient network and resource selection model in 5G networks
NewMind AI Weekly Chronicles - August'25 Week I
Understanding_Digital_Forensics_Presentation.pptx
Unlocking AI with Model Context Protocol (MCP)
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
The AUB Centre for AI in Media Proposal.docx
Machine learning based COVID-19 study performance prediction

Creating a Facebook Clone - Part XIV.pdf

  • 1. Creating a Facebook Clone - Part XIV
  • 2. public class Notification implements PropertyBusinessObject { public final Property<String, Notification> id = new Property<>("id"); public final Property<User, Notification> user = new Property<>("user", User.class); public final Property<String, Notification> text = new Property<>("text"); public final Property<String, Notification> reaction = new Property<>("reaction"); public final IntProperty<Notification> reactionColor = new IntProperty<>("reactionColor"); public final LongProperty<Notification> date = new LongProperty<>("date"); public final BooleanProperty<Notification> wasRead = new BooleanProperty<>("wasRead"); private final PropertyIndex idx=new PropertyIndex(this,"Notification", id, user, text, reaction, reactionColor, date, wasRead); @Override public PropertyIndex getPropertyIndex() { return idx; } } FriendsContainer
  • 3. public class Notification implements PropertyBusinessObject { public final Property<String, Notification> id = new Property<>("id"); public final Property<User, Notification> user = new Property<>("user", User.class); public final Property<String, Notification> text = new Property<>("text"); public final Property<String, Notification> reaction = new Property<>("reaction"); public final IntProperty<Notification> reactionColor = new IntProperty<>("reactionColor"); public final LongProperty<Notification> date = new LongProperty<>("date"); public final BooleanProperty<Notification> wasRead = new BooleanProperty<>("wasRead"); private final PropertyIndex idx=new PropertyIndex(this,"Notification", id, user, text, reaction, reactionColor, date, wasRead); @Override public PropertyIndex getPropertyIndex() { return idx; } } FriendsContainer
  • 4. public class Notification implements PropertyBusinessObject { public final Property<String, Notification> id = new Property<>("id"); public final Property<User, Notification> user = new Property<>("user", User.class); public final Property<String, Notification> text = new Property<>("text"); public final Property<String, Notification> reaction = new Property<>("reaction"); public final IntProperty<Notification> reactionColor = new IntProperty<>("reactionColor"); public final LongProperty<Notification> date = new LongProperty<>("date"); public final BooleanProperty<Notification> wasRead = new BooleanProperty<>("wasRead"); private final PropertyIndex idx=new PropertyIndex(this,"Notification", id, user, text, reaction, reactionColor, date, wasRead); @Override public PropertyIndex getPropertyIndex() { return idx; } } FriendsContainer
  • 5. public class Notification implements PropertyBusinessObject { public final Property<String, Notification> id = new Property<>("id"); public final Property<User, Notification> user = new Property<>("user", User.class); public final Property<String, Notification> text = new Property<>("text"); public final Property<String, Notification> reaction = new Property<>("reaction"); public final IntProperty<Notification> reactionColor = new IntProperty<>("reactionColor"); public final LongProperty<Notification> date = new LongProperty<>("date"); public final BooleanProperty<Notification> wasRead = new BooleanProperty<>("wasRead"); private final PropertyIndex idx=new PropertyIndex(this,"Notification", id, user, text, reaction, reactionColor, date, wasRead); @Override public PropertyIndex getPropertyIndex() { return idx; } } FriendsContainer
  • 6. return null; } public static List<Notification> fetchNotifications( long since, int amount) { if(since < initTime - UIUtils.DAY) { return null; } List<Notification> response = new ArrayList<>(); response.add(new Notification().id.set("Notify-1"). user.set(dummyUsers[0]). text.set("liked Your Post"). date.set(initTime - 60000). reaction.set("" + FontImage.MATERIAL_FAVORITE). reactionColor.set(0xff0000)); response.add(new Notification().id.set("Notify-2"). user.set(dummyUsers[1]). text.set("commented on your post"). date.set(initTime - 600000000). reaction.set("" + FontImage.MATERIAL_CHAT). reactionColor.set(0xff00)); return response; } ServerAPI
  • 7. return null; } public static List<Notification> fetchNotifications( long since, int amount) { if(since < initTime - UIUtils.DAY) { return null; } List<Notification> response = new ArrayList<>(); response.add(new Notification().id.set("Notify-1"). user.set(dummyUsers[0]). text.set("liked Your Post"). date.set(initTime - 60000). reaction.set("" + FontImage.MATERIAL_FAVORITE). reactionColor.set(0xff0000)); response.add(new Notification().id.set("Notify-2"). user.set(dummyUsers[1]). text.set("commented on your post"). date.set(initTime - 600000000). reaction.set("" + FontImage.MATERIAL_CHAT). reactionColor.set(0xff00)); return response; } ServerAPI
  • 8. return null; } public static List<Notification> fetchNotifications( long since, int amount) { if(since < initTime - UIUtils.DAY) { return null; } List<Notification> response = new ArrayList<>(); response.add(new Notification().id.set("Notify-1"). user.set(dummyUsers[0]). text.set("liked Your Post"). date.set(initTime - 60000). reaction.set("" + FontImage.MATERIAL_FAVORITE). reactionColor.set(0xff0000)); response.add(new Notification().id.set("Notify-2"). user.set(dummyUsers[1]). text.set("commented on your post"). date.set(initTime - 600000000). reaction.set("" + FontImage.MATERIAL_CHAT). reactionColor.set(0xff00)); return response; } ServerAPI
  • 9. © Codename One 2017 all rights reserved
  • 10. public class NotificationsContainer extends InfiniteContainer { private long lastTime; @Override public Component[] fetchComponents(int index, int amount) { if(index == 0) { lastTime = System.currentTimeMillis(); } List<Notification> response = ServerAPI.fetchNotifications(lastTime, amount); if(response == null) { return null; } Component[] notifications = new Component[response.size()]; int iter = 0; for(Notification n : response) { lastTime = n.date.getLong(); notifications[iter] = createNotificationEntry(n); iter++; } NotificationsContainer
  • 11. public class NotificationsContainer extends InfiniteContainer { private long lastTime; @Override public Component[] fetchComponents(int index, int amount) { if(index == 0) { lastTime = System.currentTimeMillis(); } List<Notification> response = ServerAPI.fetchNotifications(lastTime, amount); if(response == null) { return null; } Component[] notifications = new Component[response.size()]; int iter = 0; for(Notification n : response) { lastTime = n.date.getLong(); notifications[iter] = createNotificationEntry(n); iter++; } NotificationsContainer
  • 12. notifications[iter] = createNotificationEntry(n); iter++; } return notifications; } private Container createNotificationEntry(Notification n) { Image avatar = n.user.get().getAvatar(13); Label icon = new Label("", "SmallBlueCircle"); icon.getAllStyles().setBorder(RoundBorder.create(). color(n.reactionColor.get())); FontImage.setMaterialIcon(icon, n.reaction.get().charAt(0), 2); Container avatarContainer = LayeredLayout.encloseIn( new Label(avatar, "HalfPaddedContainer"), FlowLayout.encloseRightBottom(icon)); RichTextView rt = new RichTextView("<b>" + n.user.get().fullName() + "</b> " + n.text.get()); Label time = new Label(UIUtils.formatTimeAgo(n.date.get()), "SmallBlueLabel"); Container yContainer = BoxLayout.encloseY(rt, time); yContainer.setUIID("HalfPaddedContainer"); return BorderLayout. centerEastWest(yContainer, null, avatarContainer); } NotificationsContainer
  • 13. notifications[iter] = createNotificationEntry(n); iter++; } return notifications; } private Container createNotificationEntry(Notification n) { Image avatar = n.user.get().getAvatar(13); Label icon = new Label("", "SmallBlueCircle"); icon.getAllStyles().setBorder(RoundBorder.create(). color(n.reactionColor.get())); FontImage.setMaterialIcon(icon, n.reaction.get().charAt(0), 2); Container avatarContainer = LayeredLayout.encloseIn( new Label(avatar, "HalfPaddedContainer"), FlowLayout.encloseRightBottom(icon)); RichTextView rt = new RichTextView("<b>" + n.user.get().fullName() + "</b> " + n.text.get()); Label time = new Label(UIUtils.formatTimeAgo(n.date.get()), "SmallBlueLabel"); Container yContainer = BoxLayout.encloseY(rt, time); yContainer.setUIID("HalfPaddedContainer"); return BorderLayout. centerEastWest(yContainer, null, avatarContainer); } NotificationsContainer
  • 14. notifications[iter] = createNotificationEntry(n); iter++; } return notifications; } private Container createNotificationEntry(Notification n) { Image avatar = n.user.get().getAvatar(13); Label icon = new Label("", "SmallBlueCircle"); icon.getAllStyles().setBorder(RoundBorder.create(). color(n.reactionColor.get())); FontImage.setMaterialIcon(icon, n.reaction.get().charAt(0), 2); Container avatarContainer = LayeredLayout.encloseIn( new Label(avatar, "HalfPaddedContainer"), FlowLayout.encloseRightBottom(icon)); RichTextView rt = new RichTextView("<b>" + n.user.get().fullName() + "</b> " + n.text.get()); Label time = new Label(UIUtils.formatTimeAgo(n.date.get()), "SmallBlueLabel"); Container yContainer = BoxLayout.encloseY(rt, time); yContainer.setUIID("HalfPaddedContainer"); return BorderLayout. centerEastWest(yContainer, null, avatarContainer); } NotificationsContainer
  • 15. notifications[iter] = createNotificationEntry(n); iter++; } return notifications; } private Container createNotificationEntry(Notification n) { Image avatar = n.user.get().getAvatar(13); Label icon = new Label("", "SmallBlueCircle"); icon.getAllStyles().setBorder(RoundBorder.create(). color(n.reactionColor.get())); FontImage.setMaterialIcon(icon, n.reaction.get().charAt(0), 2); Container avatarContainer = LayeredLayout.encloseIn( new Label(avatar, "HalfPaddedContainer"), FlowLayout.encloseRightBottom(icon)); RichTextView rt = new RichTextView("<b>" + n.user.get().fullName() + "</b> " + n.text.get()); Label time = new Label(UIUtils.formatTimeAgo(n.date.get()), "SmallBlueLabel"); Container yContainer = BoxLayout.encloseY(rt, time); yContainer.setUIID("HalfPaddedContainer"); return BorderLayout. centerEastWest(yContainer, null, avatarContainer); } NotificationsContainer
  • 16. SmallBlueLabel { color: blue; font-size: 2mm; padding: 1mm; font-family: "native:MainLight"; } theme.css