SlideShare una empresa de Scribd logo
1 de 50
Descargar para leer sin conexión
Supercharge

  Your UI
Dominik                                 Jonas
Helleberg                              Gehring
Mobile Development           Mobile Development
Android                                  Android
HTML5                                 JavaScript




dominik-helleberg.de/+   https://github.com/jjoe64
                            http://www.jjoe64.com
Design is
important




https://play.google.com/store/apps/details?id=com.outlook.Z7
This is what happens when you let developers create UI




http://www.codinghorror.com/blog/2006/11/this-is-what-happens-when-you-let-developers-create-ui.html
Stick with Holo

http://developer.android.com/design/index.html
Holo is designed by professional
designers and let you create
beautiful apps




https://play.google.com/store/apps/details?id=com.michaelpardo.quotes
Holo is designed by professional
designers and let you create
beautiful apps




https://play.google.com/store/apps/details?id=ch.teamtasks.tasks.paid
Don‘t customize it...
...unless you know what you‘re
doing




https://play.google.com/store/apps/details?id=sweesoft.prohome
How to use Holo




https://developer.android.com/design/building-blocks/index.html
Mind the Gap




https://developer.android.com/design/style/metrics-grids.html
How to use Holo - Grids

                          res/values/dimens.xml

<resources>

     <!-- Default screen margins,
           per the Android Design guidelines. -->

    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>

    <dimen name=“ui_gap“>8dp</dimen>
    <dimen name=“element_height“>48dp</dimen>

</resources>



https://developer.android.com/design/style/metrics-grids.html
Theme.Holo

●   existiert seit API Level 11 (Honeycomb)
●   erst ab API Level 14 (ICS) garantiert unverändert durch OEM



Vorschlag
●   Ab Api Level 11 Theme.Holo verwenden (hell: Holo.Light)
●   Frühere Api Level verwenden Theme.Black. (hell: Theme)
Das richtige Theme zur Laufzeit automatisch auswählen


res/values/        res/values-v11/     res/values-v14/


     android:          android:           android:
   Theme.Black       Theme.Holo         Theme.Holo




                      android:
                   Theme.MyTheme
Das richtige Theme zur Laufzeit automatisch auswählen

                         res/values/themes.xml
<resources>
    <style name="Theme.MyTheme"
        parent="android:Theme.Black"></style>

   <style name="Theme.MyTheme.NoTitleBar"
       parent="android:Theme.Black.NoTitleBar"></style>

   <style name="Theme.MyTheme.Fullscreen"
       parent="android:Theme.Black.NoTitleBar.Fullscreen"></style>

   <style name="Theme.MyTheme.Light"
       parent="android:Theme"></style>

   <style name="Theme.MyTheme.Light.NoTitleBar"
       parent="android:Theme.NoTitleBar"></style>

    <style name="Theme.MyTheme.Light.NoTitleBar.Fullscreen"
        parent="android:Theme.NoTitleBar.Fullscreen"></style>
</resources>
Themes für Honeycomb                          res/values-v11/themes.xml


<resources>
    <style name="Theme.MyTheme"
        parent="android:Theme.Holo"></style>

    ...

   <!-- Bug: Theme.Holo.Light.NoActionBar is not public -->
   <style name="Theme.MyTheme.Light.NoTitleBar"
       parent="android:Theme.Holo.Light">
       <item name="android:windowActionBar">false</item>
       <item name="android:windowNoTitle">true</item>
   </style>

   <!-- Bug? Theme.Holo.Light.NoActionBar.Fullscreen has a titlebar -->
   <style name="Theme.MyTheme.Light.NoTitleBar.Fullscreen"
       parent="android:Theme.Holo.Light">
       <item name="android:windowActionBar">false</item>
       <item name="android:windowNoTitle">true</item>
       <item name="android:windowFullscreen">true</item>
       <item name="android:windowContentOverlay">@null</item>
   </style>
Themes für Ice Cream Sandwich

                        res/values-v14/themes.xml
