Office Hours — Today, April 25

Thursday, April 23

Apr 25
3:50 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:00 PM
Kai H.
has entered the room
4:05 PM
Mark M.
hello, Kai!
Kai H.
Hello there
Mark M.
how can I help you today?
Kai H.
I have no question right now
Mark M.
ah, OK
if you come up with a question, ask away!
Kai H.
Sure :)
4:15 PM
sudokai
has entered the room
Kai H.
:D
sudokai
Hi :)
Mark M.
hello, sudokai!
Kai H.
Hi
Mark M.
sudokai: how can I help you today?
sudokai
Hi Mark, do you know how often do Android phones check for app updates?
I swear I saw it's every 12h, but I can't find the source
Mark M.
I have no idea, sorry
and it would not surprise me if it varies by manufacturer
sudokai
I'm referring to Google Play Store updates
Mark M.
oh, wait, sorry, I misread your question
I don't know much about the mechanics of that
it's entirely possible that it is more of a push, rather than a poll
Google knows what apps you have installed, after all
sudokai
When I was looking into Play Store staged rollouts, I swear I saw this 12h interval somewhere, but I can't find it.
Mark M.
so, they could use the same engine that powers Firebase Cloud Messaging to tell the device that an update is available
my clients handle their own Play Store distribution, and I haven't shipped something of my own on the Play Store in years
4:20 PM
Mark M.
so I don't have much hands-on experience with that aspect of the overall process -- sorry!
4:20 PM
sudokai
It's alright, thanks anyway!
4:25 PM
Mark M.
if either of you come up with a question, go right ahead!
4:30 PM
sudokai
Not a question, but I had a lot of trouble subscribing to your Jetpack Compose newsletter
Mark M.
what sort of trouble?
I know of at least one person who was having difficulty getting getrevue.co to load
4:35 PM
sudokai
Toubles with the iframe
Mark M.
meaning that the content would not load in the iframe?
sudokai
So I went to https://jetc.dev/ and when I entered my email and clicked submit, the iframe gave some sort of security error
"Refused to display 'https://www.getrevue.co/profile/jetc' in a frame because it set 'X-Frame-Options' to 'sameorigin'."
Oh wow, the url is being stripped by the chat
Mark M.
they must have changed their site settings and don't support iframe
crap
sudokai
Between the single quotes in the error above, it's 'https www.getrevue.co/profile/jetc'
Mark M.
yeah, I can reproduce it here
this used to work
I'll work on coming up with some other solution tomorrow
thanks for mentioning it!
sudokai
I do have another question, now I remember it!
4:40 PM
sudokai
Do you recommend using ConstraintLayout everywhere or is there some situation where another layout would be more performant?
Mark M.
for trivial stuff (e.g., where you just need a background and some padding), I'd use FrameLayout
I tend to use ConstraintLayout for pretty much everything else
I do not know if any scenarios where ConstraintLayout is slower than, say, a bunch of nested LinearLayouts
(sorry, that should have been "know of any scenarios")
sudokai
I mean, common sense makes me think that ConstraintLayouts may not be that performant as they claim it to be. It has to perform many calculations.
Mark M.
you'
you're assuming the others don't, though
a bunch of nested LinearLayouts will require many calculations as well, just spread over N containers
sudokai
Yeah, but as you said, nesting ConstraintLayouts might be bad right?
Mark M.
I'd avoid it unless you have a concrete need for it
if your design requires it, then you don't really have a lot of choice
and that's not strictly a ConstraintLayout-holding-ConstraintLayout problem
sudokai
So you would only use the ConstraintLayout for the outer container
?
Mark M.
I'd use what I need to use :-)
sudokai
:)
4:45 PM
Mark M.
the only reason I can think of off the top of my head to need to nest a container in a ConstraintLayout is because the container itself has visible properties, such as a background
if the nested container itself has no such properties, you should be able to avoid nesting containers, relying just on ConstraintLayout rules plus virtual helpers (e.g., Barrier)
if the nested container does have visible properties, and it only needs one child, use a FrameLayout as the nested container
sudokai
Well, I have a small component that's a custom view
That uses ConstraintLayout
Mark M.
presumably, it has more than one child view
sudokai
Then this custom view is inserted dozens of times in a fragment
That uses ConstraintLayout
Mark M.
dozens?
do you have screen space for dozens?
sudokai
View paste
So I have:

ConstraintLayout
- ConstraintLayout
- CountraintLayout
- ...
Mark M.
that's not strictly a problem
after all, we use ConstraintLayout for rows in a RecyclerView all the time
sudokai
Well, dozens in plural might be an overstatement, but 1 dozen yes
Okay thanks
Mark M.
and usually performance, from a layout standpoint, is only an issue in scrolling
4:50 PM
Mark M.
so, items in a RecyclerView need to render cheaply, so when the user scrolls the list/grid/whatever, it scrolls smooothly
sudokai
Coming from the web world, I find the Android tooling for this stuff lacking tbh
Mark M.
what is "this stuff", specifically?
sudokai
This UI stuff
Mark M.
um, that wasn't very specific :-)
sudokai
I mean, for a website, scrolling is not a problem unless you do something horribly wrong
Mark M.
sure it is
you paid the price when you loaded the page, though, more than likely
sudokai
You don't need to do this fancy recycling stuff unless you need to be Google Photos
Btw, on the topic of UI, do you know of any good resources on building custom UI components for Android? Could be a link, articles, books, etc.? Anything.
4:55 PM
Mark M.
there's a chapter on it in *The Busy Coder's Guide to Android Development*
I don't have any links handy for anything else
on the whole, creating custom views isn't that common
sudokai
Thanks. It's because I think I have a big knowledge gap to cover.
Mark M.
it's a bit old, and isn't as in-depth as it could be, but it's all I have
sudokai
I'm able to put premade stuff together, like Material Components
Mark M.
and that's what the vast majority of developers do
roughly speaking, there are two main scenarios for doing something other than that:
sudokai
But then I go to Play Store and I see apps with beautiful, custom UI
Mark M.
1. you want to reuse the custom view across multiple projects, including things like releasing it as open source, which is all fine
2. you are trying to make domain-specific custom views (e.g., a RestaurantView), which isn't really how Android development usually works
"beautiful, custom UI" does not necessarily mean custom views, though it could
5:00 PM
sudokai
Okay, thanks I'll read your chapter
Mark M.
a lot can be accomplished with the stock views, coupled with styles, themes, drawables, etc.
sudokai
Maybe it's my lack of experience, but I find web styling much more straightforward
Just throw some CSS on top of your HTML
You can do anything easily
Mark M.
Android styles and themes have a lot in common with CSS, but they were not well-documented in the early years
even today, it's lacking
anyway, that's a wrap for today's chat
the next chat is Tuesday at 7:30pm US Eastern
sudokai
Thank you!
Mark M.
have a pleasant day, and stay healthy!
sudokai
You too!
Kai H.
has left the room
sudokai
has left the room
Mark M.
turned off guest access

Thursday, April 23

 

Office Hours

People in this transcript

  • Kai Hatje
  • Mark Murphy
  • sudokai