SlideShare une entreprise Scribd logo
1  sur  80
Using GWT and Eclipse to Build Great
Mobile Web Apps
Chris Ramsdale
Product Manager, GWT and Google Plugin for Eclipse

Feedback: http://goo.gl/mn6Y4
Twitter: #io2011 #gwt
Why Are We Here?




3
The Problems
• Mobile devices
    – ...have smaller screens
    – ...can have different orientations
    – ...have slower processors
    – ...can be disconnected




4
The Solution
• Use GWT and Google's Plugin for Eclipse (GPE) to build great mobile web apps
  for iPhone and Android


• And helps you
    – ...build great mobile UIs for any form factor
    – ...optimize the user experience
    – ...make it snappy
    – ...work without a connection




5
Example App: Cloud Tasks
• Web based task mgmt app
• UIs for Android, iPhone, iPad, and desktop browsers
• Orientation change handling
• Offline support
• Source code available at the end




6
•   Build great UIs for any form factor
•   Optimize the user experience
•   Make it snappy
•   Work without a connection
Build Great Mobile UIs For Any Form Factor
• UI code like you expect it
    – Declarative UI layout with UiBinder


• Speed up UI development with WYSIWYG tools
    – Using GWT Designer to build great UIs




8
Build Great Mobile UIs For Any Form Factor
UI code like you expect it
<ui:UiBinder>
    <ui:style>
        .addButton {
            color: white;
            font-size: 18pt;
            background: none;
            border: none;
            text-align: right;
            font-weight: bold;
        }
    </ui:style>

     ...

</ui:UiBinder>




9
Build Great Mobile UIs For Any Form Factor
UI code like you expect it
<ui:UiBinder>
    <ui:style>
        .addButton {
            color: white;
            font-size: 18pt;
            background: none;
            border: none;
            text-align: right;
            font-weight: bold;
        }
    </ui:style>

     ...

</ui:UiBinder>




10
Build Great Mobile UIs For Any Form Factor
UI code like you expect it
<ui:UiBinder>
    <g:DockLayoutPanel>

        <!-- Header -->
        <g:north size="32">
          <g:HTMLPanel></g:HTMLPanel>
        </g:north>

        <g:center>
            <g:DockLayoutPanel>
                <!-- Task List. -->
                <g:west size="30">
                    <g:SimpleLayoutPanel addStyleNames="{style.taskList}"/>
                </g:west>

                <!-- Content. -->
                <g:center>
                    <g:DeckLayoutPanel></g:DeckLayoutPanel>
                </g:center>
            </g:DockLayoutPanel>
        </g:center>
    </g:DockLayoutPanel>
</ui:UiBinder>



11
Build Great Mobile UIs For Any Form Factor
UI code like you expect it
<ui:UiBinder>
    <g:DockLayoutPanel>

        <!-- Header -->
        <g:north size="32">
          <g:HTMLPanel></g:HTMLPanel>
        </g:north>

        <g:center>
            <g:DockLayoutPanel>
                <!-- Task List. -->
                <g:west size="30">
                    <g:SimpleLayoutPanel addStyleNames="{style.taskList}"/>
                </g:west>

                <!-- Content. -->
                <g:center>
                    <g:DeckLayoutPanel></g:DeckLayoutPanel>
                </g:center>
            </g:DockLayoutPanel>
        </g:center>
    </g:DockLayoutPanel>
</ui:UiBinder>



12
Build Great Mobile UIs For Any Form Factor
UI code like you expect it




13
Build Great Mobile UIs For Any Form Factor
UI code like you expect it
<ui:UiBinder>
    <g:DockLayoutPanel>

        <!-- Header -->
        <g:north size="32">
          <g:HTMLPanel></g:HTMLPanel>
        </g:north>

        <g:center>
            <g:DockLayoutPanel>
                <!-- Task List. -->
                <g:west size="30">
                    <g:SimpleLayoutPanel addStyleNames="{style.taskList}"/>
                </g:west>

                <!-- Content. -->
                <g:center>
                    <g:DeckLayoutPanel></g:DeckLayoutPanel>
                </g:center>
            </g:DockLayoutPanel>
        </g:center>
    </g:DockLayoutPanel>
</ui:UiBinder>



14
Build Great Mobile UIs For Any Form Factor
UI code like you expect it




15
Build Great Mobile UIs For Any Form Factor
UI code like you expect it
<ui:UiBinder>
    <g:DockLayoutPanel>

        <!-- Header -->
        <g:north size="32">
          <g:HTMLPanel></g:HTMLPanel>
        </g:north>

        <g:center>
            <g:DockLayoutPanel>
                <!-- Task List. -->
                <g:west size="30">
                    <g:SimpleLayoutPanel addStyleNames="{style.taskList}"/>
                </g:west>

                <!-- Content. -->
                <g:center>
                    <g:DeckLayoutPanel></g:DeckLayoutPanel>
                </g:center>
            </g:DockLayoutPanel>
        </g:center>
    </g:DockLayoutPanel>
</ui:UiBinder>



16
Build Great Mobile UIs For Any Form Factor
UI code like you expect it




17
Build Great Mobile UIs For Any Form Factor
Speed up UI development with WYSIWYG tools




18
Build Great Mobile UIs For Any Form Factor
Speed up UI development with WYSIWYG tools




19
Build Great Mobile UIs For Any Form Factor
Device-specific, declarative UIs




                                             ListViewPhone.ui.xml
                   ListViewTablet.ui.xml
20
•   Build great UIs for any form factor
•   Optimize the user experience
•   Make it snappy
•   Work without a connection
Optimize the User Experience
• Desktops, tablets, and phones...oh my!
     – Deferred binding to sort them out


• Landscape vs. portrait
     – Capture and respond to orientation changes


• Icing on the cake
     – Maximize code reuse by using the Model-View-Presenter (MVP) design pattern




22
Optimize the User Experience
Select the right UI using deferred binding




                                        Deferred what?




23
Optimize the User Experience
Deferred binding - optimize for the browser




24
Optimize the User Experience
Select the right UI using deferred binding




25
Optimize the User Experience
Select the right UI using deferred binding




26
Optimize the User Experience
Select the right UI using deferred binding
     CloudTasks.gwt.xml (GWT app config)
     <!-- Use ViewFactoryImplMobile for mobile form factor. -->
     <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplMobile">
       <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/>
       <when-property-is name="formfactor" value="mobile"/>
     </replace-with>




27
Optimize the User Experience
Select the right UI using deferred binding
     CloudTasks.gwt.xml (GWT app config)
     <!-- Use ViewFactoryImplMobile for mobile form factor. -->
     <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplMobile">
       <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/>
       <when-property-is name="formfactor" value="mobile"/>
     </replace-with>




28
Optimize the User Experience
Select the right UI using deferred binding
     CloudTasks.gwt.xml (GWT app config)
     <!-- Use ViewFactoryImplMobile for tablet form factor. -->
     <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplTablet">
       <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/>
       <when-property-is name="formfactor" value="tablet"/>
     </replace-with>




29
Optimize the User Experience
Select the right UI using deferred binding
     CloudTasks.gwt.xml (GWT app config)
     <!-- Use ViewFactoryImplMobile for tablet form factor. -->
     <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplTablet">
       <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/>
       <when-property-is name="formfactor" value="tablet"/>
     </replace-with>




30
Optimize the User Experience
Select the right UI using deferred binding
     FormFactor.gwt.xml
     <property-provider name="formfactor">
       <![CDATA[
         var ua = navigator.userAgent.toLowerCase();
         if (ua.indexOf("ipad") != -1) {
             return "tablet";
         } else if (ua.indexOf("iphone") != -1 || ) {
           return "mobile";
         } else if (ua.indexOf("android") != -1) {
             // Overly complex hueristic for determining Android form factor
             ...
         }
       ]]>
     </property-provider>
31
Optimize the User Experience
Select the right UI using deferred binding
     FormFactor.gwt.xml
     <property-provider name="formfactor">
       <![CDATA[
         var ua = navigator.userAgent.toLowerCase();
         if (ua.indexOf("ipad") != -1) {
             return "tablet";
         } else if (ua.indexOf("iphone") != -1 || ) {
           return "mobile";
         } else if (ua.indexOf("android") != -1) {
             // Overly complex hueristic for determining Android form factor
             ...
         }
       ]]>
     </property-provider>
32
Optimize the User Experience
Select the right UI using deferred binding
     FormFactor.gwt.xml
     <property-provider name="formfactor">
       <![CDATA[
         var ua = navigator.userAgent.toLowerCase();
         if (ua.indexOf("ipad") != -1) {
             return "tablet";
         } else if (ua.indexOf("iphone") != -1 || ) {
           return "mobile";
         } else if (ua.indexOf("android") != -1) {
             // Overly complex hueristic for determining Android form factor
             ...
         }
       ]]>
     </property-provider>
33
Optimize the User Experience
Select the right UI using deferred binding
     FormFactor.gwt.xml
     <property-provider name="formfactor">
       <![CDATA[
         var ua = navigator.userAgent.toLowerCase();
         if (ua.indexOf("ipad") != -1) {
             return "tablet";
         } else if (ua.indexOf("iphone") != -1 || ) {
           return "mobile";
         } else if (ua.indexOf("android") != -1) {
             // Overly complex heuristic for determining Android form factor
             ...
         }
       ]]>
     </property-provider>
34
Optimize the User Experience
Select the right UI using deferred binding
     CloudTasks.gwt.xml (GWT app config)
     <!-- Use ViewFactoryImplMobile for tablet form factor. -->
     <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplTablet">
       <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/>
       <when-property-is name="formfactor" value="tablet"/>
     </replace-with>




35
Optimize the User Experience
Select the right UI using deferred binding




36
Build Great Mobile UIs For Any Form Factor
Device-specific, declarative UIs




                                             ListViewPhone.ui.xml
                   ListViewTablet.ui.xml
37
Optimize the User Experience
Capture and respond to orientation changes




38
Optimize the User Experience
Capture and respond to orientation changes




39
Optimize the User Experience
Capture and respond to orientation changes




40
Optimize the User Experience
Capture and respond to orientation changes
     /*
      * Listen for changes in the window size so we can adjust the
      * orientation of the app. This will also catch orientation changes
      * on mobile devices.
      */
     windowResizeHandler = Window.addResizeHandler(new ResizeHandler() {
       public void onResize(ResizeEvent event) {
           if (isOrientationPortrait != calculateOrientationPortrait()) {
               isOrientationPortrait = !isOrientationPortrait;
               adjustOrientation(isOrientationPortrait);
           }
       }
     });

41
Optimize the User Experience
Capture and respond to orientation changes
     /*
      * Listen for changes in the window size so we can adjust the
      * orientation of the app. This will also catch orientation changes
      * on mobile devices.
      */
     windowResizeHandler = Window.addResizeHandler(new ResizeHandler() {
       public void onResize(ResizeEvent event) {
           if (isOrientationPortrait != calculateOrientationPortrait()) {
               isOrientationPortrait = !isOrientationPortrait;
               adjustOrientation(isOrientationPortrait);
           }
       }
     });

