Office Hours — Today, August 22

Tuesday, August 20

Aug 22
7:20 PM
Mark M.
has entered the room
Mark M.
turned on guest access
7:30 PM
Scott W.
has entered the room
Mark M.
hello, Scott!
how can I help you today>
(great -- a typo in my second entry of the chat...)
Scott W.
Hey! I'm in an office hour for an online software design class right now. I do want to ask you a question though. How much longer will you be available?
Mark M.
today's office hours run from 7:30-8:30pm US Eastern
so, I'll be here for a bit less than an hour
Scott W.
ok. I'll give this thing like 10 more minutes and then just cut it off if it's still going.
7:35 PM
Scott W.
I'll be asking you about recyclerviews and the new paging library stuff.
it's driving me crazy
Mark M.
OK, though I haven't worked with the Paging library in a year, so I'll be rusty
7:45 PM
Scott W.
ok. I just started my semester with Georgia Tech's online masters in computer science program, and that was our introduction office hour by the professor. Should be a cool program!
but my JOB is android development and I'm reeeally suckin at it this week.
Mark M.
that's OK -- the week is almost over! :-)
next week is sure to be much better!
Scott W.
eh. The week will merge into the weekend unless I get this stuff worked out
Next week I go into debt!
So I'm using this paging library because one of our clients wants a contact list of 15000 users
Mark M.
in a single scrolling list? their fingers will get blisters
7:50 PM
Scott W.
yep
there are many complications with this implementation
Pao
has entered the room
Scott W.
I'm not using Room. Everybody's using Room and all examples use Room and it's a little hard to work that out. I think I've gotten past that though.
Mark M.
(BTW, hello Pao -- I will be with you shortly!)
Pao
Hi
Okay
Mark M.
conversely, I have had limited experience with the Paging library outside of Room
Scott W.
I'm using the PositionalDataSource
it has loadInitial and loadRange
everything is fine when I get my first initial set of data in there until the PagedListAdapter calls tries to bind the view of the last item loaded
so, I have a screen that shows 8 or 9 items. paging library requests 90 initial items because my page size is 30 and it multiplies that by 3 by default for the first batch.
I get the 90 items and give them back to the adapter. It binds the viewable items, but then asks for the last item for some reason.
Mark M.
asks for it in an individual loadRange() call?
Scott W.
public void onBindViewHolder(RecyclerView.ViewHolder vh, int position) {
in there
7:55 PM
Scott W.
it'll ask for 0-9, then 90 for some reason
Mark M.
oh, OK, so in the RecyclerView logic
Scott W.
right
in that RecyclerView method, I use getItem to get the actual data model for binding
Mark M.
it asks for 90, and not 89? have you loaded 90 by this point?
Scott W.
this is like you do in your city pop example
the position it asks for is 90
I have given it 90 items at this point
Mark M.
yeah, but those should be indexes 0 through 89
Scott W.
I know :(
Mark M.
unless it called loadRange() on your DataSource, you don't have a 90
Scott W.
asking for item 90 triggers loadRange, and that's where my problem is
because it loads 90 - 120 and then my RecyclerView jumps to the 90th item
Mark M.
not sure what to tell you
are you using the AndroidX edition, or the older Arch Components edition
Scott W.
AndroidX
Mark M.
they haven't updated it since January (https://developer.android.com/jetpack/androidx/...)
it's possible this is a bug
but, I have had limited experience with PositionalDataSource, and I recall it driving me nuts when I was using it
Scott W.
I think it's more likely I've done something dumb
I have another list that doesn't have this problem
8:00 PM
Mark M.
have you played with different page sizes? say, dropping it to 20 instead of 30?
Scott W.
yeah
Mark M.
OK, I'm back to "not sure what to tell you"
I just don't have enough recent experience with this particular library to be able to tell you where you might have gone wrong
especially since it's a custom DataSource
Scott W.
hmm. how about some general advice on troubleshooting?
Mark M.
let me take a question from Pao first, and I can try to provide more troubleshooting advice when I swing back to you
Pao: your turn! how can I help you today?
Scott W.
sure thing
Pao
Hi, I just want to ask if there's a tool or a better way to debug a gradle build.
I actually posted this question in Stackoverflow. Is it okay to share it here?
Mark M.
sure
Pao
Mark M.
well, the problem is coming from kapt -- how many kapt dependencies do you have?
8:05 PM
Mark M.
though to your broader question, there's no real debugging option, because a Gradle script does not run when you do a build -- it ran before, creating an object model describing the build
when we do a build, Gradle is working off of that object model, not off of the script that created it
Pao
Honestly, I really can't tell how many it is because there are several modules that use it in the project.
Basically, there's no better way to debug it?
Mark M.
none that I know of
the specific annotation processor appears to be from data binding -- I didn't know they had an annotation processor
Pao
Oh my. I think that's it for me. Thanks Mark!
Mark M.
regardless, the data binding version is tied to your Android Gradle Plugin version
they just released 3.5.0 of the data binding libraries, in conjunction with Android Studio 3.5.0
and 3.5.0 of the Android Gradle Plugin
so, if you're on an older version, perhaps try upgrading to 3.5.0 and see if you get past what is probably a bug
Pao
Yeah, I just encountered it because I used the latest version. I'll play around and try to isolate the problem. Thanks.
Mark M.
good luck!
let me swing back to Scott, and I'll return to you in a bit
Scott: back to you!
Pao
Thank you.
Pao
has left the room
8:10 PM
Scott W.
well
I've been trying to implement this paging library stuff for like 2 weeks now
Mark M.
about the only thing that popped to mind, from a troubleshooting standpoint, is to log the crap out of your PositionalDataSource and RecyclerView.Adapter
you might consider Hugo (https://github.com/JakeWharton/hugo), to basically dump the parameters and return values
and see if anything leaps out at you
Scott W.
I've done tons of logging already. I need to know why the RecyclerView is asking for that item.
my next step was to attach a debugger and walk it back
I'll try that later tonight.
it just gets in the weeds of all these libraries and is a bunch of code for me to read through and try to understand
Mark M.
agreed
Scott W.
is there a better way to do that?
trying to read through recyclerview and see how it works?
reading in AndroidStudio is pretty nice, but if there's a better way that would be helpful
Mark M.
that's probably about as good as it will get
I mean, the source is the source
8:15 PM
Scott W.
all right let's just switch gears then if you have time
Mark M.
Web browser and the IDE are usually the two easiest ways to view it
sure, got 15 minutes!
Scott W.
I got pretty far into implementing Room last weekend, but gave up late Sunday night because I thought I wouldn't have time to finish.
Mark M.
are you using plain SQLiteDatabase now, or something else?
Scott W.
I need to get a release candidate out this upcoming Sunday
nothing
Mark M.
meaning, no persistence?
Scott W.
correct
Mark M.
OK
Scott W.
we reload contacts every time the user comes back to the app.
well
it's stored in memory, but that doesn't last very long
I don't have a sense of how big of a deal it is to implement Room
I kinda felt like I could do it in a weekend, then I had a realization that there was no way that was enough time.
I've never implemented a database
Mark M.
yeah, I'd hold off for now
8:20 PM
Scott W.
I feel like I need to be learning Kotlin too
Mark M.
at some point, it'll become fairly necessary
Scott W.
yeah
Mark M.
that point is not this weekend :-)
I recommend trying to learn Kotlin within the next year
Scott W.
how can I weave that into my job?
Mark M.
*Elements of Kotlin* and *Elements of Kotlin Coroutines* are part of your Warescription
Scott W.
oh here's a good question!
Mark M.
I don't know enough about your job to really answer that, but in three years' time, Java will be considered "tech debt", IMHO
Scott W.
I'm supposed to be writing an sdk/api (?) of the core of our app for another company to use.
they will use it in a xamarin project.
so I'm planning on making the core of the app into its own module, and then having our implementation of that in the app module
I don't know how to build just the sdk part of it for distribution though
without packaging our app with it
Mark M.
your SDK will be the library module
your own app module will be able to use it via implementation project(:whatever-you-call-it)
8:25 PM
Mark M.
but the library module can also have the Gradle bits to be able to publish versioned artifacts to a Maven repository
(where "a Maven repository" is a fancy way of saying "a filesystem with some specific requirements")
Scott W.
do you have a sample project that has this setup?
Mark M.
there's quite a bit written about publishing open source libraries that you can use as a starting point, though your Maven repository wouldn't be Maven Central or JCenter like they use
my open source libraries need an overhaul in this area, so I don't have an up-to-date recipe in my own stuff, unfortunately
Scott W.
ok.
Mark M.
it's on my to-do list for this fall sometime
Scott W.
cool
I've got until end of October for this, so maybe I'll come back to you with more specific questions about the process
Mark M.
OK
Scott W.
this paging library stuff though...
it's burning my little butt!
all right I'll head off now.
Mark M.
I am not certain how popular it is, particularly outside of the Room-supplied DataSource
I recall when I worked with it that I thought Google bit off a bit more than they could chew, in terms of a generalization
Scott W.
interesting. Well I would have had to do it myself without it.
Mark M.
in your case, it's still probably the best solution, but I am not surprised that it is a pain for you to debugt
Scott W.
don't know how that would have gone
that's encouraging (seriously)
Have a good night!
8:30 PM
Mark M.
you too!
BTW, this transcript will be posted to https://commonsware.com/office-hours/ shortly
and the next chat is Saturday at 4pm US Eastern
Scott W.
has left the room
Mark M.
turned off guest access

Tuesday, August 20

 

Office Hours

People in this transcript

  • Mark Murphy
  • Pao
  • Scott Wehby