The document discusses creating a social login form, country picker form, and common code for initializing forms with a black title bar in an Uber clone mobile app built with Codename One.
The social login form allows selecting Facebook or Google accounts and defines some basic styling. The country picker form lists countries and their flags, grouping them by initial letter. Common code is provided to initialize forms with a black title bar that smoothly collapses on scroll. Styles are defined for the black title bar and white title text that animates on collapse.
The document describes a CountryCodePicker class that extends the Button class. It retrieves the device's locale code, looks it up in arrays to match the country code and flag, and allows selecting a different code/flag. It also shows a picker form for selection. The class is used in a LoginForm class, which displays Uber's logo and buttons to enter a phone number or connect via social media for logging in.
Creating a Facebook Clone - Part VII.pdfShaiAlmog1
The document discusses code for creating a signup form for a mobile app. It includes code to create fields for a user's name, birthday, and gender. Styles are defined for gender radio buttons. The code collects the user's input and navigates between forms as each field is completed.
The document describes a CountryCodePicker class that extends the Button class. It retrieves the device's locale code, looks it up in arrays to match the country code and flag, and allows selecting a different code/flag. It also shows a picker form for selection. The class is used in a LoginForm class, which displays Uber's logo and buttons to enter a phone number or connect via social media for logging in.
Creating a Facebook Clone - Part VII.pdfShaiAlmog1
The document discusses code for creating a signup form for a mobile app. It includes code to create fields for a user's name, birthday, and gender. Styles are defined for gender radio buttons. The code collects the user's input and navigates between forms as each field is completed.
Immutability and Javascript - Nadia MiętkiewiczVisuality
Visuality talks Y18W11 - Nadia Miętkiewicz is talking about Immutability and Javascript. Enjoy and subscribe to our channel - more is coming:)
Video is available here:
https://www.youtube.com/watch?v=sMYFOky8CIA&feature=youtu.be
This document discusses graphical user interfaces in Java. It covers using layout managers like BorderLayout and GridLayout to position components in containers. Common components like text fields, text areas, radio buttons, check boxes, and menus are described. Handling user input through action listeners is also covered. The document provides examples of creating a GUI with menus to change the font style of sample text.
Creating a Facebook Clone - Part XLI.pdfShaiAlmog1
The document defines a NewPostForm class that is used to create new posts in a Facebook clone app. The class initializes the user interface for composing posts, including a text area for the post content and options for adding images, videos or other styles. It also handles uploading attachments and submitting the new post to the server.
Initial UI Mockup - Part 2 - Transcript.pdfShaiAlmog1
The main class for the top level forms is the base navigation form. Here we have the material commands in the side menu that allow us to navigate to the other top level forms.
The title of the forms is really a text field as it’s editable in place. The trick in making a text field feel like a title is to style it as such which is why we created the NavigationTitle UIID and that style has 0 margin, 1 millimeter of padding with a 5 millimeter white font that’s aligned to the left.
The logo image uses a special rounded scaled logo getter which adapts the logos look to the design of the UI. When we set the property for the logo we automatically
2. Section 2. Implementing functionality in the PersonEntry. (1.5 ma.pdfallwayscollection
The document provides instructions to modify the PersonEntry class to:
1) Update the interface to match a provided figure
2) Make the close button hide the form when clicked
3) Validate data entry and save to the person list when the save button is clicked
It gives hints on how to:
- Add a label and checkbox to the interface
- Store a reference to access and hide the form
- Validate data is entered and is the right type before saving
The Duck Teaches Learn to debug from the masters. Local to production- kill ...ShaiAlmog1
The document outlines an agenda for a workshop on debugging techniques. The workshop covers installing tools, flow and breakpoints debugging, watching variables, Kubernetes debugging, and developer observability. Key techniques discussed include tracepoints, memory debugging, exception breakpoints, object marking, and logs, snapshots, and metrics for observability. The goal is to teach practical debugging skills that can be applied at scale in production environments like Kubernetes.
Immutability and Javascript - Nadia MiętkiewiczVisuality
Visuality talks Y18W11 - Nadia Miętkiewicz is talking about Immutability and Javascript. Enjoy and subscribe to our channel - more is coming:)
Video is available here:
https://www.youtube.com/watch?v=sMYFOky8CIA&feature=youtu.be
This document discusses graphical user interfaces in Java. It covers using layout managers like BorderLayout and GridLayout to position components in containers. Common components like text fields, text areas, radio buttons, check boxes, and menus are described. Handling user input through action listeners is also covered. The document provides examples of creating a GUI with menus to change the font style of sample text.
Creating a Facebook Clone - Part XLI.pdfShaiAlmog1
The document defines a NewPostForm class that is used to create new posts in a Facebook clone app. The class initializes the user interface for composing posts, including a text area for the post content and options for adding images, videos or other styles. It also handles uploading attachments and submitting the new post to the server.
Initial UI Mockup - Part 2 - Transcript.pdfShaiAlmog1
The main class for the top level forms is the base navigation form. Here we have the material commands in the side menu that allow us to navigate to the other top level forms.
The title of the forms is really a text field as it’s editable in place. The trick in making a text field feel like a title is to style it as such which is why we created the NavigationTitle UIID and that style has 0 margin, 1 millimeter of padding with a 5 millimeter white font that’s aligned to the left.
The logo image uses a special rounded scaled logo getter which adapts the logos look to the design of the UI. When we set the property for the logo we automatically
2. Section 2. Implementing functionality in the PersonEntry. (1.5 ma.pdfallwayscollection
The document provides instructions to modify the PersonEntry class to:
1) Update the interface to match a provided figure
2) Make the close button hide the form when clicked
3) Validate data entry and save to the person list when the save button is clicked
It gives hints on how to:
- Add a label and checkbox to the interface
- Store a reference to access and hide the form
- Validate data is entered and is the right type before saving
The Duck Teaches Learn to debug from the masters. Local to production- kill ...ShaiAlmog1
The document outlines an agenda for a workshop on debugging techniques. The workshop covers installing tools, flow and breakpoints debugging, watching variables, Kubernetes debugging, and developer observability. Key techniques discussed include tracepoints, memory debugging, exception breakpoints, object marking, and logs, snapshots, and metrics for observability. The goal is to teach practical debugging skills that can be applied at scale in production environments like Kubernetes.
The document describes code for implementing the server-side functionality of a WhatsApp clone. It includes classes for representing users, messages, and server connections. The Server class initializes user and message data from files, handles login/signup, and establishes a websocket connection for real-time messaging. It can send and receive messages when connected, or queue messages when offline.
“An Outlook of the Ongoing and Future Relationship between Blockchain Technologies and Process-aware Information Systems.” Invited talk at the joint workshop on Blockchain for Information Systems (BC4IS) and Blockchain for Trusted Data Sharing (B4TDS), co-located with with the 36th International Conference on Advanced Information Systems Engineering (CAiSE), 3 June 2024, Limassol, Cyprus.
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceIndexBug
Imagine a world where machines not only perform tasks but also learn, adapt, and make decisions. This is the promise of Artificial Intelligence (AI), a technology that's not just enhancing our lives but revolutionizing entire industries.
HCL Notes and Domino License Cost Reduction in the World of DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-and-domino-license-cost-reduction-in-the-world-of-dlau/
The introduction of DLAU and the CCB & CCX licensing model caused quite a stir in the HCL community. As a Notes and Domino customer, you may have faced challenges with unexpected user counts and license costs. You probably have questions on how this new licensing approach works and how to benefit from it. Most importantly, you likely have budget constraints and want to save money where possible. Don’t worry, we can help with all of this!
We’ll show you how to fix common misconfigurations that cause higher-than-expected user counts, and how to identify accounts which you can deactivate to save money. There are also frequent patterns that can cause unnecessary cost, like using a person document instead of a mail-in for shared mailboxes. We’ll provide examples and solutions for those as well. And naturally we’ll explain the new licensing model.
Join HCL Ambassador Marc Thomas in this webinar with a special guest appearance from Franz Walder. It will give you the tools and know-how to stay on top of what is going on with Domino licensing. You will be able lower your cost through an optimized configuration and keep it low going forward.
These topics will be covered
- Reducing license cost by finding and fixing misconfigurations and superfluous accounts
- How do CCB and CCX licenses really work?
- Understanding the DLAU tool and how to best utilize it
- Tips for common problem areas, like team mailboxes, functional/test users, etc
- Practical examples and best practices to implement right away
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slackshyamraj55
Discover the seamless integration of RPA (Robotic Process Automation), COMPOSER, and APM with AWS IDP enhanced with Slack notifications. Explore how these technologies converge to streamline workflows, optimize performance, and ensure secure access, all while leveraging the power of AWS IDP and real-time communication via Slack notifications.
Infrastructure Challenges in Scaling RAG with Custom AI modelsZilliz
Building Retrieval-Augmented Generation (RAG) systems with open-source and custom AI models is a complex task. This talk explores the challenges in productionizing RAG systems, including retrieval performance, response synthesis, and evaluation. We’ll discuss how to leverage open-source models like text embeddings, language models, and custom fine-tuned models to enhance RAG performance. Additionally, we’ll cover how BentoML can help orchestrate and scale these AI components efficiently, ensuring seamless deployment and management of RAG systems in the cloud.
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Speck&Tech
ABSTRACT: A prima vista, un mattoncino Lego e la backdoor XZ potrebbero avere in comune il fatto di essere entrambi blocchi di costruzione, o dipendenze di progetti creativi e software. La realtà è che un mattoncino Lego e il caso della backdoor XZ hanno molto di più di tutto ciò in comune.
Partecipate alla presentazione per immergervi in una storia di interoperabilità, standard e formati aperti, per poi discutere del ruolo importante che i contributori hanno in una comunità open source sostenibile.
BIO: Sostenitrice del software libero e dei formati standard e aperti. È stata un membro attivo dei progetti Fedora e openSUSE e ha co-fondato l'Associazione LibreItalia dove è stata coinvolta in diversi eventi, migrazioni e formazione relativi a LibreOffice. In precedenza ha lavorato a migrazioni e corsi di formazione su LibreOffice per diverse amministrazioni pubbliche e privati. Da gennaio 2020 lavora in SUSE come Software Release Engineer per Uyuni e SUSE Manager e quando non segue la sua passione per i computer e per Geeko coltiva la sua curiosità per l'astronomia (da cui deriva il suo nickname deneb_alpha).
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
GraphRAG for Life Science to increase LLM accuracyTomaz Bratanic
GraphRAG for life science domain, where you retriever information from biomedical knowledge graphs using LLMs to increase the accuracy and performance of generated answers
GraphRAG for Life Science to increase LLM accuracy
Creating an Uber Clone - Part V - Transcript.pdf
1. Creating an Uber Clone - Part V
In this part we’ll finally leave the confines of the login form and move to the simpler forms of social login and the country picker UI. I’ll start with the social login mockup
since it’s so small and simple
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
There isn’t that much to say about this form, it’s trivial. We use two icons for Facebook and Google and define the back arrow. Thanks to all the theming work we did up
to this point everything “just works” and looks like the Uber app.
We do need to define the FlagButton through as it’s a UIID that I reuse in several forms. It got the name from the countries picker form which we’ll go into next.
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
Let’s jump right into the code.
Predictably the form is a BoxLayout container on the Y axis. The initBlackTitleForm method is a static method in a common utility class. We'll cover it soon
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
We don't have flags for all the countries so we need a blank space icon so the elements align
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
Here we loop over all the country codes and create a button with the FlagsLetter UIID for every entry.
We also need to implement the alphabet letter headers, every time the first character of a country changes we add a label representing the entry
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
When an entry is selected we update the text and icon of the CountryCodePicker Button that launched this form
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
We need to override the toolbar initialization so we can set the proper BlackToolbar UIID
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
The form with the black title requires some work which should be more "generic" as a black title area is used in several places within the Uber application.
For this purpose we have the CommonCode class which stores common static code in the application. This is a non-trivial task as the logic needs to support the
animated collapse of the title area as the user scrolls down.
The method accepts a callback for the case of a search operation, this isn't implemented yet but if it's null a search icon isn't added.
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
We add the back command as a button which allows us to place it above the title in a custom way and animate the position.
We can't use the TitleCommand UIID "as is" since it uses a black on white scheme in other forms. I could have used a different UIID here.
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
If we have a search callback I build the layout that includes the search button otherwise I create a layout without it
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
I place the title on top of the back button container using a layered layout. It doesn't seem to be on top because I've set the top margin so it resides below the back
arrow icon. I did this so I can animate the position of the label fluidly by changing the margin value
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
This one line allows the title to collapse into place next to the arrow, it translates the style of the title which currently has a large top margin to one without top margin and
with side margin. This means that the change in the style causes the title to move next to the back arrow
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
Cover transition is used in the back title forms on iOS, notice that cover transitions expect in and out values for cover and uncover