ActivityKt

public final class ActivityKt


Summary

Public methods

static final void
ActivityKt.setupActionBarWithNavController(
    @NonNull AppCompatActivity receiver,
    @NonNull NavController navController,
    @Nullable DrawerLayout drawerLayout
)

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

static final void
ActivityKt.setupActionBarWithNavController(
    @NonNull AppCompatActivity receiver,
    @NonNull NavController navController,
    @NonNull AppBarConfiguration configuration
)

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

Public methods

ActivityKt.setupActionBarWithNavController

@NonNull
public static final void ActivityKt.setupActionBarWithNavController(
    @NonNull AppCompatActivity receiver,
    @NonNull NavController navController,
    @Nullable 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 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 NavController navController

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

@Nullable DrawerLayout drawerLayout

The DrawerLayout that should be toggled from the Navigation button

ActivityKt.setupActionBarWithNavController

@NonNull
public static final void ActivityKt.setupActionBarWithNavController(
    @NonNull AppCompatActivity receiver,
    @NonNull NavController 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 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 NavController 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