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
39
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
45
My Journey To Becoming And Android Engineer
pabimoloi
0
28
Other Decks in Programming
See All in Programming
GitHub Actionsの痒いところを埋めるサードパーティーランナー
dora1998
2
270
slog登場に伴うloggerの取り回し手法の見直し / kamakura.go #6
arthur1
0
150
Using "modern" Ruby to build a better, faster Homebrew
mikemcquaid
2
280
Balkan Ruby 2024 — How and why to run SQLite on Rails in production
fractaledmind
0
110
Next.js App Router
quramy
14
2.3k
Exploring Type-Informed Lint Rules in Rust based TypeScript Linters
unvalley
3
650
slow types ってなんだろう?
karad
0
210
Adding Security to Microcontroller Ruby
sylph01
1
160
TypeScriptから始める VR生活
tamagokakeg
2
120
Documentation testsの恩恵 / Documentation testing benefits
ssssota
1
560
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
13
4.4k
『WordPressコミュニティで学ぶ』OSS貢献の多様性
ippey
0
270
Featured
See All Featured
Designing for Performance
lara
601
67k
Rails Girls Zürich Keynote
gr2m
91
13k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
7k
Building Adaptive Systems
keathley
32
1.9k
BBQ
matthewcrist
80
8.8k
The Art of Programming - Codeland 2020
erikaheidi
43
12k
The Mythical Team-Month
searls
217
42k
YesSQL, Process and Tooling at Scale
rocio
165
13k
Happy Clients
brianwarren
92
6.4k
Visualization
eitanlees
137
14k
Building an army of robots
kneath
300
41k
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
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