Sep 3 | 8:25 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Sep 3 | 8:30 AM |
Dominic | has entered the room |
Mark M. |
hello, Dominic!
|
Mark M. |
how can I help you today?
|
Dominic |
hey :)
|
Dominic |
To be honest I wrote questions but have to look for them in my notes
|
Dominic |
and I was wondering, what kind of phone do you use
|
Mark M. |
um, lots
|
Mark M. |
I have ~20 within arm's reach of where I am sitting
|
Dominic |
every single with different android version?
|
Dominic |
every single one*
|
Mark M. |
they pretty much are all Android 5.0 or higher, so there is definitely overlap of versions
|
Mark M. |
but, they are ones that I have picked up either for specific technical capabilities (e.g., in-screen fingerprint reader) or due to specific crashes that I needed to try to reproduce
|
Sep 3 | 8:35 AM |
marekdef | has entered the room |
Mark M. |
hello, marekdef!
|
marekdef |
hi Mark
|
marekdef |
and Dominic
|
Mark M. |
Dominic: are you still searching your notes?
|
Dominic |
got it
|
Dominic |
If SingleModelMotor was referring to some singleton instance of ToDoRepository
|
Dominic |
we would be out of luck
|
Dominic |
In elements of Elements of Android Jetpack Version
|
Dominic |
in testing chapter, what do you mean by that?
|
Dominic |
that out of luck
|
Mark M. |
ah
|
Mark M. |
first, in the context of that section, by "singleton instance", I am referring to something like a top-level Kotlin `object`
|
Dominic |
<listening>
|
Mark M. |
we do not control the instantiation of those -- they get created at some point by the language, perhaps when we first reference tehm
|
Mark M. |
er, them
|
Mark M. |
and, for most uses of our app, we want that object to work with the real database or real server or other real things
|
Mark M. |
in a test, though, we often want to control that more, so we can use a test database or test server or mocks or something
|
Mark M. |
but, with a language-instantiated singleton, we do not really have an opportunity to configure it that way
|
Mark M. |
we could expose some sort of API from the singleton to allow our test code to reconfigure it
|
Sep 3 | 8:40 AM |
Mark M. |
but that means we probably wind up with test-specific code shipping in our production app, as we may not have a good way of getting rid of that extra code
|
Mark M. |
dependency inversion allows us some of the benefits of singletons, yet gives us a hook to replace the implementation of the singleton in the context of our tests
|
Mark M. |
so most of our test code can test the singleton naturally, and our production code is not exposed to any of this testing stuff
|
Mark M. |
but test initialization code can say "hey, DI engine, use this ToDoRepository instance instead of the one you would ordinarily use"
|
Dominic |
thanks I think I more or less get it :)
|
Mark M. |
OK
|
Mark M. |
let me take a question from marekdef, and I will be back with you in a bit
|
Mark M. |
marekdef: hi! how can I help you today?
|
marekdef |
If your app needs to display a scrolling list of elements based on large data sets (or data that frequently changes), you should use RecyclerView as described on this page.
|
marekdef |
this is on the documentation of recycler view
|
marekdef |
but If I have a opposite usecase
|
marekdef |
I have small number of elements, rarely changing or never, and I want them to be displayed in scrollable container
|
marekdef |
I could place them in LinearLayout for example (and that LL is a part of bigger screen)
|
Mark M. |
yes, and wrap the LinearLayout in a ScrollView or NestedScrollView, to enable the scrolling
|
Sep 3 | 8:45 AM |
marekdef |
still I feel like I lack some kind of adapter that I just submit a list to it and is displayed
|
marekdef |
that is what recycler gives me
|
Mark M. |
you can still use RecyclerView if you want
|
marekdef |
well but it does not recycle :)
|
Mark M. |
well, that's not uncommon
|
Dominic |
thanks guys I think thats all I needed to know for now :) see you :)
|
Mark M. |
for example, you might not know how big the data set is at runtime
|
Mark M. |
(Dominic: have a pleasant day!)
|
marekdef |
bye :)
|
Mark M. |
so, you use a RecyclerView, but sometimes you are only showing a few items, because that's all the data that there is
|
Mark M. |
this is not a problem
|
Mark M. |
what you do not want to do is use the LinearLayout approach for large data sets, as that forces you to set up all of the views for all of the items up front
|
Mark M. |
so, RecyclerView can scale up and down for varying data set sizes; the LinearLayout approach is only suitable for small data sets
|
marekdef |
yes make sense
|
Mark M. |
personally, my general rule is: use RecyclerView for large or varying data set sizes; use a NestedScrollView mostly for cases where it's a fixed layout
|
marekdef |
ok noted
|
Sep 3 | 8:50 AM |
marekdef |
I could use RV there
|
marekdef |
if I set it to wrap_content then it should be scrollable within (Nested)ScrollView
|
Mark M. |
um, maybe -- I don't know how well RV handles wrap_content
|
marekdef |
I think it just displays full content
|
Mark M. |
we were talking about that a lot last chat :-)
|
marekdef |
(if is inside nested)
|
marekdef |
we have very similar screen in our app
|
marekdef |
is nested scroll view
|
marekdef |
it has some labels
|
marekdef |
and on the bottom there is RV with some images
|
marekdef |
(vertical)
|
Mark M. |
my tendency for something like that is to put it all in the RV, with different type types based on the content
|
Mark M. |
er, different item types
|
Mark M. |
(I can't type this morning...)
|
Mark M. |
I think that you're right, and there is a recipe for having an RV inside of a NestedScrollView
|
marekdef |
if I set the RV to some height then first scroll is on the content and to scroll on the RV you either need to scroll recycler to the middle of the screen (grabbing at content top) or you grab at bottom but then only part with Recycler scrolls
|
marekdef |
I think we should have use RV for full screen
|
marekdef |
but we did not
|
Sep 3 | 8:55 AM |
Mark M. |
agreed -- as a user, I might find that sort of scrolling behavior to be confusing
|
marekdef |
in theory is only view so should be replacable :)
|
marekdef |
if we set RV to wrap_content
|
marekdef |
then it shows all the content, but scroll is nice
|
marekdef |
unfortunately is not recycling :)
|
marekdef |
and it takes long time for 500+ images
|
Mark M. |
yeah, I am not surprised that there are problems with wrap_content for large data sets
|
Mark M. |
wrap_content with maxHeight *might* allow recycling to occur, but I'm not certain
|
sudokai | has entered the room |
marekdef |
yes it would work
|
sudokai |
Hi!
|
marekdef |
still you have the double scroll efect
|
marekdef |
so you scroll content, stop then recycler
|
Mark M. |
yes, which I do not like much
|
marekdef |
well me neither
|
Mark M. |
let me take a question from sudokai, and I will come back to you in a bit
|
Mark M. |
sudokai: hi! how can I help you today?
|
marekdef |
allright thanks for the answer!
|
sudokai |
Hi Mark
|
sudokai |
I was glancing through Android R's upcoming changeset
|
sudokai |
And it seems to me that there's a big location access restriction coming
|
sudokai |
If I read it right, foreground services will no longer get location updates when the app is in the background
|
Sep 3 | 9:00 AM |
Dominic | has left the room |
sudokai |
Unless the app requests the background location permission
|
sudokai |
I'm trying to find the page where this is explained, but this is how I understood it at least
|
Mark M. |
I guess I thought that had been a requirement already
|
sudokai |
Foreground services does get location updates when the app is the background in Android Q I believe
|
sudokai |
You only need the background location permission if you do not use a foreground service
|
Mark M. |
OK, and you have determined that this is not the case for Android 11?
|
sudokai |
I saw this in the changelog, somewhere
|
Mark M. |
the only changes that I know of related to location are those listed in https://developer.android.com/preview/privacy/l...
|
sudokai |
I'm trying to find it so you can take a look whether you understand the same
|
Mark M. |
ah!
|
Mark M. | |
sudokai |
That's it!
|
sudokai |
yes!
|
Mark M. |
so it depends on how the foreground service was started
|
Mark M. |
if you were in the foreground at the time, it looks like the same behavior as before
|
Mark M. |
if you start the service from the background, you would need ACCESS_BACKGROUND_LOCATION to have location access
|
sudokai |
Mmm, but even if you started the service in the foreground, it says that when your app is minimized, you don't get the location updates
|
sudokai |
If the user has granted the ACCESS_BACKGROUND_LOCATION permission to your app, the service can access location all the time. Otherwise, if the user has granted the ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permission to your app, the service has while-in-use access to location.
|
Sep 3 | 9:05 AM |
Mark M. |
my interpretation of "while-in-use" is "so long as your process is running", but that language is a bit confusing
|
sudokai |
Do you understand this the same way I do??
|
sudokai |
Yeah, the language is super confusing
|
sudokai |
But it's potentially a Breaking change with a capital B
|
sudokai |
If interpreted the way I interpreted it
|
Mark M. |
yeah, I'll make a point of trying some experiments when I work on *Elements of Android R* next
|
sudokai |
Okay thanks, I'll try to ping some Android Dev Advocate on Twitter for clarifications
|
sudokai |
That was my question thanks!
|
Dominic | has entered the room |
Mark M. |
the only additional material I see on this is https://issuetracker.google.com/issues/158814176
|
sudokai |
I'll let the rest of you guys ask questions
|
sudokai |
Thanks
|
Mark M. |
and that basically ends with the update to the documentation that we are grumbling about
|
Mark M. |
I'll file another issue to try to get that clarified
|
Mark M. |
I'll swing back to you later if there is time
|
Mark M. |
Dominic: you're back! :-) do you have another question?
|
Sep 3 | 9:10 AM |
Dominic |
Tbh I think I found a small typo in exploring android
|
Sep 3 | 9:10 AM |
Mark M. |
it wouldn't be the first typo! :-)
|
Dominic |
In chapter about instrumental tests, last part
|
Dominic |
it says "Add these two test functions to SingleModelMotorTest :"
|
Dominic |
it should be ToDoRepositoryTest
|
Dominic |
(I think)
|
Mark M. |
yes, I think you are correct
|
Mark M. |
I reordered these testing chapters in Version 1.3 and have had some bugs as a result
|
Mark M. |
no, wait
|
Mark M. |
oh, OK -- just to confirm, this is Step #5 of "Testing the Repository"?
|
Dominic |
yes
|
Mark M. |
OK, I have fixed it for the next update, and I will file an errata notice shortly
|
Mark M. |
if you want to claim this under the Book Bug Bounty program, send me an email to bounty@commonsware.com
|
Dominic |
thanks!
|
Dominic | has left the room |
Dominic | has entered the room |
Sep 3 | 9:15 AM |
Mark M. |
let me take questions from the others, and if there is time, I will come back to you
|
Mark M. |
marekdef: your turn! do you have another question?
|
marekdef |
I pass the token further
|
Mark M. |
OK -- sudokai: do you have another question?
|
marekdef |
I mean sudokai can ask the question
|
sudokai |
Not at this time Mark
|
Mark M. |
OK, if anyone has any questions, go ahead!
|
sudokai |
I'll try to clarify this issue I brought up earlier
|
sudokai |
Because we rely on location updates heavily
|
Dominic |
More like I have a suggestion
|
marekdef |
would you say that DataBinding is popular?
|
Mark M. |
marekdef: I don't know that I would go all the way to "popular", but it is used by a lot of developers
|
marekdef |
I just read on some blog: DB ... will eventually become obsolete. DataBinding is pretty much legacy today.
|
marekdef |
we used it quite a lot and think we want to use it even more :)
|
marekdef |
but maybe I am in the bubble
|
Mark M. |
well, data binding is tied to layout resources
|
Mark M. |
Jetpack Compose is the long-term UI direction for Android, and it does not use layout resources
|
Mark M. |
(though you can integrate Compose UI with layout resources if needed, as part of migrating to Compose)
|
Sep 3 | 9:20 AM |
Mark M. |
for a project that has not started using data binding, I would recommend not investing in data binding
|
Mark M. |
for a project that already has it, it may be better to keep using it, to keep the implementation of your UI consistent
|
sudokai |
Will you write a book on Jetpack Compose Mark?
|
Mark M. |
(BTW, sudokai: I just filed https://issuetracker.google.com/issues/167581940 for clarity on "while-in-use")
|
sudokai |
I dislike this technology change for the sake of it
|
sudokai |
Thanks I'll star it lol
|
Mark M. |
sudokai: I have plans for a book on Jetpack Compose
|
sudokai |
Suddenly, RxJava is not cool anymore, now it's all Flow and coroutines. LiveData is not cool, something something StateFlow.
|
sudokai |
This mindset is toxic imo
|
Mark M. |
it is definitely a challenge to keep up at times
|
Dominic |
the stuff in android seems to be changing very fast
|
Mark M. |
however, you are conflating two separate things IMHO
|
Mark M. |
there is the fact that coroutines, Flow, and StateFlow were introduced
|
Mark M. |
and there is the fact that "thought leaders" are endorsing them
|
Mark M. |
it's tough to blame JetBrains for developing coroutines, Flow, and StateFlow -- those are Kotlin things, not Android things
|
Sep 3 | 9:25 AM |
Mark M. |
and Kotlin has uses beyond Android
|
Mark M. |
in isolation, it is tough for me to blame the thought leaders for recommending newer alternatives, as they do solve problems from their predecessors (e.g., RxJava learning curve)
|
sudokai |
Yeah, the problem is with the "thought leaders" definitely
|
Mark M. |
however, I do think that we as an ecosystem need to be doing a better job of building bridges from old approaches to new ones
|
Mark M. |
rather than just bouncing from one to the next to the next
|
Mark M. |
that's one of the reasons why, for example, I still cover Java in *Elements of Android Jetpack*
|
sudokai |
Yeah, our app is still 75% Java
|
Mark M. |
partly, it's for those who are new to Kotlin, and partly, it forces me to discuss non-Kotlin solutions
|
Dominic |
may I ask, if I were to create new project
|
Sep 3 | 9:30 AM |
Dominic |
should I use data binding? or stuff like kotlin synthetic?
|
Mark M. |
I would not invest in data binding, but I do prefer view binding over Kotlin synthetic accessors
|
Mark M. |
fortunately, view binding only requires a line in Gradle to set up and no layout changes
|
Dominic |
Also, Mark have you considered doing udemy course?
|
Mark M. |
it's an extra line or so at most to set up the binding when inflating the layout in code
|
Mark M. |
do you mean teaching one?
|
Dominic |
yes exactly
|
Dominic |
To be honest, I did an udemy course before
|
Dominic |
by Tim Butchalka and it was OK
|
Dominic |
but it lacked the "ecosystem"
|
Dominic |
I think that your books create whole ecosystem of android learning
|
Dominic |
you have everything covered in your resources referencing one another
|
Mark M. |
I can't rule out Udemy, but if I were to do video-based training, I would be more likely to do something part of the Warescription program, for the reasons that you cite
|
Mark M. |
right now, I'm just trying to make it through 2020 :-)
|
sudokai |
There's a huge "hole" in Android video training
|
Dominic |
exactly
|
sudokai |
Like, web dev is well covered
|
sudokai |
And even Swift for iOS
|
Dominic |
there is project odin for web dev
|
sudokai |
But Android video courses are very lacking atm
|
Dominic |
so true
|
Mark M. |
sorry, but I need to wrap up today's chat
|
Dominic |
I think that is a great niche
|
Dominic |
Thank you!
|
sudokai |
Okay thank Mark!
|
Dominic |
for answering have a nice day
|
Dominic |
good bye people!
|
Mark M. |
the next chat is Saturday at 4pm US Eastern
|
Dominic |
have a nice day
|
Mark M. |
have a pleasant day, all!
|
sudokai |
You too
|
Sep 3 | 9:35 AM |
Dominic | has left the room |
marekdef | has left the room |
sudokai | has left the room |
Mark M. | turned off guest access |