The Data Binding framework was one of Google’s announcements at I/O 2015, it’s a big change in the code organization of an Android app. Some developers are sceptical about this framework but, if used in the “right way”, it’s very powerful and it allows to remove a lot of redundant boilerplate code from activities and fragments.
In this talk we’ll start from the Data Binding basic concepts and then we’ll see how to use it to improve the architecture of a typical Android application applying the Model View ViewModel pattern. Using this pattern you need to write less code to create an app that can be easily tested using JVM and instrumentation tests.
This document discusses MVVM and data binding in Android development. It begins with an overview of MVVM theory and the roles of the model, view, and view model. It then covers Android's data binding library for linking UI components to data sources, including features like variable binding, listeners, and view model composition. The document also provides examples of using data binding with RecyclerView and accessing view values directly. It concludes with some links for further reading on MVVM patterns.
This document provides an overview of Android data binding, including how it works, lambdas, two-way data binding, new features announced at Google IO 2016, best practices and integration with MVVM and TDD. It discusses setting up data binding, using binding expressions and adapters, notifying views of changes, and avoiding common pitfalls like moving business logic to XML. The summary notes that data binding reduces boilerplate code but can introduce compiler errors, and emphasizes its power, official support from Google, and ability to easily integrate with custom views and libraries.
Data binding is a process that establishes a connection between an application's UI and its business logic so that when data changes, it is reflected in the UI and vice versa. Android introduced data binding in 2015 to minimize glue code between layouts and logic. The key steps to using data binding are: 1) adding the data binding library, 2) applying binding to layouts, 3) creating data binding objects, and 4) doing the binding in activities/fragments. Data binding supports observable objects to automatically update views when data changes. It allows binding layout properties like visibility and text fields.
MVVM + Data Binding is an architectural pattern that decouples the business logic from the user interface. It involves three layers: the Model layer contains the data, the View layer displays the UI, and the ViewModel layer contains the presentation logic and state. Using MVVM makes the code more testable and follows SOLID principles. The traditional way of having a single activity handle all responsibilities can be difficult to test due to high coupling, but with MVVM the Model and ViewModel layers can be tested independently of Android APIs.
This document discusses data binding in Android using the Android Data Binding Library. It provides an overview of data binding, which establishes a connection between application UI and business logic. It then discusses how the Android Data Binding Library works, including using observable objects to notify when data changes. It demonstrates how to set up data binding in an Android project using XML layouts and Java code. It also covers some advanced features like importing classes and methods into XML, handling click events, and surviving screen orientation changes with data binding. Finally, it discusses how data binding is well-suited for the MVVM pattern and concludes with some links for further information.
Android Data Binding in action using MVVM pattern - droidconUKFabio Collini
The document discusses Android Data Binding and the Model-View-ViewModel (MVVM) pattern. It covers the basics of data binding, using custom attributes with data binding, creating reusable UI components with data binding, implementing two-way data binding, and using data binding with RxJava and the MVVM pattern. The speaker presents code examples for setting up data binding in layout XML files and Java code, and binding data to views while ensuring automatic updates when the data changes.
This document discusses MVVM and data binding in Android development. It begins with an overview of MVVM theory and the roles of the model, view, and view model. It then covers Android's data binding library for linking UI components to data sources, including features like variable binding, listeners, and view model composition. The document also provides examples of using data binding with RecyclerView and accessing view values directly. It concludes with some links for further reading on MVVM patterns.
This document provides an overview of Android data binding, including how it works, lambdas, two-way data binding, new features announced at Google IO 2016, best practices and integration with MVVM and TDD. It discusses setting up data binding, using binding expressions and adapters, notifying views of changes, and avoiding common pitfalls like moving business logic to XML. The summary notes that data binding reduces boilerplate code but can introduce compiler errors, and emphasizes its power, official support from Google, and ability to easily integrate with custom views and libraries.
Data binding is a process that establishes a connection between an application's UI and its business logic so that when data changes, it is reflected in the UI and vice versa. Android introduced data binding in 2015 to minimize glue code between layouts and logic. The key steps to using data binding are: 1) adding the data binding library, 2) applying binding to layouts, 3) creating data binding objects, and 4) doing the binding in activities/fragments. Data binding supports observable objects to automatically update views when data changes. It allows binding layout properties like visibility and text fields.
MVVM + Data Binding is an architectural pattern that decouples the business logic from the user interface. It involves three layers: the Model layer contains the data, the View layer displays the UI, and the ViewModel layer contains the presentation logic and state. Using MVVM makes the code more testable and follows SOLID principles. The traditional way of having a single activity handle all responsibilities can be difficult to test due to high coupling, but with MVVM the Model and ViewModel layers can be tested independently of Android APIs.
This document discusses data binding in Android using the Android Data Binding Library. It provides an overview of data binding, which establishes a connection between application UI and business logic. It then discusses how the Android Data Binding Library works, including using observable objects to notify when data changes. It demonstrates how to set up data binding in an Android project using XML layouts and Java code. It also covers some advanced features like importing classes and methods into XML, handling click events, and surviving screen orientation changes with data binding. Finally, it discusses how data binding is well-suited for the MVVM pattern and concludes with some links for further information.
Android Data Binding in action using MVVM pattern - droidconUKFabio Collini
The document discusses Android Data Binding and the Model-View-ViewModel (MVVM) pattern. It covers the basics of data binding, using custom attributes with data binding, creating reusable UI components with data binding, implementing two-way data binding, and using data binding with RxJava and the MVVM pattern. The speaker presents code examples for setting up data binding in layout XML files and Java code, and binding data to views while ensuring automatic updates when the data changes.
This document discusses Android data binding. It begins by explaining what data binding is and providing simple examples of how to bind data to views using strings, objects, and variables. It then covers more advanced topics like creating a data binding class, setting variable values, two-way binding, binding adapters, using data binding with RecyclerView, and the performance benefits of data binding.
The document discusses using dependency injection (DI) with Vaadin applications. It explains that DI allows defining abstractions and implementations as beans that can then be injected where needed. This loosens coupling and enables features like scopes. The event bus is presented as an example DI extension. Tips are provided like automatically setting up menus based on view bean annotations and internationalization support. Overall DI is said to decouple code and ensure best practices.
This document introduces the Vaadin framework, which is a user interface framework for building rich web applications. It discusses how Vaadin enables developer productivity through features like user interface components, automated communication between the client and server, and support for multiple devices. The document also covers trends in web frameworks like AngularJS and web components, and how Vaadin is exploring these trends through new components in Vaadin Labs and building web components with GWT.
Vaadin DevDay 2017 - Data Binding in Vaadin 8Peter Lehto
The document discusses improving editing of customer records in Vaadin 7 applications. It outlines issues with directly using setters and listeners on each field, such as lots of code, implicit saving, and difficulty validating values. It recommends using a FieldGroup to bind fields to properties, which avoids explicit setters, allows committing or discarding changes, and integrates validation into the commit process. However, it notes there may still be room for improvement over the Vaadin 7 approach.
Why is DI so great? Learn about the basics concepts of Dependency Injection and how to efficiently utilise it with Vaadin 8. This talk is from Vaadin DevDay series and features some cool ideas how developers can be the most out of Vaadin and Spring Framework
Vaadin 8 with Spring Frameworks AutoConfigurationPeter Lehto
AutoConfiguration is an amazing feature of Spring Boot allowing integrating technologies more easily. Vaadin utilises AutoConfiguration for setting up beautiful Vaadin UIs with Spring Boot Applications. This talks tells all about how Boot's AutoConfiguration works with Vaadin and what kind of benefits it provides for developers
Building impressive layout systems with vaadinPeter Lehto
The document discusses building layout systems for mobile, desktop, and tablet applications using Vaadin. It covers setting up navigation with views, using the UI as a bean, navigation managers, view displays, responsive design, events and security. The key lessons are that bean-based UIs provide easier enterprise integration, Vaadin supports CDI and Spring beans, the navigator API simplifies navigation, responsive design is integrated with the Valo theme, and events allow for loose coupling between scoped components.
The document discusses the history and future of the Vaadin framework. It outlines how Vaadin has evolved from version 1 through version 8 to incorporate new technologies like Web Components and Polymer. It describes how Vaadin Components and Vaadin Flow represent the next generation of Vaadin apps, built with these modern web standards to provide a simpler development model and better performance. Vaadin Flow uses declarative composition, new UI components, latency compensation through event handlers, and client-side views to develop apps.
Techlunch - Dependency Injection with VaadinPeter Lehto
The document discusses dependency injection (DI) with programmatic configuration. It defines DI as a mechanism where dependencies between objects are not directly created but instead satisfied by a third party - a DI container. The document outlines reasons for using DI including loose coupling and inversion of control. It provides examples of DI in Java using annotations and explains concepts such as scopes, producers and programmatic configuration. It also discusses integrating DI into Vaadin applications using CDI extensions.
What's new in Vaadin 8, how do you upgrade, and what's next?Marcus Hellberg
Presentation slides for the Vaadin 8 release meetup. Covers the new features in Vaadin 8 and 8.1, the migration steps from Vaadin 7 and what's up ahead for Vaadin.
This document discusses Vaadin, GWT, and Web Components. It contains the following key points:
1. Vaadin is a server-driven UI framework that uses GWT for client-side rendering.
2. Vaadin connectors bridge GWT and Vaadin by forming connections between client-side GWT widgets and server-side Vaadin components.
3. Web Components are emerging web standards for encapsulated custom elements that will be important in the future, but browser support is still lacking without polyfills like Polymer.
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...Infinum
We're checking out new data binding lib announced on the last Google I/O. We'll go in depth of data binding - goals, benefits and drawbacks. Less code should mean less bugs - in theory.
The document discusses the history and future of the Vaadin framework. It outlines how Vaadin has evolved from GWT-based widgets to modern web components using the Polymer library. It describes how Vaadin 10 introduces Vaadin Components that are built as reusable web components, allowing developers to create user interfaces with modern APIs and structure. The talk also covers how Vaadin now uses functional data binding with its Binder class to simplify editing and validation of business objects.
The document discusses Vaadin, a technology that empowers developers to build web apps for business purposes. Vaadin prioritizes developer productivity by simplifying the developer experience and saving developers' time so they can focus on building great user interfaces. The founder and CEO hopes that users are as excited about living and breathing the Vaadin brand, which aims to fight for simplicity for both users and developers.
Knockout.js is a JavaScript library that helps create rich and dynamic user interfaces by applying the model-view-viewmodel (MVVM) pattern. It provides declarative bindings between observable view models and HTML markup. Key features include:
- Declarative bindings that associate DOM elements with observable view model properties
- Automatic UI updates when view model data changes
- Dependency tracking and computed observables to transform view model data
- Templating to generate complex UIs from view model data
- Control flow bindings like if, foreach, with to manipulate DOM elements
Knockout.js is lightweight, has no dependencies, and supports all major browsers. It provides a clean and maintainable way
Binding business data to vaadin componentsPeter Lehto
There are two main differences between setPropertyDataSource() and setContainerDataSource() for Vaadin components:
1. Data source type - setPropertyDataSource() binds the component to a single property, while setContainerDataSource() binds it to a full Container which can contain multiple items and properties.
2. Data binding - setPropertyDataSource() binds the component value to a specific property of the current item. setContainerDataSource() does not directly bind the component, it just sets the container as the available options but does not automatically select any value. The component does not know which property in the container to use as the value.
So in summary:
- setPropertyDataSource() binds a single component to a specific property
This document provides an introduction to Retrofit and RxJava. It discusses:
1. How Retrofit turns REST APIs into Java interfaces and handles JSON conversion.
2. What RxJava is and how it allows for composing asynchronous and event-based programs using observable sequences.
3. Examples of making HTTP requests with Retrofit, including defining services, making synchronous and asynchronous requests, and using callbacks and RxJava.
4. Key RxJava concepts like Observables, operators like map, flatMap, and zip, and threading.
This document discusses Android data binding. It begins by explaining what data binding is and providing simple examples of how to bind data to views using strings, objects, and variables. It then covers more advanced topics like creating a data binding class, setting variable values, two-way binding, binding adapters, using data binding with RecyclerView, and the performance benefits of data binding.
The document discusses using dependency injection (DI) with Vaadin applications. It explains that DI allows defining abstractions and implementations as beans that can then be injected where needed. This loosens coupling and enables features like scopes. The event bus is presented as an example DI extension. Tips are provided like automatically setting up menus based on view bean annotations and internationalization support. Overall DI is said to decouple code and ensure best practices.
This document introduces the Vaadin framework, which is a user interface framework for building rich web applications. It discusses how Vaadin enables developer productivity through features like user interface components, automated communication between the client and server, and support for multiple devices. The document also covers trends in web frameworks like AngularJS and web components, and how Vaadin is exploring these trends through new components in Vaadin Labs and building web components with GWT.
Vaadin DevDay 2017 - Data Binding in Vaadin 8Peter Lehto
The document discusses improving editing of customer records in Vaadin 7 applications. It outlines issues with directly using setters and listeners on each field, such as lots of code, implicit saving, and difficulty validating values. It recommends using a FieldGroup to bind fields to properties, which avoids explicit setters, allows committing or discarding changes, and integrates validation into the commit process. However, it notes there may still be room for improvement over the Vaadin 7 approach.
Why is DI so great? Learn about the basics concepts of Dependency Injection and how to efficiently utilise it with Vaadin 8. This talk is from Vaadin DevDay series and features some cool ideas how developers can be the most out of Vaadin and Spring Framework
Vaadin 8 with Spring Frameworks AutoConfigurationPeter Lehto
AutoConfiguration is an amazing feature of Spring Boot allowing integrating technologies more easily. Vaadin utilises AutoConfiguration for setting up beautiful Vaadin UIs with Spring Boot Applications. This talks tells all about how Boot's AutoConfiguration works with Vaadin and what kind of benefits it provides for developers
Building impressive layout systems with vaadinPeter Lehto
The document discusses building layout systems for mobile, desktop, and tablet applications using Vaadin. It covers setting up navigation with views, using the UI as a bean, navigation managers, view displays, responsive design, events and security. The key lessons are that bean-based UIs provide easier enterprise integration, Vaadin supports CDI and Spring beans, the navigator API simplifies navigation, responsive design is integrated with the Valo theme, and events allow for loose coupling between scoped components.
The document discusses the history and future of the Vaadin framework. It outlines how Vaadin has evolved from version 1 through version 8 to incorporate new technologies like Web Components and Polymer. It describes how Vaadin Components and Vaadin Flow represent the next generation of Vaadin apps, built with these modern web standards to provide a simpler development model and better performance. Vaadin Flow uses declarative composition, new UI components, latency compensation through event handlers, and client-side views to develop apps.
Techlunch - Dependency Injection with VaadinPeter Lehto
The document discusses dependency injection (DI) with programmatic configuration. It defines DI as a mechanism where dependencies between objects are not directly created but instead satisfied by a third party - a DI container. The document outlines reasons for using DI including loose coupling and inversion of control. It provides examples of DI in Java using annotations and explains concepts such as scopes, producers and programmatic configuration. It also discusses integrating DI into Vaadin applications using CDI extensions.
What's new in Vaadin 8, how do you upgrade, and what's next?Marcus Hellberg
Presentation slides for the Vaadin 8 release meetup. Covers the new features in Vaadin 8 and 8.1, the migration steps from Vaadin 7 and what's up ahead for Vaadin.
This document discusses Vaadin, GWT, and Web Components. It contains the following key points:
1. Vaadin is a server-driven UI framework that uses GWT for client-side rendering.
2. Vaadin connectors bridge GWT and Vaadin by forming connections between client-side GWT widgets and server-side Vaadin components.
3. Web Components are emerging web standards for encapsulated custom elements that will be important in the future, but browser support is still lacking without polyfills like Polymer.
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...Infinum
We're checking out new data binding lib announced on the last Google I/O. We'll go in depth of data binding - goals, benefits and drawbacks. Less code should mean less bugs - in theory.
The document discusses the history and future of the Vaadin framework. It outlines how Vaadin has evolved from GWT-based widgets to modern web components using the Polymer library. It describes how Vaadin 10 introduces Vaadin Components that are built as reusable web components, allowing developers to create user interfaces with modern APIs and structure. The talk also covers how Vaadin now uses functional data binding with its Binder class to simplify editing and validation of business objects.
The document discusses Vaadin, a technology that empowers developers to build web apps for business purposes. Vaadin prioritizes developer productivity by simplifying the developer experience and saving developers' time so they can focus on building great user interfaces. The founder and CEO hopes that users are as excited about living and breathing the Vaadin brand, which aims to fight for simplicity for both users and developers.
Knockout.js is a JavaScript library that helps create rich and dynamic user interfaces by applying the model-view-viewmodel (MVVM) pattern. It provides declarative bindings between observable view models and HTML markup. Key features include:
- Declarative bindings that associate DOM elements with observable view model properties
- Automatic UI updates when view model data changes
- Dependency tracking and computed observables to transform view model data
- Templating to generate complex UIs from view model data
- Control flow bindings like if, foreach, with to manipulate DOM elements
Knockout.js is lightweight, has no dependencies, and supports all major browsers. It provides a clean and maintainable way
Binding business data to vaadin componentsPeter Lehto
There are two main differences between setPropertyDataSource() and setContainerDataSource() for Vaadin components:
1. Data source type - setPropertyDataSource() binds the component to a single property, while setContainerDataSource() binds it to a full Container which can contain multiple items and properties.
2. Data binding - setPropertyDataSource() binds the component value to a specific property of the current item. setContainerDataSource() does not directly bind the component, it just sets the container as the available options but does not automatically select any value. The component does not know which property in the container to use as the value.
So in summary:
- setPropertyDataSource() binds a single component to a specific property
This document provides an introduction to Retrofit and RxJava. It discusses:
1. How Retrofit turns REST APIs into Java interfaces and handles JSON conversion.
2. What RxJava is and how it allows for composing asynchronous and event-based programs using observable sequences.
3. Examples of making HTTP requests with Retrofit, including defining services, making synchronous and asynchronous requests, and using callbacks and RxJava.
4. Key RxJava concepts like Observables, operators like map, flatMap, and zip, and threading.
As your app code gets larger and more complex, it makes sense to break your project out into smaller reusable components. But what’s the best way to do this? How can you clearly version your internal libraries? What kind of setup and maintenance can you expect? How much could it slow down development time?
In this talk we’ll dive into the various ways you can manage internal library dependencies. We’ll chat about the current state of Android dependency management, Gradle multi-project builds, Git submodules, and creating a private maven repository in Artifactory. The speaker will share real-world examples, and the pros and cons of each approach.
The document discusses a CodeLab on Android Wear. It includes an agenda for the CodeLab that covers creating a new project, adding libraries, layouts for smartwatches, communication with smartphones, and multi-fragment layouts. It provides code examples for creating WatchViewStubs, communicating between the mobile and wear modules using Teleport, and implementing a GridViewPager with fragments. The CodeLab aims to demonstrate building a simple survey app with Android Wear, including syncing data and updating the UI in response to changes.
What’s the best testing framework on Android? Espresso or Robotium? Robolectric or a plain JUnit test?
The reason why many developers don’t write tests is not due to the testing libraries but because of the low testability of the Android code.
In this talk we’ll see, thanks to a practical example, how to use Dependency Injection (using Dagger) and the Model View Presenter pattern to write a testable Android application.
Testable Android Apps using data binding and MVVMFabio Collini
The document discusses testing Android apps using data binding and MVVM. It covers setting up the MVVM architecture with a Note taking app example. It discusses using the Model-View-ViewModel pattern with data binding in Android. It also discusses how to write JVM unit tests for the ViewModel and mock dependencies by using stubs and spies.
This document outlines Pedro Gómez Sánchez's presentation on developing a world-class testing pipeline for Android applications. It discusses developing testable code through principles like dependency inversion and defining a testing pipeline to specify what to test (business logic, API integration, UI) and how (unit tests, integration tests, UI tests). Example code is provided for each type of test using tools like JUnit, Mockito, Robolectric and Espresso. The goal is to build trust in tests through an architecture and pipeline that facilitates isolated, repeatable testing.
This document summarizes the key aspects of building maintainable Android applications using MVP architecture and Dagger 2 for dependency injection. It discusses using MVP to separate concerns into Model, View, and Presenter classes and interfaces. It explains how Dagger 2 can be used to inject dependencies into classes while avoiding direct dependencies between classes. It provides examples of implementing MVP with Dagger 2 modules and components to inject dependencies into activities and presenters. It also discusses using subcomponents to scope dependencies to specific features and mocks for testing.
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginXavier Hallade
The document provides an agenda for a talk on mastering the Android NDK with Android Studio 2.0+. It discusses the history of Android Studio support for the NDK, current capabilities, migrating to the gradle-experimental plugin, and configuring NDK projects. Demo sections cover NDK code editing and debugging in Android Studio. Solutions covered for using the NDK include the gradle plugin, manual NDK builds, and mixing gradle plugins.
This document discusses creating custom views in Android. It covers default views provided by Android, reasons for creating custom views, the responsibilities of views, and how to create custom views by extending the View class and implementing key methods like onDraw(), onMeasure(), and onLayout(). It also discusses compound views, view lifecycles, defining custom attributes, and using custom views in layout files.
ConstraintLayout is a new layout supported by Google that allows creating complex layouts with flat view hierarchies using constraints. It measures and positions views during the measure-layout-draw cycle. ConstraintLayout solves performance issues of other layouts like nested weighted LinearLayouts and RelativeLayouts. It uses anchors and constraints to position views, and has tools in the visual editor to design and infer constraints. ConstraintLayout aims to create efficient UIs with scalability and flatten view hierarchies for animations.
The benefits of Clean Code are obvious: stable programs, better maintainability, finding bugs faster and easier upgrading of software. A lot of advices have been already written about Java clean code (first of all in Robert C. Martin book), what about Android? Are the same advices valid? Or the way we write code must be different because it's a mobile platform? Are there any best practices about resources and the other Android stuff? In this talk we'll see some practical examples of how take advantage of Java and Android framework to write clean code and keep a project manageable.
Librerie su Android: come non reinventare la ruota @ whymca 2012 Fabio Collini
Nei progetti J2EE siamo abituati a usare decine di librerie esterne, sia per classi di utilità sia per framework per strutturare meglio il codice. Come è messo Android da questo punto di vista? Nell'ultimo anno sono nati molti progetti interessanti (quasi tutti open source) che stanno portando un gran numero di librerie che permettono di non reinventare tutte le volte la ruota. In questo talk vedremo le principali librerie utilizzabili in un progetto Android evidenziando pregi e difetti di ognuna. Tramite una applicazione di esempio di librerie che permettono di evitare problemi di frammentazione (Android Compatibility Library e ActionBarSherlock), di quelle che mettono a disposizione nuovi componenti (GreedDroid, ViewPagerIndicator) e di quelle che cambiano radicalmente il modo di sviluppare una app (aQuery, Spring Mobile, AndroidAnnotations).
The document discusses using RxJava and MVVM together for Android development. It provides an overview of RxJava and how it can be used to compose asynchronous operations. It also explains the MVVM pattern and how it differs from MVP, with the ViewModel acting as a bridge between the Model and View. The document notes some mistakes made in their app but that they were able to recover by adopting RxJava and MVVM. It concludes by listing some resources for learning more about RxJava and code examples of MVVM.
Journey of an event, the android touch - Marco Cova, FacebookDroidConTLV
This document summarizes the journey of a touch event in an Android application. It begins at the Activity level and travels through various views and view groups as it is dispatched and handled. Key methods involved include dispatchTouchEvent(), onInterceptTouchEvent(), and onTouchEvent(). It also provides an overview of touch event types like ACTION_DOWN and ACTION_MOVE as well as techniques for handling multi-touch events and touch delegates.
This document outlines an introduction to the Android window system presented by Chia-I Wu. It covers the basic building blocks of SurfaceManager, WindowManager, and ActivityManager. It discusses concepts under the hood like process view, zygote, and binder. It also provides guidance on development tools and code areas relevant to understanding the window system.
Acrhitecture deisign pattern_MVC_MVP_MVVMDong-Ho Lee
Look over MVC, MVP, MVVM pattern in android.
and introduce android data binding library.
You can follow this with simple project.
https://github.com/withleedh/patternChat
References
https://realm.io/kr/news/eric-maxwell-mvc-mvp-and-mvvm-on-android/
Would you like to make your Android UI code cleaner and more reactive? Android data binding can help. In this talk you’ll learn everything you need to know about data binding, including why it’s so powerful and how to use it effectively. If you haven’t tried data binding in the past, that’s okay! We’ll start with the basics, assuming no prior knowledge and slowly move into more advanced topics, such as 2-way binding, binding adapters, converters, best practices and common pitfalls to avoid.
The document provides an overview of how to get started developing Android applications. It discusses creating an Android project structure with Java code, XML layouts and resources. It also covers basic Android app components like activities, intents, views and lifecycle methods. The document then demonstrates how to work with lists, menus, context menus and storing data using SQLite and a database.
TechDay: Kick Start Your Experience with Android Wear - Mario VivianiCodemotion
The document provides an overview of how to build Android Wear applications. It discusses setting up an Android Wear project in Android Studio, establishing a connection between the mobile and wear modules using GoogleApiClient, and sending and receiving data and messages between the two modules via the Data Layer API and MessageAPI. It also presents an example application structure with a foreground activity on the mobile module and a WearableListenerService on the wear module to handle data and event handling.
Kick start your experience with android wear - Codemotion Rome 2015Codemotion
The document provides an overview of how to build Android Wear applications. It discusses setting up an Android Wear project in Android Studio, establishing a connection between the mobile and wear modules using GoogleApiClient, and sending and receiving data and messages between the two modules via the Data Layer API and MessageAPI. It also describes handling data events through a WearableListenerService to keep the wear activity lightweight.
※다운로드하시면 더 선명한 자료를 보실 수 있습니다.
벅스 Android 5.0에 Kotlin, Jetpack을 적용하면서 얻은 노하우와 시행착오를 공유합니다.
목차
1. 소개
2. Java to Kotlin
3. AAC (Android Architecture Components)
4. 미디어 앱 아키텍처(Media app architecture)
대상
- Kotlin과 Jetpack을 서비스에 적용하려는 Android 개발자
- 관련 Android 기술에 관심 있는 누구나
■관련 동영상: https://youtu.be/PqsjZn30XGE
The document discusses the components and utilities of the Backbone.js framework. It describes the key components of Backbone - Models, Collections, Views - and how they work together. Models contain interactive data and bind attributes to the DOM. Collections provide methods to manage ordered sets of models. Views handle templating and user interactions. The document also covers utilities like routing and events that help connect components.
Vaadin is a Java-based web application framework that allows building rich client-side web applications without JavaScript. The presentation discusses new features in Vaadin 7 including a renewed windowing API, Sass support for styling, redesign forms, improved RPC and state handling, and new JavaScript add-ons capabilities. It also outlines the roadmap for upcoming releases that will add server push, new charts, touch support, and integration with CDI.
This document discusses building mobile applications using PhoneGap, jQuery, and Dreamweaver. It provides an overview of different mobile application types including mobile HTML, web apps, hybrid apps, and native apps. It then demonstrates how to create hybrid mobile apps with PhoneGap and jQuery Mobile, including accessing device APIs, building user interfaces with jQuery Mobile, and creating lists and charts with JavaScript plugins. It also covers how to package and deploy the app to different platforms using PhoneGap.
This document discusses building mobile applications using PhoneGap, jQuery, and Dreamweaver. It provides an overview of different mobile application types including mobile HTML, web apps, hybrid apps, and native apps. It then demonstrates how to create hybrid mobile apps with PhoneGap and jQuery Mobile, including accessing device APIs, building user interfaces with jQuery Mobile, and creating customizable PhoneGap plugins.
Progressive Enhancment with Rails and ReactTyler Johnston
This document discusses using React with Rails to add interactivity and improve performance over traditional Rails development with full page refreshes. It explains that React uses reusable components with immutable data to render views, and integrates well with Rails by allowing components to be rendered on the server for SEO. The react-rails gem handles mounting React components and cleaning up references to prevent memory leaks when used with Turbolinks. Overall React is presented as a good solution for progressive enhancement of Rails applications with JavaScript.
/*!
* Modernizr v2.0.6
* http://www.modernizr.com
*
* Copyright (c) 2009-2011 Faruk Ates, Paul Irish, Alex Sexton
* Dual-licensed under the BSD or MIT licenses: www.modernizr.com/license/
*/
/*
* Modernizr tests which native CSS3 and HTML5 features are available in
* the current UA and makes the results available to you in two ways:
* as properties on a global Modernizr object, and as classes on the
* element. This information allows you to progressively enhance
* your pages with a granular level of control over the experience.
*
* Modernizr has an optional (not included) conditional resource loader
* called Modernizr.load(), based on Yepnope.js (yepnopejs.com).
* To get a build that includes Modernizr.load(), as well as choosing
* which tests to include, go to www.modernizr.com/download/
*
* Authors Faruk Ates, Paul Irish, Alex Sexton,
* Contributors Ryan Seddon, Ben Alman
*/
window.Modernizr = (function( window, document, undefined ) {
var version = '2.0.6',
Modernizr = {},
// option for enabling the HTML classes to be added
enableClasses = true,
docElement = document.documentElement,
docHead = document.head || document.getElementsByTagName('head')[0],
/**
* Create our "modernizr" element that we do most feature tests on.
*/
mod = 'modernizr',
modElem = document.createElement(mod),
mStyle = modElem.style,
/**
* Create the input element for various Web Forms feature tests.
*/
inputElem = document.createElement('input'),
smile = ':)',
toString = Object.prototype.toString,
// List of property values to set for css tests. See ticket #21
prefixes = ' -webkit- -moz- -o- -ms- -khtml- '.split(' '),
// Following spec is to expose vendor-specific style properties as:
// elem.style.WebkitBorderRadius
// and the following would be incorrect:
// elem.style.webkitBorderRadius
// Webkit ghosts their properties in lowercase but Opera & Moz do not.
// Microsoft foregoes prefixes entirely elements in IE6-9 are considered 'NoScope' elements and therefore will be removed
// when injected with innerHTML. To get around this you need to prepend the 'NoScope' element
// with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements.
// http://msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx
style = ['', ''].join('');
div.id = mod;
div.innerHTML += style;
docElement.appendChild(div);
ret = callback(div, rule);
div.parentNode.removeChild(div);
return !!ret;
},
// adapted from matchMedia polyfill
// by Scott Jehl and Paul Irish
// gist.github.com/786768
testMediaQuery = function( mq ) {
if ( window.matchMedia ) {
return matchMedia(mq).matches;
}
var bool;
injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', funct ...
Data Binding - Android by Harin Trivediharintrivedi
Data Binding plugin for the android studio which makes the android application development faster than you thought. meduim.com blog series included for reference:
https://medium.com/@Harry91/android-data-binding-binding-view-and-data-part-1-3b9154de09c6
The document discusses techniques for writing clean JavaScript code. It provides examples of code smells and improvements to address issues like attaching events from the outside, separating selection from logic, shallow scope, overwriting default behavior, and separating logic from views. The document advocates for practices like modularizing functions, separating DOM manipulation from models, and creating model objects to represent DOM elements rather than directly manipulating the DOM. It encourages learning clean JavaScript techniques to write better structured and more maintainable code.
The document provides an overview of advanced Android Wear development techniques including:
1) Customizing notifications by creating a custom activity displayed as a notification, handling notification data changes, and building notifications with custom backgrounds.
2) Advanced UI techniques such as disabling swipe to dismiss, adding long press to dismiss interactions, and using round and rectangular layouts.
3) Transferring bitmap images between handheld and wearable devices using assets, Volley, Picasso, and data syncing APIs.
4) Techniques for voice input using the speech recognizer, networking on Wear using libraries, and avoiding data caching issues.
This document discusses how big data and analytics can be used by individuals. It notes that while people used to be able to work alone, big data now requires teams of people. It provides examples of how a team of 1 person grew to 4 people and later 10 people to work on an analytics project over 3 months. It also discusses technologies like REST APIs, Java, RequireJS, Mustache templates, and how they were used to develop applications and widgets to work with and visualize different data sources.
This document provides an introduction and overview of AngularJS. It discusses key AngularJS concepts like directives, controllers, filters, models, configuration, routing, resources, testing and more. Code examples are provided throughout to demonstrate how each concept works in practice. The document is intended to give readers a high-level understanding of AngularJS and its capabilities for building dynamic web applications.
SE2016 Android Mikle Anokhin "Speed up application development with data bind...Inhacking
Event: #SE2016
Stage: Android
Data: 4 of September 2016
Speaker: Mikle Anokhin
Topic: Speed up application development with data binding
INHACKING site: https://inhacking.com
SE2016 site: http://se2016.inhacking.com/
Similar to Data Binding in Action using MVVM pattern (20)
Compose is stable, it's time to integrate it into our apps! But it can be harder than expected and there are some questions to answer. Can the same architecture of a View-based app be reused or should we change it? Should the Compose code be aware of the architecture at all? And should the non UI code be changed to start using Compose? What can be replaced with a Composable, only the layouts or also something else?
Probably the best answer to all these questions is “it depends”, in this talk we’ll see some reasons and how to leverage Compose and the other tools to create a good architecture. Compose is more than just a UI framework and it can seem appealing to use it in a big portion of an app, a good architecture can be useful to limit this portion and use it only when necessary.
Modularizing a project is never easy, a lot of files to move and the dependencies between them is not always what we expect. Then the Dagger configuration used in a single module project often doesn't scale well to a multi module project. Hilt is opinionated about the configuration to use (we don't need to argue anymore about using component dependencies or subcomponents!) and this configuration works perfectly even in a multi module project. In this talk we'll see first an introduction to Hilt and a comparison with Dagger to understand why it's easier to configure. Then we'll see how to leverage it in a multi module project (both in a standard layered architecture and in a Clean Architecture that uses the Dependency Inversion) to improve build speed and code testability. Spoiler alert: using sample apps that include a single feature in the app helps a lot!
Using Kotlin coroutines it’s really easy to execute a task in a background thread and update the UI based on the result. Just enter the coroutine world using the launch method and then change thread using withContext. It’s even simpler if the task is an http call (thanks to coroutines support in retrofit) or a database query (thanks to Room). The final code is the same we’d use to execute synchronous code. But coroutines are more than just a tool to switch thread, we can use them to execute tasks in parallel. The code is still really easy to read but sometimes it can be difficult to write: we need to pay attention to many aspects (like nested scopes, exceptions and dispatchers). In this talk we’ll see how to leverage the coroutines library to manage parallelism, from the basic concepts to some advanced example.
Kotlin Delegates in practice - Kotlin community confFabio Collini
The lazy delegate is probably the most famous Kotlin delegate, it’s easy to use and can be really useful. However delegation is a concept that can be used in many other ways in Kotlin. A delegate can be declared at two levels:
* a delegated property allows changing the way the property is managed
* an interface can be implemented delegating the methods to another object
In this talk we’ll see many practical examples to show how to leverage standard delegates and how to create new ones to improve the quality of our code and to avoid duplication.
Kotlin delegates in practice - Kotlin Everywhere StockholmFabio Collini
The lazy delegate is probably the most famous Kotlin delegate, it’s easy to use and can be really useful. However delegation is a concept that can be used in many other ways in Kotlin. A delegate can be declared at two levels:
* a delegated property allows changing the way the property is managed
* an interface can be implemented delegating the methods to another object
In this talk we’ll see many practical examples to show how to leverage standard delegates and how to create new ones to improve the quality of our code and to avoid duplication.
Using Dagger in a Clean Architecture projectFabio Collini
Clean Architecture and app modularization are often used together to achieve a better code structure and a faster build time. But how can we use Dagger in an app structured in that way? Can we use subcomponents (with or without Dagger Android) or are component dependencies enough?
In this talk we’ll see how to leverage Dagger to organize the dependencies in a multi-module project with particular attention to testing and decoupling. The examples will be both in a standard layered architecture and in a Clean Architecture where the Dependency Inversion increases the overall structure but can complicate the Dagger code.
Solid principles in practice the clean architecture - Droidcon ItalyFabio Collini
The Clean Architecture has been formalized by Robert C. Martin in 2012, it's quite new even if it's based on the SOLID principles (presented for the first time in early 2000). The biggest benefit that we get using this architecture is the code testability, indeed it separates the application code from the code connected to external factor (that usually is more difficult to test).
In this talk we'll see a practical example of how to apply the SOLID principle, in particular, the dependency inversion.
SOLID principles in practice: the Clean Architecture - Devfest Emila RomagnaFabio Collini
The Clean Architecture has been formalized by Robert C. Martin in 2012, it's quite new even if it's based on the SOLID principles (presented for the first time in early 2000). The biggest benefit that we get using this architecture is the code testability, indeed it separates the application code from the code connected to external factor (that usually is more difficult to test).
In this talk we'll see a practical example of how to apply the SOLID principle, in particular, the dependency inversion.
SOLID principles in practice: the Clean ArchitectureFabio Collini
The Clean Architecture has been formalized by Robert C. Martin in 2012, it's quite new even if it's based on the SOLID principles (presented for the first time in early 2000). The biggest benefit that we get using this architecture is the code testability, indeed it separates the application code from the code connected to external factor (that usually is more difficult to test).
In this talk we'll see a practical example of how to apply the SOLID principle, in particular, the dependency inversion.
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf MilanFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
Async code on kotlin: rx java or/and coroutines - Kotlin Night TurinFabio Collini
It’s never easy to write async code but luckily there are many libraries to manage asynchronicity without adding too much complexity. In the last years RxJava and the other ReactiveX libraries have been very popular but lately there is a new way to manage async code in Kotlin: the coroutines. In this talk we’ll pros and cons of there two approaches and how to leverage them to simplify asynchronous code on Android.
Do they solve the same problem? Can we use them together? Which one can be used to write functional code? How can we use them effectively in Android development?
Spoiler alert: They are both great!
In this talk we’ll see how to solve common problems using RxJava or Coroutines, starting from basic concepts (for example the Retrofit support and how to cancel a task) to some more advanced (like threading, error management and how to combine multiple tasks).
All example of the talk are available on this repository:
https://github.com/fabioCollini/RxJavaVsCoroutines
This document summarizes Fabio Collini's experience at Google I/O 2018, including sessions on artificial intelligence applications in medicine, self-driving cars, Google Assistant, and Google services, as well as demonstrations of Google Duplex, Google Maps, Google Lens, Android P, Kotlin, and Flutter. It notes there were more than 7000 attendees and mentions office hours and speeches.
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
From java to kotlin beyond alt+shift+cmd+kFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay! Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write. In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
Testing Android apps based on Dagger and RxJava Droidcon UKFabio Collini
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk you'll learn how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code. In this talk, you will also explore:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests in both Java and Kotlin
how to use DaggerMock (an open source library available on github to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
This document provides an introduction to Retrofit 2 and RxJava 2. It discusses how Retrofit allows turning a REST API into a Java interface and how RxJava implements reactive programming with observable sequences. It demonstrates making synchronous and asynchronous HTTP requests with Retrofit and handling the "callback hell" problem with RxJava. Operators like map, flatMap, zip and concatMap are shown to transform and combine observables. The document emphasizes that RxJava contains over 400 methods and discusses additional RxJava concepts like error handling and threading.
Testing Android apps based on Dagger and RxJavaFabio Collini
In this talk, you will learn:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests
how to use DaggerMock (an open source library available on github https://github.com/fabioCollini/DaggerMock) to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk we’ll see how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code.
6. 6
public class TeamScore {
private final String name;
private final int goals;
//constructor and getters
}
public class MatchResult {
private final TeamScore homeTeam;
private final TeamScore awayTeam;
private final String gifUrl;
//constructor and getters
}
14. <LinearLayout style="@style/root_layout"
xmlns:android=“http://schemas.android.com/apk/res/android">
<ImageView android:id="@+id/result_gif" style="@style/gif"/>
<LinearLayout style="@style/team_layout">
<TextView android:id="@+id/home_team" style="@style/name"/>
<TextView android:id="@+id/home_goals" style="@style/goals"/>
</LinearLayout>
<LinearLayout style="@style/team_layout">
<TextView android:id="@+id/away_team" style="@style/name"/>
<TextView android:id="@+id/away_goals" style="@style/goals"/>
</LinearLayout>
</LinearLayout>
14
One layout traversal
match_result.xmlMatchResultBinding.java
Auto generated class
<?xml version="1.0" encoding="utf-8"?>
<layout>
</layout>
public class MatchResultBinding extends
android.databinding.ViewDataBinding {
// ...
public final android.widget.ImageView resultGif;
public final android.widget.TextView homeTeam;
public final android.widget.TextView homeGoals;
public final android.widget.TextView awayTeam;
public final android.widget.TextView awayGoals;
// ...
}
24. Annotated methods are static but…
@BindingAdapter("something")
public static void bindSomething(View view, AnyObject b) {
MyBinding binding = DataBindingUtil.findBinding(view);
MyObject myObject = binding.getMyObject();
//…
TextView myTextView =
binding.myTextView;
//…
}
Can be any object
Get the layout binding
Get the connected objects
Access to all the views
Can be defined anywhere Can be used everywhere
Can be any View
25. 25
BindingConversion
@BindingConversion
public static @ColorRes int convertEnumToColor(MyEnum value) {
switch (value) {
case VALUE1:
return R.color.color1;
case VALUE2:
return R.color.color2;
case VALUE3:
return R.color.color3;
default:
return R.color.color4;
}
}
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@{myObject.myEnum}"/>
44. public String getMessage() {
return message;
}____
public boolean isMessageAvailable() {
return messageAvailable;
}___
public void setMessage(String message) {
this.message = message;
}__
public void setMessageAvailable(boolean messageAvailable) {
this.messageAvailable = messageAvailable;
}_
public class ContactInfo
private String message;
private boolean messageAvailable;
44
extends BaseObservable {
}
notifyPropertyChanged(BR.message);
notifyPropertyChanged(BR.messageAvailable);
@Bindable
@Bindable
45. 45
public class ContactInfo {
public final ObservableField<String> message = new ObservableField<>();_
public final ObservableBoolean messageAvailable = new ObservableBoolean();_
}__
46. 46
public class ContactInfo {
public final ObservableField<String> message = new ObservableField<>();_
public final ObservableBoolean messageAvailable = new ObservableBoolean();_
}__
public class ContactActivity extends AppCompatActivity {
private ContactInfo contactInfo;
private ContactBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this,
R.layout.contact);
contactInfo = new ContactInfo();
binding.setInfo(contactInfo);
binding.getRoot().postDelayed(() -> {
contactInfo.message.set("my message");
contactInfo.messageAvailable.set(true);
}, 2000);
}___
public void send(View view) {
Snackbar.make(binding.getRoot(),
contactInfo.message.get(), LENGTH_LONG).show();
}__
}_
47. <layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable name="info"
type="it.droidcon.databinding.ContactInfo" />
</data>
<LinearLayout style="@style/contact_root">
<EditText
style="@style/contact_text"
android:enabled="@{info.messageAvailable}"
android:text="@{info.message}" />
<Button
style="@style/contact_button"
android:enabled="@{info.messageAvailable}"
android:onClick="send" />
</LinearLayout>
</layout>
47
public class ContactInfo {
public final ObservableField<String> message = new ObservableField<>();_
public final ObservableBoolean messageAvailable = new ObservableBoolean();_
}__
ObservableField<String>
ObservableBoolean
ObservableBoolean
49. 49
Two way Data Binding
@BindingAdapter("binding")
public static void bindEditText(EditText view,
final ObservableString observable) {
Pair<ObservableString, TextWatcherAdapter> pair =
(Pair) view.getTag(R.id.bound_observable);
if (pair == null || pair.first != observable) {
if (pair != null)
view.removeTextChangedListener(pair.second);
TextWatcherAdapter watcher = new TextWatcherAdapter() {
@Override
public void onTextChanged(CharSequence s, int a, int b, int c) {
observable.set(s.toString());
}
};
view.setTag(R.id.bound_observable, new Pair<>(observable, watcher));
view.addTextChangedListener(watcher);
}
String newValue = observable.get();
if (!view.getText().toString().equals(newValue))
view.setText(newValue);
}
medium.com/@fabioCollini/android-data-binding-f9f9d3afc761
56. 56
MatchResultViewModel
public class MatchResultViewModel {
public final ObservableField<MatchResult> result =
new ObservableField<>();
public final ObservableBoolean loading =
new ObservableBoolean();
public void reload() {
loading.set(true);
reloadInBackground(result -> {
loading.set(false);
this.result.set(result);
});
}
}
62. <LinearLayout style="@style/root_layout"
android:onClick="@{???}">
<!-- ... -->
</LinearLayout>
62
}___
public class MatchResultViewModel {
public final ObservableField<MatchResult> result =
new ObservableField<>();
public final ObservableBoolean loading = new ObservableBoolean();
public void reload() {
loading.set(true);
reloadInBackground(result -> {
loading.set(false);
this.result.set(result);
});
}__
63. public final_View.OnClickListener reloadClickListener =
new View.OnClickListener() {
@Override public void onClick(View v) {
reload();
}_
};
<LinearLayout style="@style/root_layout"
android:onClick="@{viewModel.reloadClickListener}">
<!-- ... -->
</LinearLayout>
63
}___
public class MatchResultViewModel {
public final ObservableField<MatchResult> result =
new ObservableField<>();
public final ObservableBoolean loading = new ObservableBoolean();
public void reload() {
loading.set(true);
reloadInBackground(result -> {
loading.set(false);
this.result.set(result);
});
}__
64. <LinearLayout style="@style/root_layout"
android:onClick="@{viewModel::reload}">
<!-- ... -->
</LinearLayout>
64
}___
public class MatchResultViewModel {
public final ObservableField<MatchResult> result =
new ObservableField<>();
public final ObservableBoolean loading = new ObservableBoolean();
public void reload(View v) {
loading.set(true);
reloadInBackground(result -> {
loading.set(false);
this.result.set(result);
});
}__
65. <LinearLayout style="@style/root_layout"
android:onClick="@{v -> viewModel.reload()}">
<!-- ... -->
</LinearLayout>
65
}___
public class MatchResultViewModel {
public final ObservableField<MatchResult> result =
new ObservableField<>();
public final ObservableBoolean loading = new ObservableBoolean();
public void reload() {
loading.set(true);
reloadInBackground(result -> {
loading.set(false);
this.result.set(result);
});
}__
66. public class MatchResultViewModel {
public final ObservableField<MatchResult> result =
new ObservableField<>();
public final ObservableBoolean loading = new ObservableBoolean();
public void reload() {
loading.set(true);
reloadInBackground(result -> {
loading.set(false);
this.result.set(result);
});
}__
66
}___
@BindingAdapter("android:onClick")
public static void bindOnClick(View view, final Runnable listener) {
view.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
listener.run();
}____
});
}___
<LinearLayout style="@style/root_layout"
android:onClick="@{v -> viewModel.reload()}">
<!-- ... -->
</LinearLayout>
67. public class MatchResultViewModel {
public final ObservableField<MatchResult> result =
new ObservableField<>();
public final ObservableBoolean loading = new ObservableBoolean();
public void reload() {
loading.set(true);
reloadInBackground(result -> {
loading.set(false);
this.result.set(result);
});
}__
<LinearLayout style="@style/root_layout"
android:onClick="@{viewModel::reload}">
<!-- ... -->
</LinearLayout>
67
}___
@BindingAdapter("android:onClick")
public static void bindOnClick(View view, final Runnable listener) {
view.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
listener.run();
}____
});
}___
76. 76
Data binding
You can write all your business logic
in an huge xml file
————————————————————————
————————————
77. Custom attributes Reusable UI code
77
Data binding
You can write all your business logic
in an huge xml file
————————————————————————
————————————
Includes UI components
MVVM Testable code