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
580
Display Cutout
Panini
April 13, 2018
Tweet
Share
More Decks by Panini
See All by Panini
Kotlin 1.5 preview
panini
1
410
Java谷園から逃げ出した話
panini
0
350
Kotlin 1.4-rc
panini
0
210
Fixing Broken Robots - Android Mutation Testing
panini
0
170
Kotlin Multiplatform
panini
2
610
build.gradle.kts
panini
2
2.3k
Kotlin Multi-platform(?)
panini
1
700
Convert Java file to Kotlin file ⌥⇧⌘K
panini
0
1.1k
Introducing Android P
panini
2
800
Other Decks in Programming
See All in Programming
読まないコードリーディング術
hisaju
1
140
もう少しテストを書きたいんじゃ〜 #phpstudy
o0h
PRO
21
4.4k
React 19アップデートのために必要なこと
uhyo
8
1.6k
Boos Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
700
オレを救った Cline を紹介する
codehex
15
14k
Rubyと自由とAIと
yotii23
6
1.9k
はじめてのIssueOps - GitHub Actionsで実現するコメント駆動オペレーション
tmknom
2
360
CloudNativePGを布教したい
nnaka2992
0
120
PEPCは何を変えようとしていたのか
ken7253
3
320
AIレビュー導入によるCIツールとの共存と最適化
kamo26sima
1
1k
Django NinjaによるAPI開発の効率化とリプレースの実践
kashewnuts
1
300
Kotlinの開発でも AIをいい感じに使いたい / Making the Most of AI in Kotlin Development
kohii00
5
2k
Featured
See All Featured
Building Adaptive Systems
keathley
40
2.4k
Optimising Largest Contentful Paint
csswizardry
34
3.1k
The Pragmatic Product Professional
lauravandoore
32
6.4k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.3k
Raft: Consensus for Rubyists
vanstee
137
6.8k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.4k
Stop Working from a Prison Cell
hatefulcrawdad
268
20k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Code Reviewing Like a Champion
maltzj
521
39k
How GitHub (no longer) Works
holman
314
140k
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