Office Hours — Today, February 24

Yesterday, February 23

Feb 24
3:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:10 PM
Drasko
has entered the room
Mark M.
hello, Drasko
how can I help you today?
Drasko
Hi, Mark!
Well, I have this CardView (http://pastebin.com/83sSXacu)
And everything is nice when I click on it on Lollipop phones
But doesn't look good on pre-L phones.
Mark M.
why is your foreground set to what it is?
Drasko
It shows out-of-the-box ripple effect.
Mark M.
but android:attr/selectableItemBackground is a background drawable
4:15 PM
Mark M.
regardless, what is the specific problem on pre-L phones?
Drasko
well, it just color the whole area of cardview.
with transparent blue.
Mark M.
have you tried removing the android:foreground attribute?
Drasko
yes
Mark M.
I haven't used android:attr/selectableItemBackground directly on a CardView yet
Drasko
but with that I loose ripple effect.
Mark M.
I figured it would interfere with the backport's fake elevation drop shadow
the ripple effect comes from the background, not the foregroung
er, foreground
that link is to one of my RecyclerView examples from the next book update
I wrapped my row LinearLayout in a CardView
I put android:background="?android:attr/selectableItemBackground" on the LinearLayout
seems to work fine with the ripple effect on 5.0 and standard blue on pre-5.0
Drasko
hm, interesting.
great, I'll try that.
4:20 PM
Drasko
it works, thanks! can you tell me which attribute on my custom style should I set to change that blue color to other color?
Mark M.
off the top of my head, I forget
Drasko
ok. :)
Mark M.
generate something there, asking for a custom list selector, and peek at what it gives you
Drasko
yes, I figured it out, just by looking at it.
4:25 PM
Mark M.
if you have any other questions, go right ahead -- it's a slow chat day :-)
Drasko
yes, I can see that.
4:30 PM
Drasko
I see that there is a hype around RxJava. did you try it?
Mark M.
I read the initial documentation that the guy from Netflix wrote with the original release
I found it to be incredibly difficult to follow
and I haven't quite figured out what it solves that an event bus does not solve
Drasko
Yes, documenat
Yes, documentation is very confusing.
Mark M.
I'm not saying that RxJava is bad, but it failed to impress me, and I didn't have a compelling reason to try to wrestle my way through it
Drasko
well, I stumbled today on some very fresh blog post about it and it was very easy to follow. Actually it is the first one that I understood easily from the beginning to the end.
Previous ones really confused me.
4:35 PM
Mark M.
do you have a link to it?
Drasko
this one doesn't cover network stuff, but explains concept. Give me a sec to find it.
4:40 PM
Drasko
if I set colors in my custom theme, for example android:windowBackground, does app do overdraw of that color, like paint it first with phone default and then with the given one in this item?
Mark M.
AFAIK, it shouldn't
Drasko
basically, can i reduce overdraw by setting new "default" values in my custom theme and style?
Mark M.
well, "reduce" implies that you already have overdraw
setting colors in a style/theme can reduce overdraw only if you can then get rid of something else that was contributing to the overdraw
4:45 PM
Drasko
i understood, that if i set some attribute, i.e. textColor in my layout, that I will have overdraw, since the default value would be painted and after that that same text would be repainted with color i set in layout. or did i missunderstand that?
Mark M.
I am not aware that this is the case
Drasko
ok.
Mark M.
then again, I haven't looked at overdraw in a while
Drasko
but if i set color in layout, and after that i change it in the java code, overdraw occurs, right?
Mark M.
it shouldn't
there is no real difference between android:textColor and the Java equivalent
and if android:textColor triggers overdraw, that's a framework problem far more than it is an app developer problem
Drasko
no, i mean, if i change it as a result of some action.
Mark M.
if setTextColor() triggers overdraw, that's a framework problem far more than it is an app developer problem
Drasko
i am new to overdraw problem, that's why i maybe ask some not very inteligent questions. :)
Mark M.
TextView should be determining its color based on android:textColor/setTextColor(), falling back to the style/theme if a specific color was not set on the TextView instance
and it should be drawing the text once
Drasko
ok, thanks!
4:50 PM
Mark M.
I would use the tools available to help you identify overdraw, and worry about the hot spots
the overdraw tinting that you can get just with Developer Mode is really handy
Drasko
yes, i use that.
thank you very much, today i don't have any questions.
Mark M.
OK
Drasko
have a good day!
Mark M.
you too!
5:00 PM
Mark M.
that's a wrap for today's chat
the transcript will be posted to http://commonsware.com/office-hours/ shortly
the next chat is Thursday at 7:30pm US Eastern
have a pleasant day!
Drasko
bye!
Drasko
has left the room
Mark M.
turned off guest access

Yesterday, February 23

 

Office Hours

People in this transcript

  • Drasko
  • Mark Murphy