SlideShare una empresa de Scribd logo
1 de 63
Android, The Fifth
Element
Murat Yener, eteration
@yenerm
Saturday, June 15, 13
who (the hell) am I?!?
• Java, Flex, GWT, iOS, Android developer
• Principle Mentor at Eteration
• Eclipse Committer
• GDG (GTUG) Istanbul Organizer
• Conference Speaker
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
• Activities
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
• Activities
• Intents
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
• Activities
• Intents
• Services
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
• Activities
• Intents
• Services
• Widgets
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
• Activities
• Intents
• Services
• Widgets
• ... and the WebView (hybrid apps, web
apps)
Saturday, June 15, 13
an HTML5 talk?!?
• Facebook killed HTML5 app, Zuckerberg
said HTML5 is not there yet!!
• Sencha Built FastBook
fb.html5isready.com
• LinkedIn moved to native
• anybody think its better now?
Saturday, June 15, 13
an HTML5 talk?!?
• Facebook killed HTML5 app, Zuckerberg
said HTML5 is not there yet!!
• Sencha Built FastBook
fb.html5isready.com
• LinkedIn moved to native
• anybody think its better now?
Saturday, June 15, 13
wait its too complicated!
• How many of you have web development
experience?
• How many of you develop native mobile
apps?
• How many of you don’t like web
development just because javascript
Saturday, June 15, 13
wait its too complicated!
• How many of you have web development
experience?
• How many of you develop native mobile
apps?
• How many of you don’t like web
development just because javascript
Saturday, June 15, 13
but it is slow!
• building games?
• 3d physics?
• image processing?
• ...?
Saturday, June 15, 13
but it is slow!
• building games?
• 3d physics?
• image processing?
• ...?
Saturday, June 15, 13
but it is slow!
• building games?
• 3d physics?
• image processing?
• ...?
Nooo! We just build lists and detail pages!!
(well, most of the time...)
Saturday, June 15, 13
“We started with the existing Jake2 Java port of the Quake II
engine, then used the Google Web Toolkit (along with WebGL,
WebSockets, and a lot of refactoring) to cross-compile it into
Javascript. You can see the results in the video above — we
were honestly a bit surprised when we saw it pushing over 30
frames per second on our laptops (your mileage may vary)!”
from Google Code Blog...
Wait!! Is this web?!?
• Angry Birds for Chrome (GWT)
• Quake on Mobile http://media.tojicode.com/q3bsp/
(requires Chrome Beta with WebGL)
Saturday, June 15, 13
“We started with the existing Jake2 Java port of the Quake II
engine, then used the Google Web Toolkit (along with WebGL,
WebSockets, and a lot of refactoring) to cross-compile it into
Javascript. You can see the results in the video above — we
were honestly a bit surprised when we saw it pushing over 30
frames per second on our laptops (your mileage may vary)!”
from Google Code Blog...
Wait!! Is this web?!?
• Angry Birds for Chrome (GWT)
• Quake on Mobile http://media.tojicode.com/q3bsp/
(requires Chrome Beta with WebGL)
Saturday, June 15, 13
“We started with the existing Jake2 Java port of the Quake II
engine, then used the Google Web Toolkit (along with WebGL,
WebSockets, and a lot of refactoring) to cross-compile it into
Javascript. You can see the results in the video above — we
were honestly a bit surprised when we saw it pushing over 30
frames per second on our laptops (your mileage may vary)!”
from Google Code Blog...
Wait!! Is this web?!?
• Angry Birds for Chrome (GWT)
• Quake on Mobile http://media.tojicode.com/q3bsp/
(requires Chrome Beta with WebGL)
Saturday, June 15, 13
Mobile HTML5
Frameworks
• jQueryMobile
• Sencha
• Zepto
• mGWT, hey wait! no javascript?!? Seriously?!!
Saturday, June 15, 13
Java to Javascript?!?
• GWT Compiler does the magic
• Optimized, high performance js
• Cross browser compability (upto ie6)
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Setup
• get the source from https://code.google.com/p/mgwt/
• or download the jar
• or use Maven!
<dependency>
      <groupId>com.googlecode.mgwt</groupId>
      <artifactId>mgwt</artifactId>
      <version>1.1.2</version>
