SlideShare a Scribd company logo
1 of 26
Download to read offline
Popup view
on Mortar
@KeithYokoma - Drivemode, Inc.
potatotips #21
@KeithYokoma
Keishin Yokomaku at Drivemode, Inc. as Engineer
Experience
1.SNS client and photo book application for Android
2.Driver’s application for Android
Publications
1.Android Training
2.Mixi official smartphone application development guide
Like
Motorsport, Bicycle, Photography, Tumblr
Flow & Mortar
Mortar
• Mortar
• Enumerates app’s UI states and navigates between them
• Alternative but good old practice for building UI parts
• Based on “View” system on Android and…
• Replaces fussy “Fragment” system
Fragments vs. Presenters
ListFragment
Fragment
DialogFragment
} View &Screen.Presenter
?
Fragments vs. Presenters
ListFragment
Fragment
DialogFragment
} View &Screen.Presenter
Popup & Screen.PopupPresenter
Popup
public class ConfirmationPopup implements Popup<Info, Boolean> {
private final Context mContext;
private AlertDialog mDialog;
@Override
public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) {
if (mDialog != null) throw new IllegalStateException(“already shown!”);
mDialog = new AlertDialog.Builder(getContext())
.setMessage(info.getMessage())
.setPositiveButton(info.getPositive(),
(dialog, which) -> presenter.onDismissed(true))
.setNegativeButton(info.getNegative(),
(dialog, which) -> presenter.onDismissed(false))
.show();
}
}
Popup
public class ConfirmationPopup implements Popup<Info, Boolean> {
private final Context mContext;
private AlertDialog mDialog;
@Override
public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) {
if (mDialog != null) throw new IllegalStateException(“already shown!”);
mDialog = new AlertDialog.Builder(getContext())
.setMessage(info.getMessage())
.setPositiveButton(info.getPositive(),
(dialog, which) -> presenter.onDismissed(true))
.setNegativeButton(info.getNegative(),
(dialog, which) -> presenter.onDismissed(false))
.show();
}
}
Popup
public class ConfirmationPopup implements Popup<Info, Boolean> {
private final Context mContext;
private AlertDialog mDialog;
@Override
public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) {
if (mDialog != null) throw new IllegalStateException(“already shown!”);
mDialog = new AlertDialog.Builder(getContext())
.setMessage(info.getMessage())
.setPositiveButton(info.getPositive(),
(dialog, which) -> presenter.onDismissed(true))
.setNegativeButton(info.getNegative(),
(dialog, which) -> presenter.onDismissed(false))
.show();
}
}
Popup
public class ConfirmationPopup implements Popup<Info, Boolean> {
private final Context mContext;
private AlertDialog mDialog;
@Override
public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) {
if (mDialog != null) throw new IllegalStateException(“already shown!”);
mDialog = new AlertDialog.Builder(getContext())
.setMessage(info.getMessage())
.setPositiveButton(info.getPositive(),
(dialog, which) -> presenter.onDismissed(true))
.setNegativeButton(info.getNegative(),
(dialog, which) -> presenter.onDismissed(false))
.show();
}
}
Popup
public class ConfirmationPopup implements Popup<Info, Boolean> {
private final Context mContext;
private AlertDialog mDialog;
@Override
public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) {
if (mDialog != null) throw new IllegalStateException(“already shown!”);
mDialog = new AlertDialog.Builder(getContext())
.setMessage(info.getMessage())
.setPositiveButton(info.getPositive(),
(dialog, which) -> presenter.onDismissed(true))
.setNegativeButton(info.getNegative(),
(dialog, which) -> presenter.onDismissed(false))
.show();
}
}
public class ConfirmationPopup implements Popup<Info, Boolean> {
private final Context mContext;
private AlertDialog mDialog;
@Override
public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) {
if (mDialog != null) throw new IllegalStateException(“already shown!”);
mDialog = new AlertDialog.Builder(getContext())
.setMessage(info.getMessage())
.setPositiveButton(info.getPositive(),
(dialog, which) -> presenter.onDismissed(true))
.setNegativeButton(info.getNegative(),
(dialog, which) -> presenter.onDismissed(false))
.show();
}
}
withFlourish
{
true if Popup is explicitly shown/dismissed through Presenter
false otherwise
Popup
public class ConfirmationPopup implements Popup<Info, Boolean> {
private final Context mContext;
private AlertDialog mDialog;
@Override
public boolean isShowing() { return mDialog != null; }
@Override
public Context getContext() { return mContext; }
@Override
public void dismiss(boolean withFlourish) {
mDialog.dismiss();
mDialog = null;
}
}
PopupPresenter
public class SomeView extends FrameLayout {
// do not inject popup presenter and popup here.
private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() {
@Override
public void onPopupResult(Boolean result) { } // result == user’s choice
}
private Popup mPopup;
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
mPopup = new ConfirmationPopup(getContext());
mPopupPresenter.takeView(mPopup);
}
}
PopupPresenter
public class SomeView extends FrameLayout {
// do not inject popup presenter and popup here.
private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() {
@Override
public void onPopupResult(Boolean result) { } // result == user’s choice
}
private Popup mPopup;
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
mPopup = new ConfirmationPopup(getContext());
mPopupPresenter.takeView(mPopup);
}
}
PopupPresenter
public class SomeView extends FrameLayout {
// do not inject popup presenter and popup here.
private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() {
@Override
public void onPopupResult(Boolean result) { } // result == user’s choice
}
private Popup mPopup;
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
mPopup = new ConfirmationPopup(getContext());
mPopupPresenter.takeView(mPopup);
}
}
PopupPresenter
public class SomeView extends FrameLayout {
// do not inject popup presenter and popup here.
private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() {
@Override
public void onPopupResult(Boolean result) { } // result == user’s choice
}
private Popup mPopup;
@Override
public void onDetachedFromWindow() {
mPopupPresenter.dropView(mPopup);
super.onDetachedFromWindow();
}
}
PopupPresenter
public class SomeView extends FrameLayout {
// do not inject popup presenter and popup here.
private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() {
@Override
public void onPopupResult(Boolean result) { } // result == user’s choice
}
private Popup mPopup;
@Override
public void onDetachedFromWindow() {
mPopupPresenter.dropView(mPopup);
super.onDetachedFromWindow();
}
}
PopupPresenter
public class SomeView extends FrameLayout {
// do not inject popup presenter and popup here.
private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() {
@Override
public void onPopupResult(Boolean result) { } // result == user’s choice
}
private Popup mPopup;
@OnClick(R.id.submit)
public void onSubmit() {
mPopupPresenter.show(Info.create(“Is it ok?”, “ok”, “cancel”));
}
}
PopupPresenter
public class SomeView extends FrameLayout {
// do not inject popup presenter and popup here.
private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() {
@Override
public void onPopupResult(Boolean result) { } // result == user’s choice
}
private Popup mPopup;
@OnClick(R.id.submit)
public void onSubmit() {
mPopupPresenter.show(Info.create(“Is it ok?”, “ok”, “cancel”));
}
}
Popup & PopupPresenter
• PopupPresenter<D extends Parcelable, R>
• Alternative to FragmentManager
• Handles user’s choice callback at “onPopupResult”
• Type param D must implement “equals” and “hashCode”,

