Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

TitleTextColor not correctly set #9

Open
codeversed opened this issue May 17, 2016 · 4 comments
Open

TitleTextColor not correctly set #9

codeversed opened this issue May 17, 2016 · 4 comments

Comments

@codeversed
Copy link

setCollapsedTitleTextColor and setExpandedTitleColor seems to not show the title with alpha. I tested the original CollapsingToolbarLayout and it works as expected.

It seems to jump to white/black or the closest opaque color. I plan on digging deeper into this tomorrow.

@johan12345
Copy link
Contributor

johan12345 commented May 17, 2016

Hi Steve,

thanks for the bug report. The reason for that is that we use TextPaint.setAlpha(int) in multiple places, which overrides the alpha value of the original collapsed/expandedTitleTextColor, but that should be quite easy to fix by multiplying the original alpha value to the value that is set there. The place you would need to look at is https://github.com/opacapp/multiline-collapsingtoolbar/blob/master/multiline-collapsingtoolbar/src/main/java/net/opacapp/multilinecollapsingtoolbar/CollapsingTextHelper.java#L487. The first part of the if-clause applies on Android 4.2 and below (which does not support hardware-accelerated text drawing, which means the text is saved as a texture instead) and the else part is for Android 4.3 and later, so probably both parts need to be adjusted.

If you need help, you can just ask here or via email at info@opacapp.de.

Please note that all modifications I made to the original Support Library code are marked with comments to simplify updating the code with later changes in the Support Library. So if you do adjustments, these should of course also be marked if they aren't already.

@codeversed
Copy link
Author

Thanks @johan12345!

I have not had a chance to do any testing on this but plan on in soon. I see the reason it is setup like that for the blending but will just need to test a bit.

It may be as easy as just extracting the alpha out of the textColors but I would imagine that will break or cause other things to go wrong.

I also took notice here (could be related to this issue): https://github.com/opacapp/multiline-collapsingtoolbar/blob/master/multiline-collapsingtoolbar/src/main/java/net/opacapp/multilinecollapsingtoolbar/CollapsingTextHelper.java#L336
...that setCollapsedTextBlend and setExpandedTextBlend are not in the if statement below.

Again thanks, and I will keep you updated on any progress.

@webserveis
Copy link

Yes I same poblem

<style name="TextAppearance.ExpandedTitle"
    parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
    <item name="android:textSize">26sp</item>
    <item name="android:textColor">@android:color/transparent</item>
</style>

Show title in black color when expanded, transparent = #00000000

@johan12345
Copy link
Contributor

@webserveis As written in the README, we can't spend much time to fix problems that don't occur in our app (we don't use transparent text there). I don't know if @codeversed is still working on fixing this, but if you want, you are welcome to try it too and send a Pull Request. I explained what needs to be adjusted in my post above.

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

No branches or pull requests

3 participants