SlideShare uma empresa Scribd logo
1 de 88
Improved Text Layout for
Localisation
Charles Harley & Robert Hewitt   25/10/12
Who is Kotikan?
Who is Kotikan?

• Mobile development consultancy based in
  Edinburgh
Who is Kotikan?

• Mobile development consultancy based in
  Edinburgh
• Apps
Who is Kotikan?

• Mobile development consultancy based in
  Edinburgh
• Apps
  • Skyscanner Android and iOS
Who is Kotikan?

• Mobile development consultancy based in
  Edinburgh
• Apps
  • Skyscanner Android and iOS
  • Edinburgh Festival Fringe
Who is Kotikan?

• Mobile development consultancy based in
  Edinburgh
• Apps
  • Skyscanner Android and iOS
  • Edinburgh Festival Fringe
  • Study Planner for the Scottish Qualifications
    Authority
The Problem
The Problem

• Languages, they’re so different!
The Problem

• Languages, they’re so different!
• Skyscanner app has >3 million downloads
The Problem

• Languages, they’re so different!
• Skyscanner app has >3 million downloads
• Localised into 28 languages
The Problem

• Languages, they’re so different!
• Skyscanner app has >3 million downloads
• Localised into 28 languages
• 46% of users are non-english
The Problem

• Languages, they’re so different!
• Skyscanner app has >3 million downloads
• Localised into 28 languages
• 46% of users are non-english
• Varying text lengths can impact the layout
The Problem

• Languages, they’re so different!
• Skyscanner app has >3 million downloads
• Localised into 28 languages
• 46% of users are non-english
• Varying text lengths can impact the layout
• Examples
The Problem

• Languages, they’re so different!
• Skyscanner app has >3 million downloads
• Localised into 28 languages
• 46% of users are non-english
• Varying text lengths can impact the layout
• Examples
  • Help (verb) = способствовать
The Problem

• Languages, they’re so different!
• Skyscanner app has >3 million downloads
• Localised into 28 languages
• 46% of users are non-english
• Varying text lengths can impact the layout
• Examples
  • Help (verb) = способствовать
  • Done (adjective) = Ολοκληρώθηκε
The Problem

• Languages, they’re so different!
• Skyscanner app has >3 million downloads
• Localised into 28 languages
• 46% of users are non-english
• Varying text lengths can impact the layout
• Examples
  • Help (verb) = способствовать
  • Done (adjective) = Ολοκληρώθηκε
  • Android (noun) = человекоподобный робот
The Problem Cont’d
The Problem Cont’d
Existing Solutions?
Existing Solutions?

• Use shorter text (best)
Existing Solutions?

• Use shorter text (best)
• Use built in truncation
Existing Solutions?

• Use shorter text (best)
• Use built in truncation
  • Not very flexible
Existing Solutions?

• Use shorter text (best)
• Use built in truncation
  • Not very flexible
  • Has potential to hide valuable information
Existing Solutions?

• Use shorter text (best)
• Use built in truncation
  • Not very flexible
  • Has potential to hide valuable information
• Resizable views
Existing Solutions?

• Use shorter text (best)
• Use built in truncation
  • Not very flexible
  • Has potential to hide valuable information
• Resizable views
  • Can have negative impact on screen design
Our Solution
Our Solution

• Custom TextView
Our Solution

• Custom TextView
  • Resizes text to fit available width
Our Solution

• Custom TextView
  • Resizes text to fit available width
  • Flexible truncation using markup
Implementing Auto Resizing
Implementing Auto Resizing

• Required subclassing TextView, Button and
  CheckedTextView
Implementing Auto Resizing

• Required subclassing TextView, Button and
  CheckedTextView
• Resizing logic implemented separately from
  subclasses
Implementing Auto Resizing

• Required subclassing TextView, Button and
  CheckedTextView
• Resizing logic implemented separately from
  subclasses
• Minimal code in subclasses, responsibility is to
  activate resizing when state changes
Implementing Auto Resizing Cont’d


 TextView      AutoResizingTextWidget         Button

                          1



 AutoResizeTextView                AutoResizeTextButton



                      1        1


                  AutoTextResizer
Implementing Auto Resizing Cont’d


 TextView      AutoResizingTextWidget         Button

                          1



 AutoResizeTextView                AutoResizeTextButton



                      1        1


                  AutoTextResizer
Implementing Auto Resizing Cont’d


 TextView      AutoResizingTextWidget         Button

                          1



 AutoResizeTextView                AutoResizeTextButton



                      1        1


                  AutoTextResizer
Implementing Auto Resizing Cont’d


 TextView      AutoResizingTextWidget         Button

                          1



 AutoResizeTextView                AutoResizeTextButton



                      1        1


                  AutoTextResizer
Implementing Auto Resizing Cont’d


 TextView      AutoResizingTextWidget         Button

                          1



 AutoResizeTextView                AutoResizeTextButton



                      1        1


                  AutoTextResizer
Implementing Auto Resizing Cont’d


 TextView      AutoResizingTextWidget         Button

                          1



 AutoResizeTextView                AutoResizeTextButton



                      1        1


                  AutoTextResizer
AutoTextResizer Logic
AutoTextResizer Logic

• Resizing starts with the desired text size, i.e. the
  text size set in the XML layout or through calls to
  setTextSize()
AutoTextResizer Logic

• Resizing starts with the desired text size, i.e. the
  text size set in the XML layout or through calls to
  setTextSize()
• Decreasing text sizes are measured until the text
  fits the available width
AutoTextResizer Logic

• Resizing starts with the desired text size, i.e. the
  text size set in the XML layout or through calls to
  setTextSize()
• Decreasing text sizes are measured until the text
  fits the available width
• There is a minimum text size
AutoTextResizer Logic

• Resizing starts with the desired text size, i.e. the
  text size set in the XML layout or through calls to
  setTextSize()
• Decreasing text sizes are measured until the text
  fits the available width
• There is a minimum text size
• Various optimisations
Result
Result
Resizing Harmonisation
Resizing Harmonisation

• Often buttons or text are grouped in a layout
Resizing Harmonisation

• Often buttons or text are grouped in a layout
• Text size within the group needs to be
  consistent
Resizing Harmonisation

• Often buttons or text are grouped in a layout
• Text size within the group needs to be
  consistent
• Each AutoResizeTextWidget in a group is
  registered with an instance of
  TextSizeHarmonizer
Resizing Harmonisation

• Often buttons or text are grouped in a layout
• Text size within the group needs to be
  consistent
• Each AutoResizeTextWidget in a group is
  registered with an instance of
  TextSizeHarmonizer
• TextSizeHarmonizer listens for changes to text
  sizes and sets a fixed text size across the group
Resizing Harmonisation

• Often buttons or text are grouped in a layout
• Text size within the group needs to be
  consistent
• Each AutoResizeTextWidget in a group is
  registered with an instance of
  TextSizeHarmonizer
• TextSizeHarmonizer listens for changes to text
  sizes and sets a fixed text size across the group
• Uses the smallest text size used in the group
Resizing Harmonisation

• Often buttons or text are grouped in a layout
• Text size within the group needs to be
  consistent
• Each AutoResizeTextWidget in a group is
  registered with an instance of
  TextSizeHarmonizer
• TextSizeHarmonizer listens for changes to text
  sizes and sets a fixed text size across the group
• Uses the smallest text size used in the group
• Layout lifecycle causes problems
Resizing Harmonisation Cont’d

protected void onCreate(Bundle savedInstanceState) {
    // ...


    TextSizeHarmonizer.createTextSizeHarmonizer(
        button1, button2, button3
    );
}
Result
Result
XML Harmonisation
XML Harmonisation

• We can make it better
XML Harmonisation

• We can make it better
  • Using XML attributes to define a group ID
XML Harmonisation

• We can make it better
  • Using XML attributes to define a group ID
  • Simplifies Activity code
XML Harmonisation

• We can make it better
  • Using XML attributes to define a group ID
  • Simplifies Activity code
  • Separation of layout logic from business logic
