なぜNavigation Component を使ったSingle Activity Architectureをお勧めするのか

表題について上手く言語化してある記事を見つけたので紹介したい。

oozou.com

Since the announcement of Jetpack in Google I/O 2018, Single Activity Architecture is also mentioned  

Android Developers Blog: Use Android Jetpack to Accelerate Your App Development

1.Have you ever create Activity with only one Fragment inside just because people told you that it is the best practice?

それがベストプラクティスであるという理由だけで、内部にフラグメントが1つしかないアクティビティを作成したことがありますか? その通りだが、シングルアクティビティアーキテクチャを使用すると、アプリケーションにアクティビティが1つしかないため、これらの懸念を取り除くことができます

2.There has always been a problem with transition animation between Activities.

アクティビティ間の遷移アニメーションには常に問題があります。ただし、このような問題はフラグメント間の遷移では発生しません。

3.Sharing data between Activities

アクティビティ間でのデータの共有の問題。シングルアクティビティアーキテクチャならアクティビティが1つ。また、SharedViewModelでデータの共有ができる

4.Passing arguments into the Fragment can be painful sometimes.

フラグメントに引数を渡すことは、時には苦痛になる可能性があります。Navigation component のSafe Args Gradle Plugin で楽になる

5.Easy deep linking

簡単なディープリンク。Navigation Graphでdeep linkは簡単に定義できる。

Are there any problems using the Single-Activity Architecture with the Navigation component?

We have used this architecture in several production apps and so far there are no issues. You might wonder what if we want to pass the data back and forth between Fragments like startActivityForResult? Previously, we used a shared ViewModel for communication between fragments. However, recently, Google has just added a new ability to FragmentManager which allowed the FragmentManager to act as a central store for fragment results. We can pass the data back and forth between Fragments easily. You can read more about it here Communicating with fragments  |  Android Developers

ナビゲーションコンポーネントでシングルアクティビティアーキテクチャを使用する際に問題はありますか? このアーキテクチャはいくつかの本番アプリで使用されており、これまでのところ問題はありません。 startActivityForResultのようなフラグメント間でデータをやり取りしたい場合はどうでしょうか。 以前は、フラグメント間の通信にSharedViewModelを使用していました。 ただし、最近、GoogleはFragmentManagerに新しい機能を追加しました。これにより、FragmentManagerがフラグメント結果の中央ストアとして機能できるようになりました。 フラグメント間でデータを簡単にやり取りできます。