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
24
Room ORM | Workshop 2 | GADS 2020
davidodari
0
150
Android 11 Meetups: Whats New In Android
davidodari
0
320
Journey as an Android Developer
davidodari
1
150
Improve Quality of Android Apps with BDD
davidodari
0
180
Quick Intro To Kotlin Generics
davidodari
0
190
Other Decks in Programming
See All in Programming
ファインディLT_ポケモン対戦の定量的分析
fufufukakaka
0
880
pylint custom ruleで始めるレビュー自動化
shogoujiie
0
140
Java Webフレームワークの現状 / java web framework at burikaigi
kishida
9
2.2k
CSS Linter による Baseline サポートの仕組み
ryo_manba
1
140
未経験でSRE、はじめました! 組織を支える役割と軌跡
curekoshimizu
0
110
Rails アプリ地図考 Flush Cut
makicamel
1
130
DROBEの生成AI活用事例 with AWS
ippey
0
140
AIプログラミング雑キャッチアップ
yuheinakasaka
10
1.7k
XStateを用いた堅牢なReact Components設計~複雑なClient Stateをシンプルに~ @React Tokyo ミートアップ #2
kfurusho
1
950
責務と認知負荷を整える! 抽象レベルを意識した関心の分離
yahiru
8
1.3k
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
190
新宿駅構内を三人称視点で探索してみる
satoshi7190
2
110
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
40
2.5k
Become a Pro
speakerdeck
PRO
26
5.2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
570
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
175
52k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
KATA
mclloyd
29
14k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.4k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.1k
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