XML Harmonisation Cont’d
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:harmonise="http://schemas.android.com/apk/res-auto"
    >

    <com.kotikan.android.ui.AutoResizeTextButton
        harmonise:harmonizingGroupId="footerButtons"
        ...
        />
    <com.kotikan.android.ui.AutoResizeTextButton
        harmonise:harmonizingGroupId="footerButtons"
        ...
        />
    <com.kotikan.android.ui.AutoResizeTextButton
        harmonise:harmonizingGroupId="footerButtons"
        ...
        />

</LinearLayout>
XML Harmonisation Gotchas
XML Harmonisation Gotchas

• Group IDs may be reused across activities
XML Harmonisation Gotchas

• Group IDs may be reused across activities
  • Both ID and Context identify the group
XML Harmonisation Gotchas

• Group IDs may be reused across activities
  • Both ID and Context identify the group
• Memory management!
XML Harmonisation Gotchas

• Group IDs may be reused across activities
  • Both ID and Context identify the group
• Memory management!
  • Groups are stored statically
XML Harmonisation Gotchas

• Group IDs may be reused across activities
  • Both ID and Context identify the group
• Memory management!
  • Groups are stored statically
  • Weak references used to avoid memory leaks
Flexible Truncation
Flexible Truncation

• Why?
Flexible Truncation

• Why?
  • Certain parts of TextView content may be more
    important than others
Flexible Truncation

• Why?
  • Certain parts of TextView content may be more
    important than others
  • e.g. “Edinburgh (EDI)” -> “Edinbu... (EDI)”
Flexible Truncation

• Why?
  • Certain parts of TextView content may be more
    important than others
  • e.g. “Edinburgh (EDI)” -> “Edinbu... (EDI)”
  • Truncate multiple sections
Flexible Truncation

• Why?
  • Certain parts of TextView content may be more
    important than others
  • e.g. “Edinburgh (EDI)” -> “Edinbu... (EDI)”
  • Truncate multiple sections
• Truncation defined using markup
Flexible Truncation

• Why?
  • Certain parts of TextView content may be more
    important than others
  • e.g. “Edinburgh (EDI)” -> “Edinbu... (EDI)”
  • Truncate multiple sections
• Truncation defined using markup
  • e.g. “<t>Edinburgh</t> (EDI)”
Truncation Logic
Truncation Logic

• Quick exit if no truncation required
Truncation Logic

• Quick exit if no truncation required
• Parsing phase
Truncation Logic

• Quick exit if no truncation required
• Parsing phase
• Measuring phase
Truncation Logic

• Quick exit if no truncation required
• Parsing phase
• Measuring phase
• Truncation phase
Result
Summary
Summary

• Variable text lengths across languages required
  an auto resizing solution
Summary

• Variable text lengths across languages required
  an auto resizing solution
• Use harmonizing to keep text sizes consistent
  within logical view groups
Summary

• Variable text lengths across languages required
  an auto resizing solution
• Use harmonizing to keep text sizes consistent
  within logical view groups
• Harmonizer groups can be defined using XML
  attributes
Summary

• Variable text lengths across languages required
  an auto resizing solution
• Use harmonizing to keep text sizes consistent
  within logical view groups
• Harmonizer groups can be defined using XML
  attributes
• Flexible truncation
Q&A / Feedback




                      ?



charles@kotikan.com       robert@kotikan.com
@charlesharley

Mais conteúdo relacionado

Destaque

How to build Android Chat App with Firebase for 2 hours?
How to build Android Chat App with Firebase for 2 hours?How to build Android Chat App with Firebase for 2 hours?
How to build Android Chat App with Firebase for 2 hours?Nguyễn Bá Thành
 
Introduction to Firebase with Android and Beyond...
Introduction to Firebase with Android and Beyond...Introduction to Firebase with Android and Beyond...
Introduction to Firebase with Android and Beyond...Kasper Loevborg Jensen
 
Firebase presentation
Firebase presentationFirebase presentation
Firebase presentationConnor Leech
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversCodeAndroid
 
Android - Broadcast Receiver
Android - Broadcast ReceiverAndroid - Broadcast Receiver
Android - Broadcast ReceiverYong Heui Cho
 

Destaque (7)

How to build Android Chat App with Firebase for 2 hours?
How to build Android Chat App with Firebase for 2 hours?How to build Android Chat App with Firebase for 2 hours?
How to build Android Chat App with Firebase for 2 hours?
 
Android intents
Android intentsAndroid intents
Android intents
 
Introduction to Firebase with Android and Beyond...
Introduction to Firebase with Android and Beyond...Introduction to Firebase with Android and Beyond...
Introduction to Firebase with Android and Beyond...
 
Firebase presentation
Firebase presentationFirebase presentation
Firebase presentation
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast Receivers
 
Android - Broadcast Receiver
Android - Broadcast ReceiverAndroid - Broadcast Receiver
Android - Broadcast Receiver
 
Slideshare android
Slideshare androidSlideshare android
Slideshare android
 

Semelhante a Improving Android Text Layout in Localisation

Scintillating
ScintillatingScintillating
ScintillatingESUG
 
Cocoa text talk.key
Cocoa text talk.keyCocoa text talk.key
Cocoa text talk.keyzachwaugh
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talkwalkmod
 
Hsc IT Chap 3. Advanced javascript-1.pdf
Hsc IT Chap 3. Advanced javascript-1.pdfHsc IT Chap 3. Advanced javascript-1.pdf
Hsc IT Chap 3. Advanced javascript-1.pdfAAFREEN SHAIKH
 
Xamarin.Forms or Write Once, Run Anywhere
Xamarin.Forms or Write Once, Run AnywhereXamarin.Forms or Write Once, Run Anywhere
Xamarin.Forms or Write Once, Run AnywhereTom Walker
 
Tutorial of Sentiment Analysis
Tutorial of Sentiment AnalysisTutorial of Sentiment Analysis
Tutorial of Sentiment AnalysisFabio Benedetti
 
Web inspector for front end developers..
Web inspector for front end developers..Web inspector for front end developers..
Web inspector for front end developers..Partnered Health
 
What is machine translation
What is machine translationWhat is machine translation
What is machine translationStephen Peacock
 
David Bilík: Anko – modern way to build your layouts?
David Bilík: Anko – modern way to build your layouts?David Bilík: Anko – modern way to build your layouts?
David Bilík: Anko – modern way to build your layouts?mdevtalk
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE IntroductionAhllen Javier
 
Visual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdfVisual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdfsheenmarie0212
 
computer assisted translation programme.pptx
computer assisted translation programme.pptxcomputer assisted translation programme.pptx
computer assisted translation programme.pptxssuser3183f9
 
Fitting The Text Into The Container: How To Do That?
Fitting The Text Into The Container: How To Do That?Fitting The Text Into The Container: How To Do That?
Fitting The Text Into The Container: How To Do That?Coregen Solutions LLC
 
33rd degree talk: open and automatic coding conventions with walkmod
33rd degree talk: open and automatic coding conventions with walkmod33rd degree talk: open and automatic coding conventions with walkmod
33rd degree talk: open and automatic coding conventions with walkmodwalkmod
 
Serverless Text Analytics with Amazon Comprehend
Serverless Text Analytics with Amazon ComprehendServerless Text Analytics with Amazon Comprehend
Serverless Text Analytics with Amazon ComprehendDonnie Prakoso
 
Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)Jonas Bonér
 
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...gravityworksdd
 

Semelhante a Improving Android Text Layout in Localisation (20)

Scintillating
ScintillatingScintillating
Scintillating
 
Cocoa text talk.key
Cocoa text talk.keyCocoa text talk.key
Cocoa text talk.key
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talk
 
Hsc IT Chap 3. Advanced javascript-1.pdf
Hsc IT Chap 3. Advanced javascript-1.pdfHsc IT Chap 3. Advanced javascript-1.pdf
Hsc IT Chap 3. Advanced javascript-1.pdf
 
Xamarin.Forms or Write Once, Run Anywhere
Xamarin.Forms or Write Once, Run AnywhereXamarin.Forms or Write Once, Run Anywhere
Xamarin.Forms or Write Once, Run Anywhere
 
Pa2 session 4
Pa2 session 4Pa2 session 4
Pa2 session 4
 
Tutorial of Sentiment Analysis
Tutorial of Sentiment AnalysisTutorial of Sentiment Analysis
Tutorial of Sentiment Analysis
 
