SlideShare a Scribd company logo
1 of 65
Download to read offline
Responsive mobile
design in practice
     Kirill Grouchnikov
    Android, Google Inc.
this talk is about

minimizing the pain of developing
    for multiple form factors
device variety


          Experia Pro 3.7”                  Flyer 7”                     Sony Tablet S 9.4”

Archos 2.8”              Galaxy Note 5.2”              Galaxy Tab 8.9”                    Toshiba Excite 13”
device orientation




1024*600    600*1024
adapting to the context
maps




“show more” of the infinite canvas
settings




combine two (or more) screens
    in a multi-pane layout
youtube (view)




  promote two tabs
  into the side panel
play store (details)




rearrange content in two columns
responsive mobile design
same content,
  same hierarchy

adapting to context
http://developer.android.com/design/patterns/multi-pane-layouts.html
same content,
   same hierarchy

adapting to context
minimizing the pain of developing
    for multiple form factors
same content, same hierarchy
differently stacked “blocks”
summary




screenshots




byline

+1



description
summary
screenshots
description
reviews
more by
developer links
cross-sell
flag content




rate & review
auto-update (apps)
trailer (movies)
song list (albums)
same blocks
rearranged in two columns
same building block on the same screen
     on different form factors
same building block
in different screens
res/layout/youtube_trailer_section.xml
<com.my.package.YoutubeTrailerSection>
    <ImageView
        android:id=”@+id/thumbnail”
        android:background=”black” />
    <ImageView
        android:id=”@+id/play_icon”
        android:src=”@drawable/ic_video_play” />
    <TextView
        android:id=”@+id/duration”
        android:textColor=”#CCCCCC”
        android:background=”#4C000000”
        android:textSize=”@dimen/content_primary” />
</com.my.package.YoutubeTrailerSection>
public class YoutubeTrailerSection
    extends TheMostSuitableBaseLayout

@Override onFinishInflate()
bind(YoutubeTrailerData)

@Override onMeasure() - if needed
@Override onLayout() - if needed
<com.my.package.YoutubeTrailerSection>
    <ImageView
        android:id=”@+id/thumbnail”
        android:background=”black” />
    <ImageView
        android:id=”@+id/play_icon” // ID not necessary if not used in code
        android:src=”@drawable/ic_video_play” />
    <TextView
        android:id=”@+id/duration”
        android:textColor=”#CCCCCC”
        android:background=”#4C000000”
        android:textSize=”@dimen/content_primary” />
</com.my.package.YoutubeTrailerSection>



private ImageView mThumbnail;
private TextView mDuration;

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mThumbnail = (ImageView) findViewById(R.id.thumbnail);
    mDuration = (TextView) findViewById(R.id.duration);
}
private ImageView mThumbnail;
private TextView mDuration;

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mThumbnail = (ImageView) findViewById(R.id.thumbnail);
    mDuration = (TextView) findViewById(R.id.duration);
}



public void bind(YoutubeTrailerData data) {
    mDuration.setText(data.getFormattedLength());
    String thumbnailUrl = data.getThumbnailUrl();
    ImageUtils.load(mThumbnail, thumbnailUrl); // cache / network app code
    setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Intent youtubeIntent = IntentUtils.createYoutubeIntent(
                   data.getVideoUrl());
            getContext().startActivity(youtubeIntent);
        }
    });
}
why so much trouble with a
      custom class?
encapsulation
<include
    layout=”@layout/youtube_trailer_section” />

YoutubeTrailerSection trailer =
    (YoutubeTrailerSection) findViewById
         (R.id.youtube_trailer_section);
trailer.bind(model.getYoutubeTrailerData());
each block is binding a subset of the data
  no matter what the context is
<include
    android:id=”@+id/summary_section”
    layout=”@layout/details_summary” />
<include
    android:id=”@+id/screenshots_section”
    layout=”@layout/details_screenshots” />
<include
    android:id=”@+id/byline_section”
    layout=”@layout/details_byline” />
<include
    android:id=”@+id/plusone_section”
    layout=”@layout/details_plusone” />
<include
    android:id=”@+id/description_section”
    layout=”@layout/details_text” />
