Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Android Jetpack: Navigationを使ってみる
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Yui Matsuura
May 17, 2018
Technology
4.4k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Android Jetpack: Navigationを使ってみる
Yui Matsuura
May 17, 2018
Transcript
18 slides
Android Jetpack: Navigationを使っ てみる Google I/O 2018 わいわい報告会 @teshi04
About me てし @teshi04 Yui Matuura Mercari/Marpay
Android Jetpack
Jetpack: Architecture • Databinding • Lifecycles • LiveData • Navigation
new! • Paging new! • Room • ViewModel • WorkManager new!
デモ
None
Navigationの課題 • Fragment Transition • Passing Arguments • Deep Links
• Up and Back • Testing • Error-prone Boilerplate
Architecture: Navigation ビジュアルツールとXML • Navigation Actions • Arguments • Animation
• Up behavior • Deep Link no more Fragment Transaction!
Gradle Dependency allprojects { repositories { google() jcenter() } }
implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha01' implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha01'
NavHostFragmentを追加 activity_main.xml <fragment android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/my_nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" app:navGraph="@navigation/mobile_navigation" app:defaultNavHost="true" />
Navigation Graph
Actionを設定する
Actionを設定する
Navigation Graph(XML) mobile_navigation.xml <navigation xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" app:startDestination="@+id/launcher_home"> <fragment android:id="@+id/launcher_home"
android:name="com.example.android.codelabs.navigation.MainFragment" android:label="@string/home" tools:layout="@layout/main_fragment"> <action android:id="@+id/next_action" app:destination="@id/flow_step_one" ... app:popExitAnim="@anim/slide_out_right" /> </fragment> <fragment android:id="@+id/flow_step_one" android:name="com.example.android.codelabs.navigation.FlowStepFragment" tools:layout="@layout/flow_step_one_fragment"/> ...
NavControllerで遷移する MainFragment.kt transactionsButton.setOnClickListener { view -> Navigation.findNavController(view).navigate(R.id.next_action) }
まとめ • Android Jetpack: Navigationのメリット ◦ 画面遷移が可視化できる ◦ FragmentTransition, Animationが簡単とか
• Jetpack。手段の一つでしかない。使うか使わないかは アプリの次第だと思う
参考リンク • 「Android Jetpack: manage UI navigation with Navigation Controller
(Google I/O '18) https://www.youtube.com/watch?v=8GCXtCjtg40 • Sample https://github.com/googlesamples/android-architecture-c omponents/tree/master/NavigationBasicSample • Navigation Codelab https://codelabs.developers.google.com/codelabs/androi d-navigation/index.html • ドキュメント https://developer.android.com/topic/libraries/architecture/ navigation/
Thanks!
More Decks by Yui Matsuura
See All by Yui Matsuura
★2.2のアプリがIn-App Review APIを導入して★4.2になるまで
teshi04
6
3.8k
Firebase AutoMLのオンデバイス実行とCameraXを組み合わせた新しい価値を秒で試す
teshi04
3
1.1k
技術書典アプリを作った話
teshi04
2
960
Create Layouts with the Wearable UI Library
teshi04
2
4.8k
Other Decks in Technology
See All in Technology
Go初心者のクラウドエンジニアが、デプロイを通して旨味を知っていく話
ryudai
1
200
Frontier Teams — Amazon は AI で「開発のやり方」をどう変えたのか
kmotohas
0
230
Kiro Crew の Bot (続く役目を任せる窓口) | 目指せ Kiro マスター 12
inariku
PRO
2
380
農夫は秘伝のタレを知らない - NOBODY KNOWS THE HIDDEN SOURCE - Kaggriculture 3rd Place Solution
masspeaks
0
280
プロダクションコードにおける encoding/json から encoding/json/v2 へのスムーズな移行
sansantech
PRO
1
410
サボる子はいねぇがー!AgentCoreハーネスの脆弱性に学ぶ、エージェントの入力バリデーション
iwamot
PRO
5
330
20261113_JAWS_Osaka
takuyay0ne
0
330
大江戸Ruby会議でデータベース クライアントの話をするのは 間違っているだろうか
yahonda
1
120
evcc & Home Assistant
naltatis
0
690
Kiro IDE 入門 (画面の各部から、頼み方、任せ方、戻し方まで) | 目指せ Kiro マスター 02
inariku
PRO
4
230
Ebitengine製iOSアプリ公開ボタンを押す会
eiei114
0
120
Sonnetだけで業務はまわる?
kintotechdev
1
110
Featured
See All Featured
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
880
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
Tell your own story through comics
letsgokoyo
1
1.1k
Embracing the Ebb and Flow
colly
88
5.2k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
ラッコキーワード サービス紹介資料
rakko
5
5.8M
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Skip the Path - Find Your Career Trail
mkilby
1
290
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k