42
Optimize the User Experience
Capture and respond to orientation changes




     private static boolean calculateOrientationPortrait() {
         return Window.getClientHeight() > Window.getClientWidth();
     }




43
Optimize the User Experience
Capture and respond to orientation changes
     /*
      * Listen for changes in the window size so we can adjust the
      * orientation of the app. This will also catch orientation changes
      * on mobile devices.
      */
     windowResizeHandler = Window.addResizeHandler(new ResizeHandler() {
       public void onResize(ResizeEvent event) {
           if (isOrientationPortrait != calculateOrientationPortrait()) {
               isOrientationPortrait = !isOrientationPortrait;
               adjustOrientation(isOrientationPortrait);
           }
       }
     });

44
Optimize the User Experience
Capture and respond to orientation changes




45
Optimize the User Experience
Capture and respond to orientation changes




46
Optimize the User Experience
Maximize code reuse using the MVP pattern




47
Optimize the User Experience
Maximize code reuse using the MVP pattern

• MVP recap
     – Model-View-Presenter design pattern
     – Similar to MVC - less logic in the View
     – Business logic goes are part of Model/Presenter
     – Keep Views as simple as possible
     – Faster test cycles: run tests as vanilla JRE tests




48
Optimize the User Experience
Maximize code reuse using the MVP pattern

• Tablet vs Phone
     – Business logic is the same
     – Views change
     – Ideal design pattern for supporting multiple form factors




49
Optimize the User Experience
Maximize code reuse using the MVP pattern




50
Optimize the User Experience
Maximize code reuse using the MVP pattern




51
Optimize the User Experience
Select the right UI using deferred binding
     CloudTasks.gwt.xml (GWT module config)
     <!-- Use ViewFactoryImplTablet for tablet form factor. -->
     <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplTablet">
       <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/>
       <when-property-is name="formfactor" value="tablet"/>
     </replace-with>




52
•   Build great UIs for any form factor
•   Optimize the user experience
•   Make it snappy
•   Work without a connection
Make it Snappy

• Increase responsiveness
     – Problem: HTTP requests are expensive over 3G connections


• Minimize startup time
     – Problem: Mobile processing power still trails desktops/laptops
     – Problem: Parsing large amounts of Javascript can be a large source of latency




54
Make it Snappy

• Increase responsiveness
     – Solution: Use GWT's Client Bundle to batch resource fetches


• Minimize startup time
     – Solution: Use Code Splitting to grab only the code you need
     – Solution: Remove unused code, reduce overall code size using GWT compiler optimizations




55
Make it Snappy
Increase responsiveness by bundling resource fetches




                                             Demo




56
Make it Snappy
Increase responsiveness by bundling resource fetches

• Even worse, mobile browsers limit the number of concurrent requests
• Ex http request waterfall chart for Android - 4 concurrent TCP connections




     http://calendar.perfplanet.com/2010/mobile-performance-analysis-using-pcapperf/
57
Make it Snappy
Increase responsiveness by bundling resources

     public interface Resources extends ClientBundle {
         @Source("image0.gif")
         public ImageResource image0();

         @Source("image1.gif")
         public ImageResource image1();

         ...
     }

