Sep 3 | 8:50 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Sep 3 | 9:20 AM |
Jacek | has entered the room |
Sep 3 | 9:20 AM |
Jacek |
Hello
|
Mark M. |
hello, Jacek!
|
Mark M. |
how can I help you today?
|
Jacek |
I have a question regarding Cursor and RecyclerView. Is there anything against the idea to use them together?
|
Mark M. |
no
|
Mark M. |
in my RecyclerView chapter, I have an example of creating a RecyclerView.Adapter that uses a Cursor as a data model
|
Mark M. |
there's nothing "built in" for cursors, as an equivalent of CursorAdapter, but it's not too tough to write
|
Mark M. |
the only tricky thing is that a Cursor has internal state of what row the Cursor is "pointing" at
|
Mark M. |
so you need to make sure that you always move the cursor to the proper row before trying to read stuff from it
|
Jacek |
Okay, thanks for answear. Actually I've already written it, and it works quite well
|
Jacek |
My next question is about design patterns
|
Sep 3 | 9:25 AM |
Mark M. |
go ahead, though I may or may not be able to help with it
|
Jacek |
In toolbar I have Spinner which shows some options and has influence on Fragment's content
|
Jacek |
But Toolbar belongs to Activity
|
Jacek |
How can I keep loose coupling in such situations?
|
Jacek |
Should toolbar be modified by fragment or activity?
|
Mark M. |
off the cuff, knowing nothing more than what you have written here, I would say that the activity is the one that literally manages the Toolbar, but the fragment is the one driving the work
|
Mark M. |
where you have an API between the fragment and the activity for this coordination
|
Mark M. |
so, the fragment calls some setAvailableOptions() method it calls on the activity
|
Mark M. |
today, the activity happens to populate this Spinner
|
Mark M. |
but, perhaps in the future, you do something else (e.g., put those options in a nav drawer)
|
Mark M. |
the fragment provides high-level abstractions of the requirement ("the user should be able to choose among these things"), and the activity implements it
|
Sep 3 | 9:30 AM |
Mark M. |
the activity would sink the selection events from the Spinner and let the fragment know about them
|
Jacek |
So activity should implement some interface probably to fulfil fragment requirements
|
Mark M. |
if there's a chance that more than one activity might host the fragment, definitely
|
Mark M. |
it's less critical when there's only one possible hosting activity, though you might prefer the interfaces for cleanliness
|
Jacek |
Thanks for explanation, unfortunately those design overthinking usually kills my work :)
|
Jacek |
So thanks for your time and have a nice day
|
Mark M. |
you are very welcome
|
Jacek | has left the room |
Sep 3 | 9:45 AM |
Bryan | has entered the room |
Bryan |
Hello
|
Mark M. |
hello, Bryan!
|
Mark M. |
how can I help you today?
|
Bryan |
I have 3 questions (probably more)
|
Mark M. |
hopefully they're short -- we don't have a lot of time left in the chat
|
Mark M. |
but, fire away!
|
Bryan |
1) I just found out that you can decompile APK's fairly easily and see a lot of the code. I looked through your book but I didn't see anything about how to keep sensitive data (like api keys, etc) secure
|
Bryan |
any pointers?
|
Mark M. |
don't put them on the device
|
Mark M. |
by definition, if your code can use the data, somebody can get the data
|
Bryan |
so if you need your app to get information from your server without or before a user authenticates, how do you do that?
|
Mark M. |
however you would normally do it
|
Mark M. |
bearing in mind that the API key may be compromised
|
Mark M. |
this is no different than hitting a Web server using an API key from JavaScript in the browser
|
Mark M. |
you can use stuff like DexGuard to make it more difficult to get the API key
|
Bryan |
wow, ok. In a tutorial online about in app purchases, they give the key you need to use but tell you to create it from different strings to help "secure" it
|
Bryan |
do you know what they mean?
|
Bryan |
and how it helps?
|
Mark M. |
squirrel the API key in a few pieces in various spots in your app, then use string concatenation or similar algorithms to combine them
|
Sep 3 | 9:50 AM |
Mark M. |
akin to DexGuard, it adds a small amount of challenge to the API key retrieval process
|
Sep 3 | 9:50 AM |
Bryan |
Ok
|
Mark M. |
it won't stop a determined attacker
|
Bryan |
very interesting, ok, thank you!
|
Bryan |
2) To create a "lock screen" app, are those basically apps that put an activity on top of all other screens and have their own "unlock" features
|
Mark M. |
I have no idea
|
Mark M. |
I avoid the topic like the plague
|
Bryan |
lol, can you tell me why?
|
Bryan |
that will help inform my report
|
Mark M. |
as far as I am concerned, they are all malware
|
Mark M. |
at best, they weaken security
|
Bryan |
cool, thanks
|
Bryan |
3) What is an SDK vs a Library
|
Bryan |
in terms of developing one
|
Mark M. |
whether marketing got involved in the naming process
|
Bryan |
ha
|
Mark M. |
usually, an SDK *is* a library
|
Mark M. |
though there may be accompanying tools or something
|
Bryan |
I saw one difference is that an SDK has example code, etc in it as opposed to a library
|
Bryan |
true?
|
Mark M. |
no
|
Bryan |
ah, ok, can you give me an example of what an accompanying tool would look like?
|
Mark M. |
like all the ones in the Android SDK
|
Bryan |
ok, cool
|
Sep 3 | 9:55 AM |
Bryan |
lastly, are you going to be at the Big Android BBQ?
|
Mark M. |
no (either Austin or the Netherlands)
|
Bryan |
What is the Austin one?
|
Mark M. |
that's the original BBQ
|
Mark M. |
they extended to Europe this year
|
Bryan |
very cooll, are they having one in Austin this year too?
|
Mark M. |
though, now that I think about it, more recently the Texas one has been in the Dallas area
|
Mark M. |
it started in Austin IIRC
|
Bryan |
Yeah, it is in Hurst this hyear
|
Bryan |
ahhh
|
Mark M. |
yeah, it's been in Hurst for ~3 years
|
Mark M. |
sorry, short on sleep
|
Bryan |
no problem. So you are not going to be there in Oct?
|
Bryan |
just curuious
|
Bryan |
and curious
|
Mark M. |
no
|
Mark M. |
I attended the first Hurst one, 3(?) years ago
|
Bryan |
ahh well, thanks for the answers! Have a great day
|
Mark M. |
you are very welcome
|
Bryan |
oh, I had one more, have you tried Project Fi?
|
Mark M. |
no
|
Bryan |
Alright, thanks again!!
|
Sep 3 | 10:00 AM |
Mark M. |
and that's a wrap for today's chat
|
Mark M. |
the transcript will be posted to https://commonsware.com/office-hours/ shortly
|
Mark M. |
have a pleasant day!
|
Bryan | has left the room |
Mark M. | turned off guest access |