akshay2211 / BubbleTabBar

BubbleTabBar is a bottom navigation bar with customizable bubble-like tabs

Home Page:https://github.com/akshay2211/BubbleTabBar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bubble tab stutters

dighechinmay opened this issue · comments

Hi,

I am trying to load BubbleTabBar in my activity. But because there was slow loading I set offScreenPageLimit to 1 (default). I have checked network calls in my app prior to setting offscreenpagelimit to my viewpager.

Everything loads properly but when I try to switch between the tabs, it stutters. The transition isn't smooth. Noticing a lag.

Can you help?

Hey @dighechinmay
can you provide a video or share code so this can be replicated?

Hi akshay2211,

In my activity, I am displaying 3 fragments.

viewPager.adapter = SectionViewPagerAdapter(supportFragmentManager)
        viewPager.setDurationScroll(1000)
        viewPager.offscreenPageLimit = 1
        viewPager.setPagingEnabled(false)

        bubbleTabBar.addBubbleListener(object : OnBubbleClickListener {
            override fun onBubbleClick(id: Int) {
                when (id) {
                    R.id.home -> viewPager.currentItem = 0
                    R.id.log -> viewPager.currentItem = 1
                    R.id.setting -> viewPager.currentItem = 2
                }
            }
        })
        bubbleTabBar.setupBubbleTabBar(viewPager)

when I try to change the tabs, there is roughly 1 sec delay. it works okay when offscreenPageLimit is set to 3 but then the initial loading of the activity is very slow.
I have removed all the network calls from each of the fragment. still it loads slow.

you can refer the sample app
I guess you are doing too much work on your main thread.
try using the library in any new test project, if it works fine, then maybe you are doing something else that is causing the stutter.