Aug 5 | 8:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Damian | has entered the room |
Mark M. |
hello Damian!
|
Mark M. |
how can I help you today?
|
Damian |
Hi Mark
|
Damian |
I was going to ask you about animations. Give me some time to write a proper question, please
|
Aug 5 | 9:00 AM |
Damian |
I would like to create a layout with ListView, where first item is special. Initially, special item will be bigger presenting an image, when user scroll down first item smoothly change into regular item. When it is collapsed to regular item view, the list view scroll further normal way. Scrolling up should revert transition. How would you proceed with this?
|
Mark M. |
I have absolutely no idea
|
Damian |
:)
|
Mark M. |
it's possible there is an existing library that offers this sort of "hero element" aspect
|
Mark M. |
if there is, I'd use it
|
Damian |
ok, i will look for it
|
Damian |
by the way, did you try RecycleView from support library?
|
Mark M. |
I have not yet played with it
|
Mark M. |
from all reports, it is rather skeletal
|
Mark M. |
requiring lots of additional code to get anywhere
|
Aug 5 | 9:05 AM |
Mark M. |
(at least, for some definition of "lots")
|
Damian |
true, that's my opinion too
|
Mark M. |
my focus this month is on getting my book moved over to cover Android Studio
|
Mark M. |
that, and some camera library updates, are consuming all my time
|
Mark M. |
I won't be poking at "L" too much until late this month, at best
|
Mark M. |
so, RecyclerView is probably going to be a Very Good Thing over time
|
Damian |
do you think there will be beta release of L before offical release?
|
Mark M. |
possibly
|
Mark M. |
there were hints that Google might do that, when this was all discussed at I|O
|
Mark M. |
most of the screams of anguish appear to be tools-related (e.g., can't build for L and test on older environments)
|
Mark M. |
that would seem to lessen any extrinsic pressure for a beta
|
Mark M. |
it may be that they are adding enough new stuff than an L2 will be warranted
|
Mark M. |
but I wouldn't be surprised if what we have is all we get before the next Android release
|
Mark M. |
considering that it's more than we normally get before an upcoming release
|
Damian |
another question just come to my mind, there is a lot of talk recently regarding Card UI, there is also new Cards view from Google. Is it not just another pattern? Why would they create separate view for that?
|
Mark M. |
mostly for the drop-shadow backport, as I understand it
|
Aug 5 | 9:10 AM |
Mark M. |
on "L", that's all being handled natively in the GPU, as I understand it
|
Mark M. |
but CardView will provide a similar, if not as slick, shadow on older devices
|
Mark M. |
given the library name, the backport should work to API Level 7
|
Mark M. |
the whole elevation-and-shadow thing is a big part of Material Design (motto: We Change Our Design Instructions More Frequently Than We Change Our Socks)
|
Damian |
i see, so in the future I could is it once and it will work nicely on older versions, instead handling version prior to L with additional if statements
|
Mark M. |
yes
|
Mark M. |
basically, the if statements are baked into the CardView
|
Damian |
I like new Design but i am worried that my code will get messy, probably Google will not provide support for all aspect of that design, there will be similar situation like with ActionBar for example
|
Mark M. |
agreed
|
Aug 5 | 9:15 AM |
Mark M. |
though the picture should become a bit clearer once "L" turns into Android 5.0 (or whatever number they use)
|
ming | has entered the room |
Damian |
I prefer wait longer for L release but get it with full backport for older versions
|
Mark M. |
hello, ming!
|
ming |
HI MARK IM SO EXCITED!! ALL CAPS :D
|
Mark M. |
Damian: I am not certain that the availability of a backport is necessarily tied to "L"'s ship date
|
Mark M. |
Damian: let me take a question from ming, and I'll be back with you in a bit
|
Mark M. |
ming: it's your turn! do you have a question?
|
ming |
yes, i have a question about fragment and backstack
|
ming |
so I have activity A that is hosting fragment A
|
Damian |
I have to leave now, my daily meeting starts in 3 min. Thanks for talking, bye
|
ming |
inside fragment A, i have a take picture button, it invokes the camera app, capture the picutre, and save it inside the PICTURES file
|
Mark M. |
Damian: see you later!
|
ming |
once it finishes the task, it returns to the fragment A and sets a preview which is an imageview that was not visible until the image is captured
|
ming |
now i hit back button, go back in to the fragment A, the preview image is gone.
|
Aug 5 | 9:20 AM |
ming |
I want it to show the preview image, i tried setInstanceState(true) but it does not work
|
Mark M. |
if the user pressed BACK, there is no instance state to save, as the instance is being destroyed
|
Mark M. |
you will need to consider that the photo you took is part of your model data
|
Mark M. |
and when the activity and fragment are created, see if the image is available, then use it if it is
|
ming |
where do i save it?
|
ming |
do i save it in onSaveInstanceState()?
|
Mark M. |
no
|
Mark M. |
you already saved it
|
Mark M. |
"save it inside the PICTURES file"
|
ming |
oh yes, the actual image is saved but the uri is not saved
|
ming |
i dont want to save it to database, since the preview is only supposed to show the last image taken
|
Aug 5 | 9:25 AM |
Mark M. |
:: shrug ::
|
Mark M. |
I cannot really help you with your business logic
|
ming |
..............ok
|
ming |
I always come up with some weird ideas...
|
Mark M. |
the biggest question, from a core implementation standpoint, is how long you need to remember about the "last image taken"
|
Mark M. |
let's suppose the user runs your app and takes a picture
|
Mark M. |
then the user leaves your app via BACK, as you described
|
Mark M. |
hours pass
|
Mark M. |
your process is terminated to free up memory for other apps
|
Mark M. |
then the user returns to your app and brings up fragment A again
|
Mark M. |
should you be showing the "last image taken" to the user in this case?
|
ming |
hmm, i guess not hours
|
ming |
minutes probably
|
Mark M. |
OK
|
ming |
since I want to preserve the state for user if they hit back button accidently
|
Mark M. |
in that case, you will probably wind up keeping a lastImageTaken static data member
|
Mark M. |
if that static data member is null, you start over from scratch
|
Mark M. |
if that static data member is not null, that's your Uri of the last picture taken, and you use it
|
Mark M. |
this means that you will remember the last picture taken only so long as your process is around
|
ming |
how does "static" make a difference
|
Aug 5 | 9:30 AM |
Mark M. |
your fragment and activity are being destroyed
|
Damian | has left the room |
Mark M. |
which means either you are caching this data in global scope (i.e., static in Java) or you are writing it to disk
|
Mark M. |
you cannot just save the data in a non-static data member of the activity or fragment, as they are being destroyed and will no longer be relevant
|
Mark M. |
BTW, I am assuming that the activity is being destroyed upon pressing the BACK button, as you did not indicate that the activity has any content other than the fragment
|
ming |
yes
|
Aug 5 | 9:45 AM |
ming |
i gtg now
|
ming |
Thanks a lot!!!! See you next time!
|
Mark M. |
have a pleasant day!
|
ming |
you too thank you !
|
Damian | has entered the room |
Mark M. |
hello again, Damian!
|
Mark M. |
do you have another question?
|
Damian |
hi
|
Damian |
yes
|
Damian |
are you planning to add to your book chapter about AsyncAdapter?
|
Mark M. |
AsyncAdapter?
|
Aug 5 | 9:50 AM |
Mark M. |
there's nothing by that name in the Android SDK
|
Mark M. |
is this some library?
|
Mark M. |
or do you mean SyncAdapter?
|
Damian |
sorry, yes SyncAdapter
|
Mark M. |
yes, I hope to cover it by the end of the year
|
Mark M. |
assuming that I can work out some implementation of it that is not inextricably tied to the AccountAuthenticator system
|
Mark M. |
or at least does not require a pile of icky permissions
|
Damian |
great, I like to see your point of view
|
Damian |
recently I have went through video training from Udacity by Google, have you seen it?
|
Mark M. |
I know of it
|
Mark M. |
I haven't watched any of it
|
Damian |
it' really well prepared, I have to watch last part about SyncAdapter :)
|
Aug 5 | 9:55 AM |
Damian |
by the way, I am wondering how do you find time for learning all this stuff, writing book, running webinars and writing answers on stackoverflow :)
|
Mark M. |
well, that's my job
|
Damian |
time is running out, i will stop asking :) thanks again for talking, can't wait to see your opinion about SyncAdapter
|
Damian |
bye
|
Mark M. |
the chat transcript will be posted to http://commonsware.com/office-hours/ shortly
|
Damian | has left the room |
ming | has left the room |
Mark M. | turned off guest access |