File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed
app/src/main/java/cz/muni/fi/rpg/ui/common Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -9,22 +9,14 @@ abstract class BaseFragment(@LayoutRes contentLayoutId: Int) : Fragment(contentL
99 * Set title of parent activity's action bar
1010 */
1111 protected fun setTitle (title : String ) {
12- val activity = requireActivity()
13-
14- if (activity is AppCompatActivity ) {
15- activity.supportActionBar?.title = title
16- }
12+ activity?.let { (activity as AppCompatActivity ).supportActionBar?.title = title }
1713 }
1814
1915 /* *
2016 * Set subtitle of parent activity's action bar
2117 * Note: This is not really optimal way to do this, but I did not found another one
2218 */
2319 protected fun setSubtitle (subtitle : String ) {
24- val activity = requireActivity()
25-
26- if (activity is AppCompatActivity ) {
27- activity.supportActionBar?.subtitle = subtitle
28- }
20+ activity?.let { (activity as AppCompatActivity ).supportActionBar?.subtitle = subtitle }
2921 }
3022}
You can’t perform that action at this time.
0 commit comments