SlideShare a Scribd company logo
Series 40 Developer Training
Adapting Series 40 Touch and Type
apps to full-touch UI


Michael Samarin, Ph.D
Director,
Developer Training and Evangelism
Futurice Oy
@MichaelSamarin
› Brief Full Touch Devices
                                              Overview

 Agenda for today’s                         › UI Style Guides
 webinar                                    › Adapting Touch & Type apps
                                            › Demonstrations with
                                              NetBeans and Nokia SDKs
         Don’t forget to take a look at previously recorded webinars:

http://www.developer.nokia.com/Resources/Multimedia/Webinars.xhtml#Webinar
Devices are released and in consumer hands today:

                                     Asha
                                     305
                                     306
                                     311
› Codebase on Full Touch is
                                          backward compatible

  Existing Touch &                      › Older Midlets “just work”
Type or Non Touch                       › Of course UI requires
              apps                        tweaking and remodeling to
                                          utilize new UI paradigm


Best help in understanding new UI - Series 40 Full Touch Design Guidelines:

http://www.developer.nokia.com/Resources/Library/Full_Touch/#!index.html
› Single build for multiple
                      target devices
   Strategies for      › Code level configurations
       targeting
Touch & Type and    › Multiple builds for multiple
                      target devices
       Full Touch
                       › IDE level configurations –
                         NetBeans
» For single build targeting multiple devices checkout porting part of webinar:
» Andreas Jakl, Nokia
    › Introduction to Nokia Series 40 Full Touch UI

    › http://www.slideshare.net/nokia-developer/introduction-to-series-40-full-touch-ui

    › http://forumnokia.adobeconnect.com/p3yw0g4jz6f/

» Following slides are extracts
COMPATIBILITY?
• Source & binary compatible
    – xx years old Java ME apps run on
      full touch phones!
• Downwards compatibility
    – Check API support of target phones
    – Lowest common denominator:
        → Nokia Java SDK 2.0 compiled app
        runs on old phones


7      © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
PORTING TO TOUCH
• All Java ME apps should run on full touch phone
     – High-Level UI
          –   Adapts automatically
          –   Components include touch-support
          –   Check layout
          –   New UI components (CategoryBar, etc.) don’t have to be used
     – Low-Level UI
          – New screen size & aspect ratio (but: most Java apps already flexible here)
          – Touch supported in Java ME since many years
          – Basic key simulation with drag gestures for non-touch apps
• New APIs for Multitouch, Pinch, CategoryBar & Sensors
     – Only work on FT phones
     – Careful app design even keeps downwards compatibility



 8       © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
PORTING




                                                                       Touch and type
Non-touch app with high-level UI (LCDUI):
Automatically adapts to touch
          Non-touch




9       © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl   Full touch
DYNAMIC API USAGE
• Single code base for different phones
     –Code that uses new APIs
         –Externalize to extra class
     –Check API support at runtime
         –Instantiate class if supported
         –Different methods for checking available




10      © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
EXAMPLE: PINCH GESTURE
• Gesture API
     –Available in Touch & Type
     –Full Touch adds Pinch gesture
     –Query support at runtime
       // Pinch gesture
       if (GestureInteractiveZone.isSupported(GestureInteractiveZone.GESTURE_PINCH)) {
           // Gesture is supported - register class as listener
           GestureRegistrationManager.setListener(this, this);
           // Register for pinch gesture
           gestureZone = new GestureInteractiveZone(GestureInteractiveZone.GESTURE_PINCH);
           GestureRegistrationManager.register(this, gestureZone);
       }