...
ScreenshotsSection screenshots =
                         (ScreenshotsSection) findViewById
                              (R.id.screenshots_section);
                     screenshots.bind(model.getScreenshotsData());




                     TextSection description =
                         (TextSection) findViewById
                              (R.id.description_section);
                     description.bind(model.getDescriptionData());




* I can swear that some PMs seem to think that it’s really that simple
the main flow looks up a section
and passes the relevant data subset
and each section handles its own
 data binding, events and layout
             tweaks
<include
    layout=”@layout/screenshots_section” />

ScreenshotsSection trailer =
    (ScreenshotsSection) findViewById
         (R.id.screenshots_section);
trailer.bind(model.getScreenshotsData());
no knowledge of context,
internal IDs or event handling
each block is a separate reusable layout
include                include

          include
include                include


include   include
include   include   include
          include
include   include   include
it’s like combining Lego blocks*




  * except for the part where you’re stuck maintaining the code base
all I see is <include>s

* he was kind of a douche, fell in love with the wrong girl and after
that steak it really went downhill for him. YMMV.
the code doesn’t have to be
  aware what is the context
<include
    layout=”@layout/screenshots_section” />

ScreenshotsSection trailer =
    (ScreenshotsSection) findViewById
         (R.id.screenshots_section);
trailer.bind(model.getScreenshotsData());
welcome to the real world
font size, column count,
location of rating bar in cells
font size
res/values/font-dimens.xml
   <dimen name="content_primary_size">16sp</dimen>

res/values-sw800dp/font-dimens.xml
   <dimen name="content_primary_size">18sp</dimen>

res/values/styles.xml
   <style name="DetailsPage_Header">
       ...
       <item name=”android:textSize”>@dimen/content_primary_size</item>
   </style>

res/layout/pack_header.xml
   <TextView
      android:id=”+id/header”
      style=”@style/DetailsPage_Header”
      ...
column count
res/values/ints.xml
   <integer name="moreby_items_per_row">2</integer>

res/values-sw800dp/ints.xml
   <integer name="moreby_items_per_row">1</integer>

public class MoreBySection
   private int mColumnCount;

   public MoreBySection(Context ctx) {
       ...
       mColumnCount = ctx.getResources().getInteger(
           R.integer.moreby_items_per_row);
   }
cell layouts
res/layout/item_cell.xml
res/layout-sw800dp/item_cell.xml

public class PackAdapter

   @Override
   public View getView(int pos, View convertView, ViewGroup parent) {
       if (convertView == null) {
           convertView = mLayoutInflater.inflate(
               R.layout.item_cell, parent, false);
       }

       CellViewHolder holder = (CellViewHolder) convertView.getTag();
       ...
       return convertView;
   }
the code doesn’t have to be
  aware what is the context*



  * if you managed to confine the differences to resource files
not exactly the same blocks
context awareness “leaking”
      into the code
res/values/bools.xml
   <bool name="use_two_column_layout">false</bool>

res/values-sw800dp/bools.xml
   <bool name="use_two_column_layout">true</bool>
public class BylineSection

private boolean mIsTwoColumnMode;

public BylineSection(Context ctx) {
    ...
    mIsTwoColumnMode = ctx.getResources().getBoolean(
        R.bool.use_two_column_layout);
}

public void bind() {
    if (mIsTwoColumnMode) {
        // add update date, download size and download count
    } else {
        // add rating count, update date, download size
        // and download count
    }
}
reuse blocks
  on the same screen
on different form factors
<include
    layout=”@layout/screenshots_section” />

ScreenshotsSection trailer =
    (ScreenshotsSection) findViewById
         (R.id.screenshots_section);
trailer.bind(model.getScreenshotsData());
reuse blocks
in different screens
<include
    layout=”@layout/youtube_trailer_section” />

YoutubeTrailerSection trailer =
    (YoutubeTrailerSection) findViewById
         (R.id.youtube_trailer_section);
trailer.bind(model.getYoutubeTrailerData());
“my apps” screen
combine and share blocks
this talk was about

minimizing the pain of developing
    for multiple form factors
building blocks

•identify
• encapsulate
• reuse



 * almost made it through with no bullet points
Q&A

• slideshare.net/kirillcool
• pushing-pixels.org
• +Kirill Grouchnikov
• kirillcool@yahoo.com

More Related Content

