Last active
July 23, 2018 23:39
-
-
Save kiuchikeisuke/e77fac405495ed5ccfa1ae3ba166170a to your computer and use it in GitHub Desktop.
JetpackのNavigationのオプション、NavOptionsをざっくり覗いてみる ref: https://qiita.com/k_keisuke/items/29cf9f4df7b3cdcbb147
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 略 | |
* @param launchDocument true to launch a new document task | |
* @deprecated As per the {@link android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT} | |
* documentation, it is recommended to use {@link android.R.attr#documentLaunchMode} on an | |
* Activity you wish to launch as a new document. | |
*/ | |
@Deprecated | |
@NonNull | |
public Builder setLaunchDocument(boolean launchDocument) {/* 略 */} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
view?.findViewById<Button>(R.id.button_to_activity)?.setOnClickListener { | |
val options = NavOptions.Builder() | |
.setPopEnterAnim(R.anim.abc_fade_in) | |
.setPopExitAnim(R.anim.abc_fade_out) | |
.build() | |
Navigation.findNavController(it).navigate(R.id.action_mainFragment_to_main2Activity, null, options) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
view?.findViewById<Button>(R.id.button_to_activity)?.setOnClickListener { | |
val options = NavOptions.Builder().setClearTask(true).build() | |
Navigation.findNavController(it).navigate(R.id.action_mainFragment_to_main2Activity, null, options) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<activity android:name=".Main2Activity" | |
android:documentLaunchMode="always"> | |
</activity> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val intent = Intent(context, SomeActivity::class.java) | |
intent.flags = Intent.LAUNCH_CLEAR_TASK | |
context.startActivity(intent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val intent = Intent(context, SomeActivity::class.java) | |
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK | |
context.startActivity(intent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment