This document discusses architecture components for building modern Android applications. It covers common app architecture problems and principles like separation of concerns. It introduces key Architecture Components like Activities, Fragments, Services, ContentProviders, ViewModels and LiveData. It also discusses architectural patterns like MVC, MVP, MVVM and recommendations like clean architecture. The document emphasizes principles like modularity, separation of concerns, and testability. It provides an overview of alternatives like Room, Paging Library, and recommendations for legacy apps.
A collection of libraries that help you design robust, testable, and maintainable apps. Start with classes for managing your UI component lifecycle and handling data persistence.
By now, you’ve probably heard of Akka, the JVM toolkit for building scalable, resilient and resource efficient applications in Java or Scala. With over 12 open-source and commercial modules in the toolkit, Akka takes developers from actors on a single JVM, all the way out to network partition healing and clusters of servers distributed across fleets of JVMs.
In this technical webinar, O’Reilly author and Lightbend Developer Advocate, Hugh McKee, takes you on a deep dive into advanced Akka features for enhanced application resilience, elasticity, and responsiveness.
Building on real-world examples from his past experience as an Akka developer, Hugh will show how you can take advantage of:
• Akka Multi-Data Center Clustering improves reliability across multiple data centers, availability zones or regions.
• Logically grouping related nodes in large clusters to improve stability and scalability.
• Akka Multi-Data Center Persistence for increased fault tolerance, locate data near the user, and balance the load across data centers.
• Akka Cluster Sharding in a multi data center environment, to optimize shard locality within a single data center and go Active-Active for improved resilience and availability.
The world of open source libraries and tools is vast for Android developers. Writing apps using solely Android SDK is impractical. Libraries can help you in many ways. They can speed up your development, save you creating boilerplate code and dealing with platform fragmentation, simplify your code and make it more readable and maintainable. In the talk I’m showing how several truly useful libraries can help a developer.
Presented at MobCon Europe 2017.
A collection of libraries that help you design robust, testable, and maintainable apps. Start with classes for managing your UI component lifecycle and handling data persistence.
By now, you’ve probably heard of Akka, the JVM toolkit for building scalable, resilient and resource efficient applications in Java or Scala. With over 12 open-source and commercial modules in the toolkit, Akka takes developers from actors on a single JVM, all the way out to network partition healing and clusters of servers distributed across fleets of JVMs.
In this technical webinar, O’Reilly author and Lightbend Developer Advocate, Hugh McKee, takes you on a deep dive into advanced Akka features for enhanced application resilience, elasticity, and responsiveness.
Building on real-world examples from his past experience as an Akka developer, Hugh will show how you can take advantage of:
• Akka Multi-Data Center Clustering improves reliability across multiple data centers, availability zones or regions.
• Logically grouping related nodes in large clusters to improve stability and scalability.
• Akka Multi-Data Center Persistence for increased fault tolerance, locate data near the user, and balance the load across data centers.
• Akka Cluster Sharding in a multi data center environment, to optimize shard locality within a single data center and go Active-Active for improved resilience and availability.
The world of open source libraries and tools is vast for Android developers. Writing apps using solely Android SDK is impractical. Libraries can help you in many ways. They can speed up your development, save you creating boilerplate code and dealing with platform fragmentation, simplify your code and make it more readable and maintainable. In the talk I’m showing how several truly useful libraries can help a developer.
Presented at MobCon Europe 2017.
The easy way to develop Java applications has always been the standard stack (Spring, JEE, SQL) that confirms the LAMP equivalent in Java-speak. This presentation compares this model with a real use case based on Guice, Jersey and AppEngine.
SQLite is available on every Android device. Using an SQLite database in Android does not require any database setup or administration. You only have to define the SQL statements for creating and updating the database. Afterwards the database is automatically managed for you by the Android platform. In this chapter we will discuss about developing application with SQLite.
Architecting Single Activity Applications (With or Without Fragments)Gabor Varadi
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
Working effectively with ViewModels and TDD - UA Mobile 2019UA Mobile
The introduction of Android Architecture Components made a lot of things easier for Android developers. Despite this, the documentation is still not complete and confusing. Here and their developers arise questions like: “How should I handle communication between ViewModels?”, “How to send one time events properly?”, “How to fill pleasure from Android development again?”. I will cover these topics and guide you through this dark forest and show that the light of TDD.
In this talk, I will cover the most popular pitfalls when using ViewModels and show how one can easily follow the TDD approach while implementing MVVM on Android.
http://uamobile.org/uk/topics/working-effectively-viewmodels-and-tdd
The easy way to develop Java applications has always been the standard stack (Spring, JEE, SQL) that confirms the LAMP equivalent in Java-speak. This presentation compares this model with a real use case based on Guice, Jersey and AppEngine.
SQLite is available on every Android device. Using an SQLite database in Android does not require any database setup or administration. You only have to define the SQL statements for creating and updating the database. Afterwards the database is automatically managed for you by the Android platform. In this chapter we will discuss about developing application with SQLite.
Architecting Single Activity Applications (With or Without Fragments)Gabor Varadi
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
Working effectively with ViewModels and TDD - UA Mobile 2019UA Mobile
The introduction of Android Architecture Components made a lot of things easier for Android developers. Despite this, the documentation is still not complete and confusing. Here and their developers arise questions like: “How should I handle communication between ViewModels?”, “How to send one time events properly?”, “How to fill pleasure from Android development again?”. I will cover these topics and guide you through this dark forest and show that the light of TDD.
In this talk, I will cover the most popular pitfalls when using ViewModels and show how one can easily follow the TDD approach while implementing MVVM on Android.
http://uamobile.org/uk/topics/working-effectively-viewmodels-and-tdd
Building Modern Apps using Android Architecture ComponentsHassan Abid
Android architecture components are part of Android Jetpack. They are a collection of libraries that help you design robust, testable, and maintainable apps. In this talk, We will cover LiveData, ViewModel, Room and lifecycle components. We will go through practical code example to understand modern android app architecture especially MVVM architecture.
Лаконічні та елегантні автоматизовані тести? Безболісний (майже) тестовий стек для UI веб-додатків? Більше часу, щоб випити кави/пограти у Cuphead/ подивитись у порожнечу?
Ми поговоримо про Lombok, Vavr, Owner, чому вам варто використовувати готові рішення та як зробити тести більш лаконічними та читабельними. Вам знадобиться Vaper та/або гіроборд.
In 2008 Android app code had a lot of boilerplate, and was very error prone.
More code.. more bugs!
Now it doesn't have to be... but that is an option that each developer needs to take!
Доклад включает в себя рассмотрение ключевых особенностей библиотеки. Также описывает обработку событий внутри библиотеки и в сформированных биндингах.
Дополнительно рассматривается создание собственных компонентов, расширяющих возможности элементов интерфейса, и в конце будет уделено отдельное внимание реализации двустороннего биндинга.
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/
"Android Data Binding в массы" Михаил АнохинFwdays
Рассмотрим что это такое, как работает, какие возможности предоставляет библиотека, как обрабатываются события внутри бибилиотеки и фрагменты кода сгенерированные для биндингов.
Также узнаем как добавить библиотеку в проект и на практических примерах оценим ее достоинства и недостатки при использовании в проекте.
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.
DataArt Custom Software Engineering with a Human ApproachDataArt
DataArt is a global software engineering firm that takes a uniquely human approach to solving problems. With over 20 years of experience, teams of highly-trained engineers around the world, deep industry sector knowledge and ongoing technology research, we help clients create custom software that improves their operations and opens new markets. Powered by our People First principle, we work with clients at any scale and on any platform, and adapt alongside them as they evolve.
DataArt is a global software engineering firm that takes a uniquely human approach to solving problems. With over 20 years of experience, teams of highly-trained engineers around the world, deep industry sector knowledge, and ongoing technology research, we help clients create custom software that improves their operations and opens new markets. Powered by our People First principle, we work with clients at any scale and on any platform, and adapt alongside them as they evolve.
DataArt Financial Services and Capital MarketsDataArt
DataArt is a global software engineering firm that takes a uniquely human approach to solving problems. With over 20 years of experience, teams of highly-trained engineers around the world, deep industry sector knowledge, and ongoing technology research, we help clients create custom software that improves their operations and opens new markets. Powered by our People First principle, we work with clients at any scale and on any platform, and adapt alongside them as they evolve.
We integrate our engineering excellence with deeply human values that drive our business and our approach to relationships: curiosity, empathy, trust, honesty, and intuition. These qualities help us deliver high-value, high-quality solutions that our clients depend on, and lifetime partnerships they believe in.
DataArt has earned the trust of some of the world’s leading brands and most discerning clients, including Nasdaq, Travelport, Ocado, Centrica/Hive, Paddy Power Betfair, IWG, Univision, Meetup and Apple Leisure Group among others. DataArt brings together expertise of over 3000 professionals in 20 locations in the US, Europe, and Latin America.
Мы ежедневно посещаем десятки и сотни сайтов и периодически видим рекламу, зачастую даже не задумываясь, откуда она вообще берется. Почему именно эта реклама показана вам именно здесь? И какая роль JS во всем этом?
Рассмотрим:
• поговорим о жизненном цикле рекламного баннера и проследим его путь от рекламодателя до браузера;
• узнаем, кто же постоянно следит за нами в интернете, как много информации о нас им доступно;
• определим способы выявления некачественного трафика;
• разберемся, зачем нужно контролировать качество просмотров;
• обсудим, почему нельзя так просто взять и просмотреть всю статистику по рекламе в одном месте (или все-таки можно?).
Алексей Уманский, JS Developer, AnyMind Group. Опыт работы в IT – четыре года. Участвовал в тревел- и gamedev-проектах: разрабатывал крупный сервис по покупке авиабилетов, создавал систему игровых автоматов для онлайн казино. Последний год работал в Таиланде над продуктами в области Digital Marketing: онлайн биржа для influencer-ов и сервис по управлению рекламой на сайте, а так же сбору статистики по ней.
DevOps Workshop:Что бывает, когда DevOps приходит на проектDataArt
Александр Снеговой, DevOps Software Engineer в DataArt.
Более шести лет в IT. Сертифицированный AWS Solutions Architect Associate. Докладчик на международных научных конференциях. Религиозный фанат Docker.
Оксана Харчук, Senior QA Engineer.
Презентация:
Коммуникация в жизни QA. Как выстроить эффективные коммуникации тестировщику с бизнес аналитиком, разработчиком, менеджером и клиентом.
Нельзя просто так взять и договориться, или как мы работали со сложными людьмиDataArt
Эллина Азадова, QA Lead в DataArt Kherson.
Презентация:
Реальные примеры из своей практики, как работать со сложными людьми: интровертами, экстравертами, излишне эмоциональными и с постоянно пессимистически настроенными.
Дмитрий Клипинин, DevOps Engineer в GlobalLogic, более 10 лет опыта работы в IT, сертифицированный специалист Microsoft по технологиям Active Directory и SQL Server.
Презентация:
1. Эволюция системного администратора.
2. DevOps-практики.
3. Основные DevOps-инструменты.
Александр Снеговой, DevOps Software Engineer в DataArt Kherson. Более шести лет в IT. Сертифицированный AWS Solutions Architect Associate. Докладчик на международных научных конференциях. Религиозный фанат Docker.
Презентация:
1. Докеризация приложения.
2. Настройка CI/CD.
3. Развертывание инфраструктуры в AWS с помощью Terraform.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
4. App-hopping
OS may kill app at random time
App components lifecycle is not under control
Components should not depend on each other
Can’t rely on data, stored in components
There are Everyday Problems to Solve
6. -Separation of concerns
-Provide solid user experience
-Keep UI lean and simple
-Keep UI free of app logic
-Drive UI from model
-Use persistent model
-Assign clear responsibilities for each model class
Common Principles for staying in mind :)
9. -Modular app
-Each class responsible for one well-defined function
-Should be no god objects
-The app should be testable
Remember Good Architecture Goals...
13. “It is impossible to have one way of writing apps that will be the best for
every scenario. That being said, this recommended architecture should be
a good starting point for most use cases. If you already have a good way
of writing Android apps, you don't need to change.”
Be together. not the same
15. Purpose: Display data and pass on UI events
Neither contain the UI data, nor directly manipulate data
Examples: Activity, Fragment
Views = UI Controllers = LifecycleOwners
25. Live Data
public class DetailActivityViewModel extends ViewModel {
private MutableLiveData<WeatherEntry> mWeather;
public DetailActivityViewModel() {}
public MutableLiveData<WeatherEntry> getWeather() {
return mWeather;
}
public void setWeather(WeatherEntry weatherEntry) {
mWeather.postValue(weatherEntry);
}
}
26. Live Data observing
public class DetailActivity extends LifecycleActivity {
DetailActivityViewModel viewModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
viewModel = ViewModelProviders.of(this).get(DetailActivityViewModel.class);
viewModel.getWeather().observe(this, weatherEntry -> {
if(weatherEntry!=null) { bindWeatherToUI(weatherEntry); }
});
}
27. -Single source of truth
-ViewModels simply request data
from the repository
-Is a mediator between
the different data sources
Repository
Image from fernandocejas.com
28. Manages data from a remote data
source, such as the internet
May use REST, Cloud
Remote Network Data Source
30. Each class in the diagram only
stores a reference to the class or
classes directly "below it" and not
any classes above it
Layered architecture pattern
35. @Entity declaration
@Entity(tableName = "weather",
indices = {@Index(value = {"date"}, unique = true)})
public class WeatherEntry {
@PrimaryKey(autoGenerate = true)
private int id;
…
}
36. @Entity constructors
//Room constructor
public WeatherEntry(int id, int weatherIconId, Date date, ...) {
//Json constructor - ignored by Room
@Ignore
public WeatherEntry(int weatherIconId, Date date,
// (!) Only one constructor should be exposed to Room
...
40. @Database declaration
@Database(entities = {WeatherEntry.class}, version = 1)
@TypeConverters(DateConverter.class)
public abstract class AppDatabase extends RoomDatabase {
public abstract WeatherDao weatherDao();
}
41. @Database - a singleton
private static final String DATABASE_NAME = "weather";
private static final Object LOCK = new Object();
private static volatile AppDatabase sInstance;
public static AppDatabase getInstance(Context context) {
if (sInstance == null) { synchronized (LOCK) {
if (sInstance == null) {
sInstance = Room.databaseBuilder(context.getApplicationContext(),
AppDatabase.class, AppDatabase.DATABASE_NAME).build();
}
}}
return sInstance;
}
42. Type converters
class DateConverter {
@TypeConverter
public static Date toDate(Long timestamp) {
return timestamp == null ? null : new Date(timestamp);
}
@TypeConverter
public static Long toTimestamp(Date date) {
return date == null ? null : date.getTime();
}
}
54. Data source
KeyedDataSource - if you need to use data from item N to fetch item N+1.
TiledDataSource - if you need to fetch pages in range of data from any location you choose in your data store
55. DAO for KeyedDataSource
@Dao
interface UserDao {
@Query("SELECT * from user ORDER BY name DESC LIMIT :limit")
public abstract List<User> userNameInitial(int limit);
@Query("SELECT * from user WHERE name < :key ORDER BY name DESC LIMIT :limit")
public abstract List<User> userNameLoadAfter(String key, int limit);
@Query("SELECT * from user WHERE name > :key ORDER BY name ASC LIMIT :limit")
public abstract List<User> userNameLoadBefore(String key, int limit);
}
56. KeyedDataSource implementation
public class KeyedUserQueryDataSource extends KeyedDataSource<String, User> {
@Override public boolean isInvalid() { return super.isInvalid(); }
@Override public String getKey(@NonNull User item) { return item.getName(); }
@Override public List<User> loadInitial(int pageSize) {
return mUserDao.userNameInitial(pageSize); }
@Override public List<User> loadBefore(@NonNull String userName, int pageSize) {
return mUserDao.userNameLoadBefore(userName, pageSize); }
@Override public List<User> loadAfter(@Nullable String userName, int pageSize) {
return mUserDao.userNameLoadAfter(userName, pageSize); }
}
58. TiledDataSource - under the hood
@Dao
interface UserDao {
@Query("SELECT COUNT(*) from user")
public abstract Integer getUserCount();
@Query("SELECT * from user ORDER BY mName DESC LIMIT :limit OFFSET :offset")
public abstract List<User> userNameLimitOffset(int limit, int offset);
}
59. TiledDataSource - under the hood
public class OffsetUserQueryDataSource extends TiledDataSource<User> {
@Override public boolean isInvalid() { return super.isInvalid(); }
@Override public int countItems() { return mUserDao.getUserCount(); }
@Override public List<User> loadRange(int startPosition, int loadCount) {
return mUserDao.userNameLimitOffset(loadCount, startPosition);
}
}
60. Paging Library - PagedList
DataSource
PagedList - loads its data in chunks (pages) from a DataSource
PagedListAdapter
LivePagedListProvider
61. Paging Library - LivePagedListProvider
DataSource
PagedList
PagedListAdapter - listens to PagedList loading callbacks as pages are loaded, and uses DiffUtil on a
background thread to compute fine grained updates as new PagedLists are received.
LivePagedListProvider - provides a LiveData<PagedList>, given a
means to construct a DataSource
62. LivePagedListProvider generation by DAO
@Dao
interface UserDao {
@Query("SELECT * FROM user ORDER BY lastName ASC")
public abstract LivePagedListProvider<Integer, User> usersByLastName();
}
63. Paging Library - PagedListAdapter
DataSource
PagedList
PagedListAdapter - listens to PagedList loading callbacks as pages are
loaded, and uses DiffUtil on a background thread to compute fine grained
updates as new PagedLists are received.
LivePagedListProvider
64. PagedListAdapter usage pattern - DAO
@Dao
interface UserDao {
@Query("SELECT * FROM user ORDER BY lastName ASC")
public abstract LivePagedListProvider<Integer, User> usersByLastName();
}
65. PagedListAdapter usage pattern -
PagedList.Config
class MyViewModel extends ViewModel {
public final LiveData<PagedList<User>> usersList;
public MyViewModel(UserDao userDao) {
usersList = userDao.usersByLastName().create(
/* initial load position */ 0,
new PagedList.Config.Builder()
.setPageSize(50)
.setPrefetchDistance(50)
.build());
}
}
78. Guide to App Architecture https://developer.android.com/topic/libraries/architecture/guide.html
Architecture Components
https://developer.android.com/topic/libraries/architecture/index.html
I/O ‘17 Architecture Components Introduction - https://youtu.be/FrteWKKVyzI
Solving the Lifecycle Problem - https://youtu.be/bEKNi1JOrNs
Persistence and Offline - https://youtu.be/MfHsPGQ6bgE
Architecture Components on GDD Europe - https://youtu.be/Ts-uxYiBEQ8
GDD Europe CodeLabs g.co/codelabs/gdd17
Google Github samples https://github.com/googlesamples/android-architecture-components
What to read and watch :)
79. Android MVP Helper https://github.com/Ufkoku/AndroidMVPHelper
Moxy https://github.com/Arello-Mobile/Moxy
Mosby https://github.com/sockeqwe/mosby
Clean Architecture https://github.com/android10/Android-CleanArchitecture
Reark https://github.com/reark/reark
MVP + Dagger2 + Rx https://android.jlelse.eu/mvp-dagger-2-rx-clean-modern-android-app-code-74f63c9a6f2f
Architecture the Lost Years by Uncle Bob https://youtu.be/WpkDN78P884
Alternatives to consider