Dinosaurs, like all living things, evolved, slowly and gradually, from previously existing creatures. The same happened with Listviews, they also evolved from pre-existing ancestors. Dinosaurs didn’t spring suddenly into existence two hundred million years ago, huge, toothy, and hungry for grub. Listviews on Android appeared since the beginning and they have been changing over the time. As you know, ListView is a fundamental component in Android, one of the most widely used widgets and also the most complex one.
In this talk, Jorge Barroso and Fernando Cejas will explain the evolution of this widget from previous versions of Android (based on its source code), mistakes that have been made in its implementation, giving examples and showing tips on how should be used when developing cool Android applications. Also, stuff like features, optimization, quirks and limitations will take place in this talk.
DroidConUk 2016 [Barcamp]
In this conference, I want to talk about treatments.
By treatments, I mean where and how do you implement your business logic, the way your application handles data, your global algorithms,
And to do that, I need first to talk you about Architecture. But in Android, when you say "Architecture" every boby answers MVP / MVVM / ... so we will first have a look to those patterns, from an history point of view then we will discover that we have missed some layer to split concerns accross the application.
So we will talk about layer architecture (yep, also known as N-Tier architecture).
So, we have a better idea of what a generic architecture should be, now let's apply it on Android: Let's talk about the application object, and the service services layer, in particular we'll dive into the problem "do our business services have to be implemented extending Service ?".
Then I talk to you about a ServiceManager, that we have to implement, to centralize the management of all your services and all your threads pools.
And some much more :)
Enjoy the talk,
Registerable views (Cocoaheads May 2018 Lyon)Pierre Felgines
How to improve UITableView and UICollection registerCell / dequeueReusableCell API using Swift.
The result is modern, compact and readable : no more hard coded strings, no more long and incoherent naming, no more force cast to dequeue a cell.
13 Oct 2016 talk at Boston Ember.js
An overview methods to connect to a nested API using EmberData: override adapter methods, `ember-data-url-templates` add-on and links. As a relative newcomer to Ember, I’d presumed that nested ember routes should be mirrored with nested API resources/collections, but the “truth” is murky.
Building Lithium Apps (Like a Boss) was a workshop presented on the structure and philosophy of the Lithium framework and its applications, and how best to take advantage of them.
DroidConUk 2016 [Barcamp]
In this conference, I want to talk about treatments.
By treatments, I mean where and how do you implement your business logic, the way your application handles data, your global algorithms,
And to do that, I need first to talk you about Architecture. But in Android, when you say "Architecture" every boby answers MVP / MVVM / ... so we will first have a look to those patterns, from an history point of view then we will discover that we have missed some layer to split concerns accross the application.
So we will talk about layer architecture (yep, also known as N-Tier architecture).
So, we have a better idea of what a generic architecture should be, now let's apply it on Android: Let's talk about the application object, and the service services layer, in particular we'll dive into the problem "do our business services have to be implemented extending Service ?".
Then I talk to you about a ServiceManager, that we have to implement, to centralize the management of all your services and all your threads pools.
And some much more :)
Enjoy the talk,
Registerable views (Cocoaheads May 2018 Lyon)Pierre Felgines
How to improve UITableView and UICollection registerCell / dequeueReusableCell API using Swift.
The result is modern, compact and readable : no more hard coded strings, no more long and incoherent naming, no more force cast to dequeue a cell.
13 Oct 2016 talk at Boston Ember.js
An overview methods to connect to a nested API using EmberData: override adapter methods, `ember-data-url-templates` add-on and links. As a relative newcomer to Ember, I’d presumed that nested ember routes should be mirrored with nested API resources/collections, but the “truth” is murky.
Building Lithium Apps (Like a Boss) was a workshop presented on the structure and philosophy of the Lithium framework and its applications, and how best to take advantage of them.
So you've been toying around with JavaScript. You have a basic feel for the language but don't quiet feel productive, yet. If so, this talk is for you. We'll peel away the abstractions, libraries, and frameworks to uncover the more interesting fundamentals of JavaScript.
How to write better code: in-depth best practices for writing readable, simpl...Oursky
From data structure and object to architecture to refactoring. YouTube videos included. Summary of Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin
References:
Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin (http://www.amazon.com/Clean-Code-Handbook-
Software-Craftsmanship/dp/0132350882)
Design Patterns: ELements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
The Clean Code Talks - "Global State and Singletons"
https://www.youtube.com/watch?v=-FRm3VPhseI
How to write better code: in-depth best practices for writing readable, simpl...Jane Chung
From data structure and object to architecture to refactoring. YouTube videos included. Summary of Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin
References:
Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin (http://www.amazon.com/Clean-Code-Handbook-
Software-Craftsmanship/dp/0132350882)
Design Patterns: ELements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
The Clean Code Talks - "Global State and Singletons"
https://www.youtube.com/watch?v=-FRm3VPhseI
In 2008 Android app code had a lot of boilerplate, and was very error prone.
More code.. more bugs!
Now it doesn't have to be... but that is an option that each developer needs to take!
Drupal 8 configuration system for coders and site builders - DrupalCamp Balti...swentel
Session given at DrupalCamp Baltics 2013. Overview of the configuration management system in Drupal 8. Covers the api, config entities, context system.
(AFF301) Fire Phone: The Dynamic Perspective API, Under the Hood | AWS re:Inv...Amazon Web Services
Fire phone's Dynamic Perspective adds a whole new dimension to UI and customer interaction, combining dedicated hardware and advanced algorithms to enable real-time head-tracking and 3D effects. This session goes behind the scenes with the Dynamic Perspective team, diving into the unique technical challenges they faced during development. Afterward, we explore the Dynamic Perspective SDK together so you leave the session knowing how to add innovative features like Peek, Tilt, 3D controls, and Parallax to your own apps.
UK Symfony Meetup, November 2012
Original presentation: https://docs.google.com/presentation/pub?id=1PLcqTby6yqSbfWlMIDHknH852DU6DO6OAgQJOtSEdsg&start=false&loop=false&delayms=3000
Here are my slides for my preparation class for possible Master students in Electrical Engineering and Computer Science (Specialization in Computer Science)... for the entrance examination here at Cinvestav GDL.
It is about philosophy: culture of a good programmerFernando Cejas
Philosophy is the study of general and fundamental problems, such as those connected with reality, existence, knowledge, values, reason, mind, and language.
Even though technical skills are a very positive thing, other qualifications are really more important: 'features' like respect, honesty or humility are required to become a better person and, thus, a better professional.
This is not an easy path to follow, and in order to accomplish it, let me share experiences on how to be a better programmer. Let's have a walk!
More Related Content
Similar to Dinosaurs and Androids: The Listview Evolution
So you've been toying around with JavaScript. You have a basic feel for the language but don't quiet feel productive, yet. If so, this talk is for you. We'll peel away the abstractions, libraries, and frameworks to uncover the more interesting fundamentals of JavaScript.
How to write better code: in-depth best practices for writing readable, simpl...Oursky
From data structure and object to architecture to refactoring. YouTube videos included. Summary of Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin
References:
Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin (http://www.amazon.com/Clean-Code-Handbook-
Software-Craftsmanship/dp/0132350882)
Design Patterns: ELements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
The Clean Code Talks - "Global State and Singletons"
https://www.youtube.com/watch?v=-FRm3VPhseI
How to write better code: in-depth best practices for writing readable, simpl...Jane Chung
From data structure and object to architecture to refactoring. YouTube videos included. Summary of Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin
References:
Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin (http://www.amazon.com/Clean-Code-Handbook-
Software-Craftsmanship/dp/0132350882)
Design Patterns: ELements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
The Clean Code Talks - "Global State and Singletons"
https://www.youtube.com/watch?v=-FRm3VPhseI
In 2008 Android app code had a lot of boilerplate, and was very error prone.
More code.. more bugs!
Now it doesn't have to be... but that is an option that each developer needs to take!
Drupal 8 configuration system for coders and site builders - DrupalCamp Balti...swentel
Session given at DrupalCamp Baltics 2013. Overview of the configuration management system in Drupal 8. Covers the api, config entities, context system.
(AFF301) Fire Phone: The Dynamic Perspective API, Under the Hood | AWS re:Inv...Amazon Web Services
Fire phone's Dynamic Perspective adds a whole new dimension to UI and customer interaction, combining dedicated hardware and advanced algorithms to enable real-time head-tracking and 3D effects. This session goes behind the scenes with the Dynamic Perspective team, diving into the unique technical challenges they faced during development. Afterward, we explore the Dynamic Perspective SDK together so you leave the session knowing how to add innovative features like Peek, Tilt, 3D controls, and Parallax to your own apps.
UK Symfony Meetup, November 2012
Original presentation: https://docs.google.com/presentation/pub?id=1PLcqTby6yqSbfWlMIDHknH852DU6DO6OAgQJOtSEdsg&start=false&loop=false&delayms=3000
Here are my slides for my preparation class for possible Master students in Electrical Engineering and Computer Science (Specialization in Computer Science)... for the entrance examination here at Cinvestav GDL.
It is about philosophy: culture of a good programmerFernando Cejas
Philosophy is the study of general and fundamental problems, such as those connected with reality, existence, knowledge, values, reason, mind, and language.
Even though technical skills are a very positive thing, other qualifications are really more important: 'features' like respect, honesty or humility are required to become a better person and, thus, a better professional.
This is not an easy path to follow, and in order to accomplish it, let me share experiences on how to be a better programmer. Let's have a walk!
Nowadays, we as android developers suffer serious problems regarding android fragmentation if we wanna use Material Design.
In this talk we will learn how to make backward compatibility easier when applying material design on older devices.
Welcome to the old school world of Material Design.
How to Become the MacGyver of Android Custom ViewsFernando Cejas
MacGyver is part Indiana Jones, part Sherlock Holmes.
He can turn a bicycle frame into a blowtorch, disarm a bomb with a hockey ticket, create a time machine with some duct tape and a paper clip or CREATE A CUSTOM VIEW IN ANDROID.
In this talk we will walk through the Android UI framework and learn how to push it to the next level by learning how views work and how to build custom ones that will let us create innovative a UIs.
Even though we are developers dealing with source code, it is good to know how to deal with UI/UX when building our user interfaces by applying tips and best practices.
So, in this session, we are gonna talk about android usability patterns, based on real cases and experiences with mobile development.
How ANDROID TESTING changed how we think about Death - Second EditionFernando Cejas
"Irreproducible bugs become highly reproducible right after delivery to the customer". This is something that happens "almost" everyday.
It is well known that testing offers significant advantages as a development practice and helps ensure higher quality code with fewer defects.
Unfortunately, testing Android apps can be challenging, so in this session we are gonna talk about available tools and practices that could help us accomplish our goals.
How ANDROID TESTING changed how we think about DeathFernando Cejas
"Irreproducible bugs become highly reproducible right after delivery to the customer". This is something that happens "almost" everyday.
It is well known that testing offers significant advantages as a development practice and helps ensure higher quality code with fewer defects.
Unfortunately, testing Android apps can be challenging, so in this session we are gonna talk about available tools and practices that could help us accomplish our goals.
Talk about different experiences related with mobile web and the android webview. Native vs Hybrid. Drawbacks and benefits of native and hybrid applications
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
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.
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.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
4. public abstract class AbsListView
extends AdapterView<ListAdapter>
public abstract class AdapterView
<T extends Adapter> extends
ViewGroup
Sunday, November 10, 13
6. /**
* Obtain the view and add it to our list of children. The view can be made
* fresh, converted from an unused view, or used as is if it was in the
* recycle bin.
*
* @param position Logical position in the list
* @param y Top or bottom edge of the view to add
* @param flow If flow is true, align top edge to y. If false, align bottom
*
edge to y.
* @param childrenLeft Left edge where children should be positioned
* @param selected Is this position selected?
* @return View that was added
*/
private View makeAndAddView(int position, int y, boolean flow, int childrenLeft,
boolean selected) {
View child;
if (!mDataChanged) {
// Try to use an existing view for this position
child = mRecycler.getActiveView(position);
if (child != null) {
// Found it -- we're using an existing child
// This just needs to be positioned
setupChild(child, position, y, flow, childrenLeft, selected, true);
return child;
}
}
// Make a new view for this position, or convert an unused view if possible
child = obtainView(position, mIsScrap);
// This needs to be positioned and measured
setupChild(child, position, y, flow, childrenLeft, selected, mIsScrap[0]);
return child;
}
Sunday, November 10, 13
ListView
7. /**
* Get a view and have it show the data associated with the specified
* position. This is called when we have already discovered that the view is
* not available for reuse in the recycle bin. The only choices left are
* converting an old view or making a new one.
*
* @param position The position to display
* @param isScrap Array of at least 1 boolean, the first entry will become true if
*
the returned view was taken from the scrap heap, false if otherwise.
*
* @return A view displaying the data associated with the specified position
*/
View obtainView(int position, boolean[] isScrap) {
isScrap[0] = false;
View scrapView;
scrapView = mRecycler.getTransientStateView(position);
if (scrapView != null) {
return scrapView;
}
scrapView = mRecycler.getScrapView(position);
View child;
if (scrapView != null) {
child = mAdapter.getView(position, scrapView, this);
...
}
Sunday, November 10, 13
AbsListView
11. Your code might call findViewById() frequently during the
scrolling of ListView, which can slow down performance. Even
when the Adapter returns an inflated view for recycling, you
still need to look up the elements and update them. A way
around repeated use of findViewById() is to use the "view
holder" design pattern.
Sunday, November 10, 13
12. @Override
protected View findViewTraversal(int id) {
if (id == mID) {
return this;
}
final View[] where = mChildren;
final int len = mChildrenCount;
for (int i = 0; i < len; i++) {
View v = where[i];
if ((v.mPrivateFlags & PFLAG_IS_ROOT_NAMESPACE) == 0) {
v = v.findViewById(id);
if (v != null) {
return v;
}
}
}
return null;
}
ViewGroup
Sunday, November 10, 13
19. /**
* This is where the invalidate() work actually happens. A full invalidate()
* causes the drawing cache to be invalidated, but this function can be called with
* invalidateCache set to false to skip that invalidation step for cases that do not
* need it (for example, a component that remains at the same dimensions with the same
* content).
*
* @param invalidateCache Whether the drawing cache for this view should be invalidated as
* well. This is usually true for a full invalidate, but may be set to false if the
* View's contents or dimensions have not changed.
*/
void invalidate(boolean invalidateCache) {
if (skipInvalidate()) {
return;
}
if ((mPrivateFlags & (PFLAG_DRAWN | PFLAG_HAS_BOUNDS)) == (PFLAG_DRAWN | PFLAG_HAS_BOUNDS) ||
(invalidateCache && (mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == PFLAG_DRAWING_CACHE_VALID) ||
(mPrivateFlags & PFLAG_INVALIDATED) != PFLAG_INVALIDATED || isOpaque() != mLastIsOpaque) {
mLastIsOpaque = isOpaque();
mPrivateFlags &= ~PFLAG_DRAWN;
mPrivateFlags |= PFLAG_DIRTY;
if (invalidateCache) {
mPrivateFlags |= PFLAG_INVALIDATED;
mPrivateFlags &= ~PFLAG_DRAWING_CACHE_VALID;
}
final AttachInfo ai = mAttachInfo;
final ViewParent p = mParent;
//noinspection PointlessBooleanExpression,ConstantConditions
if (!HardwareRenderer.RENDER_DIRTY_REGIONS) {
if (p != null && ai != null && ai.mHardwareAccelerated) {
// fast-track for GL-enabled applications; just invalidate the whole hierarchy
// with a null dirty rect, which tells the ViewAncestor to redraw everything
p.invalidateChild(this, null);
return;
}
}
}
}
if (p != null && ai != null) {
final Rect r = ai.mTmpInvalRect;
r.set(0, 0, mRight - mLeft, mBottom - mTop);
// Don't call invalidate -- we don't want to internally scroll
// our own bounds
p.invalidateChild(this, r);
}
Sunday, November 10, 13
View
20. 4
Mixed List
Remember one convertView for each type. Headers and Footers
http://www.flickr.com/photos/keesey/
Sunday, November 10, 13
21. /**
* Sets the data behind this ListView.
*
* The adapter passed to this method may be wrapped by a {@link
WrapperListAdapter},
* depending on the ListView features currently in use. For instance, adding
* headers and/or footers will cause the adapter to be wrapped.
*
* @param adapter The ListAdapter which is responsible for maintaining the
*
data backing this list and for producing a view to represent an
*
item in that data set.
*
* @see #getAdapter()
*/
@Override
public void setAdapter(ListAdapter adapter) {
if (mAdapter != null && mDataSetObserver != null) {
mAdapter.unregisterDataSetObserver(mDataSetObserver);
}
resetList();
mRecycler.clear();
if (mHeaderViewInfos.size() > 0|| mFooterViewInfos.size() > 0) {
mAdapter = new HeaderViewListAdapter(mHeaderViewInfos, mFooterViewInfos,
adapter);
} else {
mAdapter = adapter;
}
...
}
ListView
Sunday, November 10, 13
22. public View getView(int position, View convertView, ViewGroup parent) {
// Header (negative positions will throw an ArrayIndexOutOfBoundsException)
int numHeaders = getHeadersCount();
if (position < numHeaders) {
return mHeaderViewInfos.get(position).view;
}
// Adapter
final int adjPosition = position - numHeaders;
int adapterCount = 0;
if (mAdapter != null) {
adapterCount = mAdapter.getCount();
if (adjPosition < adapterCount) {
return mAdapter.getView(adjPosition, convertView, parent);
}
}
}
// Footer (off-limits positions will throw an ArrayIndexOutOfBoundsException)
return mFooterViewInfos.get(adjPosition - adapterCount).view;
HeaderViewListAdapter
Sunday, November 10, 13
27. lv_list.setRecyclerListener(new AbsListView.RecyclerListener() {
@Override
public void onMovedToScrapHeap(View view) {
}
});
/**
* Sets the recycler listener to be notified whenever a View is set aside in
* the recycler for later reuse. This listener can be used to free resources
* associated to the View.
*
* @param listener The recycler listener to be notified of views set aside
*
in the recycler.
*
* @see android.widget.AbsListView.RecycleBin
* @see android.widget.AbsListView.RecyclerListener
*/
public void setRecyclerListener(RecyclerListener listener) {
mRecycler.mRecyclerListener = listener;
}
AbsListView
Sunday, November 10, 13
28. /**
* Set whether this view is currently tracking transient state that the
* framework should attempt to preserve when possible. This flag is reference counted,
* so every call to setHasTransientState(true) should be paired with a later call
* to setHasTransientState(false).
*
* <p>A view with transient state cannot be trivially rebound from an external
* data source, such as an adapter binding item views in a list. This may be
* because the view is performing an animation, tracking user selection
* of content, or similar.</p>
*
* @param hasTransientState true if this view has transient state
*/
public void setHasTransientState(boolean hasTransientState) {
mTransientStateCount = hasTransientState ? mTransientStateCount + 1 :
mTransientStateCount - 1;
if (mTransientStateCount < 0) {
mTransientStateCount = 0;
Log.e(VIEW_LOG_TAG, "hasTransientState decremented below 0: " +
"unmatched pair of setHasTransientState calls");
}
if ((hasTransientState && mTransientStateCount == 1) ||
(!hasTransientState && mTransientStateCount == 0)) {
// update flag if we've just incremented up from 0 or decremented down to 0
mPrivateFlags2 = (mPrivateFlags2 & ~PFLAG2_HAS_TRANSIENT_STATE) |
(hasTransientState ? PFLAG2_HAS_TRANSIENT_STATE : 0);
if (mParent != null) {
try {
mParent.childHasTransientStateChanged(this, hasTransientState);
} catch (AbstractMethodError e) {
Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
" does not fully implement ViewParent", e);
}
}
}
}
View
Sunday, November 10, 13
29. /**
* Starts the underlying Animator for a set of properties. We use a single animator that
* simply runs from 0 to 1, and then use that fractional value to set each property
* value accordingly.
*/
private void startAnimation() {
mView.setHasTransientState(true);
ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
ArrayList<NameValuesHolder> nameValueList =
(ArrayList<NameValuesHolder>) mPendingAnimations.clone();
mPendingAnimations.clear();
int propertyMask = 0;
int propertyCount = nameValueList.size();
for (int i = 0; i < propertyCount; ++i) {
NameValuesHolder nameValuesHolder = nameValueList.get(i);
propertyMask |= nameValuesHolder.mNameConstant;
}
mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
if (mPendingSetupAction != null) {
mAnimatorSetupMap.put(animator, mPendingSetupAction);
mPendingSetupAction = null;
}
if (mPendingCleanupAction != null) {
...
}
ViewPropertyAnimator
Sunday, November 10, 13