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

setCentreButtonColor() does nothing and changeCenterButtonIcon() resets icon filter to black #96

Open
tamimattafi opened this issue Jun 20, 2019 · 3 comments

Comments

@tamimattafi
Copy link

tamimattafi commented Jun 20, 2019

Hello again! I'm implementing a logic to change the center button's appearance for each fragment from viewPage, the icons change but unfortunately their tint resets to black, setActiveCentreButtonIconColor() and setInActiveCentreButtonIconColor() make no changes.
changeCenterButtonIcon() doesn't work as well.
I hard-coded my svg icons to be white but still, they become black on icon change. setCentreButtonIconColorFilterEnabled() does nothing.

private fun setUpCenterButton(position: Int) {
    with(mainNavigation) {
        when (position) {
            1 -> {
                changeCenterButtonIcon(R.drawable.ic_filter)
                setCentreButtonColor(AppUtils.getColor(this@MainActivity, R.color.colorGrayDark))
            }
            2 -> {
                changeCenterButtonIcon(R.drawable.ic_share)
                setCentreButtonColor(AppUtils.getColor(this@MainActivity, R.color.colorBlue))
            }
            3 -> {
                changeCenterButtonIcon(R.drawable.ic_add_to_cart)
                setCentreButtonColor(AppUtils.getColor(this@MainActivity, R.color.colorLightRed))
            }
            else -> {
                changeCenterButtonIcon(R.drawable.ic_message)
                setCentreButtonColor(AppUtils.getColor(this@MainActivity, R.color.colorAccent))
            }

        }
    }
}

are there any solutions? #FF000000 black looks really ugly.

@Hillman95
Copy link

I have the same bug with setActiveCentreButtonIconColor() and setInActiveCentreButtonIconColor(), do you found solution for this?

@Hillman95
Copy link

Hello again! I'm implementing a logic to change the center button's appearance for each fragment from viewPage, the icons change but unfortunately their tint resets to black, setActiveCentreButtonIconColor() and setInActiveCentreButtonIconColor() make no changes.
changeCenterButtonIcon() doesn't work as well.
I hard-coded my svg icons to be white but still, they become black on icon change. setCentreButtonIconColorFilterEnabled() does nothing.

private fun setUpCenterButton(position: Int) {
    with(mainNavigation) {
        when (position) {
            1 -> {
                changeCenterButtonIcon(R.drawable.ic_filter)
                setCentreButtonColor(AppUtils.getColor(this@MainActivity, R.color.colorGrayDark))
            }
            2 -> {
                changeCenterButtonIcon(R.drawable.ic_share)
                setCentreButtonColor(AppUtils.getColor(this@MainActivity, R.color.colorBlue))
            }
            3 -> {
                changeCenterButtonIcon(R.drawable.ic_add_to_cart)
                setCentreButtonColor(AppUtils.getColor(this@MainActivity, R.color.colorLightRed))
            }
            else -> {
                changeCenterButtonIcon(R.drawable.ic_message)
                setCentreButtonColor(AppUtils.getColor(this@MainActivity, R.color.colorAccent))
            }

        }
    }
}

are there any solutions? #FF000000 black looks really ugly.

I have not called spaceNavigationView.setCentreButtonSelectable(true) , after i call this in activity onCreate my problem is gone, try this ,maybe your problem in this

@creekorful
Copy link

I have just started to use the library, same use-case I wanna change the center dynamically but it does work only when changed during the onCreate phase. I does not work after that.

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

No branches or pull requests

3 participants