Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Slider] Always visible label still shows up when hiding its fragment #4064

Closed
vikz95 opened this issue Feb 14, 2024 · 7 comments
Closed

[Slider] Always visible label still shows up when hiding its fragment #4064

vikz95 opened this issue Feb 14, 2024 · 7 comments

Comments

@vikz95
Copy link

vikz95 commented Feb 14, 2024

Description
When using version 1.11.0:

When using version 1.12.0-alpha03:

  • The [Slider] The label is scrolled when it's in the scroll view and LABEL_VISIBLE #2869 issue is fixed
  • But when I hide a fragment and show another one under the same FragmentManager, the slider labels of the first fragment are not hidden and still show up.
  • Showing fragment of tab Setup 1, label position follows slider position on scroll as expected:
    label scroll fixed
  • Showing fragment of tab Setup 2, but also the labels of the Setup 1 fragment are visible:
    label still visible when changing fragment

Expected behavior: When hiding a fragment also the slider labels should be hidden.

Source code:
I know that instead of adding all the fragments and hiding/showing them maybe I could use replace(), but in version 1.11.0 when hiding a fragment even the label is hidden as expected, so a bug was introduced in the alpha releases.

childFragmentManager.commit {
            setReorderingAllowed(true)
            add(R.id.call_setup_fragment_container, callSetupFragments[0], "Setup1")
            add(R.id.call_setup_fragment_container, callSetupFragments[1], "Setup2")
            hide(callSetupFragments[1])
            add(R.id.call_setup_fragment_container, callSetupFragments[2], "Setup3")
            hide(callSetupFragments[2])
            add(R.id.call_setup_fragment_container, callSetupFragments[3], "Setup4")
            hide(callSetupFragments[3])
        }

        binding.callSetupTabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
            override fun onTabSelected(tab: TabLayout.Tab?) {
                childFragmentManager.commit {
                    tab?.let { show(callSetupFragments[it.position]) }
                }
            }

            override fun onTabUnselected(tab: TabLayout.Tab?) {
                childFragmentManager.commit {
                    tab?.let { hide(callSetupFragments[it.position]) }
                }
            }

            override fun onTabReselected(tab: TabLayout.Tab?) {
            }

        })

Minimal sample app repro: Please consider attaching a minimal sample app that reproduces the issue. This will help narrow down the conditions required for reproducing the issue, and it will speed up the bug fix process. You may attach a zip file of the sample app or link to a GitHub repo that contains the sample app.

Android API version: 34

Material Library version: 1.12.0-alpha03

Device: Xiaomi Pad 6 and Samsung Galaxy tabS5e.

Edit: I tried also the latest SNAPSHOT version 1.12.0-SNAPSHOT and can confirm that the issues is still present.

@manabu-nakamura
Copy link
Contributor

@vikz95, does the latest 1.13.0-SNAPSHOT (9bf5edd) cause this issue?

@vikz95
Copy link
Author

vikz95 commented Oct 15, 2024

Yes, I tried the latest snapshot version and when I move to another tab, all the slider labels from the previous tab are visible.

@manabu-nakamura
Copy link
Contributor

Hmm... Is it impossible to provide the minimum sample app? I don't understand this issue completely. In order to understand this issue, I created a sample app (which uses a fragment) and the simplified version (which doesn't use a fragment).

@vikz95 vikz95 closed this as completed Oct 15, 2024
@vikz95
Copy link
Author

vikz95 commented Oct 15, 2024

@manabu-nakamura I created a sample app with scrolling and tab change.
So feel free to download the repo and try to debug.

@vikz95 vikz95 reopened this Oct 15, 2024
@manabu-nakamura
Copy link
Contributor

1.13.0-alpha06 seems to cause this issue, but 1.13.0-SNAPSHOT doesn't seem to cause this issue (https://github.com/material-components/material-components-android/blob/master/docs/using-snapshot-version.md). Try it!

@vikz95
Copy link
Author

vikz95 commented Oct 15, 2024

I can confirm that 1.13.0-SNAPSHOT doesn't cause the issue in my sample app.

But even with the snapshot version the issue is still present in my production app.

For now we can close this issue, I have no idea how to reproduce it in the sample app.

@vikz95 vikz95 closed this as completed Oct 15, 2024
@manabu-nakamura
Copy link
Contributor

Enjoy debugging!

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

No branches or pull requests

3 participants