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
One screen, many BottomSheets
Search
Keishin Yokomaku
June 14, 2024
Technology
460
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
One screen, many BottomSheets
Keishin Yokomaku
June 14, 2024
More Decks by Keishin Yokomaku
See All by Keishin Yokomaku
Base64 in Android
keithyokoma
0
54
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
750
Build apps for Cars
keithyokoma
0
590
Save the state
keithyokoma
0
630
Either in Kotlin
keithyokoma
0
650
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
5.6k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
5.3k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
590
DX Improvements
keithyokoma
3
450
Other Decks in Technology
See All in Technology
次世代ランサムウェア対策の考察 / 20260704 Mitsutoshi Matsuo
shift_evolve
PRO
5
1.7k
デジタル・デザイン:次の50年を描く「進化する青写真」
y150saya
0
840
Oracle Exadata Database Service on Cloud@Customer X11M (ExaDB-C@C) サービス概要
oracle4engineer
PRO
2
8.4k
型は壁、Rustでもバグを直すな、表現できなくせよ
nwiizo
12
1.8k
SRE Lounge Hiroshimaへの招待
grimoh
0
410
ZOZOTOWNの進化と信頼性を両立する負荷試験
zozotech
PRO
0
140
Zoom2Youtube.Claude
kawaguti
PRO
3
460
なぜ人は自分のプロジェクトを 「なんちゃってアジャイル」と 自嘲するのか
kozotaira
0
260
DMM.com 購入改善推進チーム におけるCodeRabbitを用いた レビューフロー改善の一例
ysknsid25
1
520
Keeping applications secure by evolving OAuth 2.0 and OpenID Connect
ahus1
PRO
1
150
金融の未来を考える / Thinking About the Future of Finance
ks91
PRO
0
180
生成AI活用によるODC欠陥分析の分類高速化の実践と導入効果 / 20260703 Suguru Ishii
shift_evolve
PRO
2
100
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Docker and Python
trallard
47
3.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Music & Morning Musume
bryan
47
7.3k
Deep Space Network (abreviated)
tonyrice
0
220
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
30 Presentation Tips
portentint
PRO
1
340
Test your architecture with Archunit
thirion
1
2.3k
Fireside Chat
paigeccino
42
4k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Transcript
One screen, many BottomSheets Keishin Yokomaku(@KeithYokoma) / Drivemode, Inc.
One screen, many BottomSheets About me ▸ Keishin Yokomaku -
@KeithYokoma ▸ GitHub / Twitter / Stack Over fl ow ▸ Drivemode, Inc. / Engineer
▸ e.g. X (چ Twitter) ▸ ԡ͢Ϙλϯ͝ͱʹҧ͏ BottomSheet ͕ग़Δ One
screen, many BottomSheets Ұͭͷը໘ʹෳछྨͷ BottomSheet Λग़͍ͨ͠
One screen, many BottomSheets ߟ͑ΒΕΔ࣮ ▸ ͦΕͧΕͷ BottomSheet Λ… ▸
BottomSheetDialogFragment Ͱ࡞Δ ▸ BottomSheetScaffold ͷ sheetContent Ͱग़͚͠Δ
One screen, many BottomSheets BottomSheetDialogFragment Ͱ࡞Δ ▸ UI ͷछྨ͝ͱʹ Fragment
Λ͚Δ BottomSheetDialogFragment BottomSheetDialogFragment BottomSheetDialogFragment
One screen, many BottomSheets BottomSheetDialogFragment Ͱ࡞Δ class FooBottomSheetFragment : BottomSheetDialogFragment()
{ override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View = ComposeView(requireContext()).apply { setContent { BottomsheetTheme { FooSheetContent() } } } @Composable fun FooSheetContent() {} }
One screen, many BottomSheets BottomSheetDialogFragment Ͱ࡞Δ ▸ BottomSheetDialogFragment ͷ UI
▸ Compose Ͱ࡞ΕΔ ▸ දࣔɾඇදࣔʹ͢Δ෦͚ͩ DialogFragment ͷ API ʹै͏ ▸ BottomSheet ্Ͱͷ UI ΠϕϯτͷϋϯυϦϯά ▸ DialogFragment ͰΑ͋͘ΔίʔϧόοΫͷ࣮ํ๏Ͳ͏͢Δ͔ ▸ BottomSheetDialogFragment Λϗετ͍ͯ͠Δը໘ͱಉ͡ ViewModel Λ ೖͰ͖ΔͳΒίʔϧόοΫΛఆٛ͠ͳ͍͍ͯ͘
One screen, many BottomSheets BottomSheetDialogFragment Ͱ࡞Δ: ViewModel class MainActivity :
AppCompatActivity() { private val viewModel: MyViewModel by viewModels() } class FooBottomSheetFragment : BottomSheetDialogFragment() { private val viewModel: MyViewModel by activityViewModels() } class MyViewModel : ViewModel() {}
One screen, many BottomSheets BottomSheetScaffold ͷ sheetContent Ͱग़͚͠Δ ▸ UI
ͷछྨ͝ͱʹ Composable Λ͚Δ RepostSheetContent() PostMenuSheetContent() ShareSheetContent()
One screen, many BottomSheets BottomSheetScaffold ͷ sheetContent Ͱग़͚͠Δ BottomSheetScaffold( sheetContent
= { when (sheetType) { BottomSheetType.FOO -> { Text(text = "Hello FOO") } BottomSheetType.BAR -> { Text(text = "Hello BAR") } BottomSheetType.BAZ -> { Text(text = "Hello BAZ") } BottomSheetType.NONE -> {} } } ) enum class BottomSheetType { FOO, BAR, BAZ, NONE }
One screen, many BottomSheets BottomSheetScaffold ͷ sheetContent Ͱग़͚͠Δ ▸ Ͳ͏ͯ͠ذ͕૿͑Δ
▸ sheetContent ͕Ұ͔ͭ͠ͳ͍ͷͰ͜ͷதͰදࣔΛ͚Δ
One screen, many BottomSheets BottomSheetScaffold ͷ sheetContent Ͱग़͚͠Δ ▸ BottomSheet
ͷ UI ͕ΞϓϦͷ༷ͱ߹Θͳ͍Մೳੑ ▸ BottomNavigationView + Fragment Ͱը໘Λߏͨ͠ͱ͖ ▸ Fragment ͷதʹ BottomSheetScaffold ͕͋Δ ▸ Fragment ͕࣋ͭ Boundary Ͱܭࢉ͢ΔͷͰ BottomSheet ͕ BottomNavigationView ͷ্͔Βग़ͯ͘Δ
One screen, many BottomSheets ͲͪΒ͕Α͍͔ ▸ It depends ▸ ཁ݅ΞϓϦͷ
UI ͷߏ࣍ୈ ▸ શ෦ Compose ͳΒ BottomSheetDialogFragment Θͳͯ͘ྑ͍
One screen, many BottomSheets Keishin Yokomaku(@KeithYokoma) / Drivemode, Inc.