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
Display Cutout
Search
Panini
April 13, 2018
Programming
1
620
Display Cutout
Panini
April 13, 2018
Tweet
Share
More Decks by Panini
See All by Panini
Kotlin 1.5 preview
panini
1
430
Java谷園から逃げ出した話
panini
0
360
Kotlin 1.4-rc
panini
0
220
Fixing Broken Robots - Android Mutation Testing
panini
0
180
Kotlin Multiplatform
panini
2
630
build.gradle.kts
panini
2
2.3k
Kotlin Multi-platform(?)
panini
1
710
Convert Java file to Kotlin file ⌥⇧⌘K
panini
0
1.1k
Introducing Android P
panini
2
820
Other Decks in Programming
See All in Programming
Go Modules: From Basics to Beyond / Go Modulesの基本とその先へ
kuro_kurorrr
0
100
実践ArchUnit ~実例による検証パターンの紹介~
ogiwarat
2
230
AIエージェントによるテストフレームワーク Arbigent
takahirom
0
360
FastMCPでMCPサーバー/クライアントを構築してみる
ttnyt8701
2
130
Javaに鉄道指向プログラミング (Railway Oriented Pro gramming) のエッセンスを取り入れる/Bringing the Essence of Railway-Oriented Programming to Java
cocet33000
2
510
機械学習って何? 5分で解説頑張ってみる
kuroneko2828
0
190
TypeScript を活かしてデザインシステム MCP を作る / #tskaigi_after_night
izumin5210
5
520
ドメインモデリングにおける抽象の役割、tagless-finalによるDSL構築、そして型安全な最適化
knih
10
1.7k
Perlで痩せる
yuukis
1
680
#QiitaBash TDDでAIに設計イメージを伝える
ryosukedtomita
2
1.7k
Effect の双対、Coeffect
yukikurage
4
1.3k
レガシーシステムの機能調査・開発におけるAI利活用
takuya_ohtonari
0
550
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
462
33k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Gamification - CAS2011
davidbonilla
81
5.3k
Adopting Sorbet at Scale
ufuk
77
9.4k
GitHub's CSS Performance
jonrohan
1031
460k
BBQ
matthewcrist
89
9.7k
A designer walks into a library…
pauljervisheath
206
24k
Unsuck your backbone
ammeep
671
58k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
4 Signs Your Business is Dying
shpigford
183
22k
Transcript
Introducing DisplayCutout Shibuya.apk #24
About Me • Matthew Vern / Panini • Twitter: @callipan
Github: panpanini • Mercari, Inc • Android Engineer (US) • Kotlin可愛い
Display Cutout support For devices like Essential Phone, or iPhone
X which have a cutout in the display (for camera, etc).
Display Cutout emulator Access from Developer options
Display Cutout emulator Mode: None - standard
Display Cutout emulator Mode: Narrow display cutout
Display Cutout emulator Mode: Tall display cutout
Display Cutout emulator Mode: Wide display cutout
Display Cutout emulator Cutout only covers status bar, so there
should be little affect to apps not using Fullscreen Activity
None
Important Point Status bar height has changed!
Important Point Clock has moved!
Important Point Clock has moved! Notifications only show on the
left
Important Point Clock has moved! Notifications only show on the
left Notifications will be hidden behind ..
LAYOUT_IN_DISPLAY_CUTOUT_MODE There are three layout modes for handling the cutout
in a fullscreen Activity: LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
LAYOUT_IN_DISPLAY_CUTOUT_MODE DEFAULT NEVER ALWAYS
WindowInsetListener // API Level 20+ view.setOnApplyWindowInsetsListener { view, windowInsets ->
val cutout: DisplayCutout? = windowInsets.displayCutout // Adjust view position based on cutout windowInsets.consumeDisplayCutout() }
WindowInsetListener // API Level 20+ view.setOnApplyWindowInsetsListener { view, windowInsets ->
val cutout: DisplayCutout? = windowInsets.displayCutout cutout?.bounds?.bounds?.let { view.translationX = it.right.toFloat() view.translationY = it.exactCenterY() - (view.measuredHeight() / 2) } windowInsets.consumeDisplayCutout() }
WindowInsetListener
Summary • Most apps don’t need to worry about DisplayCutout
• Status bar height can change • WindowInsetListener to get cutout position • LAYOUT_IN_DISPLAY_CUTOUT_MODE for fullscreen Activities • Clock & Notifications only shown on the left-hand side of status bar
Introducing DisplayCutout Shibuya.apk #24