SlideShare a Scribd company logo
Creating a Facebook Clone - Part XXXIV
© Codename One 2017 all rights reserved
public class UserForm extends Form {
private User user;
private InfiniteContainer ic = new InfiniteContainer() {
@Override
public Component[] fetchComponents(int index, int amount) {
ArrayList<Component> components = new ArrayList<>();
int page = index / amount;
if(index % amount > 0) {
page++;
}
List<Post> response = ServerAPI.postsOf(user.id.get(),
page, amount);
if(response == null) {
if(index == 0) {
return UIUtils.toArray(components);
}
return null;
}
for(Post p : response) {
UserForm
public class UserForm extends Form {
private User user;
private InfiniteContainer ic = new InfiniteContainer() {
@Override
public Component[] fetchComponents(int index, int amount) {
ArrayList<Component> components = new ArrayList<>();
int page = index / amount;
if(index % amount > 0) {
page++;
}
List<Post> response = ServerAPI.postsOf(user.id.get(),
page, amount);
if(response == null) {
if(index == 0) {
return UIUtils.toArray(components);
}
return null;
}
for(Post p : response) {
UserForm
public class UserForm extends Form {
private User user;
private InfiniteContainer ic = new InfiniteContainer() {
@Override
public Component[] fetchComponents(int index, int amount) {
ArrayList<Component> components = new ArrayList<>();
int page = index / amount;
if(index % amount > 0) {
page++;
}
List<Post> response = ServerAPI.postsOf(user.id.get(),
page, amount);
if(response == null) {
if(index == 0) {
return UIUtils.toArray(components);
}
return null;
}
for(Post p : response) {
UserForm
if(index % amount > 0) {
page++;
}
List<Post> response = ServerAPI.postsOf(user.id.get(),
page, amount);
if(response == null) {
if(index == 0) {
return UIUtils.toArray(components);
}
return null;
}
for(Post p : response) {
components.add(NewsfeedContainer.
createNewsItem(p.user.get(), p));
components.add(UIUtils.createHalfSpace());
}
return UIUtils.toArray(components);
}
};
public UserForm(User user) {
super(user.fullName(), new BorderLayout());
UserForm
return UIUtils.toArray(components);
}
return null;
}
for(Post p : response) {
components.add(NewsfeedContainer.
createNewsItem(p.user.get(), p));
components.add(UIUtils.createHalfSpace());
}
return UIUtils.toArray(components);
}
};
public UserForm(User user) {
super(user.fullName(), new BorderLayout());
this.user = user;
add(CENTER, ic);
Form previous = getCurrentForm();
getToolbar().addMaterialCommandToLeftBar("", MATERIAL_CLOSE, e ->
previous.showBack());
}
}
UserForm
public class PostForm extends Form {
public PostForm(Post p) {
super(p.title.get(), BoxLayout.y());
add(NewsfeedContainer.createNewsItem(p.user.get(), p));
Form previous = getCurrentForm();
getToolbar().addMaterialCommandToLeftBar("",
MATERIAL_ARROW_BACK, e -> previous.showBack());
}
}
PostForm

More Related Content

PDF
Creating a Facebook Clone - Part XXXIII - Transcript.pdf
PDF
Creating a Facebook Clone - Part XXIX.pdf
PDF
Creating a Facebook Clone - Part XII - Transcript.pdf
PDF
Creating a Facebook Clone - Part XXXIII.pdf
PDF
Creating a Facebook Clone - Part XII.pdf
PDF
Creating a Facebook Clone - Part XXIX - Transcript.pdf
PPTX
SPFx working with SharePoint data
PPTX
SPFx: Working with SharePoint Content
Creating a Facebook Clone - Part XXXIII - Transcript.pdf
Creating a Facebook Clone - Part XXIX.pdf
Creating a Facebook Clone - Part XII - Transcript.pdf
Creating a Facebook Clone - Part XXXIII.pdf
Creating a Facebook Clone - Part XII.pdf
Creating a Facebook Clone - Part XXIX - Transcript.pdf
SPFx working with SharePoint data
SPFx: Working with SharePoint Content

Similar to Creating a Facebook Clone - Part XXXIV.pdf (20)

PDF
Blending Culture in Twitter Client
PDF
Reactive clean architecture
PDF
Creating an Uber Clone - Part XXXX.pdf
PDF
Creating a Facebook Clone - Part XXIV.pdf
PDF
shiny.pdf
PDF
Creating a Facebook Clone - Part XXVIII - Transcript.pdf
PDF
Creating a Facebook Clone - Part XXIV - Transcript.pdf
ODP
From object oriented to functional domain modeling
PDF
From object oriented to functional domain modeling
PPTX
Computer-programming-User-defined-function-1.pptx
PPTX
Function pointer
PDF
Creating a Facebook Clone - Part XXXI.pdf
PDF
Scala UA: Big Step To Functional Programming
PDF
Creating a Facebook Clone - Part XIV - Transcript.pdf
PDF
Aspect-Oriented Programming (AOP) in .NET
PDF
Creating a Facebook Clone - Part XXXI - Transcript.pdf
PDF
Pragmatic functional refactoring with java 8
PDF
i am looking for help on the method AddSorted and the method Copy only.pdf
PDF
Android sq lite database tutorial
PDF
SQLite and ORM Binding - Part 2 - Transcript.pdf
Blending Culture in Twitter Client
Reactive clean architecture
Creating an Uber Clone - Part XXXX.pdf
Creating a Facebook Clone - Part XXIV.pdf
shiny.pdf
Creating a Facebook Clone - Part XXVIII - Transcript.pdf
Creating a Facebook Clone - Part XXIV - Transcript.pdf
From object oriented to functional domain modeling
From object oriented to functional domain modeling
Computer-programming-User-defined-function-1.pptx
Function pointer
Creating a Facebook Clone - Part XXXI.pdf
Scala UA: Big Step To Functional Programming
Creating a Facebook Clone - Part XIV - Transcript.pdf
Aspect-Oriented Programming (AOP) in .NET
Creating a Facebook Clone - Part XXXI - Transcript.pdf
Pragmatic functional refactoring with java 8
i am looking for help on the method AddSorted and the method Copy only.pdf
Android sq lite database tutorial
SQLite and ORM Binding - Part 2 - 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)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
cuic standard and advanced reporting.pdf
PDF
Approach and Philosophy of On baking technology
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Encapsulation theory and applications.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Review of recent advances in non-invasive hemoglobin estimation
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Spectral efficient network and resource selection model in 5G networks
Chapter 3 Spatial Domain Image Processing.pdf
sap open course for s4hana steps from ECC to s4
cuic standard and advanced reporting.pdf
Approach and Philosophy of On baking technology
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation_ Review paper, used for researhc scholars
Building Integrated photovoltaic BIPV_UPV.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation theory and applications.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Review of recent advances in non-invasive hemoglobin estimation
The AUB Centre for AI in Media Proposal.docx
Programs and apps: productivity, graphics, security and other tools
Digital-Transformation-Roadmap-for-Companies.pptx

Creating a Facebook Clone - Part XXXIV.pdf

  • 1. Creating a Facebook Clone - Part XXXIV
  • 2. © Codename One 2017 all rights reserved
  • 3. public class UserForm extends Form { private User user; private InfiniteContainer ic = new InfiniteContainer() { @Override public Component[] fetchComponents(int index, int amount) { ArrayList<Component> components = new ArrayList<>(); int page = index / amount; if(index % amount > 0) { page++; } List<Post> response = ServerAPI.postsOf(user.id.get(), page, amount); if(response == null) { if(index == 0) { return UIUtils.toArray(components); } return null; } for(Post p : response) { UserForm
  • 4. public class UserForm extends Form { private User user; private InfiniteContainer ic = new InfiniteContainer() { @Override public Component[] fetchComponents(int index, int amount) { ArrayList<Component> components = new ArrayList<>(); int page = index / amount; if(index % amount > 0) { page++; } List<Post> response = ServerAPI.postsOf(user.id.get(), page, amount); if(response == null) { if(index == 0) { return UIUtils.toArray(components); } return null; } for(Post p : response) { UserForm
  • 5. public class UserForm extends Form { private User user; private InfiniteContainer ic = new InfiniteContainer() { @Override public Component[] fetchComponents(int index, int amount) { ArrayList<Component> components = new ArrayList<>(); int page = index / amount; if(index % amount > 0) { page++; } List<Post> response = ServerAPI.postsOf(user.id.get(), page, amount); if(response == null) { if(index == 0) { return UIUtils.toArray(components); } return null; } for(Post p : response) { UserForm
  • 6. if(index % amount > 0) { page++; } List<Post> response = ServerAPI.postsOf(user.id.get(), page, amount); if(response == null) { if(index == 0) { return UIUtils.toArray(components); } return null; } for(Post p : response) { components.add(NewsfeedContainer. createNewsItem(p.user.get(), p)); components.add(UIUtils.createHalfSpace()); } return UIUtils.toArray(components); } }; public UserForm(User user) { super(user.fullName(), new BorderLayout()); UserForm
  • 7. return UIUtils.toArray(components); } return null; } for(Post p : response) { components.add(NewsfeedContainer. createNewsItem(p.user.get(), p)); components.add(UIUtils.createHalfSpace()); } return UIUtils.toArray(components); } }; public UserForm(User user) { super(user.fullName(), new BorderLayout()); this.user = user; add(CENTER, ic); Form previous = getCurrentForm(); getToolbar().addMaterialCommandToLeftBar("", MATERIAL_CLOSE, e -> previous.showBack()); } } UserForm
  • 8. public class PostForm extends Form { public PostForm(Post p) { super(p.title.get(), BoxLayout.y()); add(NewsfeedContainer.createNewsItem(p.user.get(), p)); Form previous = getCurrentForm(); getToolbar().addMaterialCommandToLeftBar("", MATERIAL_ARROW_BACK, e -> previous.showBack()); } } PostForm