</dependency>
Saturday, June 15, 13
Hello World
public class MGWTEntryPoint implements EntryPoint {
  public void onModuleLoad() {
    // set viewport and other settings for mobile
    MGWT.applySettings(MGWTSettings.getAppSetting());
    // build animation helper and attach it
    AnimationHelper animationHelper = new AnimationHelper();
    RootPanel.get().add(animationHelper);
    // build some UI
    LayoutPanel layoutPanel = new LayoutPanel();
    Button button = new Button("Hello mgwt");
    layoutPanel.add(button);
    // animate
    animationHelper.goTo(layoutPanel, Animation.SLIDE);
  }
}
Saturday, June 15, 13
Add a little spice:
Phonegap
• Geolocation
• Camera
• Accelerometer
• Compass
• Phonebook
• File System
• even NFC
Saturday, June 15, 13
Add a little spice:
Phonegap
• Geolocation
• Camera
• Accelerometer
• Compass
• Phonebook
• File System
• even NFC
Basically
any
Native
API
!!
Saturday, June 15, 13
Phonegap
Button button = new Button("Hello mgwt");
button().addTapHandler(new TapHandler() {
@Override
public void onTap(TapEvent event) {
phoneGap.getNotification().alert("Done!!");
}
});
layoutPanel.add(button);
Saturday, June 15, 13
more Phonegap
phoneGap.getGeolocation().watchPosition(geolocationOptions, new MyGeolocationCallback(){
@Override
public void onSuccess(Position position) {
// check accuracy
if (position.getCoordinates().getAccuracy() > 11) {
raceView.getLabel().setText("Error: Accuracy");
}
// geolocation returns mps, multiply with 3.6 to convert to kph
double speed = 3.6 * position.getCoordinates().getSpeed();
if (speed > 0.2) {// if going
raceView.getLabel().setText(speed + "km @" + position.getCoordinates().getAccuracy());
currentLocation = position;
// got the position now can start!
start();
// stop if the threshold is reached
if (isGoing && speed >= 60) {
MgwtAppEntryPoint.phoneGap.getGeolocation().clearWatch(geolocationWatcher);
endLocation = position;
calculate();
}
} else {// if stoped
raceView.getLabel().setText("get ready!!");
isGoing = false;
}
}
@Override
public void onFailure(PositionError error) {
MgwtAppEntryPoint.phoneGap.getNotification().alert("Problem getting location");
}
});
Saturday, June 15, 13
more Phonegap
phoneGap.getGeolocation().watchPosition(geolocationOptions, new MyGeolocationCallback(){
@Override
public void onSuccess(Position position) {
// check accuracy
if (position.getCoordinates().getAccuracy() > 11) {
raceView.getLabel().setText("Error: Accuracy");
}
// geolocation returns mps, multiply with 3.6 to convert to kph
double speed = 3.6 * position.getCoordinates().getSpeed();
if (speed > 0.2) {// if going
raceView.getLabel().setText(speed + "km @" + position.getCoordinates().getAccuracy());
currentLocation = position;
// got the position now can start!
start();
// stop if the threshold is reached
if (isGoing && speed >= 60) {
MgwtAppEntryPoint.phoneGap.getGeolocation().clearWatch(geolocationWatcher);
endLocation = position;
calculate();
}
} else {// if stoped
raceView.getLabel().setText("get ready!!");
isGoing = false;
}
}
@Override
public void onFailure(PositionError error) {
MgwtAppEntryPoint.phoneGap.getNotification().alert("Problem getting location");
}
});
yes, you can really do that
with mgwt/phonegap
Saturday, June 15, 13
even more...
public void onTap(TapEvent event) {
final MCheckBox check = ((MCheckBox) event.getSource());
if (check.getValue()) {
if (TWITTER.equalsIgnoreCase(type))
profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/twitter");
else if (FACEBOOK.equalsIgnoreCase(type))
profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/facebook");
profileView.getBrowser().addLocationChangeHandler(new
ChildBrowserLocationChangedHandler() {
@Override
public void onLocationChanged(ChildBrowserLocationChangedEvent event) {
//Do the login...
}
});
}
}
Saturday, June 15, 13
even more...
public void onTap(TapEvent event) {
final MCheckBox check = ((MCheckBox) event.getSource());
if (check.getValue()) {
if (TWITTER.equalsIgnoreCase(type))
profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/twitter");
else if (FACEBOOK.equalsIgnoreCase(type))
profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/facebook");
profileView.getBrowser().addLocationChangeHandler(new
ChildBrowserLocationChangedHandler() {
@Override
public void onLocationChanged(ChildBrowserLocationChangedEvent event) {
//Do the login...
}
});
}
}
Make use of the
Phonegap Plugins!!
Saturday, June 15, 13
mgwt experienced
• MVP
• Model
• View
• Presenter
• Maven Archetype
Saturday, June 15, 13
mgwt experienced
• MVP
• Model
• View
• Presenter
• Maven Archetype
Saturday, June 15, 13
mvp?!?
• Code your UI in View
• and logic in Acitivity
classes
• sound familiar?!?
• easy navigation
• a bit of boilerplate
code
Saturday, June 15, 13
mvp?!?
• Code your UI in View
• and logic in Acitivity
classes
• sound familiar?!?
• easy navigation
• a bit of boilerplate
code
Saturday, June 15, 13
calling the backend
• GWT-RPC
• JSONP & AutoBean
JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
String url = URL.encode(JSON_URL + "/sendData/" + “HelloWorld”);
jsonp.requestObject(url, new AsyncCallback<JavaScriptObject>() {
@Override
public void onFailure(Throwable caught) {
MgwtAppEntryPoint.phoneGap.getNotification().alert(caught.getMessage());
}
@Override
public void onSuccess(JavaScriptObject result) {
JSONObject jsObj = new JSONObject(result);
AutoBean<Score[]> bean = AutoBeanCodex.decode(factory, MyModel[].class, jsObj.toString());
Score[] scores = bean.as();
scoresCallback.onResponse(scores);
}
});
Saturday, June 15, 13
Calling Native JS
• Use any existing Javascript
• Use Javascript in a type safe way
• BUT dont mess touch events
• AND beware you are not in safe zone
anymore
Saturday, June 15, 13
JSNI
public native static String key(int index) /*-{
return $wnd.localStorage.key(index);
}-*/;
public native static void setItem(String key, String value) /*-{
$wnd.localStorage.setItem(key, value);
}-*/;
public native static String getItem(String key) /*-{
return $wnd.localStorage.getItem(key);
}-*/;
public native static void removeItem(String key) /*-{
$wnd.localStorage.removeItem(key);
}-*/;
public native static void clear() /*-{
$wnd.localStorage.clear();
}-*/;
Saturday, June 15, 13
gwtquery
public void onModuleLoad() {
  //Hide the text and set the width and append an h1 element
  $("#text").hide()
    .css("width", "400px")
    .prepend("<h1>GwtQuery Rocks !</h1>");
   
    //add a click handler on the button
    $("button").click(new Function(){
      public void f() {
        //display the text with effects and animate its background color
        $("#text").as(Effects)
          .clipDown()
          .animate("backgroundColor: 'yellow'", 500)
          .delay(1000)
          .animate("backgroundColor: '#fff'", 1500);
      }
    });
}
Saturday, June 15, 13
skinning
• offers default themes for
• android
• iOS/iOS Retina
• Blackberry
• easy to create yours
https://code.google.com/p/mgwt/wiki/Styling
//append your own css as last thing in the head
MGWTStyle.injectStyleSheet("yourcssfile.css");
Saturday, June 15, 13
wait! css in java??
.mgwt-Button {
	 	 	 display: inline-block;
	 	 	 float: left;
	 	 	 width: 145px;
	 	 	 height: 100px;
	 	 	 border: 1px solid rgba(0,0,0,0.23);
	 	 	 background: #ff6600;
	 	 	 border-radius: 6px;
	 	 	 box-shadow: inset -1px 0px 0px rgba(255,255,255,0.41), inset
1px 0px 0px rgba(255,255,255,0.21), inset 0px -1px 0px
rgba(0,0,0,0.21), inset 0px 1px 0px rgba(255,255,255,0.41), 0px 1px
2px rgba(0,0,0,0.21);
	 	 	 text-align: center;
	 	 	 font-size: 14px;
	 	 	 margin: 5px;
	 	 	 font-weight: bold;		 	
	 	 	 text-shadow: 0px 1px 1px rgba(0,0,0,0.49);
	 	 	 color: white;
	 	 	 line-height: 124px;
}
Saturday, June 15, 13
debugging
• First Class Java Debugging on your IDE
• Gwt Pretty Compile! and debug
Javascript in your browser
Saturday, June 15, 13
What about other OSs
• iOS, works like charm
• Blackberry
• Windows Phone
• Tablets?!
• Desktop?!?
Saturday, June 15, 13
What can I really build?
• Anything!
• but why not going native for games
• lists, carousels, forms...
• make use of current js
• windows phone?? seriously?!?
Saturday, June 15, 13
thanks to...
Saturday, June 15, 13
thanks to...
Saturday, June 15, 13
thanks to...
Saturday, June 15, 13
special thanks to my
mentor Naci Dai
Saturday, June 15, 13
</slides>
murat@muratyener.com
blogs.eteration.com
devchronicles.com
@yenerm
114028338330916709688
like what you see??
click to download!
@gdgistanbul
Saturday, June 15, 13