58
Make it Snappy
Increase responsiveness by deferring resource fetching

     void onShowImagesButtonClicked() {
         GWT.runAsync(new RunAsyncCallback() {
             public void onSuccess() {
                 showImagesDialog();
             }
         }
     }




59
Make it Snappy
Increase responsiveness by deferring resource fetching

     void onShowImagesButtonClicked() {
         GWT.runAsync(new RunAsyncCallback() {
             public void onSuccess() {
                 showImagesDialog();
             }
         }
     }




60
Make it Snappy
Increase responsiveness by deferring resource fetching
                                                                          HTTP Request Overhead
                                                2000



Total time spent waiting (ms)
                                                1500




• Not bundled: 1409ms
                                                1000




• Bundled: 594ms
                                                 500




• Bundled and code split: 664ms                    0
                                                         Not bundled             Bundled              Bundled/code split


                                                                       Startup             Image dialog



61
Make it Snappy
Reduce overall code size, reduce startup time

• More Javascript == more parsing == increased load time, cpu cycles
• Increased cpu cycles == battery drain == poor user experience
                                                       Optimized vs Unoptimized Output
                                                1100


• GWT compiler optimizations can help
     – Dead code elimination                     825




     – Duplicate function removal
                                                 550

     – Obfuscation
                                                 275




                                                   0
                                                             Size of Javascript in KB

                                                        Optimized                       Unoptimized




62
•   Build great UIs for any form factor
•   Optimize the user experience
•   Make it snappy
•   Work without a connection
Work Without a Connection

• Run wherever, whenever
     – Use Application Cache to load resources locally


• Access data wherever, whenever
     – Use Local Storage as a caching mechanism for RPCs




64
Work Without a Connection
Run wherever, whenever using Application Cache

• Part of the HTML5 feature set
• Loads resources like HTML, CSS, and JS from disk
• Works with iPhone and Android (+ Chrome, Safari, and Firefox)




65
Work Without a Connection
Run wherever, whenever using Application Cache

• appcache.nocache.manifest
     – Lists all of the files that you want to browser to cache
        • Include HTML, CSS, JS
           – Exclude GWT-RPC-related files (security)
           – "nocache" - always requested


• web.xml
     – mime-type for manifest files (text/plain)


• <your_app>.html
     – include <html manifest="app.nocache.manifest">

66
Work Without a Connection
Run wherever, whenever using Application Cache




                 ...or check out the GWT 2.4 SDK :-)




67
Work Without a Connection
Run wherever, whenever using Application Cache


<!-- Define a custom App Cache linker -->
<define-linker name="appcachelinker"
    class="com.google.gwt.sample.mobilewebapp.linker.AppCacheLinker"/>

<!-- Use it -->
<add-linker name="appcachelinker"/>




68
Work Without a Connection
Access data wherever, whenever using Local Storage

• Part of the HTML5 feature set
• Utilizes a local database for reading/writing data
• Key/value-pair persistence
• Works with iPhone and Android (+ Chrome, Safari, and Firefox)
• Included in the GWT 2.3 SDK




69
Work Without a Connection
Access data wherever, whenever using Local Storage

• Grab an instance of the Local Storage interface
     localStorage = Storage.getLocalStorageIfSupported();


• Read cache and then request any updates
     public List<Tasks> getTasks() {
         String taskListString = localStorage.getItem(TASKLIST_SAVE_KEY);
         List<Tasks> tasks = deserialize(taskListString);
         requestFactory.taskRequest().queryForUpdates().fire(...) {
             ...
         }
         return tasks;
     }
70
Work Without a Connection
Access data wherever, whenever using Local Storage

• Upon response, update cache and any listeners
     public List<Tasks> getTasks() {
         ...
         requestFactory.taskRequest().queryForUpdates().fire(
           new Receiver<List<Tasks>>() {
               public onSuccess(List<Tasks> tasks) {
                 String tasksListString = serialize(tasks);
                 localStorage.setItem(TASKSLIST_SAVE_KEY, tasksListString);
                 // update everyone listening for task list updates
               }});
         ...
     }
71
Summary

• There are many challenges when building great mobile web apps


• GWT and GPE can help


• Tools for quickly building great UIs


• Frameworks for optimizing the user experience


• Compilers and code generators to improve speed


• API support for working offline
72
More Info...

• You can download the source and tools here:
     – http://code.google.com/webtoolkit/download.html


• Other sessions to check out
     – Use Page Speed to Optimize Your Web Site For Mobile (Check back for YouTube link)
     – Mobile Web Development: From Zero to Hero (12:30pm)
     – HTML5 versus Android: Apps or Web for Mobile Development? (3pm)




73
Q&A




74
</presentation>




75

Contenu connexe

En vedette

Social Media for IABC Chapters
Social Media for IABC ChaptersSocial Media for IABC Chapters
Social Media for IABC ChaptersDare to Lead 2011
 
Event Management by Redefine SAPCPG
Event Management by Redefine SAPCPGEvent Management by Redefine SAPCPG
Event Management by Redefine SAPCPGRedefine
 
Event Management by Redefine SEL_Offsite
Event Management by Redefine SEL_Offsite Event Management by Redefine SEL_Offsite
Event Management by Redefine SEL_Offsite Redefine
 
Redefine Profile
Redefine ProfileRedefine Profile
Redefine ProfileRedefine
 
Creative Showcase by Redefine Team
Creative Showcase by Redefine TeamCreative Showcase by Redefine Team
Creative Showcase by Redefine TeamRedefine
 
Jacobson Cardinali 15 Principes
Jacobson Cardinali 15 PrincipesJacobson Cardinali 15 Principes
Jacobson Cardinali 15 PrincipesOlaf Jacobson
 
Les tic a l´educació
Les tic a l´educacióLes tic a l´educació
Les tic a l´educacióraqueltarraco
 
Classe d´anglés amb tic
Classe d´anglés amb ticClasse d´anglés amb tic
Classe d´anglés amb ticraqueltarraco
 
Classe d´anglés amb tic
Classe d´anglés amb ticClasse d´anglés amb tic
Classe d´anglés amb ticraqueltarraco
 

En vedette (13)

Social Media for IABC Chapters
Social Media for IABC ChaptersSocial Media for IABC Chapters
Social Media for IABC Chapters
 
Event Management by Redefine SAPCPG
Event Management by Redefine SAPCPGEvent Management by Redefine SAPCPG
Event Management by Redefine SAPCPG
 
Event Management by Redefine SEL_Offsite
Event Management by Redefine SEL_Offsite Event Management by Redefine SEL_Offsite
Event Management by Redefine SEL_Offsite
 
Purify water
Purify waterPurify water
Purify water
 
Facebook採用活動のご案内
Facebook採用活動のご案内Facebook採用活動のご案内
Facebook採用活動のご案内
 
Redefine Profile
Redefine ProfileRedefine Profile
Redefine Profile
 
Creative Showcase by Redefine Team
Creative Showcase by Redefine TeamCreative Showcase by Redefine Team
Creative Showcase by Redefine Team
 
Jacobson Cardinali 15 Principes
Jacobson Cardinali 15 PrincipesJacobson Cardinali 15 Principes
Jacobson Cardinali 15 Principes
 
Les tic a l´educació
Les tic a l´educacióLes tic a l´educació
Les tic a l´educació
 
Classe d´anglés amb tic
Classe d´anglés amb ticClasse d´anglés amb tic
Classe d´anglés amb tic
 
Classe d´anglés amb tic
Classe d´anglés amb ticClasse d´anglés amb tic
Classe d´anglés amb tic
 
Bus
BusBus
Bus
 
O novo-gmail
O novo-gmailO novo-gmail
O novo-gmail
 

Similaire à Cramsdale dev tools_using-gwt-and-google-plugin-for-eclipse-to-build-greate-mobile-web-apps

What's new in Android at I/O'16
What's new in Android at I/O'16What's new in Android at I/O'16
What's new in Android at I/O'16Elif Boncuk
 
Desenvolvimento Mobile Híbrido
Desenvolvimento Mobile HíbridoDesenvolvimento Mobile Híbrido
Desenvolvimento Mobile HíbridoJuliano Martins
 
Primefaces mobile users_guide_0_9
Primefaces mobile users_guide_0_9Primefaces mobile users_guide_0_9
Primefaces mobile users_guide_0_9ednilsoncampos
 
Android Wear: A Developer's Perspective
Android Wear: A Developer's PerspectiveAndroid Wear: A Developer's Perspective
Android Wear: A Developer's PerspectiveVin Lim
 
Android N Highligts
Android N HighligtsAndroid N Highligts
Android N HighligtsSercan Yusuf
 
Telerik Kendo UI Overview
Telerik Kendo UI OverviewTelerik Kendo UI Overview
Telerik Kendo UI OverviewEd Musters
 
embedding web browser in your app
embedding web browser in your appembedding web browser in your app
embedding web browser in your appSamsung
 
Mobile html5 today
Mobile html5 todayMobile html5 today
Mobile html5 todayIdo Green
 
How To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages ApplicationHow To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages ApplicationMichael McGarel
 
How to speedup GWT compiler
How to speedup GWT compilerHow to speedup GWT compiler
How to speedup GWT compilerMohammed Kharma
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactOliver N
 
CiklumJavaSat15112011:Andrew Mormysh-GWT features overview
CiklumJavaSat15112011:Andrew Mormysh-GWT features overviewCiklumJavaSat15112011:Andrew Mormysh-GWT features overview
CiklumJavaSat15112011:Andrew Mormysh-GWT features overviewCiklum Ukraine
 
V Legakis Presentation
V Legakis PresentationV Legakis Presentation
V Legakis PresentationVLegakis
 
BP204 - Take a REST and put your data to work with APIs!
BP204 - Take a REST and put your data to work with APIs!BP204 - Take a REST and put your data to work with APIs!
BP204 - Take a REST and put your data to work with APIs!Craig Schumann
 
Google I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackGoogle I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackSunita Singh
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 
Polymer
Polymer Polymer
Polymer jskvara
 
Final year project working documentation 2020
Final year project working documentation 2020Final year project working documentation 2020
Final year project working documentation 2020Vikram Singh
 
Gdg san diego android 11 meetups what's new in android - ui and dev tools
Gdg san diego android 11 meetups  what's new in android  - ui and dev toolsGdg san diego android 11 meetups  what's new in android  - ui and dev tools
Gdg san diego android 11 meetups what's new in android - ui and dev toolsSvetlin Stanchev
 

Similaire à Cramsdale dev tools_using-gwt-and-google-plugin-for-eclipse-to-build-greate-mobile-web-apps (20)

What's new in Android at I/O'16
What's new in Android at I/O'16What's new in Android at I/O'16
What's new in Android at I/O'16
 
Desenvolvimento Mobile Híbrido
Desenvolvimento Mobile HíbridoDesenvolvimento Mobile Híbrido
Desenvolvimento Mobile Híbrido
 
Primefaces mobile users_guide_0_9
Primefaces mobile users_guide_0_9Primefaces mobile users_guide_0_9
Primefaces mobile users_guide_0_9
 
Android Wear: A Developer's Perspective
Android Wear: A Developer's PerspectiveAndroid Wear: A Developer's Perspective
Android Wear: A Developer's Perspective
 
Android N Highligts
Android N HighligtsAndroid N Highligts
Android N Highligts
 
Telerik Kendo UI Overview
Telerik Kendo UI OverviewTelerik Kendo UI Overview
Telerik Kendo UI Overview
 
embedding web browser in your app
embedding web browser in your appembedding web browser in your app
embedding web browser in your app
 
Mobile html5 today
Mobile html5 todayMobile html5 today
Mobile html5 today
 
How To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages ApplicationHow To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages Application
 
How to speedup GWT compiler
How to speedup GWT compilerHow to speedup GWT compiler
How to speedup GWT compiler
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose React
 
CiklumJavaSat15112011:Andrew Mormysh-GWT features overview
CiklumJavaSat15112011:Andrew Mormysh-GWT features overviewCiklumJavaSat15112011:Andrew Mormysh-GWT features overview
CiklumJavaSat15112011:Andrew Mormysh-GWT features overview
 
V Legakis Presentation
V Legakis PresentationV Legakis Presentation
V Legakis Presentation
 
BP204 - Take a REST and put your data to work with APIs!
BP204 - Take a REST and put your data to work with APIs!BP204 - Take a REST and put your data to work with APIs!
BP204 - Take a REST and put your data to work with APIs!
 
Google I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackGoogle I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and Jetpack
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
Polymer
Polymer Polymer
Polymer
 
Final year project working documentation 2020
Final year project working documentation 2020Final year project working documentation 2020
Final year project working documentation 2020
 
Gdg san diego android 11 meetups what's new in android - ui and dev tools
Gdg san diego android 11 meetups  what's new in android  - ui and dev toolsGdg san diego android 11 meetups  what's new in android  - ui and dev tools
Gdg san diego android 11 meetups what's new in android - ui and dev tools
 
Night Watch with QA
Night Watch with QANight Watch with QA
Night Watch with QA
 

Dernier

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 

Dernier (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

Cramsdale dev tools_using-gwt-and-google-plugin-for-eclipse-to-build-greate-mobile-web-apps

  • 1.
  • 2.
  • 3. Using GWT and Eclipse to Build Great Mobile Web Apps Chris Ramsdale Product Manager, GWT and Google Plugin for Eclipse Feedback: http://goo.gl/mn6Y4 Twitter: #io2011 #gwt
  • 4. Why Are We Here? 3
  • 5. The Problems • Mobile devices – ...have smaller screens – ...can have different orientations – ...have slower processors – ...can be disconnected 4
  • 6. The Solution • Use GWT and Google's Plugin for Eclipse (GPE) to build great mobile web apps for iPhone and Android • And helps you – ...build great mobile UIs for any form factor – ...optimize the user experience – ...make it snappy – ...work without a connection 5
  • 7. Example App: Cloud Tasks • Web based task mgmt app • UIs for Android, iPhone, iPad, and desktop browsers • Orientation change handling • Offline support • Source code available at the end 6
  • 8.
  • 9. Build great UIs for any form factor • Optimize the user experience • Make it snappy • Work without a connection
  • 10. Build Great Mobile UIs For Any Form Factor • UI code like you expect it – Declarative UI layout with UiBinder • Speed up UI development with WYSIWYG tools – Using GWT Designer to build great UIs 8
  • 11. Build Great Mobile UIs For Any Form Factor UI code like you expect it <ui:UiBinder> <ui:style> .addButton { color: white; font-size: 18pt; background: none; border: none; text-align: right; font-weight: bold; } </ui:style> ... </ui:UiBinder> 9
  • 12. Build Great Mobile UIs For Any Form Factor UI code like you expect it <ui:UiBinder> <ui:style> .addButton { color: white; font-size: 18pt; background: none; border: none; text-align: right; font-weight: bold; } </ui:style> ... </ui:UiBinder> 10
  • 13. Build Great Mobile UIs For Any Form Factor UI code like you expect it <ui:UiBinder> <g:DockLayoutPanel> <!-- Header --> <g:north size="32"> <g:HTMLPanel></g:HTMLPanel> </g:north> <g:center> <g:DockLayoutPanel> <!-- Task List. --> <g:west size="30"> <g:SimpleLayoutPanel addStyleNames="{style.taskList}"/> </g:west> <!-- Content. --> <g:center> <g:DeckLayoutPanel></g:DeckLayoutPanel> </g:center> </g:DockLayoutPanel> </g:center> </g:DockLayoutPanel> </ui:UiBinder> 11
  • 14. Build Great Mobile UIs For Any Form Factor UI code like you expect it <ui:UiBinder> <g:DockLayoutPanel> <!-- Header --> <g:north size="32"> <g:HTMLPanel></g:HTMLPanel> </g:north> <g:center> <g:DockLayoutPanel> <!-- Task List. --> <g:west size="30"> <g:SimpleLayoutPanel addStyleNames="{style.taskList}"/> </g:west> <!-- Content. --> <g:center> <g:DeckLayoutPanel></g:DeckLayoutPanel> </g:center> </g:DockLayoutPanel> </g:center> </g:DockLayoutPanel> </ui:UiBinder> 12
  • 15. Build Great Mobile UIs For Any Form Factor UI code like you expect it 13
  • 16. Build Great Mobile UIs For Any Form Factor UI code like you expect it <ui:UiBinder> <g:DockLayoutPanel> <!-- Header --> <g:north size="32"> <g:HTMLPanel></g:HTMLPanel> </g:north> <g:center> <g:DockLayoutPanel> <!-- Task List. --> <g:west size="30"> <g:SimpleLayoutPanel addStyleNames="{style.taskList}"/> </g:west> <!-- Content. --> <g:center> <g:DeckLayoutPanel></g:DeckLayoutPanel> </g:center> </g:DockLayoutPanel> </g:center> </g:DockLayoutPanel> </ui:UiBinder> 14
  • 17. Build Great Mobile UIs For Any Form Factor UI code like you expect it 15
  • 18. Build Great Mobile UIs For Any Form Factor UI code like you expect it <ui:UiBinder> <g:DockLayoutPanel> <!-- Header --> <g:north size="32"> <g:HTMLPanel></g:HTMLPanel> </g:north> <g:center> <g:DockLayoutPanel> <!-- Task List. --> <g:west size="30"> <g:SimpleLayoutPanel addStyleNames="{style.taskList}"/> </g:west> <!-- Content. --> <g:center> <g:DeckLayoutPanel></g:DeckLayoutPanel> </g:center> </g:DockLayoutPanel> </g:center> </g:DockLayoutPanel> </ui:UiBinder> 16
  • 19. Build Great Mobile UIs For Any Form Factor UI code like you expect it 17
  • 20. Build Great Mobile UIs For Any Form Factor Speed up UI development with WYSIWYG tools 18
  • 21. Build Great Mobile UIs For Any Form Factor Speed up UI development with WYSIWYG tools 19
  • 22. Build Great Mobile UIs For Any Form Factor Device-specific, declarative UIs ListViewPhone.ui.xml ListViewTablet.ui.xml 20
  • 23.
  • 24. Build great UIs for any form factor • Optimize the user experience • Make it snappy • Work without a connection
  • 25. Optimize the User Experience • Desktops, tablets, and phones...oh my! – Deferred binding to sort them out • Landscape vs. portrait – Capture and respond to orientation changes • Icing on the cake – Maximize code reuse by using the Model-View-Presenter (MVP) design pattern 22
  • 26. Optimize the User Experience Select the right UI using deferred binding Deferred what? 23
  • 27. Optimize the User Experience Deferred binding - optimize for the browser 24
  • 28. Optimize the User Experience Select the right UI using deferred binding 25
  • 29. Optimize the User Experience Select the right UI using deferred binding 26
  • 30. Optimize the User Experience Select the right UI using deferred binding CloudTasks.gwt.xml (GWT app config) <!-- Use ViewFactoryImplMobile for mobile form factor. --> <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplMobile"> <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/> <when-property-is name="formfactor" value="mobile"/> </replace-with> 27
  • 31. Optimize the User Experience Select the right UI using deferred binding CloudTasks.gwt.xml (GWT app config) <!-- Use ViewFactoryImplMobile for mobile form factor. --> <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplMobile"> <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/> <when-property-is name="formfactor" value="mobile"/> </replace-with> 28
  • 32. Optimize the User Experience Select the right UI using deferred binding CloudTasks.gwt.xml (GWT app config) <!-- Use ViewFactoryImplMobile for tablet form factor. --> <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplTablet"> <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/> <when-property-is name="formfactor" value="tablet"/> </replace-with> 29
  • 33. Optimize the User Experience Select the right UI using deferred binding CloudTasks.gwt.xml (GWT app config) <!-- Use ViewFactoryImplMobile for tablet form factor. --> <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplTablet"> <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/> <when-property-is name="formfactor" value="tablet"/> </replace-with> 30
  • 34. Optimize the User Experience Select the right UI using deferred binding FormFactor.gwt.xml <property-provider name="formfactor"> <![CDATA[ var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("ipad") != -1) { return "tablet"; } else if (ua.indexOf("iphone") != -1 || ) { return "mobile"; } else if (ua.indexOf("android") != -1) { // Overly complex hueristic for determining Android form factor ... } ]]> </property-provider> 31
  • 35. Optimize the User Experience Select the right UI using deferred binding FormFactor.gwt.xml <property-provider name="formfactor"> <![CDATA[ var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("ipad") != -1) { return "tablet"; } else if (ua.indexOf("iphone") != -1 || ) { return "mobile"; } else if (ua.indexOf("android") != -1) { // Overly complex hueristic for determining Android form factor ... } ]]> </property-provider> 32
  • 36. Optimize the User Experience Select the right UI using deferred binding FormFactor.gwt.xml <property-provider name="formfactor"> <![CDATA[ var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("ipad") != -1) { return "tablet"; } else if (ua.indexOf("iphone") != -1 || ) { return "mobile"; } else if (ua.indexOf("android") != -1) { // Overly complex hueristic for determining Android form factor ... } ]]> </property-provider> 33
  • 37. Optimize the User Experience Select the right UI using deferred binding FormFactor.gwt.xml <property-provider name="formfactor"> <![CDATA[ var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("ipad") != -1) { return "tablet"; } else if (ua.indexOf("iphone") != -1 || ) { return "mobile"; } else if (ua.indexOf("android") != -1) { // Overly complex heuristic for determining Android form factor ... } ]]> </property-provider> 34
  • 38. Optimize the User Experience Select the right UI using deferred binding CloudTasks.gwt.xml (GWT app config) <!-- Use ViewFactoryImplMobile for tablet form factor. --> <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplTablet"> <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/> <when-property-is name="formfactor" value="tablet"/> </replace-with> 35
  • 39. Optimize the User Experience Select the right UI using deferred binding 36
  • 40. Build Great Mobile UIs For Any Form Factor Device-specific, declarative UIs ListViewPhone.ui.xml ListViewTablet.ui.xml 37
  • 41. Optimize the User Experience Capture and respond to orientation changes 38
  • 42. Optimize the User Experience Capture and respond to orientation changes 39
  • 43. Optimize the User Experience Capture and respond to orientation changes 40
  • 44. Optimize the User Experience Capture and respond to orientation changes /* * Listen for changes in the window size so we can adjust the * orientation of the app. This will also catch orientation changes * on mobile devices. */ windowResizeHandler = Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { if (isOrientationPortrait != calculateOrientationPortrait()) { isOrientationPortrait = !isOrientationPortrait; adjustOrientation(isOrientationPortrait); } } }); 41
  • 45. Optimize the User Experience Capture and respond to orientation changes /* * Listen for changes in the window size so we can adjust the * orientation of the app. This will also catch orientation changes * on mobile devices. */ windowResizeHandler = Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { if (isOrientationPortrait != calculateOrientationPortrait()) { isOrientationPortrait = !isOrientationPortrait; adjustOrientation(isOrientationPortrait); } } }); 42
  • 46. Optimize the User Experience Capture and respond to orientation changes private static boolean calculateOrientationPortrait() { return Window.getClientHeight() > Window.getClientWidth(); } 43
  • 47. Optimize the User Experience Capture and respond to orientation changes /* * Listen for changes in the window size so we can adjust the * orientation of the app. This will also catch orientation changes * on mobile devices. */ windowResizeHandler = Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { if (isOrientationPortrait != calculateOrientationPortrait()) { isOrientationPortrait = !isOrientationPortrait; adjustOrientation(isOrientationPortrait); } } }); 44
  • 48. Optimize the User Experience Capture and respond to orientation changes 45
  • 49. Optimize the User Experience Capture and respond to orientation changes 46
  • 50. Optimize the User Experience Maximize code reuse using the MVP pattern 47
  • 51. Optimize the User Experience Maximize code reuse using the MVP pattern • MVP recap – Model-View-Presenter design pattern – Similar to MVC - less logic in the View – Business logic goes are part of Model/Presenter – Keep Views as simple as possible – Faster test cycles: run tests as vanilla JRE tests 48
  • 52. Optimize the User Experience Maximize code reuse using the MVP pattern • Tablet vs Phone – Business logic is the same – Views change – Ideal design pattern for supporting multiple form factors 49
  • 53. Optimize the User Experience Maximize code reuse using the MVP pattern 50
  • 54. Optimize the User Experience Maximize code reuse using the MVP pattern 51
  • 55. Optimize the User Experience Select the right UI using deferred binding CloudTasks.gwt.xml (GWT module config) <!-- Use ViewFactoryImplTablet for tablet form factor. --> <replace-with class="com.google.mobilecalendar.client.ViewFactoryImplTablet"> <when-type-is class="com.google.mobilecalendar.client.ViewFactory"/> <when-property-is name="formfactor" value="tablet"/> </replace-with> 52
  • 56.
  • 57. Build great UIs for any form factor • Optimize the user experience • Make it snappy • Work without a connection
  • 58. Make it Snappy • Increase responsiveness – Problem: HTTP requests are expensive over 3G connections • Minimize startup time – Problem: Mobile processing power still trails desktops/laptops – Problem: Parsing large amounts of Javascript can be a large source of latency 54
  • 59. Make it Snappy • Increase responsiveness – Solution: Use GWT's Client Bundle to batch resource fetches • Minimize startup time – Solution: Use Code Splitting to grab only the code you need – Solution: Remove unused code, reduce overall code size using GWT compiler optimizations 55
  • 60. Make it Snappy Increase responsiveness by bundling resource fetches Demo 56
  • 61. Make it Snappy Increase responsiveness by bundling resource fetches • Even worse, mobile browsers limit the number of concurrent requests • Ex http request waterfall chart for Android - 4 concurrent TCP connections http://calendar.perfplanet.com/2010/mobile-performance-analysis-using-pcapperf/ 57
  • 62. Make it Snappy Increase responsiveness by bundling resources public interface Resources extends ClientBundle { @Source("image0.gif") public ImageResource image0(); @Source("image1.gif") public ImageResource image1(); ... } 58
  • 63. Make it Snappy Increase responsiveness by deferring resource fetching void onShowImagesButtonClicked() { GWT.runAsync(new RunAsyncCallback() { public void onSuccess() { showImagesDialog(); } } } 59
  • 64. Make it Snappy Increase responsiveness by deferring resource fetching void onShowImagesButtonClicked() { GWT.runAsync(new RunAsyncCallback() { public void onSuccess() { showImagesDialog(); } } } 60
  • 65. Make it Snappy Increase responsiveness by deferring resource fetching HTTP Request Overhead 2000 Total time spent waiting (ms) 1500 • Not bundled: 1409ms 1000 • Bundled: 594ms 500 • Bundled and code split: 664ms 0 Not bundled Bundled Bundled/code split Startup Image dialog 61
  • 66. Make it Snappy Reduce overall code size, reduce startup time • More Javascript == more parsing == increased load time, cpu cycles • Increased cpu cycles == battery drain == poor user experience Optimized vs Unoptimized Output 1100 • GWT compiler optimizations can help – Dead code elimination 825 – Duplicate function removal 550 – Obfuscation 275 0 Size of Javascript in KB Optimized Unoptimized 62
  • 67.
  • 68. Build great UIs for any form factor • Optimize the user experience • Make it snappy • Work without a connection
  • 69. Work Without a Connection • Run wherever, whenever – Use Application Cache to load resources locally • Access data wherever, whenever – Use Local Storage as a caching mechanism for RPCs 64
  • 70. Work Without a Connection Run wherever, whenever using Application Cache • Part of the HTML5 feature set • Loads resources like HTML, CSS, and JS from disk • Works with iPhone and Android (+ Chrome, Safari, and Firefox) 65
  • 71. Work Without a Connection Run wherever, whenever using Application Cache • appcache.nocache.manifest – Lists all of the files that you want to browser to cache • Include HTML, CSS, JS – Exclude GWT-RPC-related files (security) – "nocache" - always requested • web.xml – mime-type for manifest files (text/plain) • <your_app>.html – include <html manifest="app.nocache.manifest"> 66
  • 72. Work Without a Connection Run wherever, whenever using Application Cache ...or check out the GWT 2.4 SDK :-) 67
  • 73. Work Without a Connection Run wherever, whenever using Application Cache <!-- Define a custom App Cache linker --> <define-linker name="appcachelinker" class="com.google.gwt.sample.mobilewebapp.linker.AppCacheLinker"/> <!-- Use it --> <add-linker name="appcachelinker"/> 68
  • 74. Work Without a Connection Access data wherever, whenever using Local Storage • Part of the HTML5 feature set • Utilizes a local database for reading/writing data • Key/value-pair persistence • Works with iPhone and Android (+ Chrome, Safari, and Firefox) • Included in the GWT 2.3 SDK 69
  • 75. Work Without a Connection Access data wherever, whenever using Local Storage • Grab an instance of the Local Storage interface localStorage = Storage.getLocalStorageIfSupported(); • Read cache and then request any updates public List<Tasks> getTasks() { String taskListString = localStorage.getItem(TASKLIST_SAVE_KEY); List<Tasks> tasks = deserialize(taskListString); requestFactory.taskRequest().queryForUpdates().fire(...) { ... } return tasks; } 70
  • 76. Work Without a Connection Access data wherever, whenever using Local Storage • Upon response, update cache and any listeners public List<Tasks> getTasks() { ... requestFactory.taskRequest().queryForUpdates().fire( new Receiver<List<Tasks>>() { public onSuccess(List<Tasks> tasks) { String tasksListString = serialize(tasks); localStorage.setItem(TASKSLIST_SAVE_KEY, tasksListString); // update everyone listening for task list updates }}); ... } 71
  • 77. Summary • There are many challenges when building great mobile web apps • GWT and GPE can help • Tools for quickly building great UIs • Frameworks for optimizing the user experience • Compilers and code generators to improve speed • API support for working offline 72
  • 78. More Info... • You can download the source and tools here: – http://code.google.com/webtoolkit/download.html • Other sessions to check out – Use Page Speed to Optimize Your Web Site For Mobile (Check back for YouTube link) – Mobile Web Development: From Zero to Hero (12:30pm) – HTML5 versus Android: Apps or Web for Mobile Development? (3pm) 73

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n