<resources>
    <style name="Theme.MyTheme"
        parent="android:Theme.Holo"></style>

    <style name="Theme.MyTheme.NoTitleBar"
        parent="android:Theme.Holo.NoActionBar"></style>

    <style name="Theme.MyTheme.Fullscreen"
        parent="android:Theme.Holo.NoActionBar.Fullscreen"></style>

    <style name="Theme.MyTheme.Light"
        parent="android:Theme.Holo.Light"></style>

    <style name="Theme.MyTheme.Light.NoTitleBar"
        parent="android:Theme.Holo.Light.NoActionBar"></style>

    <style name="Theme.MyTheme.Light.Fullscreen"
        parent="android:Theme.Holo.Light.NoActionBar.Fullscreen"></style>

</resources>
Verschiedene Themes sind nun unter einem gemeinsamen
                  Namen ansprechbar.


                    Verwendung in der AndroidManifest.xml

<activity
            android:theme="@style/Theme.MyTheme.Light.NoTitleBar“
...
Colors


#33B5E5   #AA66CC   #99CC00   #FFBB33   #FF4444




#0099CC   #9933CC   #669900   #FF8800   #CC0000
Colors
                res/colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="light_blue">#33B5E5</color>
    <color name="dark_blue">#0099CC</color>
    <color name="light_purple">#AA66CC</color>
    <color name="dark_purple">#9933CC</color>
    <color name="light_green">#99CC00</color>
    <color name="dark_green">#669900</color>
    <color name="light_orange">#FFBB33</color>
    <color name="dark_orange">#FF8800</color>
    <color name="light_red">#FF4444</color>
    <color name="dark_red">#CC0000</color>
</resources>
Build Responsive




  302 Redirect to Juhani Lehtimäki

http://developer.android.com/training/basics/fragments/fragment-ui.html
Build with Holo Components




http://developer.android.com/design/patterns/actionbar.html
Since we use Holo... Life is good....
OEMS und Themes
WAAAAAAAAA




http://www.flickr.com/photos/fspugna/4507352674/
OEMS und Themes
Zusammenfassung
Befolgen der Design-Guidlines
   ● Verwenden der Standard-Widgets

   ● Verwenden der Standard-Patterns

   ● Verwenden des Standard-Themes

   ● Verwenden der Standard-Farbpalette

   ● Verwenden von Responsive Design Techniques


Gefahr
   ● Gestaltung der App hebt sich womöglich kaum ab


Wie differenzieren?
   ● Qualität

   ● Wir sorgen dafür, dass sich die App gut anfühlt
Was heißt gut anfühlen?


●   klare logische UI Struktur
●   Die App ist responsive und snappy
●   Animationen
●   Grafische Effekte, eigene Widgets (wo es
    sinnvoll ist)
Android Custom Views




http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/
https://github.com/harism/android_page_curl
Most Simple Custom View

public class ExampleView extends View {

    public ExampleView(Context context, AttributeSet attrs) {
      super(context, attrs);
    }

    @Override
    protected void onDraw(Canvas canvas) {
       canvas.drawColor(Color.RED);
    }
}
Einige wichtige Methoden
Touch Events
@Override
public boolean onTouchEvent(MotionEvent event)

Größenabhängige Berechnungen
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh)


Spezielle Anforderungen an die Abmessungen

@Override
protected void onMeasure(int widthMeasureSpec, int
heightMeasureSpec)
View Drawing

Canvas API                      Paint API
●   Formen (Linien, Ellipsen,   ●   Gradienten (Kreis und
    Rechtecke etc)                  Linear)
●   Text                        ●   Effekte (Blur,...)
●   Bitmaps                     ●   Farbfilter
●   Zeichenmatrix (Position,    ●   Vermessen von Text
    Größe, Drehung)             ●   Texteigenschaften
                                ●   Farbe, Muster, Dicke
                                    von Formen
keines Paint Beispiel

SimplePaintExample
Gradients

Sinnvoll einsetzen

LinearGradient

RadialGradient

Shader.TileMode
CLAMP, REPEAT,       MIRROR
Gradients
LinearGradient(float x0, float y0,
    float x1, float y1,
    int color0, int color1,
    Shader.TileMode tile)

LinearGradient(float x0, float y0,
   float x1, float y1, int[] colors,
   float[] positions, Shader.TileMode tile)
Custom ViewGroups




https://developer.android.com/design/patterns/index.html
Custom ViewGroups

einfache Möglichkeit um das Rendering von Child Views zu ändern:

setStaticTransformationsEnabled(true);

@Override
boolean getChildStaticTransformation(View child, Transformation t)