and may not be null(otherwise Popup will not be shown)
Popup & PopupPresenter
• Popup<D extends Parcelable, R>
• Alternative to DialogFragment
• Receives arguments without Bundle (like DialogFragment)
• Presenter will publish user’s choice data for you
–Hollywood Principle
“Don't call us, we'll call you”
Popup view
on Mortar
@KeithYokoma - Drivemode, Inc.
potatotips #21
Join our team? Contact me!

More Related Content

What's hot

AWT Packages , Containers and Components
AWT Packages , Containers and ComponentsAWT Packages , Containers and Components
AWT Packages , Containers and ComponentsSohanur63
 
A comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter componentA comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter componentKaty Slemon
 
Android UI Reference
Android UI ReferenceAndroid UI Reference
Android UI ReferenceGauntFace
 
Conquering the code in softimage
Conquering the code in softimageConquering the code in softimage
Conquering the code in softimageJared Glass
 
Intro to Google TV
Intro to Google TVIntro to Google TV
Intro to Google TVGauntFace
 
Modern Android Architecture
Modern Android ArchitectureModern Android Architecture
Modern Android ArchitectureEric Maxwell
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...Nikolay Rumyantsev
 
STYLISH FLOOR
STYLISH FLOORSTYLISH FLOOR
STYLISH FLOORABU HASAN
 
Effective Android Data Binding
Effective Android Data BindingEffective Android Data Binding
Effective Android Data BindingEric Maxwell
 
Developing Mobile Apps, Lecture 5
Developing Mobile Apps, Lecture 5Developing Mobile Apps, Lecture 5
Developing Mobile Apps, Lecture 5fpatton
 

What's hot (13)

AWT Packages , Containers and Components
AWT Packages , Containers and ComponentsAWT Packages , Containers and Components
AWT Packages , Containers and Components
 
A comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter componentA comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter component
 
Android UI Reference
Android UI ReferenceAndroid UI Reference
Android UI Reference
 
Conquering the code in softimage
Conquering the code in softimageConquering the code in softimage
Conquering the code in softimage
 
Intro to Google TV
Intro to Google TVIntro to Google TV
Intro to Google TV
 
Modern Android Architecture
Modern Android ArchitectureModern Android Architecture
Modern Android Architecture
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
 
STYLISH FLOOR
STYLISH FLOORSTYLISH FLOOR
STYLISH FLOOR
 
Effective Android Data Binding
Effective Android Data BindingEffective Android Data Binding
Effective Android Data Binding
 
Developing Mobile Apps, Lecture 5
Developing Mobile Apps, Lecture 5Developing Mobile Apps, Lecture 5
Developing Mobile Apps, Lecture 5
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
Dojo1.0_Tutorials
Dojo1.0_TutorialsDojo1.0_Tutorials
Dojo1.0_Tutorials
 

Similar to Popup view on Mortar

softshake 2014 - Java EE
softshake 2014 - Java EEsoftshake 2014 - Java EE
softshake 2014 - Java EEAlexis Hassler
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)Jose Manuel Pereira Garcia
 
Building maintainable app #droidconzg
Building maintainable app #droidconzgBuilding maintainable app #droidconzg
Building maintainable app #droidconzgKristijan Jurković
 
Google Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification GoogleGoogle Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification GoogleMathias Seguy
 
Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014Antoine Sabot-Durand
 
Android Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and IntentAndroid Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and Intentadmin220812
 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonfNataliya Patsovska
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02rhemsolutions
 
Diving in the Flex Data Binding Waters
Diving in the Flex Data Binding WatersDiving in the Flex Data Binding Waters
Diving in the Flex Data Binding Watersmichael.labriola
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo Ali Parmaksiz
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Mahmoud Hamed Mahmoud
 
Android Architecture Components
Android Architecture ComponentsAndroid Architecture Components
Android Architecture ComponentsBurhanuddinRashid
 
Visual Studio tool windows
Visual Studio tool windowsVisual Studio tool windows
Visual Studio tool windowsPVS-Studio
 
MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009Jonas Follesø
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM patternNAVER Engineering
 
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Alina Vilk
 

Similar to Popup view on Mortar (20)

Devoxx 2012 (v2)
Devoxx 2012 (v2)Devoxx 2012 (v2)
Devoxx 2012 (v2)
 
softshake 2014 - Java EE
softshake 2014 - Java EEsoftshake 2014 - Java EE
softshake 2014 - Java EE
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
 
Building maintainable app #droidconzg
Building maintainable app #droidconzgBuilding maintainable app #droidconzg
Building maintainable app #droidconzg
 
Google Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification GoogleGoogle Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification Google
 
Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Building maintainable app
Building maintainable appBuilding maintainable app
Building maintainable app
 
Android Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and IntentAndroid Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and Intent
 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonf
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02
 
Diving in the Flex Data Binding Waters
Diving in the Flex Data Binding WatersDiving in the Flex Data Binding Waters
Diving in the Flex Data Binding Waters
 
Vaadin7
Vaadin7Vaadin7
Vaadin7
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
 
Android Architecture Components
Android Architecture ComponentsAndroid Architecture Components
Android Architecture Components
 
Visual Studio tool windows
Visual Studio tool windowsVisual Studio tool windows
Visual Studio tool windows
 
MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009MVVM Design Pattern NDC2009
MVVM Design Pattern NDC2009
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern
 
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
 

More from Keishin Yokomaku

More from Keishin Yokomaku (14)

UI optimization for night
UI optimization for nightUI optimization for night
UI optimization for night
 
Regexp in Android and Java
Regexp in Android and JavaRegexp in Android and Java
Regexp in Android and Java
 