Más contenido relacionado

Similar a Android WebView, The Fifth Element

From jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 MinutesFrom jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 Minutesedill3484
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Matt Raible
 
Using Grails to power your electric car
Using Grails to power your electric carUsing Grails to power your electric car
Using Grails to power your electric carMarco Pas
 
Using Grails to power your electric car
Using Grails to power your electric carUsing Grails to power your electric car
Using Grails to power your electric carMarco Pas
 
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Alina Vilk
 
Enabling Microservice @ Orbitz - GOTO Chicago 2016
Enabling Microservice @ Orbitz - GOTO Chicago 2016Enabling Microservice @ Orbitz - GOTO Chicago 2016
Enabling Microservice @ Orbitz - GOTO Chicago 2016Steve Hoffman
 
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...Codemotion
 
Using Grails to Power your Electric Car
Using Grails to Power your Electric CarUsing Grails to Power your Electric Car
Using Grails to Power your Electric CarGR8Conf
 
jQuery Mobile Jump Start
jQuery Mobile Jump StartjQuery Mobile Jump Start
jQuery Mobile Jump StartTroy Miles
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)Bramus Van Damme
 
WebGL Crash Course
WebGL Crash CourseWebGL Crash Course
WebGL Crash CourseTony Parisi
 
Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"Alex Theedom
 