11      © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
EXAMPLE: OPTIONAL MULTITOUCH
• Encapsulate API using code to separate class
      public class MultitouchManager implements MultipointTouchListener {

          public MultitouchManager(MainCanvas canvas) {
              MultipointTouch mpt = MultipointTouch.getInstance();                              Hint: only handle
              mpt.addMultipointTouchListener(this);                                             Canvas.pointerPressed()
          }                                                                                     on single touch phones

          public void pointersChanged(int[] pointerIds) { /* ... */ }       protected void pointerPressed(int x, int y) {
      }                                                                         if (!useMultitouch) {
                                                                                    // Handle touch event
                                                                                    // on single-touch phone
                                                                                }
• Check support and instantiate on demand                                   }
      if (System.getProperty("com.nokia.mid.ui.multipointtouch.version") != null) {
          // API is supported: Can implement multipoint touch functionality
          multiManager = new MultitouchManager(this);
                                                                                                In MainCanvas class
          useMultitouch = true;
      }
                                                                                                (extends Canvas)

 12          © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
EXAMPLE: API AVAILABILITY
• No System property for the API version?
     –Check Class availability
     –ClassNotFoundException? → API not supported
       // Virtual keyboard support
       try {
           // Check if class is available
           Class.forName("com.nokia.mid.ui.VirtualKeyboard");
           vkbManager = new VkbManager(this);
           useVkb = true;
       } catch (ClassNotFoundException e) {
           // Class not available: running app on Java Runtime < 2.0.0 phone.
           // -> no Virtual Keyboard API support.
           useVkb = false;
       } catch (Exception e) { }


13      © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
» For multiple builds targeting multiple devices currently NetBeans provides
  simplest and hassle free solution.
» Use NetBeans “Configurations” when targeting multiple devices / SDKs, for
  example Nokia SDK for Java 1.1 (Touch & Type) and Nokia SDK for Java 2.0 (Full
  Touch).
» Live Demo
» If you are watching this slides on SlideShare, next part is live coding
  demonstration.You can see video recording from the link in the comments
  section. Link should appear within week after live webinar.
› Topics related to today’s webinar:
› Porting from BlackBerry to Series 40 Wiki article:
› http://www.developer.nokia.com/Community/Wiki/Porting_from
  _BlackBerry_to_Series_40
› Porting from Android to Series 40 Guide:
› http://www.developer.nokia.com/Resources/Library/Porting_to_
  Series_40/#!porting-from-android-to-series-40.html
› Java for Mobile Devices:
  New Horizons with Fantastic
  New Devices
   › Monday, Oct 1, 8:30AM
   › Notel Nikko – Monterey I/II
Thank you!




  @MichaelSamarin
http://www.futurice.com

More Related Content