Deep Inside Android Hacks
Deep Inside Android HacksDeep Inside Android Hacks
Deep Inside Android Hacks
 
Make it compatible
Make it compatibleMake it compatible
Make it compatible
 
Signature
SignatureSignature
Signature
 
Android Media Hacks
Android Media HacksAndroid Media Hacks
Android Media Hacks
 
Null, the Abyss
Null, the AbyssNull, the Abyss
Null, the Abyss
 
?
??
?
 
Building stable and flexible libraries
Building stable and flexible librariesBuilding stable and flexible libraries
Building stable and flexible libraries
 
Typeface
TypefaceTypeface
Typeface
 
Version Management
Version ManagementVersion Management
Version Management
 
イカしたライブラリを作った話
イカしたライブラリを作った話イカしたライブラリを作った話
イカしたライブラリを作った話
 
Google I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と GradleGoogle I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と Gradle
 
自己組織化
自己組織化自己組織化
自己組織化
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

Popup view on Mortar

  • 1. Popup view on Mortar @KeithYokoma - Drivemode, Inc. potatotips #21
  • 2. @KeithYokoma Keishin Yokomaku at Drivemode, Inc. as Engineer Experience 1.SNS client and photo book application for Android 2.Driver’s application for Android Publications 1.Android Training 2.Mixi official smartphone application development guide Like Motorsport, Bicycle, Photography, Tumblr
  • 3.
  • 5. Mortar • Mortar • Enumerates app’s UI states and navigates between them • Alternative but good old practice for building UI parts • Based on “View” system on Android and… • Replaces fussy “Fragment” system
  • 7. Fragments vs. Presenters ListFragment Fragment DialogFragment } View &Screen.Presenter Popup & Screen.PopupPresenter
  • 8. Popup public class ConfirmationPopup implements Popup<Info, Boolean> { private final Context mContext; private AlertDialog mDialog; @Override public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) { if (mDialog != null) throw new IllegalStateException(“already shown!”); mDialog = new AlertDialog.Builder(getContext()) .setMessage(info.getMessage()) .setPositiveButton(info.getPositive(), (dialog, which) -> presenter.onDismissed(true)) .setNegativeButton(info.getNegative(), (dialog, which) -> presenter.onDismissed(false)) .show(); } }
  • 9. Popup public class ConfirmationPopup implements Popup<Info, Boolean> { private final Context mContext; private AlertDialog mDialog; @Override public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) { if (mDialog != null) throw new IllegalStateException(“already shown!”); mDialog = new AlertDialog.Builder(getContext()) .setMessage(info.getMessage()) .setPositiveButton(info.getPositive(), (dialog, which) -> presenter.onDismissed(true)) .setNegativeButton(info.getNegative(), (dialog, which) -> presenter.onDismissed(false)) .show(); } }
  • 10. Popup public class ConfirmationPopup implements Popup<Info, Boolean> { private final Context mContext; private AlertDialog mDialog; @Override public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) { if (mDialog != null) throw new IllegalStateException(“already shown!”); mDialog = new AlertDialog.Builder(getContext()) .setMessage(info.getMessage()) .setPositiveButton(info.getPositive(), (dialog, which) -> presenter.onDismissed(true)) .setNegativeButton(info.getNegative(), (dialog, which) -> presenter.onDismissed(false)) .show(); } }
  • 11. Popup public class ConfirmationPopup implements Popup<Info, Boolean> { private final Context mContext; private AlertDialog mDialog; @Override public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) { if (mDialog != null) throw new IllegalStateException(“already shown!”); mDialog = new AlertDialog.Builder(getContext()) .setMessage(info.getMessage()) .setPositiveButton(info.getPositive(), (dialog, which) -> presenter.onDismissed(true)) .setNegativeButton(info.getNegative(), (dialog, which) -> presenter.onDismissed(false)) .show(); } }
  • 12. Popup public class ConfirmationPopup implements Popup<Info, Boolean> { private final Context mContext; private AlertDialog mDialog; @Override public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) { if (mDialog != null) throw new IllegalStateException(“already shown!”); mDialog = new AlertDialog.Builder(getContext()) .setMessage(info.getMessage()) .setPositiveButton(info.getPositive(), (dialog, which) -> presenter.onDismissed(true)) .setNegativeButton(info.getNegative(), (dialog, which) -> presenter.onDismissed(false)) .show(); } }
  • 13. public class ConfirmationPopup implements Popup<Info, Boolean> { private final Context mContext; private AlertDialog mDialog; @Override public void show(Info info, boolean withFlourish, PopupPresenter<Info, Boolean> presenter) { if (mDialog != null) throw new IllegalStateException(“already shown!”); mDialog = new AlertDialog.Builder(getContext()) .setMessage(info.getMessage()) .setPositiveButton(info.getPositive(), (dialog, which) -> presenter.onDismissed(true)) .setNegativeButton(info.getNegative(), (dialog, which) -> presenter.onDismissed(false)) .show(); } } withFlourish { true if Popup is explicitly shown/dismissed through Presenter false otherwise
  • 14. Popup public class ConfirmationPopup implements Popup<Info, Boolean> { private final Context mContext; private AlertDialog mDialog; @Override public boolean isShowing() { return mDialog != null; } @Override public Context getContext() { return mContext; } @Override public void dismiss(boolean withFlourish) { mDialog.dismiss(); mDialog = null; } }
  • 15. PopupPresenter public class SomeView extends FrameLayout { // do not inject popup presenter and popup here. private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() { @Override public void onPopupResult(Boolean result) { } // result == user’s choice } private Popup mPopup; @Override public void onAttachedToWindow() { super.onAttachedToWindow(); mPopup = new ConfirmationPopup(getContext()); mPopupPresenter.takeView(mPopup); } }
  • 16. PopupPresenter public class SomeView extends FrameLayout { // do not inject popup presenter and popup here. private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() { @Override public void onPopupResult(Boolean result) { } // result == user’s choice } private Popup mPopup; @Override public void onAttachedToWindow() { super.onAttachedToWindow(); mPopup = new ConfirmationPopup(getContext()); mPopupPresenter.takeView(mPopup); } }
  • 17. PopupPresenter public class SomeView extends FrameLayout { // do not inject popup presenter and popup here. private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() { @Override public void onPopupResult(Boolean result) { } // result == user’s choice } private Popup mPopup; @Override public void onAttachedToWindow() { super.onAttachedToWindow(); mPopup = new ConfirmationPopup(getContext()); mPopupPresenter.takeView(mPopup); } }
  • 18. PopupPresenter public class SomeView extends FrameLayout { // do not inject popup presenter and popup here. private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() { @Override public void onPopupResult(Boolean result) { } // result == user’s choice } private Popup mPopup; @Override public void onDetachedFromWindow() { mPopupPresenter.dropView(mPopup); super.onDetachedFromWindow(); } }
  • 19. PopupPresenter public class SomeView extends FrameLayout { // do not inject popup presenter and popup here. private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() { @Override public void onPopupResult(Boolean result) { } // result == user’s choice } private Popup mPopup; @Override public void onDetachedFromWindow() { mPopupPresenter.dropView(mPopup); super.onDetachedFromWindow(); } }
  • 20. PopupPresenter public class SomeView extends FrameLayout { // do not inject popup presenter and popup here. private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() { @Override public void onPopupResult(Boolean result) { } // result == user’s choice } private Popup mPopup; @OnClick(R.id.submit) public void onSubmit() { mPopupPresenter.show(Info.create(“Is it ok?”, “ok”, “cancel”)); } }
  • 21. PopupPresenter public class SomeView extends FrameLayout { // do not inject popup presenter and popup here. private PopupPresenter<Info, Boolean> mPopupPresenter = new PopupPresenter<>() { @Override public void onPopupResult(Boolean result) { } // result == user’s choice } private Popup mPopup; @OnClick(R.id.submit) public void onSubmit() { mPopupPresenter.show(Info.create(“Is it ok?”, “ok”, “cancel”)); } }
  • 22. Popup & PopupPresenter • PopupPresenter<D extends Parcelable, R> • Alternative to FragmentManager • Handles user’s choice callback at “onPopupResult” • Type param D must implement “equals” and “hashCode”,
 and may not be null(otherwise Popup will not be shown)
  • 23. Popup & PopupPresenter • Popup<D extends Parcelable, R> • Alternative to DialogFragment • Receives arguments without Bundle (like DialogFragment) • Presenter will publish user’s choice data for you
  • 24. –Hollywood Principle “Don't call us, we'll call you”
  • 25. Popup view on Mortar @KeithYokoma - Drivemode, Inc. potatotips #21
  • 26. Join our team? Contact me!