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
Nairobi IO Extended Dark Theme
Search
David Odari
June 15, 2019
Programming
0
68
Nairobi IO Extended Dark Theme
A brief overview of Androids Dark theme from Google IO 2019.
David Odari
June 15, 2019
Tweet
Share
More Decks by David Odari
See All by David Odari
Ship Faster With Feature Flags
davidodari
0
280
Getting Started with Jetpack Compose
davidodari
0
130
Persistence
davidodari
0
61
Building Trust in a Multicultural Team
davidodari
1
23
Room ORM | Workshop 2 | GADS 2020
davidodari
0
150
Android 11 Meetups: Whats New In Android
davidodari
0
300
Journey as an Android Developer
davidodari
1
140
Improve Quality of Android Apps with BDD
davidodari
0
170
Quick Intro To Kotlin Generics
davidodari
0
180
Other Decks in Programming
See All in Programming
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
CSC509 Lecture 11
javiergs
PRO
0
180
Jakarta EE meets AI
ivargrimstad
0
220
距離関数を極める! / SESSIONS 2024
gam0022
0
290
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
140
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
690
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
110
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
受け取る人から提供する人になるということ
little_rubyist
0
250
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
cmp.Or に感動した
otakakot
3
200
Featured
See All Featured
KATA
mclloyd
29
14k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Statistics for Hackers
jakevdp
796
220k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Designing the Hi-DPI Web
ddemaree
280
34k
Six Lessons from altMBA
skipperchong
27
3.5k
It's Worth the Effort
3n
183
27k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Happy Clients
brianwarren
98
6.7k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Site-Speed That Sticks
csswizardry
0
28
Transcript
| Dark Theme
David Odari IT Student at Jkuat, Android Developer
| Dark Theme
A contrast of material theme with dark background colors and
light foreground colors.
System wide dark mode. Android Q
• Save On Battery • Accessibility • Low Light Environment
Why DarkTheme ?
Force Dark Rapid Adoption Of Dark Theme on API 29+,
Q. NEW IN Q
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:forceDarkAllowed">true</item> </style> <ImageView …. android:forceDarkAllowed =
“false” />
None
Custom Dark Theme
DayNight AppCompat and MDC
<style name="AppTheme" parent="Theme.AppCompat.DayNight"> Or <style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
AppCompat Material Components
Theme Attributes Avoid Hard Coding Values
values/themes.xml <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar"> values-night/themes.xml <style name="AppTheme" parent="Theme.MaterialComponents.DarkActionBar">
Modes
Tell Appcompat what mode to use with; AppCompatDelegate.setDefaultNightMode() getDelegate().setLocalNightMode()
Available Modes //Always Dark Themed MODE_NIGHT_YES //Always Light Themed MODE_NIGHT_NO
//Uses Current System Setting ( For Q and Above) MODE_NIGHT_FOLLOW_SYSTEM //Switches to dark theme when battery saver is activated MODE_NIGHT_AUTO_BATTERY
//Changes between day/night based on the time of day. MODE_NIGHT_AUTO_TIME
DEPRECATED
Theme Settings
Android P and Below Light Dark Set By Battery Saver
Android Q and Above Light Dark System Default
Elevation
Elevation will not work on Dark Theme. Elevation overlays solve
this by applying the concept of surfaces becoming lighter with higher elevation. Overlays surface of components with colorSurface attribute.
• Material Shape Drawable • ElevationOverlayProvider Custom Views
Configuration
Triggers the uiMode configuration change Activity declares it can handle
<activity ... android:configChanges="uiMode" /> onConfigurationChanged() method will be called
fun checkDarkThemeMode(context: Context) : String { val mode = context.resources.configuration.uiMode.and(
Configuration.UI_MODE_NIGHT_MASK) return when(mode){ Configuration.UI_MODE_NIGHT_NO -> “Light Theme” Configuration.UI_MODE_NIGHT_YES -> “Dark Theme” Configuration.UI_MODE_NIGHT_UNDEFINED -> “Unknown Mode” } }
Illustrations Use theme attributes or provide a variant for each
theme for vector assets.
Notifications Work Out the Box with system provided templates
Demo /Davidodari/NightKing @_davidodari