Office Hours — Today, March 29

Tuesday, March 27

Mar 29
8:55 AM
Mark M.
has entered the room
Mark M.
turned on guest access
9:00 AM
Jan
has entered the room
Mark M.
hello, Jan!
how can I help you today?
Jan
Hello!
Well, I've been redoing my app
Ed T.
has entered the room
Ed T.
gm Mark
Jan
and I'd like to ask you for an opinion
Mark M.
(hello, Ed -- Jan got here first, so let me take that question, and I'll be with you shortly!)
Jan: go ahead
Jan
what is the best way how to decouple View, model and presenter/controler
Mark M.
um, that's rather broad, and I doubt that I can answer it very well
Jan
I found MVC, MVP and MVVM and I like MVP the most
Mark M.
I cover MVI in *Android's Architecture Components*, with capsule summaries of the other MV* candidates
but, I cannot claim MVI to be "best"
so, I am not certain how to help you
Jan
interesting, I didn't notice this, thanks. I'm going to check it out, bye
9:05 AM
Mark M.
OK
let me take a question from Ed, and I'll return to you shortly
Ed: your turn! do you have a question?
Ed T.
I've got a few this AM, thanks. :-)
Curious what the best way to do a FORM Layout. Your book recommended Grid
curious your if you still feel the same way
Mark M.
it did?
Ed T.
I think you did... when you talked about it.. and Table
Mark M.
TableLayout is something I can see recommending
as you can line up columns, if that's the look that you want
you'll be able to achieve a similar effect with ConstraintLayout with 1.1.0, when that (finally) ships, if I understand correctly
Jan
has left the room
Ed T.
you said that Grid was added as a way to make it easy to use a tool to 'drag n drop' ... I think... on my 2nd cup of coffee... watched Ready Player One last night. :-)
Mark M.
I assume that you're referring to GridLayout
I hope I never recommended it
Ed T.
yes, where you set columns and rows and can do a span
Mark M.
it was an option that Google introduced, that failed miserably in the court of public opinion
Ed T.
I'm using a nested Linear Layout
and having issues with spinners playing nicely
Mark M.
if you do not need strict columns, then ConstraintLayout or your nested LinearLayout are typical choices
if you want labels and the labeled widgets to be in separate columns, then it's TableLayout or the next version of ConstraintLayout
9:10 AM
Ed T.
I was afraid to use ConstraintLayout as I have 'dynamic' views
I have a view where there may be no data and I set the view to GONE
so that seemed like a dangerous path
Mark M.
ConstraintLayout is pretty good about handling GONE
Ed T.
as long as I don't remove something everything is using as an anchor point right?
not sure if that is the correct terminology.... what I used to call it from Delphi and Visual C++ days... when Borland had a similar layout
Mark M.
IIRC, it will treat a GONE widget as being there, with zero height/width, for the purposes of anchors targetign it
er, targeting it
Ed T.
that's very good to know
what is your favorite layout for a nice looking form ?
Mark M.
I never like the look of any forms
so, it'
so, it would be more of what the designer was aiming for
with ties going to ConstraintLayout, as Google is pushing it hard
Ed T.
lol. I'm in that mode now.... looking back on something and I'm like... ugh
Mark M.
9:15 AM
Ed T.
if I'm designing something that will only run on a phone do I still need to consider Fragments?
Mark M.
that depends
for example, nav drawers work easiest with a single activity
Ed T.
Fragment seems to me, as a way to re-use for multiple display sizes
Mark M.
so, for a nav drawer-centric app, I'd consider fragments as being what the nav drawer navigates to
similarly, ViewPager works best with fragments, though I have been using RecyclerView more in this role recently
so, if you're using one or both of those, fragments are well worth considering
while the original vision of fragments was for multiple display sizes, fragments evolved into a general-purpose "smaller than an activity" unit of UI
Ed T.
I'm surprised about some of the design choices for Android... honestly....
9:20 AM
Ed T.
I used the Calendar popup and it mixed base zero with base 1 params.... so I had a bug to track down...
months are base zero and the rest is base 1
some things seem 'patchy' while others are very impressive
Mark M.
that's a java.util.Calendar thing
Ed T.
the RecylerView and Androids Tree view with 2 levels
and how many Open Source projects were created to fix that one? lol more than one
I use LocalDate and it works fine for what I need
Mark M.
note that LocalDate is new to API Level 26
Ed T.
import org.joda.time.LocalDate;
which is why I had to do it that way
Mark M.
ah, OK, forgot that they used the same class name
Ed T.
no worries
my IDE has 'automagically' hosed me a few times by 'guessing' that for me. :)
have you used AndroidAnnotations?
Mark M.
no, sorry
9:25 AM
Ed T.
Lombok?
Mark M.
also: no, sorry
Ed T.
they are both annotations
that do code for you
View paste
@EActivity(R.layout.activity_vehicle_info)
public class VehicleInfoActivity extends AppCompatActivity {

    @ViewById(R.id.vin_edit_text)
    EditText mVIN;
example
it does all of the boiler plate for you... very nice
Mark M.
in my case, I need to teach the boilerplate
Ed T.
code generation
very true
View paste
    @Click(R.id.get_vin_button)
    void scanVinButtonClicked() {
View paste
    @OnActivityResult(RC_BARCODE_CAPTURE)
    void onResult(int resultCode, Intent data) {
those are two examples... keeps the code small
makes it easy to see business logic from framework
@Background @UiThread. take care of dealing with treading items nicely
what are your thoughts for Kotlin?
Mark M.
I think it starts with the letter 'K'!
Ed T.
lol
Mark M.
and, it ends in 'otlin'!
overall, the language is an order of magnitude more complex than Java
however, there is a ~20% subset of Kotlin that is all most developers will need, and that subset is relatively easy
9:30 AM
Mark M.
also, the runtime overhead is impressively lean
Ed T.
IDEA does a lot of neat things but I'm not sure I want to trust them for my core language syntax
Android Studio 3.1 is out
Mark M.
yes, which means I have the honor and privilege of redoing a zillion screenshots
doing that for *Exploring Android* is part of today's workload
as I have Version 0.2 of that coming out shortly
Ed T.
thanks for doing that. :)
your section on icons in that book was a life saver
they make that more 'magic' and if it doesn't work... it just doesn't work
Mark M.
yeah, Google's priorities and mine often are not in alignment
Ed T.
world domination isn't on the top of your list? lol
Mark M.
I'll settle for "condo domination"
frequently, the dust bunnies are winning
Ed T.
I get so many mixed messages from Google
9:35 AM
Ed T.
they are so big... it gets confusing...
so they want me to move to Kotlin and then they also tell me this is the future ?
Mark M.
frequently, the right hand doesn't know what the left hand is doing, and those two are oblivious to the 28 other hands
Ed T.
I don't understand the 'shinny new toy'
Java has annoying parts, but if you use annotations.... you don't even have to type the boilerplate
so Java + annotations is less code than Kotlin
imho
Mark M.
annotations can be very difficult to debug, though
View paste
tend tend to be "magic boxes
er, they tend to be "magic boxes"
Ed T.
View paste
        <activity
            android:name=".ProgramInfoDetailsActivity_"
            android:screenOrientation="portrait" />
Mark M.
when they work, they're fine
Ed T.
from my AppManifest.xml file
AndroidAnnotations generates all of the code into a "class"_.java file
so you can see what is generated as well as debug it
if you need to
Mark M.
yes, compile-time annotations are better for debugging than are runtime annotations
Ed T.
and for some items I don't use annotations... like the RecylerView
9:40 AM
Ed T.
the binding and wrapping the data... it didn't play nicely
Mark M.
@Oh @There @Probably @IsA @RecyclerView @Annotation @Library @Somewhere
Ed T.
lol
you have any questions for me? :-)
Mark M.
none come to mind, sorry
Ed T.
thanks for your hard work on the book! has been a great resource
Mark M.
I am glad that it is useful!
Ed T.
I've found the new IDE to be much faster. Especially after updating to the newer version of Gradle
for builds
Mark M.
yes, they are making good strides in that area
Ed T.
are you still keeping the lightening bolt feature turned off?
Mark M.
Instant Run? yes
9:45 AM
Ed T.
Thanks for your time Mark! I'm the only dev on a startup project. Nice to have someone to bounce things off of. Cheers
Mark M.
you're very welcome!
10:00 AM
Mark M.
that's a wrap for today's chat
the transcript will be posted to https://commonsware.com/office-hours/ shortly
the next chat is Saturday at 4pm US Eastern
have a pleasant day!
Ed T.
has left the room
Mark M.
turned off guest access

Tuesday, March 27

 

Office Hours

People in this transcript

  • Ed Tidwell
  • Jan
  • Mark Murphy