Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Theming In Android++
Search
Pabi Moloi
July 03, 2019
Programming
1
41
Theming In Android++
In this talk, I spoke about some of the mistakes I made with theming and how I overcame them.
Pabi Moloi
July 03, 2019
Tweet
Share
More Decks by Pabi Moloi
See All by Pabi Moloi
Theming In Android
pabimoloi
0
50
My Journey To Becoming And Android Engineer
pabimoloi
0
47
Other Decks in Programming
See All in Programming
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
0
110
Being an ethical software engineer
xgouchet
PRO
0
210
AWS で実現する安全な AI エージェントの作り方 〜 Bedrock Engineer の実装例を添えて 〜 / how-to-build-secure-ai-agents
gawa
8
830
設計の本質:コード、システム、そして組織へ / The Essence of Design: To Code, Systems, and Organizations
nrslib
4
630
Dissecting and Reconstructing Ruby Syntactic Structures
ydah
1
750
DataStoreをテストする
mkeeda
0
290
Lambda(Python)の リファクタリングが好きなんです
komakichi
3
210
地域ITコミュニティの活性化とAWSに移行してみた話
yuukis
0
240
プロダクト横断分析に役立つ、事前集計しないサマリーテーブル設計
hanon52_
2
450
Strategic Design (DDD)for the Frontend @DDD Meetup Stuttgart
manfredsteyer
PRO
0
160
AI Coding Agent Enablement - エージェントを自走させよう
yukukotani
14
6.2k
「影響が少ない」を自分の目でみてみる
o0h
PRO
2
1.1k
Featured
See All Featured
Side Projects
sachag
452
42k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.6k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
23
2.6k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.2k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.5k
Scaling GitHub
holman
459
140k
Designing for humans not robots
tammielis
252
25k
Transcript
Pabi Moloi @pabiforbes www.peckishpabi.co.za Android Engineer
Theming In Android Color Typography Style Theme
What is theming, and why is it important?
Material Components implementation "com.google.android.material:material:$material_version"
Theming In Android Color Typography Style Theme
Theming In Android Blog
None
None
None
So how should we ideally name our colors?
Colors have names :)
Parmesan
Material Color Tool
<!--?xml version="1.0" encoding="UTF-8"?--> <resources> <color name="primaryColor">#f9a825</color> <color name="primaryLightColor">#ffd95a</color> <color name="primaryDarkColor">#c17900</color>
<color name="secondaryColor">#ffffff</color> <color name="secondaryLightColor">#ffffff</color> <color name="secondaryDarkColor">#25cccccc</color> <color name="primaryTextColor">#ffffff</color> <color name="secondaryTextColor">#000000</color> </resources>
<!--?xml version="1.0" encoding="UTF-8"?--> <resources> <color name="primaryColor">#f9a825</color> <color name="primaryLightColor">#ffd95a</color> <color name="primaryDarkColor">#c17900</color>
<color name="secondaryColor">#ffffff</color> <color name="secondaryLightColor">#ffffff</color> <color name="secondaryDarkColor">#25cccccc</color> <color name="primaryTextColor">#ffffff</color> <color name="secondaryTextColor">#000000</color> </resources>
Give colors their names!
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#d32f2f</color> <color name="mustard">#F9A825</color> <color name="yellow">#ffd95a</color>
<color name="dark_mustard">#c17900</color> <color name="white">#ffffff</color> <color name="light_grey">#25CCCCCC</color> <color name="black">#000000</color> </resources>
<style name="..." parent="..."> <item name="colorPrimary">@color/mustard</item> <item name= "colorOnPrimary">@color/white</item> <item name="colorPrimaryDark">@color/dark_mustard</item>
<item name="colorAccent">@color/red</item> <item name="colorSecondary">@color/white</item> <item name="colorOnSecondary">@color/black</item> </style>
Recap - Color - Give colors names, which helps in
the reduction of duplication. - “On” colours are usually used for iconography, text, and strokes
Theming In Android Color Typography Style Theme
Typography
Attributes • textAppearanceHeadline1 - textAppearanceHeadline6 • textAppearanceSubtitle1 - textAppearanceSubtitle2 •
textAppearanceBody1 - textAppearanceBody2 • textAppearanceCaption • textAppearanceButton • textAppearanceOverline
None
<style name="headline3" parent="TextAppearance.MaterialComponents.Headline3"> ... </style>
<style name="headline3" parent="TextAppearance.MaterialComponents.Headline3"> <item name="android:letterSpacing">0</item> ... </style>
<style name="headline3" parent="TextAppearance.MaterialComponents.Headline3"> <item name="android:letterSpacing">0</item> <item name="android:textAllCaps">false</item> ... </style>
<style name="headline3" parent="TextAppearance.MaterialComponents.Headline3"> <item name="android:letterSpacing">0</item> <item name="android:textAllCaps">false</item> <item name="android:textSize">24sp</item> ...
</style>
<style name="headline3" parent="TextAppearance.MaterialComponents.Headline3"> <item name="android:letterSpacing">0</item> <item name="android:textAllCaps">false</item> <item name="android:textSize">24sp</item> <item
name="android:textStyle">normal</item> </style>
None
Theming In Android Color Typography Style Theme
Style
Font Color Font Size Background Colour Padding MinHeight MinWidth ...
<style name="headline3" parent="TextAppearance.MaterialComponents.Headline3"> <item name="android:letterSpacing">0</item> <item name="android:textAllCaps">false</item> <item name="android:textSize">24sp</item> <item
name="android:textStyle">normal</item> </style>
None
<style name="FloatingActionButtonStyle" parent="Widget.MaterialComponents.FloatingActionButton"> ... </style>
<style name="FloatingActionButtonStyle" parent="Widget.MaterialComponents.FloatingActionButton"> <item name="backgroundTint">@color/mustard</item> <item name="tint">@color/white</item> <item name="rippleColor">@color/white</item> </style>
<com.google.android.material.floatingactionbutton.FloatingActi onButton ... style="@style/FloatingActionButtonStyle"/>
Theming In Android Color Typography Style Theme
Theme
...is a type of style that is applied to: •
The entire application • Activity • View Hierarchy
<style name="NoActionBarTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> <item name="colorPrimary">@color/mustard</item> <item name= "colorOnPrimary">@color/white</item> <item name="colorPrimaryVariant">@color/yellow</item>
<item name="colorPrimaryDark">@color/dark_mustard</item> <item name="colorAccent">@color/red</item> <item name="colorSecondary">@color/white</item> <item name="colorOnSecondary">@color/black</item> <item name="android:windowBackground">@color/white</item> </style>
Dark Theme
None
<style name="NoActionBarTheme" parent= "Theme.MaterialComponents.Light.NoActionBar"> ... </style>
<style name="NoActionBarTheme" parent= "Theme.MaterialComponents.DayNight.NoActionBar"> ... </style>
AppCompatDelegate.setDefaultNightMode (AppCompatDelegate.MODE)
Modes: • MODE_NIGHT_FOLLOW_SYSTEM • MODE_NIGHT_YES • MODE_NIGHT_NO • MODE_NIGHT_AUTO_BATTERY
Honourable Mention: • MODE_NIGHT_AUTO_TIME • MODE_NIGHT_AUTO
What to keep at the back of your mind: Android’s
Style Hierarchy
View Specific Styling Theme Default Styling Applying a style to
a view Setting individual attributes
Programmatically applying attributes Character/Paragraph styling