Adapting Series 40 touch and type apps to the full-touch UI

  • 1. Series 40 Developer Training Adapting Series 40 Touch and Type apps to full-touch UI Michael Samarin, Ph.D Director, Developer Training and Evangelism Futurice Oy @MichaelSamarin
  • 2. › Brief Full Touch Devices Overview Agenda for today’s › UI Style Guides webinar › Adapting Touch & Type apps › Demonstrations with NetBeans and Nokia SDKs Don’t forget to take a look at previously recorded webinars: http://www.developer.nokia.com/Resources/Multimedia/Webinars.xhtml#Webinar
  • 3. Devices are released and in consumer hands today: Asha 305 306 311
  • 4. › Codebase on Full Touch is backward compatible Existing Touch & › Older Midlets “just work” Type or Non Touch › Of course UI requires apps tweaking and remodeling to utilize new UI paradigm Best help in understanding new UI - Series 40 Full Touch Design Guidelines: http://www.developer.nokia.com/Resources/Library/Full_Touch/#!index.html
  • 5. › Single build for multiple target devices Strategies for › Code level configurations targeting Touch & Type and › Multiple builds for multiple target devices Full Touch › IDE level configurations – NetBeans
  • 6. » For single build targeting multiple devices checkout porting part of webinar: » Andreas Jakl, Nokia › Introduction to Nokia Series 40 Full Touch UI › http://www.slideshare.net/nokia-developer/introduction-to-series-40-full-touch-ui › http://forumnokia.adobeconnect.com/p3yw0g4jz6f/ » Following slides are extracts
  • 7. COMPATIBILITY? • Source & binary compatible – xx years old Java ME apps run on full touch phones! • Downwards compatibility – Check API support of target phones – Lowest common denominator: → Nokia Java SDK 2.0 compiled app runs on old phones 7 © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
  • 8. PORTING TO TOUCH • All Java ME apps should run on full touch phone – High-Level UI – Adapts automatically – Components include touch-support – Check layout – New UI components (CategoryBar, etc.) don’t have to be used – Low-Level UI – New screen size & aspect ratio (but: most Java apps already flexible here) – Touch supported in Java ME since many years – Basic key simulation with drag gestures for non-touch apps • New APIs for Multitouch, Pinch, CategoryBar & Sensors – Only work on FT phones – Careful app design even keeps downwards compatibility 8 © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
  • 9. PORTING Touch and type Non-touch app with high-level UI (LCDUI): Automatically adapts to touch Non-touch 9 © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl Full touch
  • 10. DYNAMIC API USAGE • Single code base for different phones –Code that uses new APIs –Externalize to extra class –Check API support at runtime –Instantiate class if supported –Different methods for checking available 10 © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
  • 11. EXAMPLE: PINCH GESTURE • Gesture API –Available in Touch & Type –Full Touch adds Pinch gesture –Query support at runtime // Pinch gesture if (GestureInteractiveZone.isSupported(GestureInteractiveZone.GESTURE_PINCH)) { // Gesture is supported - register class as listener GestureRegistrationManager.setListener(this, this); // Register for pinch gesture gestureZone = new GestureInteractiveZone(GestureInteractiveZone.GESTURE_PINCH); GestureRegistrationManager.register(this, gestureZone); } 11 © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
  • 12. EXAMPLE: OPTIONAL MULTITOUCH • Encapsulate API using code to separate class public class MultitouchManager implements MultipointTouchListener { public MultitouchManager(MainCanvas canvas) { MultipointTouch mpt = MultipointTouch.getInstance(); Hint: only handle mpt.addMultipointTouchListener(this); Canvas.pointerPressed() } on single touch phones public void pointersChanged(int[] pointerIds) { /* ... */ } protected void pointerPressed(int x, int y) { } if (!useMultitouch) { // Handle touch event // on single-touch phone } • Check support and instantiate on demand } if (System.getProperty("com.nokia.mid.ui.multipointtouch.version") != null) { // API is supported: Can implement multipoint touch functionality multiManager = new MultitouchManager(this); In MainCanvas class useMultitouch = true; } (extends Canvas) 12 © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
  • 13. EXAMPLE: API AVAILABILITY • No System property for the API version? –Check Class availability –ClassNotFoundException? → API not supported // Virtual keyboard support try { // Check if class is available Class.forName("com.nokia.mid.ui.VirtualKeyboard"); vkbManager = new VkbManager(this); useVkb = true; } catch (ClassNotFoundException e) { // Class not available: running app on Java Runtime < 2.0.0 phone. // -> no Virtual Keyboard API support. useVkb = false; } catch (Exception e) { } 13 © 2012 Nokia Java ME Touch v1.3.0 June 27, 2012 Andreas Jakl
  • 14. » For multiple builds targeting multiple devices currently NetBeans provides simplest and hassle free solution. » Use NetBeans “Configurations” when targeting multiple devices / SDKs, for example Nokia SDK for Java 1.1 (Touch & Type) and Nokia SDK for Java 2.0 (Full Touch). » Live Demo » If you are watching this slides on SlideShare, next part is live coding demonstration.You can see video recording from the link in the comments section. Link should appear within week after live webinar.
  • 15. › Topics related to today’s webinar: › Porting from BlackBerry to Series 40 Wiki article: › http://www.developer.nokia.com/Community/Wiki/Porting_from _BlackBerry_to_Series_40 › Porting from Android to Series 40 Guide: › http://www.developer.nokia.com/Resources/Library/Porting_to_ Series_40/#!porting-from-android-to-series-40.html
  • 16. › Java for Mobile Devices: New Horizons with Fantastic New Devices › Monday, Oct 1, 8:30AM › Notel Nikko – Monterey I/II
  • 17. Thank you! @MichaelSamarin http://www.futurice.com