ActivityKt

Added in 1.0.0

public final class ActivityKt


Summary

Public methods

static final void

Sets up the ActionBar returned by AppCompatActivity.getSupportActionBar for use with a NavController.

static final void
setupActionBarWithNavController(
    @NonNull AppCompatActivity receiver,
    @NonNull <Error class: unknown class> navController,
    DrawerLayout drawerLayout
)

Sets up the ActionBar returned by AppCompatActivity.getSupportActionBar for use with a NavController.

Public methods

public static final void setupActionBarWithNavController(
    @NonNull AppCompatActivity receiver,
    @NonNull <Error class: unknown class> navController,
    @NonNull AppBarConfiguration configuration
)

Sets up the ActionBar returned by AppCompatActivity.getSupportActionBar for use with a NavController.

By calling this method, the title in the action bar will automatically be updated when the destination changes (assuming there is a valid androidx.navigation.NavDestination.label).

The AppBarConfiguration you provide controls how the Navigation button is displayed.

You are responsible for calling NavController.navigateUp to handle the Navigation button. Typically this is done in AppCompatActivity.onSupportNavigateUp.

Parameters
@NonNull <Error class: unknown class> navController

The NavController whose navigation actions will be reflected in the title of the action bar.

@NonNull AppBarConfiguration configuration

Additional configuration options for customizing the behavior of the ActionBar

public static final void setupActionBarWithNavController(
    @NonNull AppCompatActivity receiver,
    @NonNull <Error class: unknown class> navController,
    DrawerLayout drawerLayout
)

Sets up the ActionBar returned by AppCompatActivity.getSupportActionBar for use with a NavController.

By calling this method, the title in the action bar will automatically be updated when the destination changes (assuming there is a valid androidx.navigation.NavDestination.label).

The start destination of your navigation graph is considered the only top level destination. On the start destination of your navigation graph, the ActionBar will show the drawer icon if the given drawerLayout is non null. On all other destinations, the ActionBar will show the Up button.

You are responsible for calling NavController.navigateUp to handle the Navigation button. Typically this is done in AppCompatActivity.onSupportNavigateUp.

Parameters
@NonNull <Error class: unknown class> navController

The NavController whose navigation actions will be reflected in the title of the action bar.

DrawerLayout drawerLayout

The DrawerLayout that should be toggled from the Navigation button