Statische Transformationen
     Alpha Wert
  ●
     Über das Matrix-Object
  ●
      ○ rotieren

      ○   positionieren
      ○   skalieren
      ○ "3D Blick"
 Beispiel: ExampleCustomViewGroup
ListView 3D

 ●   Custom ViewGroup
 ●   3D Effekt mit Canvas API
 ●   Bitmap Caching




MTCRichGraphics
Demo ViewPager3d
https://github.com/inovex/ViewPager3D




      ●   3D mit Canvas API
      ●   Animation
      ●   Multi Touch Handling
      ●   XML-Attribute
Animationen



 Animationen

                sollen

sinnvoll
                         sein
Animationen
Animation Framework:
                since 3.0

ObjectAnimator.ofFloat(myView, "alpha", 0f).start()

ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
    anim.setDuration(500);
    anim.start();
Animation Framework:
                since 3.x
PropertyValuesHolder pvhX =
        PropertyValuesHolder.ofFloat("x", 50f);
PropertyValuesHolder pvhY =
        PropertyValuesHolder.ofFloat("y", 100f);
ObjectAnimator.ofPropertyValuesHolder(myView,
        pvhX, pvyY).start();

//since 3.1

myView.animate().x(50f).y(100f);
2.x ? NineOldAndroids

Usage


The API is exactly the same as the Honeycomb API, just change
your imports to use com.nineoldandroids.animation.*




http://nineoldandroids.com
ListViewAnimations



                 Mind the View-recycling!


            inspired by Chet Haase's Demo
http://graphics-geek.blogspot.de/2013/02/devbytes-listview-animations.html
ListViewAnimations
ab 4.1 -> view.setHasTransientState(true);

Alternative:
Custom Adapter
oder
ListViewAnimations-Lib von Niek Haarman
https://bitbucket.org/nhaarman/listviewanimations/
Demo

https://github.com/renard314/LEDView



         ●   Canvas API
         ●   Linear Gradients
         ●   Radial Gradients
         ●   BitmapShader
         ●   ColorFilter
         ●   Animation
         ●   XML-Attribute
         ●   Caching
Vermeide Canvas.drawText ()

   ●   Zeilenumbrüche
   ●   Zeilenabstände
   ●   Vermessen und Positionieren des Textes



Dafür gibt es Hilfsklassen!

   StaticLayout:              Mehrzeiliger Text der sich nicht ändert
   DynamicLayout: Mehrzeiliger Text der sich ändert
   BoringLayout:              Einzeiliger Text der sich nicht ändert

 Example: ExampleCanvasText
Tipps und Tricks

●   Bei beliebten Apps abgucken
●   onDraw leichtgewichtig lassen
●   invalide(Rect) statt invalide()
●   Bitmap Caching
●   nicht sinnlos malen
●   Advanced: Surface View
    ○   onDraw über eigenen Thread
Summary

Stick with Holo
Use defaults unless you're a designer
Use the techniques from design.android.com
OEM Themes DO suck
Add Custom Views / ViewGroups / Animations
 to differentiate, but do it right
DANKE!

Más contenido relacionado

Destacado

Android Enterprise Integration
Android Enterprise IntegrationAndroid Enterprise Integration
Android Enterprise Integration
Dominik Helleberg
 

Destacado (11)

Why do we need more nerds?
Why do we need more nerds?Why do we need more nerds?
Why do we need more nerds?
 
Android Studio und gradle
Android Studio und gradleAndroid Studio und gradle
Android Studio und gradle
 
Android Development Tools
Android Development ToolsAndroid Development Tools
Android Development Tools
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android
 
Android ActionBar Navigation reloaded
Android ActionBar Navigation reloadedAndroid ActionBar Navigation reloaded
Android ActionBar Navigation reloaded
 
Android Studio vs. ADT
Android Studio vs. ADTAndroid Studio vs. ADT
Android Studio vs. ADT
 
Android Development Tools
Android Development ToolsAndroid Development Tools
Android Development Tools
 
Renderscript in Android 3.x
Renderscript in Android 3.xRenderscript in Android 3.x
Renderscript in Android 3.x
 
Android Enterprise Integration
Android Enterprise IntegrationAndroid Enterprise Integration
Android Enterprise Integration
 
Core Android
Core AndroidCore Android
Core Android
 
Rich Graphics & OpenGL mit Android
Rich Graphics & OpenGL mit AndroidRich Graphics & OpenGL mit Android
Rich Graphics & OpenGL mit Android
 

Similar a Supercharge your ui

Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
Romain Guy
 
Android design and Custom views
Android design and Custom views Android design and Custom views
Android design and Custom views
Lars Vogel
 
Android 2D Drawing and Animation Framework
Android 2D Drawing and Animation FrameworkAndroid 2D Drawing and Animation Framework
Android 2D Drawing and Animation Framework
Jussi Pohjolainen
 
Google Developer Day 2010 - Prague - Styles in Android
Google Developer Day 2010 - Prague - Styles in AndroidGoogle Developer Day 2010 - Prague - Styles in Android
Google Developer Day 2010 - Prague - Styles in Android
pavelpetrek
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 
Advanced Android Design Implementation
Advanced Android Design ImplementationAdvanced Android Design Implementation
Advanced Android Design Implementation
Tack Mobile
 

Similar a Supercharge your ui (20)

Day seven
Day sevenDay seven
Day seven
 
Supercharge your Android UI
Supercharge your Android UISupercharge your Android UI
Supercharge your Android UI
 
Top Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsTop Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on Tablets
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
 
Android design and Custom views
Android design and Custom views Android design and Custom views
Android design and Custom views
 
Android 2D Drawing and Animation Framework
Android 2D Drawing and Animation FrameworkAndroid 2D Drawing and Animation Framework
Android 2D Drawing and Animation Framework
 
Fernando F. Gallego - Efficient Android Resources 101
Fernando F. Gallego - Efficient Android Resources 101Fernando F. Gallego - Efficient Android Resources 101
Fernando F. Gallego - Efficient Android Resources 101
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty gritty
 
The Role of Python in SPAs (Single-Page Applications)
The Role of Python in SPAs (Single-Page Applications)The Role of Python in SPAs (Single-Page Applications)
The Role of Python in SPAs (Single-Page Applications)
 
Practical tipsmakemobilefaster oscon2016
Practical tipsmakemobilefaster oscon2016Practical tipsmakemobilefaster oscon2016
Practical tipsmakemobilefaster oscon2016
 
Android layouts
Android layoutsAndroid layouts
Android layouts
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and Techniques
 
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
 
Google Developer Day 2010 - Prague - Styles in Android
Google Developer Day 2010 - Prague - Styles in AndroidGoogle Developer Day 2010 - Prague - Styles in Android
Google Developer Day 2010 - Prague - Styles in Android
 
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
 
Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
 
Advanced Android Design Implementation
Advanced Android Design ImplementationAdvanced Android Design Implementation
Advanced Android Design Implementation
 
Android Material Design APIs/Tips
Android Material Design APIs/TipsAndroid Material Design APIs/Tips
Android Material Design APIs/Tips
 