Similar to Responsive mobile design in practice

07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdfImranS18
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsHassan Abid
 
Different types of sticker apps
Different types of sticker appsDifferent types of sticker apps
Different types of sticker appsJelena Krmar
 
Making it fit - DroidCon Paris 18 june 2013
Making it fit - DroidCon Paris 18 june 2013Making it fit - DroidCon Paris 18 june 2013
Making it fit - DroidCon Paris 18 june 2013Paris Android User Group
 
Custom UI Components at Android Only 2011
Custom UI Components at Android Only 2011Custom UI Components at Android Only 2011
Custom UI Components at Android Only 2011Johan Nilsson
 
Android App Development - 04 Views and layouts
Android App Development - 04 Views and layoutsAndroid App Development - 04 Views and layouts
Android App Development - 04 Views and layoutsDiego Grancini
 
"Android Data Binding в массы" Михаил Анохин
"Android Data Binding в массы" Михаил Анохин"Android Data Binding в массы" Михаил Анохин
"Android Data Binding в массы" Михаил АнохинFwdays
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in androidInnovationM
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
MVVM & Data Binding Library
MVVM & Data Binding Library MVVM & Data Binding Library
MVVM & Data Binding Library 10Clouds
 
Android Tutorials : Basic widgets
Android Tutorials : Basic widgetsAndroid Tutorials : Basic widgets
Android Tutorials : Basic widgetsPrajyot Mainkar
 
Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Mario Jorge Pereira
 
Михаил Анохин "Data binding 2.0"
Михаил Анохин "Data binding 2.0"Михаил Анохин "Data binding 2.0"
Михаил Анохин "Data binding 2.0"Fwdays
 
Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesMichael Galpin
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentMonir Zzaman
 

Similar to Responsive mobile design in practice (20)

07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdf
 
Compose In Practice
Compose In PracticeCompose In Practice
Compose In Practice
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
 
Different types of sticker apps
Different types of sticker appsDifferent types of sticker apps
Different types of sticker apps
 
Making it fit - DroidCon Paris 18 june 2013
Making it fit - DroidCon Paris 18 june 2013Making it fit - DroidCon Paris 18 june 2013
Making it fit - DroidCon Paris 18 june 2013
 
Android xml-based layouts-chapter5
Android xml-based layouts-chapter5Android xml-based layouts-chapter5
Android xml-based layouts-chapter5
 
Custom UI Components at Android Only 2011
Custom UI Components at Android Only 2011Custom UI Components at Android Only 2011
Custom UI Components at Android Only 2011
 
Android App Development - 04 Views and layouts
Android App Development - 04 Views and layoutsAndroid App Development - 04 Views and layouts
Android App Development - 04 Views and layouts
 
"Android Data Binding в массы" Михаил Анохин
"Android Data Binding в массы" Михаил Анохин"Android Data Binding в массы" Михаил Анохин
"Android Data Binding в массы" Михаил Анохин
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in android
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
MVVM & Data Binding Library
MVVM & Data Binding Library MVVM & Data Binding Library
MVVM & Data Binding Library
 
Modern android development
Modern android developmentModern android development
Modern android development
 
Android Tutorials : Basic widgets
Android Tutorials : Basic widgetsAndroid Tutorials : Basic widgets
Android Tutorials : Basic widgets
 
08ui.pptx
08ui.pptx08ui.pptx
08ui.pptx
 
Android Application Fundamentals.
Android Application Fundamentals.Android Application Fundamentals.
Android Application Fundamentals.
 
Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015
 
Михаил Анохин "Data binding 2.0"
Михаил Анохин "Data binding 2.0"Михаил Анохин "Data binding 2.0"
Михаил Анохин "Data binding 2.0"
 
Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and Smartphones
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 

More from Kirill Grouchnikov

More from Kirill Grouchnikov (7)

Designing for the mobile form factor
Designing for the mobile form factorDesigning for the mobile form factor
Designing for the mobile form factor
 
Substance Java One 2007 Community Corner
Substance Java One 2007  Community  CornerSubstance Java One 2007  Community  Corner
Substance Java One 2007 Community Corner
 
Flamingo Ribbon component
Flamingo Ribbon componentFlamingo Ribbon component
Flamingo Ribbon component
 
