Office Hours — Today, May 2

Thursday, April 30

Mark M.
has entered the room
Mark M.
turned on guest access
May 2
4:15 PM
Kai H.
has entered the room
Kai H.
Hello
Mark M.
hello, Kai!
how can I help you today?
Kai H.
I was wondering if there is a premade solution for "editable TextViews", TextViews whose text the user can select and that turn into an EditText, preferably with some "save/cancel" type of buttons.
Mark M.
it's possible that the Android Arsenal has a library for that
Kai H.
By premade I mean preferably by google :)
Mark M.
I am not aware of a Google-endorsed option
Kai H.
Do you use anything like I described in any product?
Mark M.
no, sorry
I have seen the question pop up from time to time in Stack Overflow
Kai H.
So it's not a much used thing in the Android world?
4:20 PM
Mark M.
I don't see many apps going that route
and, it's not hard to implement, if you wanted it
Kai H.
Do you have an idea why few apps go that route?
It seems quite useful to edit in place
Instead of opening a dialog or a new view just for some simple text.
Mark M.
to me, the bigger question is: when are you actually committing the change, and to what scope?
few things are *just* a piece of text, after all
Kai H.
I don't really get the question
Mark M.
so, if you have a screen with various bits of text, and they all have pencil icons to allow you to edit them, when do you save the changes? as each one gets submitted? when the user exits the screen? sometime else?
Kai H.
I think the pencil icon would turn into two icons, save and cancel
And only one of the bits of text can be editable at a time
And each one gets submitted when it's saved or canceled.
But how do you control the "only one is editable at a time" state?
4:25 PM
Kai H.
And what if the user edits some text, then doesn't save it and exits the screen?
Mark M.
presumably, your hosting activity/fragment is keeping track of what is editable
so, in terms of "only one is editable at a time", if there is an already-editable item when the user goes to edit another one, the activity/fragment could cancel the original item
Kai H.
That seems like a lot of state that needs to be held :D
Mark M.
well, it's your proposed UX -- don't shoot the messenger :-)
in terms of "then doesn't save it and exits the screen", typically if you have a positive "submit" option, then exit implies "cancel"
Kai H.
I am just thinking loud
Btw, do you use material design a lot?
Mark M.
well, that depends on what you mean
Kai H.
It seems to have textfields with some edit functionality, even though not exactly as I wanted: https://material.io/develop/android/components/...
Mark M.
the stock widgets in Android use Material Design "out of the box"
OK, you are referring to Material Components for Android
Kai H.
I don#t really get the difference.
Mark M.
Material Design is the "design language" describing what a UI could look like
4:30 PM
Mark M.
it is independent of any particular platform
Google, for example, uses it for Web and Android
Material Components for Android is a specific library that implements part of the Material Design specification, particularly for things "over and above" what Theme.Material offers in Android itself
Kai H.
So why is there "material design components" when it's already applied to the stock widgets in Android?
Mark M.
because Android only bothers with a small subset of Material Design elements
Kai H.
You answered before I questionered ;)
Mark M.
for example, Material Design has a "snackbar" UI element
Android does not have that, but Material Components for Android does
on the whole, particularly for UI stuff, Google is getting away from having much of that in the framework and is more delegating it to libraries
why Material Components for Android is separate from the Jetpack stuff is a mystery to me
Kai H.
I was about to ask that :D
Mark M.
Material Components for Android is based on Android's classic view-based UI system
Kai H.
It's a bit of a shame that Android is so fragmented; that there (have to be|are) so many libraries and so many ways to do something.
Mark M.
well, some of that is simply a mix of age plus rapid development
the UIs from Android 1.0 look, um, crappy :-)
Kai H.
I remember X)
Mark M.
as phones got more powerful, particularly in terms of GPUs, and we as an industry learned more, we built better options
but, backwards compatibility is a pretty big deal
4:35 PM
Mark M.
and that's why you wind up with all this layered stuff (framework -> AppCompat -> Material Components for Android)
that's also why Google is trying to replace the view-and-fragment UI system with Jetpack Compose, so we can jettison a lot of this historical baggage
Kai H.
Will Jetpack Compose dispose of View and Fragment?
Mark M.
mostly, yes
Kai H.
I can't even imagine :D
Mark M.
fragments may stick around for a bit, while we work out how best to route from screen to screen in a Compose-centric app
Kai H.
That is actually the other question I had for today: I know some ppl avoid fragments like the plague. Why is that?
Mark M.
well, in the early days, fragments were kinda buggy
and, since the focus was on using the framework implementation of fragments on Android 3.0+ devices, you couldn't get away from those bugs
that improved over time, of course
and now, the framework fragments are deprecated, with the library implementation being the official one
but, all those blog posts from the earlier days are still out there
so, while fragments now are about as stable as they're going to get (and are fairly decent overall), some will avoid them because of the earlier problems
Kai H.
I didn't even know that Fragments are in a library of their own (now)
4:40 PM
Kai H.
And wonder which version we use in our app.
Mark M.
if the import is android.app.Fragment, that is the framework edition
if it is something else, in the androidx or android.support packages, then it is coming from a library
Kai H.
I see
It's funny how you alternate between "Android programming is fun!" and "Android programming is contrived and hard" in your books btw ;-)
Mark M.
yeah, well, "contrived and hard" frequently is the outcome of a long series of decisions that left us in a weird place
4:45 PM
Kai H.
But it's being worked on to get some of that out of the way
Even though we might end up with components called "ViewPager2" ;-)
Mark M.
in some cases, yes, such as Jetpack Compose
in other cases, such as the whole "scoped storage" mess, will remain a mess
Kai H.
There's no news on that?
Mark M.
news on what?
Kai H.
scoped storage
Mark M.
well, Android R is shuffling the deck again, somewhat
4:50 PM
Mark M.
in a nutshell, READ_EXTERNAL_STORAGE works again
(at least, mostly)
so for some apps, they are going to need to deal with messy stuff just for Android 10 -- code that worked for Android 9 might work on Android 11
Kai H.
Grrr
That can be quite frustrating.
Mark M.
so, some things improve with time, and some... just get weird
Kai H.
Luckily we have ppl working out how stuff works, like you, and write blog posts about it.
Mark M.
yes, and there are a lot more such people now than in the early days, which helps
which means we're about due for a major problem, like Medium going out of business, or a pandemic, or...
:-)
Kai H.
Murphys law? ;-)
Mark M.
story of my life
4:55 PM
Kai H.
How many ppl work on Android?
You once mentioned that the Android team is smaller than one would think
(And I also wonder why that is the case. It's not like google doesn't have money).
Mark M.
it's probably bigger now then when I last made that statement :-)
Kai H.
I think that was three weeks ago
Mark M.
OK, I don't remember making that comment that recently, though I have definitely said it a few times over the years
and it also depends a bit on how you want to define "work on Android"
so, for example, a lot of the people that we see are in developer relations
how much they contribute to core Android stuff varies by engineer
conversely, a lot of the engineers we rarely see, because they don't deliver Google I|O talks and stuff
but, in the early years, it was a pretty small team
Kai H.
Ok
Mark M.
as in "could probably fit in a good-sized conference room" sort of small
5:00 PM
Kai H.
How big is it nowadays?
Mark M.
I have no way of offering a number
but my guess is over a 100 now
Kai H.
That doesn't seem like a lot
For such a big and widely used system.
Mark M.
partly, it's where you draw the lines, and partly, it's because some stuff is not done by Google
there are device manufacturers, and JetBrains, and just ordinary developers who pitch in on AOSP, and...
Kai H.
Ok
I didn't know Jetbrains is actively working on Android too
Mark M.
well, they work fairly closely with Google on Kotlin with respect to Android
plus, Android Studio is built on top of IntelliJ IDEA
Kai H.
Well sure, if you take that aspect
I was thinking about Android as a Framework. But yea
Mark M.
and that's part of the problem: where do you draw the lines?
for example, I suspect that there is a team that is purely focused on working with major hardware vendors, from Qualcomm to Samsung and so on
leastways, I assume there has to be such a team
but, they aren't working on framework classes, though they might be contributing some to the lower-level OS stuff
Kai H.
Huh
5:05 PM
Mark M.
and I haven't the foggiest notion whether that team is 50 people, 5, or one person working part time
(though probably not that latter one)
Kai H.
I hope not :D
So much we don't know
Thanks for your insights
Mark M.
sure!
and, that's a wrap for today's chat
next one is Tuesday at 8:30am US Eastern
Kai H.
Stay health and have a good time
Mark M.
you too!
Kai H.
thx
Kai H.
has left the room
Mark M.
turned off guest access

Thursday, April 30

 

Office Hours

People in this transcript

  • Kai Hatje
  • Mark Murphy