FITC 2013 - The Technical Learning Curve
FITC 2013 - The Technical Learning CurveFITC 2013 - The Technical Learning Curve
FITC 2013 - The Technical Learning CurveLittle Miss Robot
 
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...MarcinStachniuk
 
First steps with GWT @ Google IO Extended - Pordenone
First steps with GWT @ Google IO Extended - PordenoneFirst steps with GWT @ Google IO Extended - Pordenone
First steps with GWT @ Google IO Extended - PordenoneGiampaolo Trapasso
 
Using Geoscript Groovy
Using Geoscript GroovyUsing Geoscript Groovy
Using Geoscript GroovyJared Erickson
 
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...Yottaa
 
Developing cross platform desktop application with Ruby
Developing cross platform desktop application with RubyDeveloping cross platform desktop application with Ruby
Developing cross platform desktop application with RubyAnis Ahmad
 
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 PanicGWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 PanicCristiano Costantini
 

Similar a Android WebView, The Fifth Element (20)

From jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 MinutesFrom jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 Minutes
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
 
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
 
Using Grails to power your electric car
Using Grails to power your electric carUsing Grails to power your electric car
Using Grails to power your electric car
 
Using Grails to power your electric car
Using Grails to power your electric carUsing Grails to power your electric car
Using Grails to power your electric car
 
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
 
