Aug 31 | 3:50 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Aug 31 | 4:05 PM |
Scott W. | has entered the room |
Scott W. |
hello!
|
Mark M. |
hello, Scott!
|
Mark M. |
how can I help you today?
|
Scott W. |
I have a question, but I'd like to give you an update on the pagination library first
|
Scott W. |
we spoke about it last week
|
Mark M. |
yup! any luck?
|
Scott W. |
I'm sticking with the library, but I decided to remove the header rows in my list to simplify things
|
Mark M. |
if the customer is happy, simpler is good
|
Scott W. |
yeah
|
Scott W. |
I'm still having a problem with the adapter asking for the last available item, which triggers this lookAround function when triggers loadRange, which triggers the recyclerview jumping.
|
Aug 31 | 4:10 PM |
Scott W. |
Also, I'm using 1 fragment to switch between displaying two different data sets of the same data type
|
Scott W. |
I think I can fix some other small issues by separating these into their own fragments
|
Scott W. |
I ran into some of your answers on stack overflow trying to do this actually.
|
Scott W. |
I have a view pager and tab layout to display 3 fragments
|
Scott W. |
the first fragment needs to display different data based on a boolean
|
Scott W. |
so I want to just have 4 fragments and swap the first spot out.
|
Mark M. |
ViewPager, or at least the stock adapters, does not handle that well
|
Mark M. |
OTOH, if you are using library implementations of fragments, nested fragments are stable nowadays
|
Scott W. |
yeah it ended up being too difficult for the time I have left and I will not solve this problem in the near future.
|
Mark M. |
when you return to it, your first page might be a fragment that holds one of two nested fragments
|
Scott W. |
that's a good idea
|
Mark M. |
so you can switch the contents of that page as that boolean changes
|
Scott W. |
I will try this
|
Scott W. |
ok now to my question for the day
|
Aug 31 | 4:15 PM |
Scott W. |
My app uses an SDK for video calls. It does not handle the situation of starting a video call while the user is on the phone well.
|
Scott W. |
so, I'd like to know how to detect if another app, not just the phone app, is using the microphone before a call starts.
|
Scott W. |
all that I've seen so far it to try recording something, and if it fails, you know someone else is using the microphone.
|
Mark M. |
the APIs aren't really set up for that AFAIK
|
Mark M. |
that might actually be the only viable option
|
Scott W. |
ok I
|
Scott W. |
ok I
|
Scott W. |
haha
|
Scott W. |
ok I'll stick with that
|
Scott W. |
I'm typing at an odd angle right now
|
Mark M. |
I won't ask :-)
|
Scott W. |
good good
|
Mark M. |
the media APIs aren't my strong suit, so I can't rule out there being some other option
|
Scott W. |
I've got another topic I'd like to chat with you about
|
Mark M. |
if it's "how is Duke shutting out Bama?", I can't explain that
|
Aug 31 | 4:20 PM |
Scott W. |
haha I've got the game on and am sitting on my couch! there's the odd angle explanation.
|
Scott W. |
so, I am the lead developer on one app, but the basics of the app were in place when I joined the company.
|
Scott W. |
so all of the communication between client and server were set up by the founder of the company.
|
Scott W. |
::roll tide::
|
Scott W. |
This guy isn't a Java developer, and the way he implemented this communication doesn't seem standard at all.
|
Mark M. |
is the Android app the only client, or do you have others (iOS, desktop, single-page Web app)?
|
Scott W. |
iOS and web. web functions on desktop and mobile
|
Scott W. |
iOS came first, then Android was adapted from that code.
|
Mark M. |
perhaps the communications were set up with iOS in mind
|
Scott W. |
maybe
|
Mark M. |
what sort of communications is it? REST Web service? GraphQL? WebSockets? something else?
|
Scott W. |
sockets
|
Aug 31 | 4:25 PM |
Mark M. |
plain sockets? that's... rather low level
|
Scott W. |
all the socket objects have been moved to a lower library that we hired a couple of dudes to come in a write last year.
|
Scott W. |
I'm not too concerned with that right now. That library was written by some Java pros
|
Scott W. |
in out app though, I make a request to the server like "get page of one of my contacts"
|
Scott W. |
and it hands me an object called a Deferred. When the response comes back, it is delivered through callbacks or errorbacks in this Deferred object
|
Scott W. |
Trying to figure out how to handle these Deferred objects has been a great pain for me.
|
Scott W. |
We are about to make the core of our app into a library to sell to people, and I do not want to expose Deferreds to them.
|
Scott W. | |
Scott W. |
That's what the original developer based the Deferred object code off of.
|
Scott W. |
So, I'm wondering if this is a common thing, or if I should use a more standard Java object for this.
|
Scott W. |
And what that standard Java object is.
|
Aug 31 | 4:30 PM |
Mark M. |
"deferred" is one approach to a reactive sort of API
|
Mark M. |
that particular construct is not common in Android
|
Mark M. |
if you wanted to stick with fairly "pure" Android SDK stuff, LiveData would be the reactive option to consider
|
Mark M. |
RxJava's Single is another candidate, if you want to climb the RxJava learning curve
|
Scott W. |
I do not
|
Scott W. |
I just got my first taste of LiveData with this pagedlist stuff
|
Scott W. |
I don't understand LiveData yet. I'll have to go through your book on this stuff.
|
Scott W. |
I don't understand the relationship between it and ViewModel
|
Mark M. |
I cover it in *Elements of Android Jetpack* and *Android's Architecture Components*
|
Mark M. |
in a CRUD-style app, a ViewModel typically will expose LiveData to the UI (activities/fragments)
|
Mark M. |
if you want to stick with a Deferred approach, you could consider http://jdeferred.org/, which AFAIK is the most popular implementation
|
Mark M. |
as opposed to using a homebrew implementation
|
Aug 31 | 4:35 PM |
Scott W. |
interesting
|
Scott W. |
one issue our Deferred has is that it is eventually "called" which triggers all of the chains of callbacks you've attached to it. However, it's possible for it to be called before you attach your callbacks. So, you callback would never run in that case.
|
Mark M. |
that seems like a bug
|
Mark M. |
there should be a way to wire everything up, then say "go!"
|
Scott W. |
It's a known limitation according to the developer. For me to go in and add that capability would seem like a waste of time.
|
Scott W. |
I would rather switch to this jdeferred or use LiveData if I'm going to put that sort of time in.
|
Mark M. |
I don't know enough of JDeferred to say how it handles the situation that you described
|
Mark M. |
with LiveData, you would start the work in the onActive() method, which means you have at least one observer to deliver results to
|
Aug 31 | 4:40 PM |
Mark M. |
as you are creating this API, you also need to keep Kotlin in mind
|
Mark M. |
insofar as some percentage of your customers might be developing in Kotlin
|
Mark M. |
the advantage of LiveData and RxJava is that there is quite a bit written about using those from Kotlin
|
Scott W. |
our first customer is developing in xamarin
|
Mark M. |
oh, right, you mentioned that
|
Mark M. |
I haven't the foggiest notion what would be easiest for Xamarin users
|
Mark M. |
I'm happy that I can usually spell "Xamarin" successfully
|
Scott W. |
yeah. They've said androidx in general might be a problem
|
Scott W. |
I'm hoping that xamarin has support for androidx by the time we get them this library.
|
Scott W. |
I'd like to explain a little more of our process to you
|
Scott W. |
The deferred is held by a Command object that goes into a queue held by our custom Reactor
|
Scott W. |
we pump the Reactor once every 100ms
|
Scott W. |
results go into Result objects which gets the deferred and starts the chain of callbacks
|
Scott W. |
Results are in a separate queue in the Reactor
|
Scott W. |
This whole process also seems like something that we should not have written ourselves.
|
Aug 31 | 4:45 PM |
Scott W. |
so I have the same concerns with our Reactor as I do with the Deferred object
|
Mark M. |
well, there are standard approaches for work queues and results delivery with RxJava and Kotlin coroutines
|
Mark M. |
but that reflects a lot of work in reactive programming in the past 4-5 years
|
Mark M. |
your Reactor is implementation, not interface, if I understand correctly
|
Scott W. |
that's right
|
Mark M. |
so, you can change that around in the future without necessarily impacting your API customers
|
Scott W. |
absolutely
|
Scott W. |
however it's tightly coupled with Deferreds right now
|
Scott W. |
I don't know what it would take to swap out Deferreds for LiveData
|
Mark M. |
yeah, I can't really answer that
|
Scott W. |
yeah I'll see how far I can get with that. Might need to pull in the original developer.
|
Scott W. |
I'll have to convince him this is a good ideal
|
Scott W. |
*idea
|
Aug 31 | 4:50 PM |
Scott W. |
I don't work with any other Android developers, and there aren't many at all where I live. Being able to chat with you like this is really great.
|
Mark M. |
happy to help!
|
Scott W. |
I'm going to switch gears to Udacity videos now.
|
Scott W. |
Thanks for the help!
|
Mark M. |
you're welcome!
|
Scott W. | has left the room |
Aug 31 | 5:00 PM |
Mark M. | turned off guest access |