Apr 21 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Ed T. | has entered the room |
Ed T. |
good evening Mark!
|
Mark M. |
actually, I'm on the road, so it is morning here :-)
|
Ed T. |
yikes
|
Ed T. |
India?
|
Mark M. |
Southeast Asia
|
Ed T. |
brb neighbor looking for me...
|
Apr 21 | 7:30 PM |
bill | has entered the room |
Mark M. |
hello, bill!
|
Mark M. |
how can I help you today?
|
bill |
hello Mrk
|
Alex | has entered the room |
bill |
It has to do with this issue https://github.com/square/okhttp/issues/2646
|
Mark M. |
(BTW, hello Alex -- I will be with you shortly!)
|
Alex |
No rush!
|
Mark M. |
bill: OK
|
bill |
I want to use self signed certifications with OkHttp
|
bill |
And I receive the error "tm is an instance of ... which is not a supported type of X509TrustManager"
|
Mark M. |
are you following this recipe: https://github.com/square/okhttp/wiki/HTTPS#cus... ?
|
Ed T. |
back
|
Ed T. |
back of the line if fine.... cheers
|
Mark M. |
(Ed: I'll turn back to you after bill and Alex!)
|
Apr 21 | 7:35 PM |
bill |
Mark, now I will study the recipe and later I will be back. Thanks!!!
|
Mark M. |
OK -- I'll take questions from the others, and I'll be back with you shortly
|
Mark M. |
Alex: your turn! do you have a question?
|
Alex |
Ed, you can go before me. I'm about to eat
|
Alex |
Passing my turn to Ed
|
Mark M. |
OK... Ed: do you have a question?
|
Alex |
Going AFK for now
|
Mark M. |
OK, if anyone is around and has a question, go right ahead
|
Ed T. |
I have a PDF question
|
Apr 21 | 7:40 PM |
Mark M. |
fire away!
|
Ed T. |
pdf.js looks like my best bet... after reading your book
|
Ed T. |
I don't need to support anything before API 19
|
Ed T. |
the example uses embedded PDF files
|
Mark M. |
OK, though bear in mind that my copy of PDF.js is probably a year or two old
|
Ed T. |
if I pull a PDF from a URL do I need to save it to temp storage first?
|
Mark M. |
I suspect that the answer is no, but I am not completely certain
|
Ed T. |
ok
|
Ed T. |
your example code was....
|
Mark M. |
I did not test that scenario (or if I did, I forget the result)
|
Ed T. |
View paste
|
Ed T. |
I didn't see anything for that in your book
|
Ed T. |
and from our last meeting... fyi
|
Ed T. |
seeker has a boolean called 'user'
|
Ed T. |
to separate event created from code versus the UI
|
Ed T. |
and that was how I solved my 'event storm' issue
|
Mark M. |
OK
|
Ed T. |
safe travels!
|
Mark M. |
thanks!
|
Ed T. |
thank you sir
|
Mark M. |
OK, if anyone has a question, go ahead, as I'm not sure who is around with questions at the moment...
|
Ed T. | has left the room |
Apr 21 | 7:45 PM |
Alex |
Still eating, how are you doing Mark?
|
Mark M. |
OK, and yourself? besides presumably being less hungry now... :-)
|
Alex |
I've been very sick, but as soon as the antibiotics kicked in I've been studying everything Android
|
Mark M. |
I hope you get to feeling better soon
|
Alex |
I recently just learned about architecture patterns but its such a new idea I don't really know what to make of it or what does it mean practically in my own projects
|
Mark M. |
if you mean GUI architecture patterns -- using abbreviations like "MVC", "MVP", "MVVM", "MVI", and so on -- I cover those in "Android's Architecture Components"
|
Mark M. |
I can try to answer your questions about GUI architecture patterns, but you might want to read those chapters first
|
Apr 21 | 7:50 PM |
Alex |
Yes, and also something "clean architecture"
|
Mark M. |
I mention clean architecture in passing in one of the testing chapters in "The Busy Coder's Guide to Android Development"
|
Alex |
I see, I'm firing up the pdf to find the chapter you mentioned earlier
|
Alex |
Yea I guess it just seems unfitting that I just keep creating classes in the java folder and just let it get messy. I wonder how others organize that stuff, separating logic classes from activity classes
|
Mark M. |
well, in terms of folders, you are welcome to create sub-packages as you see fit
|
Mark M. |
the extended MVI samples presently in "Android's Architecture Components" use separate sub-packages for the UI versus the rest of the implementation
|
Mark M. |
clean architecture is not concerned with package names, but rather with roles
|
Alex |
The file is big, is there a page number? If I Ctrl-F the title I'll crash Apple Preview
|
Mark M. |
hold on
|
Apr 21 | 7:55 PM |
Mark M. |
it's in the Unit Testing chapter
|
Mark M. |
in Version 8.11, the clean architecture material starts at page 1122
|
Alex |
Great, found it
|
Alex |
How come fragment tab layout with viewpager dont work with constraint layout?
|
Mark M. |
um, it should
|
Mark M. |
(BTW, bill: if you have another question, let me know)
|
Alex |
I built mine using LinearLayout. But after reading the Constraint Layout chapter, I wanted to master it. And switched my main activity which housed my tab and viewpager widget xml.
|
Alex |
But when I ran the app, the tabs disappeared and there was a visual glitch
|
bill |
I have n't use the recipe of OkHttp
|
Mark M. |
bill: try using their approach for custom certificates, and see if that helps you with your self-signed certificate
|
Mark M. |
Alex: I do not know of any problem with using any flavor of tabs, ViewPager, and ConstraintLayout
|
Mark M. |
but, if you have a layout file that you can show me, perhaps I'll spot something
|
Apr 21 | 8:00 PM |
bill |
I had use a general example which I adapted to OkHttp, and I received the mentioned before error
|
Alex |
Let me create a gist
|
Alex |
Actually better yet, have you ever made a sample project that implemented a TabViewPagerContraint?
|
Alex |
I ended up going ahead with LinearLayout on my project so I have nothing to throw into the gist
|
Mark M. |
I don't know what TabViewPagerConstraint is, sorry
|
bill |
I saw in square/okhttp issues that you had started the issue with the specific error. I think that I MUST follow your advice and implement their recipe!!
|
Alex |
Sorry that's just what I call a Fragment layout that implements XML Constraint layout with Tabs and Viewpager
|
Alex |
I don't know any real short hand to describe it
|
Mark M. |
I don't think that I have an example that wraps a ViewPager in a ConstraintLayout, sorry
|
Alex |
No worries, I'll just make a playground file to get it to work
|
Alex |
Just about every example uses LinearLayout for some reason
|
Mark M. |
well, ViewPager was introduced long before ConstraintLayout
|
Mark M. |
and some developers are switching away from ViewPager to other solutions, such as RecyclerView
|
Apr 21 | 8:05 PM |
Alex |
To be honest, I don't fully understand what ViewPager is
|
Alex |
Is that what allows fragments to slide to the left and right?
|
Mark M. |
there's a couple of chapters on it in "The Busy Coder's Guide...", but yes, that's the original swipe-a-page-at-a-time solution in Android
|
Mark M. |
a typical implementation uses fragments for pages, though that's not strictly required
|
Alex |
And RecyclerView is replacing that?
|
Mark M. |
it's more that RecyclerView can be used as a swipe-a-page-at-a-time solution as well
|
Alex |
I wasn't aware it had swipe functionality, I have yet to read that chapter
|
Mark M. |
it has some useful characteristics compared to ViewPager, but it has less support for things like tabs
|
Alex |
That's unfortunate. I really need the tabs.
|
Mark M. |
my Advanced RecyclerView chapter works through a bunch of ViewPager-workalike scenarios with RecyclerView, including tabs
|
Mark M. |
however, with RecyclerView, the pages are views, not fragments
|
Mark M. |
so, if you already have working ViewPager code, you might just stick with that for now
|
Mark M. |
only change if you have a concrete reason to do so
|
Alex |
Yea I'll stick with it. Good, I'll put that on the reading list. And hmm interesting, I'll hold off on more questions on this until I have read these chapters.
|
Apr 21 | 8:10 PM |
Mark M. |
if either of you have additional questions, go right ahead!
|
Alex |
Yea I'm full of them, I've been waiting all week
|
Alex |
Just taking in some more food haha
|
Mark M. |
sorry, I'm on travel this week, and that tends to scramble my office hours schedule
|
Alex |
Thats fine, I've been sick for the past 2 weeks but my mind has been always thinking
|
Mark M. |
well, that's good, because if your mind stops thinking... that's far less good
|
Alex |
Haha well I'd hope my body throws an exception
|
Mark M. |
only do that if you have a qualified medical exception handler in place
|
Apr 21 | 8:15 PM |
Mark M. |
I also recommend logging the stack trace, though please do so somewhere private, because ew
|
Alex |
Hahaha good one
|
Alex |
But now that I'm closer to completion of this certain piece of my app (i'm making a fitness app for my own use). I've been thinking about the "workout" part of my app on a layout and logic end. But I'll worry about the layout first
|
Alex |
Lets say you click a button on the mainactivity to start a new workout. You are taken to a new activity. The layout of this workout activity is a LinearLayout and within it are nested LinearLayouts (with a custom drawable background) to make it look more like a card: these represent each exercise.
|
Alex |
But would I need to put this into a ScrollView or RecyclerView to account for screen overflow?
|
Mark M. |
that's probably a good idea
|
Apr 21 | 8:20 PM |
Mark M. |
also note that there is a CardView for making things with a card background
|
Alex |
So the XML higherarchy would look like LinearLayout (global) > ScrollView -> LinearLayout (exercise) x nExercisesInWorkout
|
Alex |
And then a button to finish or cancel the workout below all of this
|
Mark M. |
ScrollView only has one child
|
Alex |
Oh?
|
Mark M. |
which represents the area to be scrolled
|
Mark M. |
one typical solution is to wrap the whole thing in the ScrollView
|
Alex |
I use LinearLayouts as visual cards. Is that not a good way to do it?
|
Alex |
Ohhh
|
Alex |
So would ScrollView be the outermost element in the xml
|
Mark M. |
right
|
Alex |
I see
|
Mark M. |
if there are things that you want always visible, either make them be action bar items, or you will need an outer container that holds those things plus your ScrollView
|
Alex |
I see
|
Alex |
Okay, I think I have a good idea on how to go about the design of this. Now I have to think about the logic. It's still fuzzy.
|
Mark M. |
for your exercises, if there will be lots of those, then a RecyclerView instead of ScrollView+LinearLayout may be worthwhile
|
Alex |
Yea another reason to really get into the RecyclerView stuff
|
Mark M. |
if there will only be a few exercises, and you prefer the ScrollView+LinearLayout approach, that's fine
|
Alex |
Well the largest workout would typically have about 7 workouts, which would definitely overflow the screen
|
Alex |
That would be an upper body workout. Leg workouts are generally shorter workouts
|
Mark M. |
yes, but that's not so many that the recycling aspect would be necessary
|
Alex |
7 exercises*
|
Apr 21 | 8:25 PM |
Alex |
Right, so I guess the question is. Does the finite (small) number of exercises per workout merit recycler view
|
Mark M. |
probably not
|
Mark M. |
though there's nothing wrong with using one
|
Alex |
Of course.
|
Mark M. |
for that number, go with whatever makes you more comfortasble
|
Mark M. |
er, comfortable
|
Alex |
Sounds like plan. Now all I got to worry about is the logic of how Workouts are persisted and organized
|
Mark M. |
typically, if the contents of the layout are hard-coded, the ScrollView approach is the easier one, but if the contents of the layout are dynamic (e.g., determined by database I/O), the RecyclerView approach is the easier one
|
Apr 21 | 8:30 PM |
Alex |
Oh then I would need a RecyclerView I think. I haven't even thought about how to do a database yet, I'm about to read that chapter tonight. But in my mind, I believe that there will be "Tracks" which would be an object that would have "exercises" as well as predefined set,rep, rest time information.
|
Mark M. |
OK, that's a wrap for today's office hours chat
|
Mark M. |
the transcript will be posted to https://commonsware.com/office-hours/ shortly
|
Alex |
:)
|
Alex |
Until next time
|
Mark M. |
the next chat is Tuesday at 4pm US Eastern
|
Mark M. |
have a pleasant day!
|
bill |
good day
|
bill | has left the room |
Alex | has left the room |
Mark M. | turned off guest access |