Web inspector for front end developers..
Web inspector for front end developers..Web inspector for front end developers..
Web inspector for front end developers..
 
What is machine translation
What is machine translationWhat is machine translation
What is machine translation
 
David Bilík: Anko – modern way to build your layouts?
David Bilík: Anko – modern way to build your layouts?David Bilík: Anko – modern way to build your layouts?
David Bilík: Anko – modern way to build your layouts?
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
 
Visual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdfVisual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdf
 
computer assisted translation programme.pptx
computer assisted translation programme.pptxcomputer assisted translation programme.pptx
computer assisted translation programme.pptx
 
Fitting The Text Into The Container: How To Do That?
Fitting The Text Into The Container: How To Do That?Fitting The Text Into The Container: How To Do That?
Fitting The Text Into The Container: How To Do That?
 
33rd degree talk: open and automatic coding conventions with walkmod
33rd degree talk: open and automatic coding conventions with walkmod33rd degree talk: open and automatic coding conventions with walkmod
33rd degree talk: open and automatic coding conventions with walkmod
 
Pa1 json requests
Pa1 json requestsPa1 json requests
Pa1 json requests
 
Serverless Text Analytics with Amazon Comprehend
Serverless Text Analytics with Amazon ComprehendServerless Text Analytics with Amazon Comprehend
Serverless Text Analytics with Amazon Comprehend
 
Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)
 
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...
Responsive Web Design: From Mobile To Desktop, And Beyond (updated for MobiDe...
 
DC presentation 1
DC presentation 1DC presentation 1
DC presentation 1
 

Último

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 educationjfdjdjcjdnsjd
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
[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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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...DianaGray10
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
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...Martijn de Jong
 
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 2024The Digital Insurer
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Último (20)

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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
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...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
[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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
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...
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Improving Android Text Layout in Localisation

  • 1. Improved Text Layout for Localisation Charles Harley & Robert Hewitt 25/10/12
  • 3. Who is Kotikan? • Mobile development consultancy based in Edinburgh
  • 4. Who is Kotikan? • Mobile development consultancy based in Edinburgh • Apps
  • 5. Who is Kotikan? • Mobile development consultancy based in Edinburgh • Apps • Skyscanner Android and iOS
  • 6. Who is Kotikan? • Mobile development consultancy based in Edinburgh • Apps • Skyscanner Android and iOS • Edinburgh Festival Fringe
  • 7. Who is Kotikan? • Mobile development consultancy based in Edinburgh • Apps • Skyscanner Android and iOS • Edinburgh Festival Fringe • Study Planner for the Scottish Qualifications Authority
  • 9. The Problem • Languages, they’re so different!
  • 10. The Problem • Languages, they’re so different! • Skyscanner app has >3 million downloads
  • 11. The Problem • Languages, they’re so different! • Skyscanner app has >3 million downloads • Localised into 28 languages
  • 12. The Problem • Languages, they’re so different! • Skyscanner app has >3 million downloads • Localised into 28 languages • 46% of users are non-english
  • 13. The Problem • Languages, they’re so different! • Skyscanner app has >3 million downloads • Localised into 28 languages • 46% of users are non-english • Varying text lengths can impact the layout
  • 14. The Problem • Languages, they’re so different! • Skyscanner app has >3 million downloads • Localised into 28 languages • 46% of users are non-english • Varying text lengths can impact the layout • Examples
  • 15. The Problem • Languages, they’re so different! • Skyscanner app has >3 million downloads • Localised into 28 languages • 46% of users are non-english • Varying text lengths can impact the layout • Examples • Help (verb) = способствовать
  • 16. The Problem • Languages, they’re so different! • Skyscanner app has >3 million downloads • Localised into 28 languages • 46% of users are non-english • Varying text lengths can impact the layout • Examples • Help (verb) = способствовать • Done (adjective) = Ολοκληρώθηκε
  • 17. The Problem • Languages, they’re so different! • Skyscanner app has >3 million downloads • Localised into 28 languages • 46% of users are non-english • Varying text lengths can impact the layout • Examples • Help (verb) = способствовать • Done (adjective) = Ολοκληρώθηκε • Android (noun) = человекоподобный робот
  • 21. Existing Solutions? • Use shorter text (best)
  • 22. Existing Solutions? • Use shorter text (best) • Use built in truncation
  • 23. Existing Solutions? • Use shorter text (best) • Use built in truncation • Not very flexible
  • 24. Existing Solutions? • Use shorter text (best) • Use built in truncation • Not very flexible • Has potential to hide valuable information
  • 25. Existing Solutions? • Use shorter text (best) • Use built in truncation • Not very flexible • Has potential to hide valuable information • Resizable views
  • 26. Existing Solutions? • Use shorter text (best) • Use built in truncation • Not very flexible • Has potential to hide valuable information • Resizable views • Can have negative impact on screen design
  • 29. Our Solution • Custom TextView • Resizes text to fit available width
  • 30. Our Solution • Custom TextView • Resizes text to fit available width • Flexible truncation using markup
  • 32. Implementing Auto Resizing • Required subclassing TextView, Button and CheckedTextView
  • 33. Implementing Auto Resizing • Required subclassing TextView, Button and CheckedTextView • Resizing logic implemented separately from subclasses
  • 34. Implementing Auto Resizing • Required subclassing TextView, Button and CheckedTextView • Resizing logic implemented separately from subclasses • Minimal code in subclasses, responsibility is to activate resizing when state changes
  • 35. Implementing Auto Resizing Cont’d TextView AutoResizingTextWidget Button 1 AutoResizeTextView AutoResizeTextButton 1 1 AutoTextResizer
  • 36. Implementing Auto Resizing Cont’d TextView AutoResizingTextWidget Button 1 AutoResizeTextView AutoResizeTextButton 1 1 AutoTextResizer
  • 37. Implementing Auto Resizing Cont’d TextView AutoResizingTextWidget Button 1 AutoResizeTextView AutoResizeTextButton 1 1 AutoTextResizer
  • 38. Implementing Auto Resizing Cont’d TextView AutoResizingTextWidget Button 1 AutoResizeTextView AutoResizeTextButton 1 1 AutoTextResizer
  • 39. Implementing Auto Resizing Cont’d TextView AutoResizingTextWidget Button 1 AutoResizeTextView AutoResizeTextButton 1 1 AutoTextResizer
  • 40. Implementing Auto Resizing Cont’d TextView AutoResizingTextWidget Button 1 AutoResizeTextView AutoResizeTextButton 1 1 AutoTextResizer
  • 42. AutoTextResizer Logic • Resizing starts with the desired text size, i.e. the text size set in the XML layout or through calls to setTextSize()
  • 43. AutoTextResizer Logic • Resizing starts with the desired text size, i.e. the text size set in the XML layout or through calls to setTextSize() • Decreasing text sizes are measured until the text fits the available width
  • 44. AutoTextResizer Logic • Resizing starts with the desired text size, i.e. the text size set in the XML layout or through calls to setTextSize() • Decreasing text sizes are measured until the text fits the available width • There is a minimum text size
  • 45. AutoTextResizer Logic • Resizing starts with the desired text size, i.e. the text size set in the XML layout or through calls to setTextSize() • Decreasing text sizes are measured until the text fits the available width • There is a minimum text size • Various optimisations
  • 49. Resizing Harmonisation • Often buttons or text are grouped in a layout
  • 50. Resizing Harmonisation • Often buttons or text are grouped in a layout • Text size within the group needs to be consistent
  • 51. Resizing Harmonisation • Often buttons or text are grouped in a layout • Text size within the group needs to be consistent • Each AutoResizeTextWidget in a group is registered with an instance of TextSizeHarmonizer
  • 52. Resizing Harmonisation • Often buttons or text are grouped in a layout • Text size within the group needs to be consistent • Each AutoResizeTextWidget in a group is registered with an instance of TextSizeHarmonizer • TextSizeHarmonizer listens for changes to text sizes and sets a fixed text size across the group
  • 53. Resizing Harmonisation • Often buttons or text are grouped in a layout • Text size within the group needs to be consistent • Each AutoResizeTextWidget in a group is registered with an instance of TextSizeHarmonizer • TextSizeHarmonizer listens for changes to text sizes and sets a fixed text size across the group • Uses the smallest text size used in the group
  • 54. Resizing Harmonisation • Often buttons or text are grouped in a layout • Text size within the group needs to be consistent • Each AutoResizeTextWidget in a group is registered with an instance of TextSizeHarmonizer • TextSizeHarmonizer listens for changes to text sizes and sets a fixed text size across the group • Uses the smallest text size used in the group • Layout lifecycle causes problems
  • 55. Resizing Harmonisation Cont’d protected void onCreate(Bundle savedInstanceState) { // ... TextSizeHarmonizer.createTextSizeHarmonizer( button1, button2, button3 ); }
  • 59. XML Harmonisation • We can make it better
  • 60. XML Harmonisation • We can make it better • Using XML attributes to define a group ID
  • 61. XML Harmonisation • We can make it better • Using XML attributes to define a group ID • Simplifies Activity code
  • 62. XML Harmonisation • We can make it better • Using XML attributes to define a group ID • Simplifies Activity code • Separation of layout logic from business logic
  • 63. XML Harmonisation Cont’d <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:harmonise="http://schemas.android.com/apk/res-auto" > <com.kotikan.android.ui.AutoResizeTextButton harmonise:harmonizingGroupId="footerButtons" ... /> <com.kotikan.android.ui.AutoResizeTextButton harmonise:harmonizingGroupId="footerButtons" ... /> <com.kotikan.android.ui.AutoResizeTextButton harmonise:harmonizingGroupId="footerButtons" ... /> </LinearLayout>
  • 65. XML Harmonisation Gotchas • Group IDs may be reused across activities
  • 66. XML Harmonisation Gotchas • Group IDs may be reused across activities • Both ID and Context identify the group
  • 67. XML Harmonisation Gotchas • Group IDs may be reused across activities • Both ID and Context identify the group • Memory management!
  • 68. XML Harmonisation Gotchas • Group IDs may be reused across activities • Both ID and Context identify the group • Memory management! • Groups are stored statically
  • 69. XML Harmonisation Gotchas • Group IDs may be reused across activities • Both ID and Context identify the group • Memory management! • Groups are stored statically • Weak references used to avoid memory leaks
  • 72. Flexible Truncation • Why? • Certain parts of TextView content may be more important than others
  • 73. Flexible Truncation • Why? • Certain parts of TextView content may be more important than others • e.g. “Edinburgh (EDI)” -> “Edinbu... (EDI)”
  • 74. Flexible Truncation • Why? • Certain parts of TextView content may be more important than others • e.g. “Edinburgh (EDI)” -> “Edinbu... (EDI)” • Truncate multiple sections
  • 75. Flexible Truncation • Why? • Certain parts of TextView content may be more important than others • e.g. “Edinburgh (EDI)” -> “Edinbu... (EDI)” • Truncate multiple sections • Truncation defined using markup
  • 76. Flexible Truncation • Why? • Certain parts of TextView content may be more important than others • e.g. “Edinburgh (EDI)” -> “Edinbu... (EDI)” • Truncate multiple sections • Truncation defined using markup • e.g. “<t>Edinburgh</t> (EDI)”
  • 78. Truncation Logic • Quick exit if no truncation required
  • 79. Truncation Logic • Quick exit if no truncation required • Parsing phase
  • 80. Truncation Logic • Quick exit if no truncation required • Parsing phase • Measuring phase
  • 81. Truncation Logic • Quick exit if no truncation required • Parsing phase • Measuring phase • Truncation phase
  • 84. Summary • Variable text lengths across languages required an auto resizing solution
  • 85. Summary • Variable text lengths across languages required an auto resizing solution • Use harmonizing to keep text sizes consistent within logical view groups
  • 86. Summary • Variable text lengths across languages required an auto resizing solution • Use harmonizing to keep text sizes consistent within logical view groups • Harmonizer groups can be defined using XML attributes
  • 87. Summary • Variable text lengths across languages required an auto resizing solution • Use harmonizing to keep text sizes consistent within logical view groups • Harmonizer groups can be defined using XML attributes • Flexible truncation
  • 88. Q&A / Feedback ? charles@kotikan.com robert@kotikan.com @charlesharley

Notas do Editor

  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
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n