Suche senden
Hochladen
Retrolambda+bolts
•
0 gefällt mir
•
269 views
Tom Sun
Folgen
Language: Traditional Chinese Bolts-Android & RetroLambda introduction
Weniger lesen
Mehr lesen
Ingenieurwesen
Melden
Teilen
Melden
Teilen
1 von 25
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
JavaFX8 TestFX - CDI
JavaFX8 TestFX - CDI
Sven Ruppert
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
Andres Almiray
JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...
JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...
chbornet
中華電信 教育訓練
中華電信 教育訓練
謝 宗穎
Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"
Fwdays
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
Fwdays
How to create an Angular builder
How to create an Angular builder
Maurizio Vitale
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
謝 宗穎
Weitere ähnliche Inhalte
Was ist angesagt?
Eclipse Mars News @JUG HH
Eclipse Mars News @JUG HH
simonscholz
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
Fwdays
Виталий Редько "React + Redux: performance & scalability"
Виталий Редько "React + Redux: performance & scalability"
Fwdays
Александр Махомет "Feature Flags. Уменьшаем риски при выпуске изменений"
Александр Махомет "Feature Flags. Уменьшаем риски при выпуске изменений"
Fwdays
Супер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOS
SQALab
vienna.js - Automatic testing of (RESTful) API documentation
vienna.js - Automatic testing of (RESTful) API documentation
Rouven Weßling
Continuous Integration for your Android projects
Continuous Integration for your Android projects
Sergii Zhuk
Rest, sockets em golang
Rest, sockets em golang
jefferson Otoni Lima
Graphql usage
Graphql usage
Valentin Buryakov
java8-patterns
java8-patterns
Justin Lin
Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"
Fwdays
Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"
Fwdays
Introducing spring
Introducing spring
Ernesto Hernández Rodríguez
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Florent BENOIT
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin
Gradle起步走: 以CLI Application為例 @ JCConf 2014
Gradle起步走: 以CLI Application為例 @ JCConf 2014
Chen-en Lu
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
Use React Patterns to Build Large Scalable App
Use React Patterns to Build Large Scalable App
Yao Nien Chung
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD
Annie Huang
Testing in go
Testing in go
Eduardo Felipe Ewert Bonet
Was ist angesagt?
(20)
Eclipse Mars News @JUG HH
Eclipse Mars News @JUG HH
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
Виталий Редько "React + Redux: performance & scalability"
Виталий Редько "React + Redux: performance & scalability"
Александр Махомет "Feature Flags. Уменьшаем риски при выпуске изменений"
Александр Махомет "Feature Flags. Уменьшаем риски при выпуске изменений"
Супер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOS
vienna.js - Automatic testing of (RESTful) API documentation
vienna.js - Automatic testing of (RESTful) API documentation
Continuous Integration for your Android projects
Continuous Integration for your Android projects
Rest, sockets em golang
Rest, sockets em golang
Graphql usage
Graphql usage
java8-patterns
java8-patterns
Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"
Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"
Introducing spring
Introducing spring
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
Gradle起步走: 以CLI Application為例 @ JCConf 2014
Gradle起步走: 以CLI Application為例 @ JCConf 2014
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Use React Patterns to Build Large Scalable App
Use React Patterns to Build Large Scalable App
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD
Testing in go
Testing in go
Ähnlich wie Retrolambda+bolts
Using the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM Development
Schalk Cronjé
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
Andres Almiray
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 version
Schalk Cronjé
HTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
David Padbury
testing.pdf
testing.pdf
NuttavutThongjor1
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Java User Group Latvia
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You Test
Schalk Cronjé
Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018
Loiane Groner
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
Ortus Solutions, Corp
Enter the gradle
Enter the gradle
Parameswari Ettiappan
Gradle in 45min
Gradle in 45min
Schalk Cronjé
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburg
simonscholz
Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios - Medianet Software
Ernesto Hernández Rodríguez
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Roman Kirillov
How to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDK
Industrial Technology Research Institute (ITRI)(工業技術研究院, 工研院)
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API -
Ortus Solutions, Corp
Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012
Anton Arhipov
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Guillaume Laforge
What's New in Groovy 1.6?
What's New in Groovy 1.6?
Guillaume Laforge
Patterns Are Good For Managers
Patterns Are Good For Managers
AgileThought
Ähnlich wie Retrolambda+bolts
(20)
Using the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM Development
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 version
HTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
testing.pdf
testing.pdf
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You Test
Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
Enter the gradle
Enter the gradle
Gradle in 45min
Gradle in 45min
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburg
Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios - Medianet Software
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
How to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDK
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API -
Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
What's New in Groovy 1.6?
What's New in Groovy 1.6?
Patterns Are Good For Managers
Patterns Are Good For Managers
Mehr von Tom Sun
Pioc
Pioc
Tom Sun
Cloud radio 閃電秀
Cloud radio 閃電秀
Tom Sun
健康報告:德國飲食
健康報告:德國飲食
Tom Sun
Linux usb2ether
Linux usb2ether
Tom Sun
iOs app 101
iOs app 101
Tom Sun
Whos Fault
Whos Fault
Tom Sun
小巫婆麗特拉
小巫婆麗特拉
Tom Sun
Serial Pnp
Serial Pnp
Tom Sun
Mehr von Tom Sun
(8)
Pioc
Pioc
Cloud radio 閃電秀
Cloud radio 閃電秀
健康報告:德國飲食
健康報告:德國飲食
Linux usb2ether
Linux usb2ether
iOs app 101
iOs app 101
Whos Fault
Whos Fault
小巫婆麗特拉
小巫婆麗特拉
Serial Pnp
Serial Pnp
Kürzlich hochgeladen
Vertical- Machining - Center - VMC -LMW-Machine-Tool-Division.pptx
Vertical- Machining - Center - VMC -LMW-Machine-Tool-Division.pptx
LMW Machine Tool Division
GENERAL CONDITIONS FOR CONTRACTS OF CIVIL ENGINEERING WORKS
GENERAL CONDITIONS FOR CONTRACTS OF CIVIL ENGINEERING WORKS
Bahzad5
Test of Significance of Large Samples for Mean = µ.pptx
Test of Significance of Large Samples for Mean = µ.pptx
Home
Power System electrical and electronics .pptx
Power System electrical and electronics .pptx
MUKULKUMAR210
IT3401-WEB ESSENTIALS PRESENTATIONS.pptx
IT3401-WEB ESSENTIALS PRESENTATIONS.pptx
SAJITHABANUS
ChatGPT-and-Generative-AI-Landscape Working of generative ai search
ChatGPT-and-Generative-AI-Landscape Working of generative ai search
rohitcse52
Landsman converter for power factor improvement
Landsman converter for power factor improvement
VijayMuni2
Design of Clutches and Brakes in Design of Machine Elements.pptx
Design of Clutches and Brakes in Design of Machine Elements.pptx
YogeshKumarKJMIT
Transforming Process Safety Management: Challenges, Benefits, and Transition ...
Transforming Process Safety Management: Challenges, Benefits, and Transition ...
soginsider
Nodal seismic construction requirements.pptx
Nodal seismic construction requirements.pptx
wendy cai
Présentation IIRB 2024 Chloe Dufrane.pdf
Présentation IIRB 2024 Chloe Dufrane.pdf
Institut Technique de la Betterave
Best-NO1 Best Rohani Amil In Lahore Kala Ilam In Lahore Kala Jadu Amil In Lah...
Best-NO1 Best Rohani Amil In Lahore Kala Ilam In Lahore Kala Jadu Amil In Lah...
Amil baba
sdfsadopkjpiosufoiasdoifjasldkjfl a asldkjflaskdjflkjsdsdf
sdfsadopkjpiosufoiasdoifjasldkjfl a asldkjflaskdjflkjsdsdf
Julia Kaye
ASME BPVC 2023 Section I para leer y entender
ASME BPVC 2023 Section I para leer y entender
juancarlos286641
Lecture 4 .pdf
Lecture 4 .pdf
abdnazar2003
Gender Bias in Engineer, Honors 203 Project
Gender Bias in Engineer, Honors 203 Project
reemakb03
Mohs Scale of Hardness, Hardness Scale.pptx
Mohs Scale of Hardness, Hardness Scale.pptx
KISHAN KUMAR
UNIT4_ESD_wfffffggggggggggggith_ARM.pptx
UNIT4_ESD_wfffffggggggggggggith_ARM.pptx
realme6igamerr
Summer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdf
Summer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdf
NaveenVerma126
Basic Principle of Electrochemical Sensor
Basic Principle of Electrochemical Sensor
Tanvir Moin
Kürzlich hochgeladen
(20)
Vertical- Machining - Center - VMC -LMW-Machine-Tool-Division.pptx
Vertical- Machining - Center - VMC -LMW-Machine-Tool-Division.pptx
GENERAL CONDITIONS FOR CONTRACTS OF CIVIL ENGINEERING WORKS
GENERAL CONDITIONS FOR CONTRACTS OF CIVIL ENGINEERING WORKS
Test of Significance of Large Samples for Mean = µ.pptx
Test of Significance of Large Samples for Mean = µ.pptx
Power System electrical and electronics .pptx
Power System electrical and electronics .pptx
IT3401-WEB ESSENTIALS PRESENTATIONS.pptx
IT3401-WEB ESSENTIALS PRESENTATIONS.pptx
ChatGPT-and-Generative-AI-Landscape Working of generative ai search
ChatGPT-and-Generative-AI-Landscape Working of generative ai search
Landsman converter for power factor improvement
Landsman converter for power factor improvement
Design of Clutches and Brakes in Design of Machine Elements.pptx
Design of Clutches and Brakes in Design of Machine Elements.pptx
Transforming Process Safety Management: Challenges, Benefits, and Transition ...
Transforming Process Safety Management: Challenges, Benefits, and Transition ...
Nodal seismic construction requirements.pptx
Nodal seismic construction requirements.pptx
Présentation IIRB 2024 Chloe Dufrane.pdf
Présentation IIRB 2024 Chloe Dufrane.pdf
Best-NO1 Best Rohani Amil In Lahore Kala Ilam In Lahore Kala Jadu Amil In Lah...
Best-NO1 Best Rohani Amil In Lahore Kala Ilam In Lahore Kala Jadu Amil In Lah...
sdfsadopkjpiosufoiasdoifjasldkjfl a asldkjflaskdjflkjsdsdf
sdfsadopkjpiosufoiasdoifjasldkjfl a asldkjflaskdjflkjsdsdf
ASME BPVC 2023 Section I para leer y entender
ASME BPVC 2023 Section I para leer y entender
Lecture 4 .pdf
Lecture 4 .pdf
Gender Bias in Engineer, Honors 203 Project
Gender Bias in Engineer, Honors 203 Project
Mohs Scale of Hardness, Hardness Scale.pptx
Mohs Scale of Hardness, Hardness Scale.pptx
UNIT4_ESD_wfffffggggggggggggith_ARM.pptx
UNIT4_ESD_wfffffggggggggggggith_ARM.pptx
Summer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdf
Summer training report on BUILDING CONSTRUCTION for DIPLOMA Students.pdf
Basic Principle of Electrochemical Sensor
Basic Principle of Electrochemical Sensor
Retrolambda+bolts
1.
Bolts + RetroLambda 2015.11.26
2.
• Bolts-Android • Design
API Based On Bolts • Retrolabmda • Refactor
3.
Why use ? •
spec.
4.
member func() { Serialize
Asynchronous Tasks callback { callback { callback{ } then { then { then { } } } } member func() { } } }
5.
• Bolts-Android • Design
API Based On Bolts • Retrolabmda • Refactor
6.
Example show dialog press “YES” button
Cancel Do something NO YES
7.
Example 1/4 public class
RunnableCB implements Runnable { public void run() { this.run(); } }
8.
private AlertDialog simpleAlertDialog(String
message, final RunnableCB cb) { if (cb == null) { final RunnableCB emptyCallback= new RunnableCB() { public void run() { } }; return buildDialog(message, "OK", emptyCallback); } else { return buildDialog(message, "OK", cb); } } Example 2/4
9.
private AlertDialog buildDialog(String
message, String cb1Option, final RunnableCB cb1) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(message); builder.setPositiveButton(cb1Option, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); cb1.run(); } }); return builder.create(); } Example 3/4
10.
final RunnableCB cbSwitchOff
= new RunnableCB() { public void run() { ((CompoundButton) bleSwitch).setChecked(false); } }; String str = getResources().getString(R.string.no_ble_device_available); simpleAlertDialog(str, cbSwitchOff).show(); Example 4/4
11.
Refactor with Bolts public
class Dialog { static Task<Integer> dlg(String msg, String opt1, String opt2) { final Task<Integer>.TaskCompletionSource tcs = Task.create(); AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setMessage(msg); if (opt1 != null && !opt1.isEmpty()) { builder.setPositiveButton(opt1, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { tcs.setResult(0); } }); } if (opt2 != null && !opt2.isEmpty()) { builder.setPositiveButton(opt2, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { tcs.setResult(1); } }); } AlertDialog d = builder.create(); d.show(); return tcs.getTask(); } }
12.
String str =
getResources().getString(R.string.no_ble_device_available); mDialog.show(str, "OK", null).continueWith(new Continuation<Integer, Void>() { @Override public Void then(Task<Integer> task) throws Exception { ((CompoundButton) bleSwitch).setChecked(false); return null; } }); Calling API we made RunnableCB
13.
, they !! (
Java)
14.
• Bolts-Android • Design
API Based On Bolts • Retrolabmda • Refactor
15.
What’s Retrolambda • Back
port Java8 to Java 7, 6, 5 • Syntax Sugar ( ) • Good introduction : Ingram Chen http:// ingramchen.io/blog/2014/10/retromlambda.html
16.
Retrolambda Limitation • Does
not back port Java 8 APIs https://docs.oracle.com/javase/8/docs/api/java/ util/function/package-summary.html
17.
gradle • • https://github.com/evant/gradle-retrolambda
18.
// defined in
the SDK interface OnClickListener { public void onClick(View v); } // your code mButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // do something here } }); syntax sugar 1/2
19.
mButton.setOnClickListener((View v) ->
{ // do something here }); syntax sugar 2/2
20.
• Bolts-Android • Design
API Based On Bolts • Code Example • Retrolabmda • Refactor
21.
public class Dialog
{ static Task<Integer> dlg(String msg, String opt1, String opt2) { final Task<Integer>.TaskCompletionSource tcs = Task.create(); AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setMessage(msg); if (opt1 != null && !opt1.isEmpty()) { builder.setPositiveButton(opt1, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { tcs.setResult(0); } }); } if (opt2 != null && !opt2.isEmpty()) { builder.setPositiveButton(opt2, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { tcs.setResult(1); } }); } AlertDialog d = builder.create(); d.show(); return tcs.getTask(); } } -> ->
22.
String str =
getResources().getString(R.string.no_ble_device_available); mDialog.show(str, "OK", null).continueWith(new Continuation<Integer, Void>() { @Override public Void then(Task<Integer> task) throws Exception { ((CompoundButton) bleSwitch).setChecked(false); return null; } }); ->
23.
public Task<Integer> show(String
msg, String opt1, String opt2) { final Task.TaskCompletionSource tcs = Task.create(); final AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setMessage(msg); if (opt1 != null && !opt1.isEmpty()) { builder.setPositiveButton(opt1, (DialogInterface dialog, int which) -> { tcs.setResult(0); }); } if (opt2 != null && !opt2.isEmpty()) { builder.setNegativeButton(opt2, (DialogInterface dialog, int which) -> { tcs.setResult(1); }); } AlertDialog d = builder.create(); d.show(); return tcs.getTask(); } Result 1/2
24.
mDialog.show1(R.string.no_ble_device_available).continueWith(task -> { ((CompoundButton)
bleSwitch).setChecked(false); gotoScanPage(); return null; }); Result 2/2
Jetzt herunterladen