Presentation by Gabor Varadi (@zhuinden)
What Activity and Fragment actually are in Android
What are the problems they solve, and what are their downsides
How to use a custom solution that simplifies navigation in Android applications
https://github.com/Zhuinden/navigation-example
Reactive state management with Jetpack ComponentsGabor Varadi
This talk explains what problems exist in the context of Android application development, how Jetpack components such as SavedStateHandle help handle that, and how we can combine observable values to expose our state, to be observed only when it is needed.
Simplified Android Development with Simple-StackGabor Varadi
This talk describes multiple Activities, Jetpack Navigation, and Simple-Stack in a single-activity android application context. How to develop screens and navigation using Simple-Stack.
Building React Applications with Redux
with Yuri Takhteyev
OVERVIEW
Since React is just a “view framework”, it leaves you with lots of options for how to architect the deeper parts of your stack. The best way to handle those deeper layers is by using Redux – a state container that allows you to write much of your application in the form of pure functions. Using Redux helps you write applications that are much easier to test and understand and to achieve more thorough separation between your views and your business logic. Redux also unlocks the possibility of using amazing tools.
OBJECTIVE
Introduce the audience to Redux, a state container that can be used together with React to achieve sanity deeper down in your stack.
TARGET AUDIENCE
Developers familiar with core React and looking for a better way to architect their applications.
ASSUMED AUDIENCE KNOWLEDGE
Core React knowledge is assumed. Familiarity with basic Flux concepts would help, but I’ll review those quickly.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
Why pure functions make your code easier to maintain.
How unidirectional data flows help you sleep better at night.
How Redux helps you manage state better via reducers.
How to use Redux together with React.
How to test Redux applications.
React – Structure Container Component In MeteorDesignveloper
Over the past two months, I have been working on an interesting project at my company which is supposed to be a very big one. So at first, as a team leader and core maker, I spent quite a lot of time to find a good starting point, I meant stuff like how to structure the project, which frontend stack to use, how that stack connects to server, how to set up and bring all those things together, etc, to satisfy all the project’s requirements.....
Reactive state management with Jetpack ComponentsGabor Varadi
This talk explains what problems exist in the context of Android application development, how Jetpack components such as SavedStateHandle help handle that, and how we can combine observable values to expose our state, to be observed only when it is needed.
Simplified Android Development with Simple-StackGabor Varadi
This talk describes multiple Activities, Jetpack Navigation, and Simple-Stack in a single-activity android application context. How to develop screens and navigation using Simple-Stack.
Building React Applications with Redux
with Yuri Takhteyev
OVERVIEW
Since React is just a “view framework”, it leaves you with lots of options for how to architect the deeper parts of your stack. The best way to handle those deeper layers is by using Redux – a state container that allows you to write much of your application in the form of pure functions. Using Redux helps you write applications that are much easier to test and understand and to achieve more thorough separation between your views and your business logic. Redux also unlocks the possibility of using amazing tools.
OBJECTIVE
Introduce the audience to Redux, a state container that can be used together with React to achieve sanity deeper down in your stack.
TARGET AUDIENCE
Developers familiar with core React and looking for a better way to architect their applications.
ASSUMED AUDIENCE KNOWLEDGE
Core React knowledge is assumed. Familiarity with basic Flux concepts would help, but I’ll review those quickly.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
Why pure functions make your code easier to maintain.
How unidirectional data flows help you sleep better at night.
How Redux helps you manage state better via reducers.
How to use Redux together with React.
How to test Redux applications.
React – Structure Container Component In MeteorDesignveloper
Over the past two months, I have been working on an interesting project at my company which is supposed to be a very big one. So at first, as a team leader and core maker, I spent quite a lot of time to find a good starting point, I meant stuff like how to structure the project, which frontend stack to use, how that stack connects to server, how to set up and bring all those things together, etc, to satisfy all the project’s requirements.....
Let's Redux! by Joseph Chiang
Published April 15, 2016 in Technology
For people who use React but haven’t tried Redux.
- Why - Common issues while people use React
- Redux Basic Concept
В презентации описаны лучшие практики использования библиотеки React в связке с Redux. Быстрое разворачивание SPA без настройки Webpack и Babel с помощью утилиты Create React App, Smart and Dumb, Stateful and Stateless Components, управление рендером с помощью shouldComponentUpdate, Redux модули, мемоизация и middlewares.
More useful info on our:
- website: https://clickky.biz
- blog: https://clickky.biz/blog
Sign up!
React is a fantastic Javascript rendering framework with a steep learning curve. One of the reasons is understanding state. We explore unidirectional flow, props, state Immutability and Redux.
Adding a modern twist to legacy web applicationsJeff Durta
Avoid misery of working with legacy code
We will see how you can add independent and isolated components to existing pages; pages that may be difficult to change
React and Flux allow you to make self-contained additions that handle their own data access/persistence
On May 14, 2015, Jeff Winkler gave a talk at Harvard University's Lamont Library titled "Intro to ReactJS."
Description
Created by Facebook and Instagram, React has recently been embraced by companies and organizations including Airbnb, Khan Academy, Reddit, the BBC, and Code Academy. This presentation will be especially interesting for those using or planning to use javascript libraries such as angularJS, backbone.js, ember.js, and others.
For this talk, Jeff Winkler will present:
- An introduction to React, mixed with demos.
- An examination of how React implements Computer Science principles from Functional and Object-Oriented. The discussion will consider the impact on maintainable large-scale systems.
Biography
Jeff Winkler, is a professional developer* in the Boston area and organizer of the Boston ReactJS Meetup. In addition to the ReactJS Boston Meetup, Jeff works with React professionally at TapJoy and runs http://react.rocks.
(* Full-stack guy. ReactJS, Rails, TDD. Best OODA loop wins)
Slides for the 2016 Redux & Angular workshop. Redux is a popular library for state management. This workshop is about understanding how to use Redux and how to integrate it wit Angular 2
Slides from the "Data flow architecture in angular2 with redux". Introduction to Redux, it's inspirations and implementation. Join the "AngularJS-IL" meetup group for more community events and workshops! (http://www.meetup.com/AngularJS-IL/events/229660127/)
Workshop Apps with ReactNative III:
- React Native short Recap
- The Native Side
- Building Native Modules (iOS & Android)
- Building Native Components (iOS & Android)
Presentado por ingenieros Alberto Irurueta y Enrique Oriol
Let's Redux! by Joseph Chiang
Published April 15, 2016 in Technology
For people who use React but haven’t tried Redux.
- Why - Common issues while people use React
- Redux Basic Concept
В презентации описаны лучшие практики использования библиотеки React в связке с Redux. Быстрое разворачивание SPA без настройки Webpack и Babel с помощью утилиты Create React App, Smart and Dumb, Stateful and Stateless Components, управление рендером с помощью shouldComponentUpdate, Redux модули, мемоизация и middlewares.
More useful info on our:
- website: https://clickky.biz
- blog: https://clickky.biz/blog
Sign up!
React is a fantastic Javascript rendering framework with a steep learning curve. One of the reasons is understanding state. We explore unidirectional flow, props, state Immutability and Redux.
Adding a modern twist to legacy web applicationsJeff Durta
Avoid misery of working with legacy code
We will see how you can add independent and isolated components to existing pages; pages that may be difficult to change
React and Flux allow you to make self-contained additions that handle their own data access/persistence
On May 14, 2015, Jeff Winkler gave a talk at Harvard University's Lamont Library titled "Intro to ReactJS."
Description
Created by Facebook and Instagram, React has recently been embraced by companies and organizations including Airbnb, Khan Academy, Reddit, the BBC, and Code Academy. This presentation will be especially interesting for those using or planning to use javascript libraries such as angularJS, backbone.js, ember.js, and others.
For this talk, Jeff Winkler will present:
- An introduction to React, mixed with demos.
- An examination of how React implements Computer Science principles from Functional and Object-Oriented. The discussion will consider the impact on maintainable large-scale systems.
Biography
Jeff Winkler, is a professional developer* in the Boston area and organizer of the Boston ReactJS Meetup. In addition to the ReactJS Boston Meetup, Jeff works with React professionally at TapJoy and runs http://react.rocks.
(* Full-stack guy. ReactJS, Rails, TDD. Best OODA loop wins)
Slides for the 2016 Redux & Angular workshop. Redux is a popular library for state management. This workshop is about understanding how to use Redux and how to integrate it wit Angular 2
Slides from the "Data flow architecture in angular2 with redux". Introduction to Redux, it's inspirations and implementation. Join the "AngularJS-IL" meetup group for more community events and workshops! (http://www.meetup.com/AngularJS-IL/events/229660127/)
Workshop Apps with ReactNative III:
- React Native short Recap
- The Native Side
- Building Native Modules (iOS & Android)
- Building Native Components (iOS & Android)
Presentado por ingenieros Alberto Irurueta y Enrique Oriol
Esta charla comprende las lecciones aprendidas convirtiendo la app de Android de Teambox (una app repleta de deuda técnica y con un alto nivel de acoplamiento entre clases), en la versión actual de Redbooth, que intenta cumplir la arquitectura Hexagonal y los principios SOLID. Durante la exposición explicaremos como fuimos desenredando el código paso a paso; como aplicamos por partes los conceptos de la arquitectura hexagonal; como dejamos de lado componentes del framework de Android que dificultaban el mantenimiento de la app; y que errores cometimos, como los solucionamos y como se podrían haber evitado.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
top nidhi software solution freedownloadvrstrong314
This presentation emphasizes the importance of data security and legal compliance for Nidhi companies in India. It highlights how online Nidhi software solutions, like Vector Nidhi Software, offer advanced features tailored to these needs. Key aspects include encryption, access controls, and audit trails to ensure data security. The software complies with regulatory guidelines from the MCA and RBI and adheres to Nidhi Rules, 2014. With customizable, user-friendly interfaces and real-time features, these Nidhi software solutions enhance efficiency, support growth, and provide exceptional member services. The presentation concludes with contact information for further inquiries.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
2. What do we think we know about
Activities?
From https://developer.android.com/guide/components/intents-filters.html
„Starting an activity
An Activity represents a single screen in an app.
You can start a new instance of an Activity by
passing an Intent to startActivity().
The Intent describes the activity to start and
carries any necessary data.”
3. What do we think we know about
Fragments?
From https://developer.android.com/guide/components/fragments.html
„A Fragment represents a behavior or a portion
of user interface in an Activity. You can combine
multiple fragments in a single activity to build a
multi-pane UI and reuse a fragment in multiple
activities.”
5. Dianne Hackborn
„How should I design my Android
application?”
Activity
Once we have gotten in to this entry-point to your UI, we really don't
care how you organize the flow inside.
Make it all one activity with manual changes to its views, use
fragments (a convenience framework we provide) or some other
framework, or split it into additional internal activities. Or do all three
as needed.
As long as you are following the high-level contract of activity (it
launches in the proper state, and saves/restores in the current state),
it doesn't matter to the system.
6. What does that tell us?
• Activities are not „screens”, they are entry points to the
app (like a main function)
• The high-level Activity contract is showing UI for current
state, handling initial state, and persist state across
configuration change and process death
• Fragments are just a „convenience framework” —
technically they are ViewControllers with lifecycle
integration
• Android does NOT care how you handle the flow inside
your application!
7. Wait, process death?
• Step 1: put app in background with HOME
• Step 2: press „Terminate application”
• Step 3: restart app from launcher
• Step 4: enjoy strange behavior
(app restart, statics are cleared, savedInstanceState != null)
8. What IS the flow inside your
application?
• Navigation
– where you are in your application (and what to show)
– where you came from, back/up navigation
– remembering navigation state across config change
and process death
• Scoping
– what data needs to be shown
– what services need to exist (singleton and subscopes)
– how to keep scoped services alive across config
change
10. Passing objects through the context
hierarchy: getSystemService() trick
• Any object can be exposed via the Context
hierarchy by overriding getSystemService()
• Objects from Activity (and the activity!) can be
exposed directly via Activity.getSystemService()
• Objects in subscope of Activity can be exposed
through ContextWrapper.getSystemService()
by inflating the view with a cloned layout inflater
LayoutInflater.from(baseContext)
.cloneInContext(contextWrapper);
11. Exposing objects through the Context
from the Activity
public class MainActivity
extends AppCompatActivity {
private static final String TAG = "MainActivity";
public static MainActivity get(Context context) {
// noinspection ResourceType
return (MainActivity)context.getSystemService(TAG);
}
@Override
public Object getSystemService(String name) {
if(TAG.equals(name)) {
return this; // <-- now MainActivity.get(context) works
}
return super.getSystemService(name);
}
}
12. public class KeyContextWrapper extends ContextWrapper {
public static final String TAG = "Backstack.KEY";
LayoutInflater layoutInflater;
final Object key;
public KeyContextWrapper(Context base, @NonNull Object key) {
super(base);
this.key = key;
}
public static <T> T getKey(Context context) {
// noinspection ResourceType
Object key = context.getSystemService(TAG);
// noinspection unchecked
return (T) key;
}
@Override
public Object getSystemService(String name) {
if(Context.LAYOUT_INFLATER_SERVICE.equals(name)) {
if(layoutInflater == null) {
layoutInflater = LayoutInflater.from(getBaseContext())
.cloneInContext(this);
}
return layoutInflater;
} else if(TAG.equals(name)) {
return key; // <-- now KeyContextWrapper.getKey(context) works
}
return super.getSystemService(name);
}
}
14. Scoping
Allowing data and services to exist for the entire duration of
when the screen is visible, and not be killed on configuration
changes.
Child scopes should be able to inherit from their superscope.
Things that set out to solve scoping problem:
- Activity: onRetainCustomNonConfigurationInstance()
- Fragment: retained fragments
- Loaders
- square/Mortar: MortarScope
- lyft/Scoop: Scoop
- zhuinden/Service-Tree: ServiceTree
- Architectural Components: ViewModel
15. Goal of scoping
• The goal is to make sure the data and services exist for as long as
the scope
• When the scope is destroyed (as it is no longer needed), the data
and services are torn down along with it
• In advanced use:
– scoped data becomes a dependency that is provided to
constructor, but obtained asynchronously and observed for
changes
(LiveData, BehaviorRelay, Observable + RxReplayingShare)
– Dagger component is subscoped, and provides the data as
scoped dependency
– The Dagger component is stored in the scope to survive
configuration changes
18. The common approach to simplifying
the problem
• Create only Singleton scope (and a single global
injector), everything else is unscoped
• Unscoped dependencies have their state
persisted to Bundle, and restored if state exists
• Also: if the ViewController is preserved even
without its view hierarchy, then it can BE the
scope!
(retained fragments, Conductor’s Controller)
19. Navigation
• We must know where we are, remember where we have been
• This state must be preserved across configuration changes and
process death
• Things that set out to solve Navigation problem:
– Activity record stack
– Fragment backstack
– square/flow 0.8
– lyft/scoop
– square/flow 1.0-alpha3
– terrakok/Cicerone (no backstack, only command queue)
– bluelinelabs/Conductor
– zhuinden/simple-stack
– wealthfront/magellan (don’t use it – does NOT preserve state
across process death!!!)
20. Checklist for what a backstack should
be able to do
• Handling state persistence across config change /
process death
• Should receive both the previous and the new state on
state change
• Animations are asynchronous – operations must be
enqueued
• State changer is not always available (after onPause) –
operations must be enqueued
21. How do Activities handle navigation?
• Intents to start new Activities
• Parameters are provided in the extras Bundle, generally
as a dynamically typed storage with string keys
• Intents have „intent flags” to manipulate „task stack”
(CLEAR_TOP, REORDER_TO_FRONT, etc.)
• Downsides:
– You can’t easily tell what Activities exist in the background
– Modifying stack needs tricky combinations of intent flags
(no fine-grained control)
– No notifications about change (previous state, new state)
– Complicated lifecycle if multiple Activities exist
23. How are Fragments generally used for
navigation?
• FragmentTransactions (begin/commit)
• Tutorials typically show „replace()” in conjunction with
„addToBackStack()”
• The backstack stores transactions (operations) with a tag to
pop to (inclusive/exclusive)
• (Parameters are also provided as Bundle, called arguments)
• Downsides:
– onBackstackChanged() provides change notification, but does
not provide previous and new states (also it’s kinda random)
– Stack stores operations instead of active fragments, so
asymmetric navigation is super-difficult
– commit() runs transaction on the NEXT event loop
(what about onPause?
„Cannot perform after onSaveInstanceState()”)
24. Principle of Flow (and its variants)
• „Flow” is a custom backstack to store current state and
history
• Content of the backstack is saved to and restored from
Bundle (for process death) as Parcelables
• State is represented as immutable parcelable value objects,
called Keys
• Keys contain all necessary data in order to set up the initial
state (like Intent extras), but as typed values of the class
• List of previous / new keys are both available („Traversal”,…)
25. @AutoValue
public abstract class TaskDetailKey
implements Key, Parcelable {
public abstract String taskId(); // <- instead of static final TASK_ID = „TASK_ID”;
public static TaskDetailKey create(String taskId) {
return new AutoValue_TaskDetailKey(R.layout.path_taskdetail, taskId);
}
@Override
public int menu() {
return R.menu.taskdetail_fragment_menu;
}
@Override
public boolean isFabVisible() {
return true;
}
@Override
public View.OnClickListener fabClickListener(View view) {
return v -> {
((TaskDetailView)view).editTask();
};
}
@Override
public int fabDrawableIcon() {
return R.drawable.ic_edit;
}
}
26. @PaperParcel
data class TaskDetailKey(val taskId: String)
: Key, PaperParcelable {
override fun layout() = R.layout.task_detail
override fun menu() = R.menu.taskdetail_fragment_menu
override fun isFabVisible() = true
override fun fabClickListener(view: View) {
return View.OnClickListener {
v -> (view as SecondView).editTask()
}
}
override fun fabDrawableIcon() = R.drawable.ic_edit
companion object {
@JvmField val CREATOR = PaperParcelTaskDetailKey.CREATOR
}
}
28. Displaying the View for a given Key
• Our Key specifies what we want to show
• We need to handle the events of the views (clicks, text
changes, etc.)
• For that, we need a „ViewController” (which can be used
inside an Activity, so not an Activity)
• Possible options:
– Custom ViewGroup
– Fragment
– lyft/scoop’s ViewController
– square/coordinators’s Coordinator
– bluelinelabs/Conductor’s Controller
32. Same thing using library defaults
Navigator.install(this, root,
HistoryBuilder.single(FirstKey.create()));
Or showing off some configuration builders...
Navigator.configure()
.setStateChanger(DefaultStateChanger
.configure()
.create(this, root))
.install(this, root,
HistoryBuilder.single(FirstKey.create()));
34. But what about Fragments?
• Fragments are also ViewControllers
• Activity provides them with lifecycle integration
out of the box
• FragmentManager keeps track of them and their
state transitions
• All added fragments are recreated after process
death by super.onCreate() in Activity
• (Supports nesting out of the box... with caveats)
35. Fragment Ops beyond „replace”
• Other useful operators of FragmentTransaction:
– Add/remove:
• Create fragment and its view hierarchy
• Destroy view hierarchy, and fragment as well
– Attach/detach:
• Restore view state, (re-)create view hierarchy
• preserve view state, but destroy view hierarchy
– commitNow():
• Execute the fragment transaction synchronously
• Note: this method cannot be used alongside addToBackStack()
• Using these operators, we can combine this with a custom
backstack, by keeping the fragments and their state alive,
but only the currently visible view hierarchy.
36. Key for the Fragment
public abstract class BaseKey implements Key {
@Override
public String getFragmentTag() {
return toString();
}
@Override
public final BaseFragment newFragment() {
BaseFragment fragment = createFragment();
Bundle bundle = fragment.getArguments();
if (bundle == null) {
bundle = new Bundle();
}
bundle.putParcelable("KEY", this); // => <T> T getKey() { … }
fragment.setArguments(bundle);
return fragment;
}
protected abstract BaseFragment createFragment();
}
37. Handling state change with Fragments
• Remove all Fragments that were in previous
state, but are no longer in the new state
(if they are still in new state, then just detach
them)
• Create and add all fragments that are in the new
state and not yet added
• In the new state, if the current top already exists
but is detached, then attach it, if it doesn’t exist,
then create it and add it
(and detach all other non-top fragments)
• Commit transaction now
41. Additional resources
Advocating against Android Fragments
Simpler Apps with Flow and Mortar
Michael Yotive: State of Fragments in 2017
Simplified Fragment Navigation using a custom
backstack
Communication between same-level components => superscoped service with change listeners
Flow: Traversal, Scoop: RouteChange, Simple-Stack: StateChange, Conductor: RouterTransaction
Keys were also once called „Screen”
This code runs for the current top state, both on forward AND back navigation!
Mortar’s ViewPresenter was responsible for Custom Viewgroup’s onSaveInstanceState() integration. It wasn’t particularly good though and could result in very hard to fix state persistence bugs.