Enabling Microservice @ Orbitz - GOTO Chicago 2016
Enabling Microservice @ Orbitz - GOTO Chicago 2016Enabling Microservice @ Orbitz - GOTO Chicago 2016
Enabling Microservice @ Orbitz - GOTO Chicago 2016
 
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
 
Using Grails to Power your Electric Car
Using Grails to Power your Electric CarUsing Grails to Power your Electric Car
Using Grails to Power your Electric Car
 
jQuery Mobile Jump Start
jQuery Mobile Jump StartjQuery Mobile Jump Start
jQuery Mobile Jump Start
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)
 
WebGL Crash Course
WebGL Crash CourseWebGL Crash Course
WebGL Crash Course
 
Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"
 
FITC 2013 - The Technical Learning Curve
FITC 2013 - The Technical Learning CurveFITC 2013 - The Technical Learning Curve
FITC 2013 - The Technical Learning Curve
 
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
 
First steps with GWT @ Google IO Extended - Pordenone
First steps with GWT @ Google IO Extended - PordenoneFirst steps with GWT @ Google IO Extended - Pordenone
First steps with GWT @ Google IO Extended - Pordenone
 
Using Geoscript Groovy
Using Geoscript GroovyUsing Geoscript Groovy
Using Geoscript Groovy
 
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
 
Developing cross platform desktop application with Ruby
Developing cross platform desktop application with RubyDeveloping cross platform desktop application with Ruby
Developing cross platform desktop application with Ruby
 
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 PanicGWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 Panic
 

Más de Murat Yener

Design patterns with Kotlin
Design patterns with KotlinDesign patterns with Kotlin
Design patterns with KotlinMurat Yener
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsMurat Yener
 
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Murat Yener
 
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)Murat Yener
 
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse LibraJavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse LibraMurat Yener
 
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)Murat Yener
 
Eclipsist2009 Rich Client Roundup
Eclipsist2009 Rich Client RoundupEclipsist2009 Rich Client Roundup
Eclipsist2009 Rich Client RoundupMurat Yener
 

Más de Murat Yener (7)

Design patterns with Kotlin
Design patterns with KotlinDesign patterns with Kotlin
Design patterns with Kotlin
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
 
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
 
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse LibraJavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
 
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
 
Eclipsist2009 Rich Client Roundup
Eclipsist2009 Rich Client RoundupEclipsist2009 Rich Client Roundup
Eclipsist2009 Rich Client Roundup
 

Último

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
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
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
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
 
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
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
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
 
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
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 

Último (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
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
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
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
 
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...
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
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
 
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
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 

Android WebView, The Fifth Element

  • 1. Android, The Fifth Element Murat Yener, eteration @yenerm Saturday, June 15, 13
  • 2. who (the hell) am I?!? • Java, Flex, GWT, iOS, Android developer • Principle Mentor at Eteration • Eclipse Committer • GDG (GTUG) Istanbul Organizer • Conference Speaker Saturday, June 15, 13
  • 3. Me as an Android Developer Saturday, June 15, 13
  • 4. Me as an Android Developer Saturday, June 15, 13
  • 5. Me as an Android Developer Saturday, June 15, 13
  • 6. Me as an Android Developer Saturday, June 15, 13
  • 7. Me as an Android Developer Saturday, June 15, 13
  • 8. Me as an Android Developer Saturday, June 15, 13
  • 9. Me as an Android Developer Saturday, June 15, 13
  • 10. Me as an Android Developer Saturday, June 15, 13
  • 11. Me as an Android Developer Saturday, June 15, 13
  • 12. what (the hell) is the fifth element?!? Saturday, June 15, 13
  • 13. what (the hell) is the fifth element?!? • Activities Saturday, June 15, 13
  • 14. what (the hell) is the fifth element?!? • Activities • Intents Saturday, June 15, 13
  • 15. what (the hell) is the fifth element?!? • Activities • Intents • Services Saturday, June 15, 13
  • 16. what (the hell) is the fifth element?!? • Activities • Intents • Services • Widgets Saturday, June 15, 13
  • 17. what (the hell) is the fifth element?!? • Activities • Intents • Services • Widgets • ... and the WebView (hybrid apps, web apps) Saturday, June 15, 13
  • 18. an HTML5 talk?!? • Facebook killed HTML5 app, Zuckerberg said HTML5 is not there yet!! • Sencha Built FastBook fb.html5isready.com • LinkedIn moved to native • anybody think its better now? Saturday, June 15, 13
  • 19. an HTML5 talk?!? • Facebook killed HTML5 app, Zuckerberg said HTML5 is not there yet!! • Sencha Built FastBook fb.html5isready.com • LinkedIn moved to native • anybody think its better now? Saturday, June 15, 13
  • 20. wait its too complicated! • How many of you have web development experience? • How many of you develop native mobile apps? • How many of you don’t like web development just because javascript Saturday, June 15, 13
  • 21. wait its too complicated! • How many of you have web development experience? • How many of you develop native mobile apps? • How many of you don’t like web development just because javascript Saturday, June 15, 13
  • 22. but it is slow! • building games? • 3d physics? • image processing? • ...? Saturday, June 15, 13
  • 23. but it is slow! • building games? • 3d physics? • image processing? • ...? Saturday, June 15, 13
  • 24. but it is slow! • building games? • 3d physics? • image processing? • ...? Nooo! We just build lists and detail pages!! (well, most of the time...) Saturday, June 15, 13
  • 25. “We started with the existing Jake2 Java port of the Quake II engine, then used the Google Web Toolkit (along with WebGL, WebSockets, and a lot of refactoring) to cross-compile it into Javascript. You can see the results in the video above — we were honestly a bit surprised when we saw it pushing over 30 frames per second on our laptops (your mileage may vary)!” from Google Code Blog... Wait!! Is this web?!? • Angry Birds for Chrome (GWT) • Quake on Mobile http://media.tojicode.com/q3bsp/ (requires Chrome Beta with WebGL) Saturday, June 15, 13
  • 26. “We started with the existing Jake2 Java port of the Quake II engine, then used the Google Web Toolkit (along with WebGL, WebSockets, and a lot of refactoring) to cross-compile it into Javascript. You can see the results in the video above — we were honestly a bit surprised when we saw it pushing over 30 frames per second on our laptops (your mileage may vary)!” from Google Code Blog... Wait!! Is this web?!? • Angry Birds for Chrome (GWT) • Quake on Mobile http://media.tojicode.com/q3bsp/ (requires Chrome Beta with WebGL) Saturday, June 15, 13
  • 27. “We started with the existing Jake2 Java port of the Quake II engine, then used the Google Web Toolkit (along with WebGL, WebSockets, and a lot of refactoring) to cross-compile it into Javascript. You can see the results in the video above — we were honestly a bit surprised when we saw it pushing over 30 frames per second on our laptops (your mileage may vary)!” from Google Code Blog... Wait!! Is this web?!? • Angry Birds for Chrome (GWT) • Quake on Mobile http://media.tojicode.com/q3bsp/ (requires Chrome Beta with WebGL) Saturday, June 15, 13
  • 28. Mobile HTML5 Frameworks • jQueryMobile • Sencha • Zepto • mGWT, hey wait! no javascript?!? Seriously?!! Saturday, June 15, 13
  • 29. Java to Javascript?!? • GWT Compiler does the magic • Optimized, high performance js • Cross browser compability (upto ie6) Saturday, June 15, 13
  • 37. Setup • get the source from https://code.google.com/p/mgwt/ • or download the jar • or use Maven! <dependency>       <groupId>com.googlecode.mgwt</groupId>       <artifactId>mgwt</artifactId>       <version>1.1.2</version> </dependency> Saturday, June 15, 13
  • 38. Hello World public class MGWTEntryPoint implements EntryPoint {   public void onModuleLoad() {     // set viewport and other settings for mobile     MGWT.applySettings(MGWTSettings.getAppSetting());     // build animation helper and attach it     AnimationHelper animationHelper = new AnimationHelper();     RootPanel.get().add(animationHelper);     // build some UI     LayoutPanel layoutPanel = new LayoutPanel();     Button button = new Button("Hello mgwt");     layoutPanel.add(button);     // animate     animationHelper.goTo(layoutPanel, Animation.SLIDE);   } } Saturday, June 15, 13
  • 39. Add a little spice: Phonegap • Geolocation • Camera • Accelerometer • Compass • Phonebook • File System • even NFC Saturday, June 15, 13
  • 40. Add a little spice: Phonegap • Geolocation • Camera • Accelerometer • Compass • Phonebook • File System • even NFC Basically any Native API !! Saturday, June 15, 13
  • 41. Phonegap Button button = new Button("Hello mgwt"); button().addTapHandler(new TapHandler() { @Override public void onTap(TapEvent event) { phoneGap.getNotification().alert("Done!!"); } }); layoutPanel.add(button); Saturday, June 15, 13
  • 42. more Phonegap phoneGap.getGeolocation().watchPosition(geolocationOptions, new MyGeolocationCallback(){ @Override public void onSuccess(Position position) { // check accuracy if (position.getCoordinates().getAccuracy() > 11) { raceView.getLabel().setText("Error: Accuracy"); } // geolocation returns mps, multiply with 3.6 to convert to kph double speed = 3.6 * position.getCoordinates().getSpeed(); if (speed > 0.2) {// if going raceView.getLabel().setText(speed + "km @" + position.getCoordinates().getAccuracy()); currentLocation = position; // got the position now can start! start(); // stop if the threshold is reached if (isGoing && speed >= 60) { MgwtAppEntryPoint.phoneGap.getGeolocation().clearWatch(geolocationWatcher); endLocation = position; calculate(); } } else {// if stoped raceView.getLabel().setText("get ready!!"); isGoing = false; } } @Override public void onFailure(PositionError error) { MgwtAppEntryPoint.phoneGap.getNotification().alert("Problem getting location"); } }); Saturday, June 15, 13
  • 43. more Phonegap phoneGap.getGeolocation().watchPosition(geolocationOptions, new MyGeolocationCallback(){ @Override public void onSuccess(Position position) { // check accuracy if (position.getCoordinates().getAccuracy() > 11) { raceView.getLabel().setText("Error: Accuracy"); } // geolocation returns mps, multiply with 3.6 to convert to kph double speed = 3.6 * position.getCoordinates().getSpeed(); if (speed > 0.2) {// if going raceView.getLabel().setText(speed + "km @" + position.getCoordinates().getAccuracy()); currentLocation = position; // got the position now can start! start(); // stop if the threshold is reached if (isGoing && speed >= 60) { MgwtAppEntryPoint.phoneGap.getGeolocation().clearWatch(geolocationWatcher); endLocation = position; calculate(); } } else {// if stoped raceView.getLabel().setText("get ready!!"); isGoing = false; } } @Override public void onFailure(PositionError error) { MgwtAppEntryPoint.phoneGap.getNotification().alert("Problem getting location"); } }); yes, you can really do that with mgwt/phonegap Saturday, June 15, 13
  • 44. even more... public void onTap(TapEvent event) { final MCheckBox check = ((MCheckBox) event.getSource()); if (check.getValue()) { if (TWITTER.equalsIgnoreCase(type)) profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/twitter"); else if (FACEBOOK.equalsIgnoreCase(type)) profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/facebook"); profileView.getBrowser().addLocationChangeHandler(new ChildBrowserLocationChangedHandler() { @Override public void onLocationChanged(ChildBrowserLocationChangedEvent event) { //Do the login... } }); } } Saturday, June 15, 13
  • 45. even more... public void onTap(TapEvent event) { final MCheckBox check = ((MCheckBox) event.getSource()); if (check.getValue()) { if (TWITTER.equalsIgnoreCase(type)) profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/twitter"); else if (FACEBOOK.equalsIgnoreCase(type)) profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/facebook"); profileView.getBrowser().addLocationChangeHandler(new ChildBrowserLocationChangedHandler() { @Override public void onLocationChanged(ChildBrowserLocationChangedEvent event) { //Do the login... } }); } } Make use of the Phonegap Plugins!! Saturday, June 15, 13
  • 46. mgwt experienced • MVP • Model • View • Presenter • Maven Archetype Saturday, June 15, 13
  • 47. mgwt experienced • MVP • Model • View • Presenter • Maven Archetype Saturday, June 15, 13
  • 48. mvp?!? • Code your UI in View • and logic in Acitivity classes • sound familiar?!? • easy navigation • a bit of boilerplate code Saturday, June 15, 13
  • 49. mvp?!? • Code your UI in View • and logic in Acitivity classes • sound familiar?!? • easy navigation • a bit of boilerplate code Saturday, June 15, 13
  • 50. calling the backend • GWT-RPC • JSONP & AutoBean JsonpRequestBuilder jsonp = new JsonpRequestBuilder(); String url = URL.encode(JSON_URL + "/sendData/" + “HelloWorld”); jsonp.requestObject(url, new AsyncCallback<JavaScriptObject>() { @Override public void onFailure(Throwable caught) { MgwtAppEntryPoint.phoneGap.getNotification().alert(caught.getMessage()); } @Override public void onSuccess(JavaScriptObject result) { JSONObject jsObj = new JSONObject(result); AutoBean<Score[]> bean = AutoBeanCodex.decode(factory, MyModel[].class, jsObj.toString()); Score[] scores = bean.as(); scoresCallback.onResponse(scores); } }); Saturday, June 15, 13
  • 51. Calling Native JS • Use any existing Javascript • Use Javascript in a type safe way • BUT dont mess touch events • AND beware you are not in safe zone anymore Saturday, June 15, 13
  • 52. JSNI public native static String key(int index) /*-{ return $wnd.localStorage.key(index); }-*/; public native static void setItem(String key, String value) /*-{ $wnd.localStorage.setItem(key, value); }-*/; public native static String getItem(String key) /*-{ return $wnd.localStorage.getItem(key); }-*/; public native static void removeItem(String key) /*-{ $wnd.localStorage.removeItem(key); }-*/; public native static void clear() /*-{ $wnd.localStorage.clear(); }-*/; Saturday, June 15, 13
  • 53. gwtquery public void onModuleLoad() {   //Hide the text and set the width and append an h1 element   $("#text").hide()     .css("width", "400px")     .prepend("<h1>GwtQuery Rocks !</h1>");         //add a click handler on the button     $("button").click(new Function(){       public void f() {         //display the text with effects and animate its background color         $("#text").as(Effects)           .clipDown()           .animate("backgroundColor: 'yellow'", 500)           .delay(1000)           .animate("backgroundColor: '#fff'", 1500);       }     }); } Saturday, June 15, 13
  • 54. skinning • offers default themes for • android • iOS/iOS Retina • Blackberry • easy to create yours https://code.google.com/p/mgwt/wiki/Styling //append your own css as last thing in the head MGWTStyle.injectStyleSheet("yourcssfile.css"); Saturday, June 15, 13
  • 55. wait! css in java?? .mgwt-Button { display: inline-block; float: left; width: 145px; height: 100px; border: 1px solid rgba(0,0,0,0.23); background: #ff6600; border-radius: 6px; box-shadow: inset -1px 0px 0px rgba(255,255,255,0.41), inset 1px 0px 0px rgba(255,255,255,0.21), inset 0px -1px 0px rgba(0,0,0,0.21), inset 0px 1px 0px rgba(255,255,255,0.41), 0px 1px 2px rgba(0,0,0,0.21); text-align: center; font-size: 14px; margin: 5px; font-weight: bold; text-shadow: 0px 1px 1px rgba(0,0,0,0.49); color: white; line-height: 124px; } Saturday, June 15, 13
  • 56. debugging • First Class Java Debugging on your IDE • Gwt Pretty Compile! and debug Javascript in your browser Saturday, June 15, 13
  • 57. What about other OSs • iOS, works like charm • Blackberry • Windows Phone • Tablets?! • Desktop?!? Saturday, June 15, 13
  • 58. What can I really build? • Anything! • but why not going native for games • lists, carousels, forms... • make use of current js • windows phone?? seriously?!? Saturday, June 15, 13
  • 62. special thanks to my mentor Naci Dai Saturday, June 15, 13