Skip to content

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

Closed
@vikz95

Description

@vikz95

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions