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!
|
Mark M. |
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
|
Mark M. |
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?
|
May 2 | 4:20 PM |
Mark M. |
I don't see many apps going that route
|
Mark M. |
and, it's not hard to implement, if you wanted it
|
Kai H. |
Do you have an idea why few apps go that route?
|
Kai H. |
It seems quite useful to edit in place
|
Kai H. |
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?
|
Mark M. |
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
|
Kai H. |
And only one of the bits of text can be editable at a time
|
Kai H. |
And each one gets submitted when it's saved or canceled.
|
Kai H. |
But how do you control the "only one is editable at a time" state?
|
May 2 | 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
|
Mark M. |
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 :-)
|
Mark M. |
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
|
Kai H. |
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"
|
Mark M. |
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
|
May 2 | 4:30 PM |
Mark M. |
it is independent of any particular platform
|
Mark M. |
Google, for example, uses it for Web and Android
|
Mark M. |
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
|
Mark M. |
Android does not have that, but Material Components for Android does
|
Mark M. |
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
|
Mark M. |
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
|
Mark M. |
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
|
Mark M. |
but, backwards compatibility is a pretty big deal
|
May 2 | 4:35 PM |
Mark M. |
and that's why you wind up with all this layered stuff (framework -> AppCompat -> Material Components for Android)
|
Mark M. |
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
|
Mark M. |
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
|
Mark M. |
that improved over time, of course
|
Mark M. |
and now, the framework fragments are deprecated, with the library implementation being the official one
|
Mark M. |
but, all those blog posts from the earlier days are still out there
|
Mark M. |
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)
|
May 2 | 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
|
Mark M. |
if it is something else, in the androidx or android.support packages, then it is coming from a library
|
Kai H. |
I see
|
Kai H. |
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
|
May 2 | 4:45 PM |
Kai H. |
But it's being worked on to get some of that out of the way
|
Kai H. |
Even though we might end up with components called "ViewPager2" ;-)
|
Mark M. |
in some cases, yes, such as Jetpack Compose
|
Mark M. |
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
|
Mark M. | |
May 2 | 4:50 PM |
Mark M. |
in a nutshell, READ_EXTERNAL_STORAGE works again
|
Mark M. |
(at least, mostly)
|
Mark M. |
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
|
Kai H. |
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
|
Mark M. |
which means we're about due for a major problem, like Medium going out of business, or a pandemic, or...
|
Mark M. |
:-)
|
Kai H. |
Murphys law? ;-)
|
Mark M. |
story of my life
|
May 2 | 4:55 PM |
Kai H. |
How many ppl work on Android?
|
Kai H. |
You once mentioned that the Android team is smaller than one would think
|
Kai H. |
(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
|
Mark M. |
and it also depends a bit on how you want to define "work on Android"
|
Mark M. |
so, for example, a lot of the people that we see are in developer relations
|
Mark M. |
how much they contribute to core Android stuff varies by engineer
|
Mark M. |
conversely, a lot of the engineers we rarely see, because they don't deliver Google I|O talks and stuff
|
Mark M. |
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
|
May 2 | 5:00 PM |
Kai H. |
How big is it nowadays?
|
Mark M. |
I have no way of offering a number
|
Mark M. |
but my guess is over a 100 now
|
Kai H. |
That doesn't seem like a lot
|
Kai H. |
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
|
Mark M. |
there are device manufacturers, and JetBrains, and just ordinary developers who pitch in on AOSP, and...
|
Kai H. |
Ok
|
Kai H. |
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
|
Mark M. |
plus, Android Studio is built on top of IntelliJ IDEA
|
Kai H. |
Well sure, if you take that aspect
|
Kai H. |
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?
|
Mark M. |
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
|
Mark M. |
leastways, I assume there has to be such a team
|
Mark M. |
but, they aren't working on framework classes, though they might be contributing some to the lower-level OS stuff
|
Kai H. |
Huh
|
May 2 | 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
|
Mark M. |
(though probably not that latter one)
|
Kai H. |
I hope not :D
|
Kai H. |
So much we don't know
|
Kai H. |
Thanks for your insights
|
Mark M. |
sure!
|
Mark M. |
and, that's a wrap for today's chat
|
Mark M. |
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 |