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
44
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
56
My Journey To Becoming And Android Engineer
pabimoloi
0
49
Other Decks in Programming
See All in Programming
🔨 小さなビルドシステムを作る
momeemt
4
680
Android 16 × Jetpack Composeで縦書きテキストエディタを作ろう / Vertical Text Editor with Compose on Android 16
cc4966
1
200
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
320
ProxyによるWindow間RPC機構の構築
syumai
3
1.2k
Rancher と Terraform
fufuhu
2
360
実用的なGOCACHEPROG実装をするために / golang.tokyo #40
mazrean
1
270
テストカバレッジ100%を10年続けて得られた学びと品質
mottyzzz
2
590
Azure SRE Agentで運用は楽になるのか?
kkamegawa
0
2.2k
OSS開発者という働き方
andpad
5
1.7k
RDoc meets YARD
okuramasafumi
4
170
今だからこそ入門する Server-Sent Events (SSE)
nearme_tech
PRO
3
170
Improving my own Ruby thereafter
sisshiki1969
1
160
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
The World Runs on Bad Software
bkeepers
PRO
70
11k
Why Our Code Smells
bkeepers
PRO
339
57k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.5k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Facilitating Awesome Meetings
lara
55
6.5k
RailsConf 2023
tenderlove
30
1.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.7k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
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