Intro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresIntro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS features
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
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...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Supercharge your ui

  • 2. Dominik Jonas Helleberg Gehring Mobile Development Mobile Development Android Android HTML5 JavaScript dominik-helleberg.de/+ https://github.com/jjoe64 http://www.jjoe64.com
  • 4. This is what happens when you let developers create UI http://www.codinghorror.com/blog/2006/11/this-is-what-happens-when-you-let-developers-create-ui.html
  • 6. Holo is designed by professional designers and let you create beautiful apps https://play.google.com/store/apps/details?id=com.michaelpardo.quotes
  • 7. Holo is designed by professional designers and let you create beautiful apps https://play.google.com/store/apps/details?id=ch.teamtasks.tasks.paid
  • 8. Don‘t customize it... ...unless you know what you‘re doing https://play.google.com/store/apps/details?id=sweesoft.prohome
  • 9. How to use Holo https://developer.android.com/design/building-blocks/index.html
  • 11. How to use Holo - Grids res/values/dimens.xml <resources> <!-- Default screen margins, per the Android Design guidelines. --> <dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen> <dimen name=“ui_gap“>8dp</dimen> <dimen name=“element_height“>48dp</dimen> </resources> https://developer.android.com/design/style/metrics-grids.html
  • 12. Theme.Holo ● existiert seit API Level 11 (Honeycomb) ● erst ab API Level 14 (ICS) garantiert unverändert durch OEM Vorschlag ● Ab Api Level 11 Theme.Holo verwenden (hell: Holo.Light) ● Frühere Api Level verwenden Theme.Black. (hell: Theme)
  • 13. Das richtige Theme zur Laufzeit automatisch auswählen res/values/ res/values-v11/ res/values-v14/ android: android: android: Theme.Black Theme.Holo Theme.Holo android: Theme.MyTheme
  • 14. Das richtige Theme zur Laufzeit automatisch auswählen res/values/themes.xml <resources> <style name="Theme.MyTheme" parent="android:Theme.Black"></style> <style name="Theme.MyTheme.NoTitleBar" parent="android:Theme.Black.NoTitleBar"></style> <style name="Theme.MyTheme.Fullscreen" parent="android:Theme.Black.NoTitleBar.Fullscreen"></style> <style name="Theme.MyTheme.Light" parent="android:Theme"></style> <style name="Theme.MyTheme.Light.NoTitleBar" parent="android:Theme.NoTitleBar"></style> <style name="Theme.MyTheme.Light.NoTitleBar.Fullscreen" parent="android:Theme.NoTitleBar.Fullscreen"></style> </resources>
  • 15. Themes für Honeycomb res/values-v11/themes.xml <resources> <style name="Theme.MyTheme" parent="android:Theme.Holo"></style> ... <!-- Bug: Theme.Holo.Light.NoActionBar is not public --> <style name="Theme.MyTheme.Light.NoTitleBar" parent="android:Theme.Holo.Light"> <item name="android:windowActionBar">false</item> <item name="android:windowNoTitle">true</item> </style> <!-- Bug? Theme.Holo.Light.NoActionBar.Fullscreen has a titlebar --> <style name="Theme.MyTheme.Light.NoTitleBar.Fullscreen" parent="android:Theme.Holo.Light"> <item name="android:windowActionBar">false</item> <item name="android:windowNoTitle">true</item> <item name="android:windowFullscreen">true</item> <item name="android:windowContentOverlay">@null</item> </style>
  • 16. Themes für Ice Cream Sandwich res/values-v14/themes.xml <resources> <style name="Theme.MyTheme" parent="android:Theme.Holo"></style> <style name="Theme.MyTheme.NoTitleBar" parent="android:Theme.Holo.NoActionBar"></style> <style name="Theme.MyTheme.Fullscreen" parent="android:Theme.Holo.NoActionBar.Fullscreen"></style> <style name="Theme.MyTheme.Light" parent="android:Theme.Holo.Light"></style> <style name="Theme.MyTheme.Light.NoTitleBar" parent="android:Theme.Holo.Light.NoActionBar"></style> <style name="Theme.MyTheme.Light.Fullscreen" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen"></style> </resources>
  • 17. Verschiedene Themes sind nun unter einem gemeinsamen Namen ansprechbar. Verwendung in der AndroidManifest.xml <activity android:theme="@style/Theme.MyTheme.Light.NoTitleBar“ ...
  • 18. Colors #33B5E5 #AA66CC #99CC00 #FFBB33 #FF4444 #0099CC #9933CC #669900 #FF8800 #CC0000
  • 19. Colors res/colors.xml <?xml version="1.0" encoding="utf-8"?> <resources> <color name="light_blue">#33B5E5</color> <color name="dark_blue">#0099CC</color> <color name="light_purple">#AA66CC</color> <color name="dark_purple">#9933CC</color> <color name="light_green">#99CC00</color> <color name="dark_green">#669900</color> <color name="light_orange">#FFBB33</color> <color name="dark_orange">#FF8800</color> <color name="light_red">#FF4444</color> <color name="dark_red">#CC0000</color> </resources>
  • 20. Build Responsive 302 Redirect to Juhani Lehtimäki http://developer.android.com/training/basics/fragments/fragment-ui.html
  • 21. Build with Holo Components http://developer.android.com/design/patterns/actionbar.html
  • 22. Since we use Holo... Life is good....
  • 26. Zusammenfassung Befolgen der Design-Guidlines ● Verwenden der Standard-Widgets ● Verwenden der Standard-Patterns ● Verwenden des Standard-Themes ● Verwenden der Standard-Farbpalette ● Verwenden von Responsive Design Techniques Gefahr ● Gestaltung der App hebt sich womöglich kaum ab Wie differenzieren? ● Qualität ● Wir sorgen dafür, dass sich die App gut anfühlt
  • 27. Was heißt gut anfühlen? ● klare logische UI Struktur ● Die App ist responsive und snappy ● Animationen ● Grafische Effekte, eigene Widgets (wo es sinnvoll ist)
  • 29. Most Simple Custom View public class ExampleView extends View { public ExampleView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { canvas.drawColor(Color.RED); } }
  • 30. Einige wichtige Methoden Touch Events @Override public boolean onTouchEvent(MotionEvent event) Größenabhängige Berechnungen @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) Spezielle Anforderungen an die Abmessungen @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
  • 31. View Drawing Canvas API Paint API ● Formen (Linien, Ellipsen, ● Gradienten (Kreis und Rechtecke etc) Linear) ● Text ● Effekte (Blur,...) ● Bitmaps ● Farbfilter ● Zeichenmatrix (Position, ● Vermessen von Text Größe, Drehung) ● Texteigenschaften ● Farbe, Muster, Dicke von Formen
  • 34. Gradients LinearGradient(float x0, float y0, float x1, float y1, int color0, int color1, Shader.TileMode tile) LinearGradient(float x0, float y0, float x1, float y1, int[] colors, float[] positions, Shader.TileMode tile)
  • 36. Custom ViewGroups einfache Möglichkeit um das Rendering von Child Views zu ändern: setStaticTransformationsEnabled(true); @Override boolean getChildStaticTransformation(View child, Transformation t) Statische Transformationen Alpha Wert ● Über das Matrix-Object ● ○ rotieren ○ positionieren ○ skalieren ○ "3D Blick" Beispiel: ExampleCustomViewGroup
  • 37. ListView 3D ● Custom ViewGroup ● 3D Effekt mit Canvas API ● Bitmap Caching MTCRichGraphics
  • 38. Demo ViewPager3d https://github.com/inovex/ViewPager3D ● 3D mit Canvas API ● Animation ● Multi Touch Handling ● XML-Attribute
  • 39. Animationen Animationen sollen sinnvoll sein
  • 41. Animation Framework: since 3.0 ObjectAnimator.ofFloat(myView, "alpha", 0f).start() ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f); anim.setDuration(500); anim.start();
  • 42. Animation Framework: since 3.x PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("x", 50f); PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("y", 100f); ObjectAnimator.ofPropertyValuesHolder(myView, pvhX, pvyY).start(); //since 3.1 myView.animate().x(50f).y(100f);
  • 43. 2.x ? NineOldAndroids Usage The API is exactly the same as the Honeycomb API, just change your imports to use com.nineoldandroids.animation.* http://nineoldandroids.com
  • 44. ListViewAnimations Mind the View-recycling! inspired by Chet Haase's Demo http://graphics-geek.blogspot.de/2013/02/devbytes-listview-animations.html
  • 45. ListViewAnimations ab 4.1 -> view.setHasTransientState(true); Alternative: Custom Adapter oder ListViewAnimations-Lib von Niek Haarman https://bitbucket.org/nhaarman/listviewanimations/
  • 46. Demo https://github.com/renard314/LEDView ● Canvas API ● Linear Gradients ● Radial Gradients ● BitmapShader ● ColorFilter ● Animation ● XML-Attribute ● Caching
  • 47. Vermeide Canvas.drawText () ● Zeilenumbrüche ● Zeilenabstände ● Vermessen und Positionieren des Textes Dafür gibt es Hilfsklassen! StaticLayout: Mehrzeiliger Text der sich nicht ändert DynamicLayout: Mehrzeiliger Text der sich ändert BoringLayout: Einzeiliger Text der sich nicht ändert Example: ExampleCanvasText
  • 48. Tipps und Tricks ● Bei beliebten Apps abgucken ● onDraw leichtgewichtig lassen ● invalide(Rect) statt invalide() ● Bitmap Caching ● nicht sinnlos malen ● Advanced: Surface View ○ onDraw über eigenen Thread
  • 49. Summary Stick with Holo Use defaults unless you're a designer Use the techniques from design.android.com OEM Themes DO suck Add Custom Views / ViewGroups / Animations to differentiate, but do it right