Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Step 10 Deep Linking - Up button not showing #60

Closed
solamour opened this issue Mar 8, 2019 · 1 comment
Closed

Step 10 Deep Linking - Up button not showing #60

solamour opened this issue Mar 8, 2019 · 1 comment

Comments

@solamour
Copy link

solamour commented Mar 8, 2019

Step 10 "Deep Linking to a destination" contains the following screen shot at the end of the page. Notice the Up button on the upper-left corner.

image

I can't speak for others, but the Up button never showed up for my case, even when I reach the screen from the widget in the home screen. The only way to make it show is to remove R.id.deeplink_dest in MainActivity.kt.

class MainActivity : AppCompatActivity() {
    ...
    // TODO STEP 9.5 - Create an AppBarConfiguration with the correct top-level destinations
    // You should also remove the old appBarConfiguration setup above
    val drawerLayout : DrawerLayout? = findViewById(R.id.drawer_layout)
    appBarConfiguration = AppBarConfiguration(
            setOf(R.id.home_dest, R.id.deeplink_dest),    // <-- Remove "R.id.deeplink_dest".
            drawerLayout)

But if I do, the Up button always shows up in "Deep Link" screen, even when I reach the screen from Navigation Drawer or Bottom Navigation.

Is the Up button supposed to show up only when I reach it from the "Deep Link" widget? If so, how do I make it show up, but not show up when reaching it from Navigation Drawer or Bottom Navigation?

@ceruleanotter
Copy link
Contributor

Thanks for reporting this and the feedback! Apologies for the confusion - in an older version of the codelab (which this screenshot was taken from) I did not teach about different top level destinations, so the screenshots were out of date.

The up button is not supposed to show up conditionally based on whether you got to the destination via deep link. Instead, this behavior is controlled by whether or not it's a top level destination, which is determined by passing in the id R.id.deeplink_dest to AppBarConfiguration. If it is top level, the up button shows. If it's not top level, the up button doesn't show (and either nothing or a nav drawer menu button shows). Hope that clarifies things and I am updating these screenshots so others will not be confused by this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants