Feb 6 | 3:50 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Feb 6 | 4:00 PM |
Ed T. | has entered the room |
Mark M. |
hello, Ed!
|
Mark M. |
how can I help you today?
|
Ed T. |
can we start with a beer? it's been a long week already... lol
|
Ed T. |
this might be more like therapy...
|
Ed T. |
:-)
|
Mark M. |
look on the bright side
|
Mark M. |
you could have been sitting in a certain Tesla Roadster just a little bit ago
|
Ed T. |
I've been tasked to port an iPhone app to android...
|
Ed T. |
ripped thru the 1,000 plus BigNerd ranch book in 2 weeks
|
Ed T. |
pretty good book
|
Ed T. |
then was in a Ken Kousten class and he recommended your book
|
Ed T. |
the problem I'm having
|
Ed T. |
Android Studio 3.0
|
Ed T. |
seems a little odd to me
|
Ed T. |
trying to get annotations to work correctly
|
Ed T. |
Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
|
Mark M. |
custom annotations of yours? stock annotations? annotations from a library?
|
Ed T. |
I got this error a little while back.. after rolling back..
|
Feb 6 | 4:05 PM |
Ed T. |
let me post the gradle files...
|
Ed T. |
trying to use a few things at the same time
|
Mark M. |
bear in mind that these chat transcripts are archived
|
Mark M. |
so, don't post anything here that you don't want others to see
|
Ed T. |
thanks for the heads up
|
Ed T. |
this might help someone else down the road
|
Mark M. |
OK
|
Ed T. |
View paste
(14 more lines)
|
Ed T. |
did you have to add the javaCompileOptions
|
Mark M. |
I haven't for any annotation processors that I have used
|
Ed T. |
to get AndroidAnnontations to work ?
|
Mark M. |
I haven't used AndroidAnnotations specifically
|
Mark M. |
but I use annotations from libraries all the time
|
Ed T. |
View paste
(13 more lines)
|
Ed T. |
AS 3.0 has a new gradle plugin
|
Ed T. |
the 'listening bolt' feature seems to be putting annotation stuff into a weird place
|
Mark M. |
if you mean "lightning bolt", that is Instant Run, and I always turn it off
|
Ed T. |
I didn't know that was an option
|
Ed T. |
thanks for that info!
|
Mark M. |
search for "instant" in Settings
|
Feb 6 | 4:10 PM |
Mark M. |
in Build, Execution, Deployment > Instant Run, the top checkbox controls whether Instant Run is enabled ornot
|
Feb 6 | 4:10 PM |
Mark M. |
er, or not
|
Ed T. |
found it! Instant Run under Build area
|
Mark M. |
yup
|
Mark M. |
the other thing that seems a bit odd in your Gradle is: implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.1'
|
Mark M. |
I haven't seen anyone use that in Android
|
Mark M. |
it's quite possible that it is perfectly normal and I just haven't run across it
|
Ed T. |
Lombok wouldn't compile
|
Ed T. |
then the other issue I ran into is the Lombok generated code
|
Mark M. |
I haven't tried using Project Lombok in an Android project
|
Ed T. |
in IntelliJ if I ran it.. looked good
|
Ed T. |
in AS it 'would' run OK but in the editor it would give red underlines
|
Ed T. |
so the IDE didn't 'see it'
|
Ed T. |
and I got weird compile errors down the road
|
Mark M. |
if this is for a pure Java module, I have encountered the red-underlines problem: https://issuetracker.google.com/issues/71022016
|
Mark M. |
I haven't run into compile errors related to that, though
|
Ed T. |
it is a java module
|
Feb 6 | 4:15 PM |
Ed T. |
using Lombok but I made the decision to auto-generate the code... nothing major in there
|
Ed T. |
for a REST / JSON interface to the server
|
Ed T. |
server side had already built it out for testing
|
Ed T. |
was going to put a UI up and use that as my data model
|
Ed T. |
thanks Mark!
|
Mark M. |
um, you're welcome!
|
Ed T. |
I work remote... so it's nice to have a chat with someone
|
Ed T. |
anything else you would advise me on AS 3.0 ?
|
Ed T. |
3.1 is what I'm running actually
|
Mark M. |
ah
|
Mark M. |
I don't bother with their pre-release IDEs, usually
|
Mark M. |
I spend enough time helping them debug their pre-release OS
|
Ed T. |
3.2 is the pre-release
|
Mark M. |
so is 3.1
|
Ed T. |
lol
|
Mark M. |
3.1 is beta
|
Mark M. |
3.2 is canary
|
Mark M. |
3.0.1 is the current production release
|
Ed T. |
ahh , yes - you are correct
|
Mark M. |
I have a rough enough time with their tools that are *supposed* to work, to spend time "chasing sensor ghosts" with tools that might not work
|
Ed T. |
the confusing part for me... coming to Android...
|
Ed T. |
is the 'sort of' support for Java 1.8
|
Mark M. |
yes, well, to an extent, you have the Oracle v. Google lawsuit to blame for that
|
Ed T. |
I did Java Swing for 10 years
|
Ed T. |
and was in telecom
|
Feb 6 | 4:20 PM |
Ed T. |
Google poached the Java smart folks
|
Ed T. |
Joshu Bloch
|
Ed T. |
met him twice.. nice guy
|
Ed T. |
Romain Guy
|
Ed T. |
met him once
|
Ed T. |
was a guru on the Swing team
|
Ed T. |
Chet Hase left to Adobe... Fles team ... but is now at Google
|
Ed T. |
Sun never gave away the JVM on the mobile handset
|
Ed T. |
and it was terrible
|
Ed T. |
no math.lang package for example... because most of them didn't have a math co-processor
|
Ed T. |
Google should have paid for it in my humble opinion... because they have ton of money
|
Ed T. |
but the bigger issue... is if it is no longer free... and you have a monopoly ... I think they call that 'dumping' to control a market... not sure
|
Ed T. |
but the background is Oracle's CEO who sat on Apple Board... was best friends with Steve Jobs
|
Ed T. |
those two took vacations together with their families
|
showdawn | has entered the room |
Ed T. |
so... expect Oracle to pay the lawyers forever ... it's very personal... my guess
|
Ed T. |
ok... time to share
|
Ed T. |
thanks Mark!
|
Mark M. |
you're welcome
|
showdawn |
hi Mark
|
Ed T. |
I'll catch you another day.... this was great help
|
Mark M. |
Ed: sounds good!
|
Mark M. |
showdawn: hi! it's your turn -- do you have a question?
|
Feb 6 | 4:25 PM |
showdawn |
Yes. I am trying to implement a messenger kind of application and here is what I have thought of. Need your suggestion.
|
Steve S. | has entered the room |
Mark M. |
(Steve: hi! I'll be with you shortly, after showdawn's question)
|
Steve S. |
Hi, Mark!. Sure thing
|
showdawn |
I run a service which starts and listen on socket. When there are messages, update the database and use livedata to update the UI ?
|
showdawn |
Is that a good approach ? I would terminate the service when the app is closed.
|
Ed T. | has left the room |
Mark M. |
you only need a service if you are looking to process messages when your UI is not in the foreground
|
Mark M. |
and then it would need to be a foreground service, to support Android 8.0+
|
Mark M. |
in terms of the networking, I would recommend using established protocols rather than creating something yourself with bare sockets
|
Mark M. |
otherwise, what you describe seems fine
|
showdawn |
How can I do it, when I am in a different screen (not the chat screen) and still be notified of new messages
|
Mark M. |
you just need some central object that is managing your network connection
|
Mark M. |
it does not have to be a service
|
Mark M. |
it could be some singleton
|
Feb 6 | 4:30 PM |
showdawn |
Ok got it.
|
showdawn |
But how would I update the databse when I get a new message? Do I do an async task in the singleton ?
|
Mark M. |
use a background thread of some form, but probably not an AsyncTask, as you do not need to be doing work on the main application thread there
|
showdawn |
Ok. I get the problem you mention with Services.
|
showdawn |
Especially with 8.
|
showdawn |
0+
|
Mark M. |
let me take a question from Steve, and I will return to you shortly
|
showdawn |
Sure
|
Mark M. |
Steve: your turn! do you have a question?
|
Steve S. |
I'll paste in my question:
|
Steve S. |
I'm working on an implementation of the master-detail pattern. I think I can see why fragments are used for the details. But what is the rationale for using a fragment as the master?
|
Mark M. |
as opposed to... what?
|
Steve S. |
Just an actvity
|
Mark M. |
OK, so you're proposing an activity that manages the master UI directly, and optionally shows a fragment for the detail if there is room?
|
Steve S. |
Yes
|
Mark M. |
I suppose that could work
|
Feb 6 | 4:35 PM |
Mark M. |
on smaller screens, you would have to hide your master UI at the View level (setVisibility()), since you would not be running a fragment transaction to replace that UI
|
Steve S. |
ok
|
Mark M. |
the original Google-recommended pattern was for two fragments, presumably for parallelism
|
Steve S. |
right. that's what i've seen. i was curious why that was the pattern since it seems simpler to use just an activity for the mster
|
Mark M. |
I'm not convinced it's that much simpler, though it could be -- I haven't tried that pattern
|
Steve S. |
ok. i don't have any more questions today. than you so much, Mark!
|
Mark M. |
you're welcome!
|
Mark M. |
showdawn: back to you! do you have another question?
|
Steve S. |
have a great rest of the day!
|
Mark M. |
Steve: you too!
|
Steve S. | has left the room |
showdawn |
yes mark.
|
showdawn |
So if I am using a thread to update the DB and then use livedata to update the activity, dont you think there would be a delay ?
|
Mark M. |
well, to some extent, there will be
|
Feb 6 | 4:40 PM |
showdawn |
Of-course these would be single line inserts into the database.
|
Mark M. |
however, you already are on a background thread for the network I/O
|
Mark M. |
you can't use that thread for the database I/O, as you cannot process more incoming messages that way
|
Mark M. |
and you do not want to do disk I/O on the main application thread
|
Mark M. |
so, another thread is unavoidable
|
Mark M. |
you're certainly welcome to post data to the LiveData before you do the disk I/O, if you want
|
showdawn |
Can I do that from a background thread that I create in singleton class ?
|
Mark M. |
can you do what? post to the LiveData? sure, assuming that you have access to it
|
showdawn |
Post to Activity from Background thread of Singleton class ?
|
Mark M. |
well, that's what the LiveData is for
|
showdawn |
Ok.
|
Mark M. |
for example, if you have the latest copy of "Android's Architecture Components", I walk through an example of Model-View-Intent as a GUI architecture
|
Mark M. |
there, I use background threads (via RxJava) for the database I/O, and the results of that work eventually trigger updates to LiveData to update the UI
|
Mark M. |
it's not an exact match for your scenario, as all my data changes are driven by the UI, not by background events (incoming messages from the server)
|
Mark M. |
but the flow of doing background work and using LiveData to stream the results to the UI would still hold
|
Feb 6 | 4:45 PM |
showdawn |
Ok. I will go through that book. havent read it.
|
Feb 6 | 4:45 PM |
Mark M. |
Version 0.8 of "Android's Architecture Components" has that material, and Version 0.9 should be out on Monday
|
showdawn |
Thanks Mark.
|
Mark M. |
no, wait, sorry -- 0.7 is the current version, and 0.8 is coming out on Monday
|
showdawn |
So 0.7 already has it ?
|
Mark M. |
the MVI sample? yes
|
Mark M. |
I just had the version numbers wrong
|
showdawn |
Ok
|
showdawn |
Thanks again mark. I will leave now.
|
Mark M. |
OK
|
showdawn | has left the room |
Feb 6 | 4:55 PM |
Mark M. | turned off guest access |