armcha / Space-Navigation-View

Space Navigation is a library allowing easily integrate fully customizable Google Spaces like navigation to your app.
1.99k stars 378 forks source link

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

Open tamimattafi opened 5 years ago

tamimattafi commented 5 years ago

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 commented 5 years ago

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

Hillman95 commented 5 years ago

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 commented 4 years ago

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.