Skip to content

Commit

Permalink
improvement: expose SingleFragmentActivity fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
david-allison committed Jan 28, 2025
1 parent 63a6ac2 commit 3e04c50
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ open class SingleFragmentActivity : AnkiActivity() {
}
}

/** Reference to the hosted fragment */
val fragment
get() = supportFragmentManager.findFragmentByTag(FRAGMENT_TAG)

override val shortcuts: ShortcutGroup?
get() = (supportFragmentManager.findFragmentByTag(FRAGMENT_TAG) as? ShortcutGroupProvider)?.shortcuts
get() = (fragment as? ShortcutGroupProvider)?.shortcuts

companion object {
const val FRAGMENT_NAME_EXTRA = "fragmentName"
Expand Down

0 comments on commit 3e04c50

Please sign in to comment.