Party of One
Party of OneParty of One
Party of One
 
Advanced Effects Oscon 2007
Advanced Effects   Oscon 2007Advanced Effects   Oscon 2007
Advanced Effects Oscon 2007
 
High DPI for desktop applications
High DPI for desktop applicationsHigh DPI for desktop applications
High DPI for desktop applications
 
On The Shoulders Of Giants
On The Shoulders Of GiantsOn The Shoulders Of Giants
On The Shoulders Of Giants
 

Recently uploaded

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

Responsive mobile design in practice

  • 1. Responsive mobile design in practice Kirill Grouchnikov Android, Google Inc.
  • 2. this talk is about minimizing the pain of developing for multiple form factors
  • 3. device variety Experia Pro 3.7” Flyer 7” Sony Tablet S 9.4” Archos 2.8” Galaxy Note 5.2” Galaxy Tab 8.9” Toshiba Excite 13”
  • 5. adapting to the context
  • 6. maps “show more” of the infinite canvas
  • 7. settings combine two (or more) screens in a multi-pane layout
  • 8. youtube (view) promote two tabs into the side panel
  • 9. play store (details) rearrange content in two columns
  • 11. same content, same hierarchy adapting to context
  • 13. same content, same hierarchy adapting to context
  • 14. minimizing the pain of developing for multiple form factors
  • 15. same content, same hierarchy differently stacked “blocks”
  • 17. summary screenshots description reviews more by developer links cross-sell flag content rate & review auto-update (apps) trailer (movies) song list (albums)
  • 19.
  • 20. same building block on the same screen on different form factors
  • 21. same building block in different screens
  • 22.
  • 23. res/layout/youtube_trailer_section.xml <com.my.package.YoutubeTrailerSection> <ImageView android:id=”@+id/thumbnail” android:background=”black” /> <ImageView android:id=”@+id/play_icon” android:src=”@drawable/ic_video_play” /> <TextView android:id=”@+id/duration” android:textColor=”#CCCCCC” android:background=”#4C000000” android:textSize=”@dimen/content_primary” /> </com.my.package.YoutubeTrailerSection>
  • 24. public class YoutubeTrailerSection extends TheMostSuitableBaseLayout @Override onFinishInflate() bind(YoutubeTrailerData) @Override onMeasure() - if needed @Override onLayout() - if needed
  • 25. <com.my.package.YoutubeTrailerSection> <ImageView android:id=”@+id/thumbnail” android:background=”black” /> <ImageView android:id=”@+id/play_icon” // ID not necessary if not used in code android:src=”@drawable/ic_video_play” /> <TextView android:id=”@+id/duration” android:textColor=”#CCCCCC” android:background=”#4C000000” android:textSize=”@dimen/content_primary” /> </com.my.package.YoutubeTrailerSection> private ImageView mThumbnail; private TextView mDuration; @Override protected void onFinishInflate() { super.onFinishInflate(); mThumbnail = (ImageView) findViewById(R.id.thumbnail); mDuration = (TextView) findViewById(R.id.duration); }
  • 26. private ImageView mThumbnail; private TextView mDuration; @Override protected void onFinishInflate() { super.onFinishInflate(); mThumbnail = (ImageView) findViewById(R.id.thumbnail); mDuration = (TextView) findViewById(R.id.duration); } public void bind(YoutubeTrailerData data) { mDuration.setText(data.getFormattedLength()); String thumbnailUrl = data.getThumbnailUrl(); ImageUtils.load(mThumbnail, thumbnailUrl); // cache / network app code setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent youtubeIntent = IntentUtils.createYoutubeIntent( data.getVideoUrl()); getContext().startActivity(youtubeIntent); } }); }
  • 27. why so much trouble with a custom class?
  • 29. <include layout=”@layout/youtube_trailer_section” /> YoutubeTrailerSection trailer = (YoutubeTrailerSection) findViewById (R.id.youtube_trailer_section); trailer.bind(model.getYoutubeTrailerData());
  • 30. each block is binding a subset of the data no matter what the context is
  • 31. <include android:id=”@+id/summary_section” layout=”@layout/details_summary” /> <include android:id=”@+id/screenshots_section” layout=”@layout/details_screenshots” /> <include android:id=”@+id/byline_section” layout=”@layout/details_byline” /> <include android:id=”@+id/plusone_section” layout=”@layout/details_plusone” /> <include android:id=”@+id/description_section” layout=”@layout/details_text” /> ...
  • 32. ScreenshotsSection screenshots = (ScreenshotsSection) findViewById (R.id.screenshots_section); screenshots.bind(model.getScreenshotsData()); TextSection description = (TextSection) findViewById (R.id.description_section); description.bind(model.getDescriptionData()); * I can swear that some PMs seem to think that it’s really that simple
  • 33. the main flow looks up a section and passes the relevant data subset
  • 34. and each section handles its own data binding, events and layout tweaks
  • 35. <include layout=”@layout/screenshots_section” /> ScreenshotsSection trailer = (ScreenshotsSection) findViewById (R.id.screenshots_section); trailer.bind(model.getScreenshotsData());
  • 36. no knowledge of context, internal IDs or event handling
  • 37. each block is a separate reusable layout
  • 38. include include include include include include include include include include include include include include
  • 39. it’s like combining Lego blocks* * except for the part where you’re stuck maintaining the code base
  • 40. all I see is <include>s * he was kind of a douche, fell in love with the wrong girl and after that steak it really went downhill for him. YMMV.
  • 41. the code doesn’t have to be aware what is the context
  • 42. <include layout=”@layout/screenshots_section” /> ScreenshotsSection trailer = (ScreenshotsSection) findViewById (R.id.screenshots_section); trailer.bind(model.getScreenshotsData());
  • 43. welcome to the real world
  • 44. font size, column count, location of rating bar in cells
  • 45. font size res/values/font-dimens.xml <dimen name="content_primary_size">16sp</dimen> res/values-sw800dp/font-dimens.xml <dimen name="content_primary_size">18sp</dimen> res/values/styles.xml <style name="DetailsPage_Header"> ... <item name=”android:textSize”>@dimen/content_primary_size</item> </style> res/layout/pack_header.xml <TextView android:id=”+id/header” style=”@style/DetailsPage_Header” ...
  • 46. column count res/values/ints.xml <integer name="moreby_items_per_row">2</integer> res/values-sw800dp/ints.xml <integer name="moreby_items_per_row">1</integer> public class MoreBySection private int mColumnCount; public MoreBySection(Context ctx) { ... mColumnCount = ctx.getResources().getInteger( R.integer.moreby_items_per_row); }
  • 47. cell layouts res/layout/item_cell.xml res/layout-sw800dp/item_cell.xml public class PackAdapter @Override public View getView(int pos, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mLayoutInflater.inflate( R.layout.item_cell, parent, false); } CellViewHolder holder = (CellViewHolder) convertView.getTag(); ... return convertView; }
  • 48. the code doesn’t have to be aware what is the context* * if you managed to confine the differences to resource files
  • 49. not exactly the same blocks
  • 51. res/values/bools.xml <bool name="use_two_column_layout">false</bool> res/values-sw800dp/bools.xml <bool name="use_two_column_layout">true</bool>
  • 52. public class BylineSection private boolean mIsTwoColumnMode; public BylineSection(Context ctx) { ... mIsTwoColumnMode = ctx.getResources().getBoolean( R.bool.use_two_column_layout); } public void bind() { if (mIsTwoColumnMode) { // add update date, download size and download count } else { // add rating count, update date, download size // and download count } }
  • 53. reuse blocks on the same screen on different form factors
  • 54. <include layout=”@layout/screenshots_section” /> ScreenshotsSection trailer = (ScreenshotsSection) findViewById (R.id.screenshots_section); trailer.bind(model.getScreenshotsData());
  • 56.
  • 57.
  • 58.
  • 59.
  • 60. <include layout=”@layout/youtube_trailer_section” /> YoutubeTrailerSection trailer = (YoutubeTrailerSection) findViewById (R.id.youtube_trailer_section); trailer.bind(model.getYoutubeTrailerData());
  • 63. this talk was about minimizing the pain of developing for multiple form factors
  • 64. building blocks •identify • encapsulate • reuse * almost made it through with no bullet points
  • 65. Q&A • slideshare.net/kirillcool • pushing-pixels.org • +Kirill Grouchnikov • kirillcool@yahoo.com