SlideShare a Scribd company logo
1 of 30
Download to read offline
Creating an Uber Clone - Part V
Social Login
© Codename One 2017 all rights reserved
public class FacebookOrGoogleLoginForm extends Form {
public FacebookOrGoogleLoginForm() {
super(BoxLayout.y());
Form previous = getCurrentForm();
getToolbar().setBackCommand("",
Toolbar.BackCommandPolicy.AS_ARROW,
e -> previous.showBack());
add(new Label("Choose an account", "FlagButton"));
Button facebook = new Button("Facebook",
Resources.getGlobalResources().getImage("facebook.png"),
"FlagButton");
Button google = new Button("Google",
Resources.getGlobalResources().getImage("google.png"),
“FlagButton");
add(facebook).add(google);
}
}
FacebookOrGoogleLoginForm
FlagButton
© Codename One 2017 all rights reserved
FlagButton
© Codename One 2017 all rights reserved
Country Picker
© Codename One 2017 all rights reserved
public class CountryPickerForm extends Form {
public CountryPickerForm(Button sourceButton, Resources flags) {
super(BoxLayout.y());
CommonCode.initBlackTitleForm(this, "Select a Country", val -> search(val));
Image blankIcon = Image.createImage(100, 70, 0);
char lastChar = (char)-1;
for(int iter = 0 ; iter < ActivationForm.COUNTRY_CODES.length ; iter++) {
Button b = new Button(ActivationForm.COUNTRY_NAMES[iter], "FlagButton");
char current = b.getText().charAt(0);
if(current != lastChar) {
lastChar = current;
Label l = new Label("" + lastChar, "FlagsLetter");
add(l);
}
b.setIcon(flags.getImage(ActivationForm.COUNTRY_FLAGS[iter]));
if(b.getIcon() == null) {
b.setIcon(blankIcon);
}
String currentCountryCode = ActivationForm.COUNTRY_CODES[iter];
b.addActionListener(ee -> {
sourceButton.setIcon(b.getIcon());
sourceButton.setText("+" + currentCountryCode);
CountryPickerForm
public class CountryPickerForm extends Form {
public CountryPickerForm(Button sourceButton, Resources flags) {
super(BoxLayout.y());
CommonCode.initBlackTitleForm(this, "Select a Country", val -> search(val));
Image blankIcon = Image.createImage(100, 70, 0);
char lastChar = (char)-1;
for(int iter = 0 ; iter < ActivationForm.COUNTRY_CODES.length ; iter++) {
Button b = new Button(ActivationForm.COUNTRY_NAMES[iter], "FlagButton");
char current = b.getText().charAt(0);
if(current != lastChar) {
lastChar = current;
Label l = new Label("" + lastChar, "FlagsLetter");
add(l);
}
b.setIcon(flags.getImage(ActivationForm.COUNTRY_FLAGS[iter]));
if(b.getIcon() == null) {
b.setIcon(blankIcon);
}
String currentCountryCode = ActivationForm.COUNTRY_CODES[iter];
b.addActionListener(ee -> {
sourceButton.setIcon(b.getIcon());
sourceButton.setText("+" + currentCountryCode);
CountryPickerForm
public class CountryPickerForm extends Form {
public CountryPickerForm(Button sourceButton, Resources flags) {
super(BoxLayout.y());
CommonCode.initBlackTitleForm(this, "Select a Country", val -> search(val));
Image blankIcon = Image.createImage(100, 70, 0);
char lastChar = (char)-1;
for(int iter = 0 ; iter < ActivationForm.COUNTRY_CODES.length ; iter++) {
Button b = new Button(ActivationForm.COUNTRY_NAMES[iter], "FlagButton");
char current = b.getText().charAt(0);
if(current != lastChar) {
lastChar = current;
Label l = new Label("" + lastChar, "FlagsLetter");
add(l);
}
b.setIcon(flags.getImage(ActivationForm.COUNTRY_FLAGS[iter]));
if(b.getIcon() == null) {
b.setIcon(blankIcon);
}
String currentCountryCode = ActivationForm.COUNTRY_CODES[iter];
b.addActionListener(ee -> {
sourceButton.setIcon(b.getIcon());
sourceButton.setText("+" + currentCountryCode);
CountryPickerForm
public class CountryPickerForm extends Form {
public CountryPickerForm(Button sourceButton, Resources flags) {
super(BoxLayout.y());
CommonCode.initBlackTitleForm(this, "Select a Country", val -> search(val));
Image blankIcon = Image.createImage(100, 70, 0);
char lastChar = (char)-1;
for(int iter = 0 ; iter < ActivationForm.COUNTRY_CODES.length ; iter++) {
Button b = new Button(ActivationForm.COUNTRY_NAMES[iter], "FlagButton");
char current = b.getText().charAt(0);
if(current != lastChar) {
lastChar = current;
Label l = new Label("" + lastChar, "FlagsLetter");
add(l);
}
b.setIcon(flags.getImage(ActivationForm.COUNTRY_FLAGS[iter]));
if(b.getIcon() == null) {
b.setIcon(blankIcon);
}
String currentCountryCode = ActivationForm.COUNTRY_CODES[iter];
b.addActionListener(ee -> {
sourceButton.setIcon(b.getIcon());
sourceButton.setText("+" + currentCountryCode);
CountryPickerForm
b.setIcon(flags.getImage(ActivationForm.COUNTRY_FLAGS[iter]));
if(b.getIcon() == null) {
b.setIcon(blankIcon);
}
String currentCountryCode = ActivationForm.COUNTRY_CODES[iter];
b.addActionListener(ee -> {
sourceButton.setIcon(b.getIcon());
sourceButton.setText("+" + currentCountryCode);
});
add(b);
}
}
@Override
protected void initGlobalToolbar() {
super.initGlobalToolbar();
getToolbar().setUIID("BlackToolbar");
}
void search(String s) {
}
}
CountryPickerForm
BlackToolbar
© Codename One 2017 all rights reserved
BlackToolbar
© Codename One 2017 all rights reserved
BlackToolbar
© Codename One 2017 all rights reserved
FlagsLetter
© Codename One 2017 all rights reserved
FlagsLetter
© Codename One 2017 all rights reserved
public static void initBlackTitleForm(Form f, String title,
SuccessCallback<String> searchResults) {
Form backTo = getCurrentForm();
f.getContentPane().setScrollVisible(false);
Button back = new Button("", "TitleCommand");
back.addActionListener(e -> backTo.showBack());
back.getAllStyles().setFgColor(0xffffff);
FontImage.setMaterialIcon(back, FontImage.MATERIAL_ARROW_BACK);
Container searchBack = null;
if(searchResults != null) {
Button search = new Button("", "TitleCommand");
search.getAllStyles().setFgColor(0xffffff);
FontImage.setMaterialIcon(search, FontImage.MATERIAL_SEARCH);
search.addActionListener(e -> {
// TODO
});
searchBack = BorderLayout.north(
BorderLayout.centerEastWest(null, search, back));
} else {
searchBack = BorderLayout.north(
BorderLayout.centerEastWest(null, null, back));
initBlackTitleForm
public static void initBlackTitleForm(Form f, String title,
SuccessCallback<String> searchResults) {
Form backTo = getCurrentForm();
f.getContentPane().setScrollVisible(false);
Button back = new Button("", "TitleCommand");
back.addActionListener(e -> backTo.showBack());
back.getAllStyles().setFgColor(0xffffff);
FontImage.setMaterialIcon(back, FontImage.MATERIAL_ARROW_BACK);
Container searchBack = null;
if(searchResults != null) {
Button search = new Button("", "TitleCommand");
search.getAllStyles().setFgColor(0xffffff);
FontImage.setMaterialIcon(search, FontImage.MATERIAL_SEARCH);
search.addActionListener(e -> {
// TODO
});
searchBack = BorderLayout.north(
BorderLayout.centerEastWest(null, search, back));
} else {
searchBack = BorderLayout.north(
BorderLayout.centerEastWest(null, null, back));
initBlackTitleForm
public static void initBlackTitleForm(Form f, String title,
SuccessCallback<String> searchResults) {
Form backTo = getCurrentForm();
f.getContentPane().setScrollVisible(false);
Button back = new Button("", "TitleCommand");
back.addActionListener(e -> backTo.showBack());
back.getAllStyles().setFgColor(0xffffff);
FontImage.setMaterialIcon(back, FontImage.MATERIAL_ARROW_BACK);
Container searchBack = null;
if(searchResults != null) {
Button search = new Button("", "TitleCommand");
search.getAllStyles().setFgColor(0xffffff);
FontImage.setMaterialIcon(search, FontImage.MATERIAL_SEARCH);
search.addActionListener(e -> {
// TODO
});
searchBack = BorderLayout.north(
BorderLayout.centerEastWest(null, search, back));
} else {
searchBack = BorderLayout.north(
BorderLayout.centerEastWest(null, null, back));
initBlackTitleForm
} else {
searchBack = BorderLayout.north(
BorderLayout.centerEastWest(null, null, back));
}
Label titleLabel = new Label(title, "WhiteOnBlackTitle");
titleLabel.getAllStyles().setMarginTop(back.getPreferredH());
titleLabel.getAllStyles().setMarginUnit(Style.UNIT_TYPE_PIXELS,
Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS);
f.getToolbar().setTitleComponent(
LayeredLayout.encloseIn(searchBack, titleLabel));
f.getAnimationManager().onTitleScrollAnimation(
titleLabel.createStyleAnimation("WhiteOnBlackTitleLeftMargin", 200));
f.setTransitionInAnimator(CommonTransitions.
createCover(CommonTransitions.SLIDE_VERTICAL, false, 300));
f.setTransitionOutAnimator(CommonTransitions.
createCover(CommonTransitions.SLIDE_VERTICAL, true, 300));
}
initBlackTitleForm
} else {
searchBack = BorderLayout.north(
BorderLayout.centerEastWest(null, null, back));
}
Label titleLabel = new Label(title, "WhiteOnBlackTitle");
titleLabel.getAllStyles().setMarginTop(back.getPreferredH());
titleLabel.getAllStyles().setMarginUnit(Style.UNIT_TYPE_PIXELS,
Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS);
f.getToolbar().setTitleComponent(
LayeredLayout.encloseIn(searchBack, titleLabel));
f.getAnimationManager().onTitleScrollAnimation(
titleLabel.createStyleAnimation("WhiteOnBlackTitleLeftMargin", 200));
f.setTransitionInAnimator(CommonTransitions.
createCover(CommonTransitions.SLIDE_VERTICAL, false, 300));
f.setTransitionOutAnimator(CommonTransitions.
createCover(CommonTransitions.SLIDE_VERTICAL, true, 300));
}
initBlackTitleForm
} else {
searchBack = BorderLayout.north(
BorderLayout.centerEastWest(null, null, back));
}
Label titleLabel = new Label(title, "WhiteOnBlackTitle");
titleLabel.getAllStyles().setMarginTop(back.getPreferredH());
titleLabel.getAllStyles().setMarginUnit(Style.UNIT_TYPE_PIXELS,
Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS);
f.getToolbar().setTitleComponent(
LayeredLayout.encloseIn(searchBack, titleLabel));
f.getAnimationManager().onTitleScrollAnimation(
titleLabel.createStyleAnimation("WhiteOnBlackTitleLeftMargin", 200));
f.setTransitionInAnimator(CommonTransitions.
createCover(CommonTransitions.SLIDE_VERTICAL, false, 300));
f.setTransitionOutAnimator(CommonTransitions.
createCover(CommonTransitions.SLIDE_VERTICAL, true, 300));
}
initBlackTitleForm
WhiteOnBlackTitle
© Codename One 2017 all rights reserved
WhiteOnBlackTitle
© Codename One 2017 all rights reserved
WhiteOnBlackTitle
© Codename One 2017 all rights reserved
WhiteOnBlackTitle
© Codename One 2017 all rights reserved
WhiteOnBlackTitleLeftMargin
© Codename One 2017 all rights reserved
WhiteOnBlackTitleLeftMargin
© Codename One 2017 all rights reserved
WhiteOnBlackTitleLeftMargin
© Codename One 2017 all rights reserved
WhiteOnBlackTitleLeftMargin
© Codename One 2017 all rights reserved

More Related Content

Similar to Creating an Uber Clone - Part V.pdf

mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
Devnology
 
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdf
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdfImport java.awt.; Import acm.program.; Import acm.graphics.;.pdf
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdf
apexcomputer54
 
2. Section 2. Implementing functionality in the PersonEntry. (1.5 ma.pdf
2. Section 2. Implementing functionality in the PersonEntry. (1.5 ma.pdf2. Section 2. Implementing functionality in the PersonEntry. (1.5 ma.pdf
2. Section 2. Implementing functionality in the PersonEntry. (1.5 ma.pdf
allwayscollection
 

Similar to Creating an Uber Clone - Part V.pdf (20)

Creating a Facebook Clone - Part XLI.pdf
Creating a Facebook Clone - Part XLI.pdfCreating a Facebook Clone - Part XLI.pdf
Creating a Facebook Clone - Part XLI.pdf
 
Creating a Facebook Clone - Part VI.pdf
Creating a Facebook Clone - Part VI.pdfCreating a Facebook Clone - Part VI.pdf
Creating a Facebook Clone - Part VI.pdf
 
Creating a Facebook Clone - Part XLII.pdf
Creating a Facebook Clone - Part XLII.pdfCreating a Facebook Clone - Part XLII.pdf
Creating a Facebook Clone - Part XLII.pdf
 
UI Design From Scratch - Part 5.pdf
UI Design From Scratch - Part 5.pdfUI Design From Scratch - Part 5.pdf
UI Design From Scratch - Part 5.pdf
 
Initial UI Mockup - Part 2.pdf
Initial UI Mockup - Part 2.pdfInitial UI Mockup - Part 2.pdf
Initial UI Mockup - Part 2.pdf
 
Creating a Facebook Clone - Part XLVI.pdf
Creating a Facebook Clone - Part XLVI.pdfCreating a Facebook Clone - Part XLVI.pdf
Creating a Facebook Clone - Part XLVI.pdf
 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
 
Creating an Uber - Part VI.pdf
Creating an Uber - Part VI.pdfCreating an Uber - Part VI.pdf
Creating an Uber - Part VI.pdf
 
Creating a Facebook Clone - Part XXVIII.pdf
Creating a Facebook Clone - Part XXVIII.pdfCreating a Facebook Clone - Part XXVIII.pdf
Creating a Facebook Clone - Part XXVIII.pdf
 
Creating an Uber Clone - Part XXIV.pdf
Creating an Uber Clone - Part XXIV.pdfCreating an Uber Clone - Part XXIV.pdf
Creating an Uber Clone - Part XXIV.pdf
 
Creating an Uber Clone - Part III.pdf
Creating an Uber Clone - Part III.pdfCreating an Uber Clone - Part III.pdf
Creating an Uber Clone - Part III.pdf
 
UI Design From Scratch - Part 5 - transcript.pdf
UI Design From Scratch - Part 5 - transcript.pdfUI Design From Scratch - Part 5 - transcript.pdf
UI Design From Scratch - Part 5 - transcript.pdf
 
Creating a Facebook Clone - Part XLIII.pdf
Creating a Facebook Clone - Part XLIII.pdfCreating a Facebook Clone - Part XLIII.pdf
Creating a Facebook Clone - Part XLIII.pdf
 
Initial UI Mockup - Part 3 - Transcript.pdf
Initial UI Mockup - Part 3 - Transcript.pdfInitial UI Mockup - Part 3 - Transcript.pdf
Initial UI Mockup - Part 3 - Transcript.pdf
 
Creating an Uber Clone - Part IX.pdf
Creating an Uber Clone - Part IX.pdfCreating an Uber Clone - Part IX.pdf
Creating an Uber Clone - Part IX.pdf
 
Creating a Facebook Clone - Part XXX.pdf
Creating a Facebook Clone - Part XXX.pdfCreating a Facebook Clone - Part XXX.pdf
Creating a Facebook Clone - Part XXX.pdf
 
Extracting ui Design - part 4 - transcript.pdf
Extracting ui Design - part 4 - transcript.pdfExtracting ui Design - part 4 - transcript.pdf
Extracting ui Design - part 4 - transcript.pdf
 
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdf
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdfImport java.awt.; Import acm.program.; Import acm.graphics.;.pdf
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdf
 
Extracting ui Design - part 4.pdf
Extracting ui Design - part 4.pdfExtracting ui Design - part 4.pdf
Extracting ui Design - part 4.pdf
 
2. Section 2. Implementing functionality in the PersonEntry. (1.5 ma.pdf
2. Section 2. Implementing functionality in the PersonEntry. (1.5 ma.pdf2. Section 2. Implementing functionality in the PersonEntry. (1.5 ma.pdf
2. Section 2. Implementing functionality in the PersonEntry. (1.5 ma.pdf
 

More from ShaiAlmog1

More from ShaiAlmog1 (20)

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

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 

Creating an Uber Clone - Part V.pdf

  • 1. Creating an Uber Clone - Part V
  • 2. Social Login © Codename One 2017 all rights reserved
  • 3. public class FacebookOrGoogleLoginForm extends Form { public FacebookOrGoogleLoginForm() { super(BoxLayout.y()); Form previous = getCurrentForm(); getToolbar().setBackCommand("", Toolbar.BackCommandPolicy.AS_ARROW, e -> previous.showBack()); add(new Label("Choose an account", "FlagButton")); Button facebook = new Button("Facebook", Resources.getGlobalResources().getImage("facebook.png"), "FlagButton"); Button google = new Button("Google", Resources.getGlobalResources().getImage("google.png"), “FlagButton"); add(facebook).add(google); } } FacebookOrGoogleLoginForm
  • 4. FlagButton © Codename One 2017 all rights reserved
  • 5. FlagButton © Codename One 2017 all rights reserved
  • 6. Country Picker © Codename One 2017 all rights reserved
  • 7. public class CountryPickerForm extends Form { public CountryPickerForm(Button sourceButton, Resources flags) { super(BoxLayout.y()); CommonCode.initBlackTitleForm(this, "Select a Country", val -> search(val)); Image blankIcon = Image.createImage(100, 70, 0); char lastChar = (char)-1; for(int iter = 0 ; iter < ActivationForm.COUNTRY_CODES.length ; iter++) { Button b = new Button(ActivationForm.COUNTRY_NAMES[iter], "FlagButton"); char current = b.getText().charAt(0); if(current != lastChar) { lastChar = current; Label l = new Label("" + lastChar, "FlagsLetter"); add(l); } b.setIcon(flags.getImage(ActivationForm.COUNTRY_FLAGS[iter])); if(b.getIcon() == null) { b.setIcon(blankIcon); } String currentCountryCode = ActivationForm.COUNTRY_CODES[iter]; b.addActionListener(ee -> { sourceButton.setIcon(b.getIcon()); sourceButton.setText("+" + currentCountryCode); CountryPickerForm
  • 8. public class CountryPickerForm extends Form { public CountryPickerForm(Button sourceButton, Resources flags) { super(BoxLayout.y()); CommonCode.initBlackTitleForm(this, "Select a Country", val -> search(val)); Image blankIcon = Image.createImage(100, 70, 0); char lastChar = (char)-1; for(int iter = 0 ; iter < ActivationForm.COUNTRY_CODES.length ; iter++) { Button b = new Button(ActivationForm.COUNTRY_NAMES[iter], "FlagButton"); char current = b.getText().charAt(0); if(current != lastChar) { lastChar = current; Label l = new Label("" + lastChar, "FlagsLetter"); add(l); } b.setIcon(flags.getImage(ActivationForm.COUNTRY_FLAGS[iter])); if(b.getIcon() == null) { b.setIcon(blankIcon); } String currentCountryCode = ActivationForm.COUNTRY_CODES[iter]; b.addActionListener(ee -> { sourceButton.setIcon(b.getIcon()); sourceButton.setText("+" + currentCountryCode); CountryPickerForm
  • 9. public class CountryPickerForm extends Form { public CountryPickerForm(Button sourceButton, Resources flags) { super(BoxLayout.y()); CommonCode.initBlackTitleForm(this, "Select a Country", val -> search(val)); Image blankIcon = Image.createImage(100, 70, 0); char lastChar = (char)-1; for(int iter = 0 ; iter < ActivationForm.COUNTRY_CODES.length ; iter++) { Button b = new Button(ActivationForm.COUNTRY_NAMES[iter], "FlagButton"); char current = b.getText().charAt(0); if(current != lastChar) { lastChar = current; Label l = new Label("" + lastChar, "FlagsLetter"); add(l); } b.setIcon(flags.getImage(ActivationForm.COUNTRY_FLAGS[iter])); if(b.getIcon() == null) { b.setIcon(blankIcon); } String currentCountryCode = ActivationForm.COUNTRY_CODES[iter]; b.addActionListener(ee -> { sourceButton.setIcon(b.getIcon()); sourceButton.setText("+" + currentCountryCode); CountryPickerForm
  • 10. public class CountryPickerForm extends Form { public CountryPickerForm(Button sourceButton, Resources flags) { super(BoxLayout.y()); CommonCode.initBlackTitleForm(this, "Select a Country", val -> search(val)); Image blankIcon = Image.createImage(100, 70, 0); char lastChar = (char)-1; for(int iter = 0 ; iter < ActivationForm.COUNTRY_CODES.length ; iter++) { Button b = new Button(ActivationForm.COUNTRY_NAMES[iter], "FlagButton"); char current = b.getText().charAt(0); if(current != lastChar) { lastChar = current; Label l = new Label("" + lastChar, "FlagsLetter"); add(l); } b.setIcon(flags.getImage(ActivationForm.COUNTRY_FLAGS[iter])); if(b.getIcon() == null) { b.setIcon(blankIcon); } String currentCountryCode = ActivationForm.COUNTRY_CODES[iter]; b.addActionListener(ee -> { sourceButton.setIcon(b.getIcon()); sourceButton.setText("+" + currentCountryCode); CountryPickerForm
  • 11. b.setIcon(flags.getImage(ActivationForm.COUNTRY_FLAGS[iter])); if(b.getIcon() == null) { b.setIcon(blankIcon); } String currentCountryCode = ActivationForm.COUNTRY_CODES[iter]; b.addActionListener(ee -> { sourceButton.setIcon(b.getIcon()); sourceButton.setText("+" + currentCountryCode); }); add(b); } } @Override protected void initGlobalToolbar() { super.initGlobalToolbar(); getToolbar().setUIID("BlackToolbar"); } void search(String s) { } } CountryPickerForm
  • 12. BlackToolbar © Codename One 2017 all rights reserved
  • 13. BlackToolbar © Codename One 2017 all rights reserved
  • 14. BlackToolbar © Codename One 2017 all rights reserved
  • 15. FlagsLetter © Codename One 2017 all rights reserved
  • 16. FlagsLetter © Codename One 2017 all rights reserved
  • 17. public static void initBlackTitleForm(Form f, String title, SuccessCallback<String> searchResults) { Form backTo = getCurrentForm(); f.getContentPane().setScrollVisible(false); Button back = new Button("", "TitleCommand"); back.addActionListener(e -> backTo.showBack()); back.getAllStyles().setFgColor(0xffffff); FontImage.setMaterialIcon(back, FontImage.MATERIAL_ARROW_BACK); Container searchBack = null; if(searchResults != null) { Button search = new Button("", "TitleCommand"); search.getAllStyles().setFgColor(0xffffff); FontImage.setMaterialIcon(search, FontImage.MATERIAL_SEARCH); search.addActionListener(e -> { // TODO }); searchBack = BorderLayout.north( BorderLayout.centerEastWest(null, search, back)); } else { searchBack = BorderLayout.north( BorderLayout.centerEastWest(null, null, back)); initBlackTitleForm
  • 18. public static void initBlackTitleForm(Form f, String title, SuccessCallback<String> searchResults) { Form backTo = getCurrentForm(); f.getContentPane().setScrollVisible(false); Button back = new Button("", "TitleCommand"); back.addActionListener(e -> backTo.showBack()); back.getAllStyles().setFgColor(0xffffff); FontImage.setMaterialIcon(back, FontImage.MATERIAL_ARROW_BACK); Container searchBack = null; if(searchResults != null) { Button search = new Button("", "TitleCommand"); search.getAllStyles().setFgColor(0xffffff); FontImage.setMaterialIcon(search, FontImage.MATERIAL_SEARCH); search.addActionListener(e -> { // TODO }); searchBack = BorderLayout.north( BorderLayout.centerEastWest(null, search, back)); } else { searchBack = BorderLayout.north( BorderLayout.centerEastWest(null, null, back)); initBlackTitleForm
  • 19. public static void initBlackTitleForm(Form f, String title, SuccessCallback<String> searchResults) { Form backTo = getCurrentForm(); f.getContentPane().setScrollVisible(false); Button back = new Button("", "TitleCommand"); back.addActionListener(e -> backTo.showBack()); back.getAllStyles().setFgColor(0xffffff); FontImage.setMaterialIcon(back, FontImage.MATERIAL_ARROW_BACK); Container searchBack = null; if(searchResults != null) { Button search = new Button("", "TitleCommand"); search.getAllStyles().setFgColor(0xffffff); FontImage.setMaterialIcon(search, FontImage.MATERIAL_SEARCH); search.addActionListener(e -> { // TODO }); searchBack = BorderLayout.north( BorderLayout.centerEastWest(null, search, back)); } else { searchBack = BorderLayout.north( BorderLayout.centerEastWest(null, null, back)); initBlackTitleForm
  • 20. } else { searchBack = BorderLayout.north( BorderLayout.centerEastWest(null, null, back)); } Label titleLabel = new Label(title, "WhiteOnBlackTitle"); titleLabel.getAllStyles().setMarginTop(back.getPreferredH()); titleLabel.getAllStyles().setMarginUnit(Style.UNIT_TYPE_PIXELS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS); f.getToolbar().setTitleComponent( LayeredLayout.encloseIn(searchBack, titleLabel)); f.getAnimationManager().onTitleScrollAnimation( titleLabel.createStyleAnimation("WhiteOnBlackTitleLeftMargin", 200)); f.setTransitionInAnimator(CommonTransitions. createCover(CommonTransitions.SLIDE_VERTICAL, false, 300)); f.setTransitionOutAnimator(CommonTransitions. createCover(CommonTransitions.SLIDE_VERTICAL, true, 300)); } initBlackTitleForm
  • 21. } else { searchBack = BorderLayout.north( BorderLayout.centerEastWest(null, null, back)); } Label titleLabel = new Label(title, "WhiteOnBlackTitle"); titleLabel.getAllStyles().setMarginTop(back.getPreferredH()); titleLabel.getAllStyles().setMarginUnit(Style.UNIT_TYPE_PIXELS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS); f.getToolbar().setTitleComponent( LayeredLayout.encloseIn(searchBack, titleLabel)); f.getAnimationManager().onTitleScrollAnimation( titleLabel.createStyleAnimation("WhiteOnBlackTitleLeftMargin", 200)); f.setTransitionInAnimator(CommonTransitions. createCover(CommonTransitions.SLIDE_VERTICAL, false, 300)); f.setTransitionOutAnimator(CommonTransitions. createCover(CommonTransitions.SLIDE_VERTICAL, true, 300)); } initBlackTitleForm
  • 22. } else { searchBack = BorderLayout.north( BorderLayout.centerEastWest(null, null, back)); } Label titleLabel = new Label(title, "WhiteOnBlackTitle"); titleLabel.getAllStyles().setMarginTop(back.getPreferredH()); titleLabel.getAllStyles().setMarginUnit(Style.UNIT_TYPE_PIXELS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS); f.getToolbar().setTitleComponent( LayeredLayout.encloseIn(searchBack, titleLabel)); f.getAnimationManager().onTitleScrollAnimation( titleLabel.createStyleAnimation("WhiteOnBlackTitleLeftMargin", 200)); f.setTransitionInAnimator(CommonTransitions. createCover(CommonTransitions.SLIDE_VERTICAL, false, 300)); f.setTransitionOutAnimator(CommonTransitions. createCover(CommonTransitions.SLIDE_VERTICAL, true, 300)); } initBlackTitleForm
  • 23. WhiteOnBlackTitle © Codename One 2017 all rights reserved
  • 24. WhiteOnBlackTitle © Codename One 2017 all rights reserved
  • 25. WhiteOnBlackTitle © Codename One 2017 all rights reserved
  • 26. WhiteOnBlackTitle © Codename One 2017 all rights reserved