Nov 11 | 3:50 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Nov 11 | 3:55 PM |
Chaitanya R. | has entered the room |
Mark M. |
howdy, Chaitanya!
|
Chaitanya R. |
hello
|
Mark M. |
how can I help you today?
|
Chaitanya R. |
hi Mark
|
Chaitanya R. |
well this is my first time trying out the office hours
|
Chaitanya R. |
I don't know the scope of the questions, but I thought I'd try one
|
Chaitanya R. |
I was implementing a CWAC today
|
Chaitanya R. |
ViewSwiper
|
Chaitanya R. |
and noticed a large time difference between my swipe gesture and the actual view flip
|
Mark M. |
well, the flip will not begin until the gesture is complete
|
Mark M. |
that is inherent in the way GestureDetector works
|
Chaitanya R. |
yes, I did mean the time difference from the point I finish my swipe. it takes a full second or more to flip
|
Mark M. |
what are the views you are flipping between?
|
Nov 11 | 4:00 PM |
Mark M. |
in other words, what are the immediate children of the ViewSwiper?
|
Chaitanya R. |
previously I had implemented viewFlipper with a
custom GestureListener. Admittedly that had a slight lag too...around
0.5 seconds.
|
Chaitanya R. |
there are 3 grid views of 12 icons each
|
Mark M. |
what you are probably seeing is the time to render all that
|
Mark M. |
particularly depending on how the icons are being handled, that could be a bit slow
|
Mark M. |
you might consider using Traceview to get a firmer grasp on where the time is being spent
|
Chaitanya R. |
thank you, i'll give that a try
|
Mark M. |
also, long term, you should probably consider
ViewPager from the Android Support package (formerly known as the
Android Compatibility Library)
|
Chaitanya R. |
on the same topic, I think I should try to implement ViewPager to have an immediate effect
|
Mark M. |
that is the long-term direction for horizontal-swipes-to-move-between-things
|
Chaitanya R. |
haha yes
|
Mark M. |
I need to cover ViewPager sometime soonish
|
Chaitanya R. |
that would be very helpful indeed
|
Chaitanya R. |
well thank you for your time Mark. have a good weekend
|
Mark M. |
you too!
|
Chaitanya R. | has left the room |
Nov 11 | 4:05 PM |
Adam W. | has entered the room |
Mark M. |
howdy, Adam!
|
Adam W. |
Hi Mark!
|
Mark M. |
how can I help you today?
|
Adam W. |
I have a concept-y question about Fragments and being properly modular.
|
Adam W. |
I'm working on an application that seems to have a clear architecture when I think about it using Activities.
|
Adam W. |
For example, one part involves editing text.
|
Adam W. |
If a user wants to use a different text editor for that part, it's easy to do so.
|
Nov 11 | 4:10 PM |
Adam W. |
I don't do anything special as a programmer to enable that.
|
Adam W. |
If they want to use a different part for
"processing the text", as long as the other programmer looks at my
intents/documentation, they can make something that drops right in.
|
Adam W. |
However, I seem to get lost thinking about it using Fragments.
|
Mark M. |
if you want to have that sort of drop-in
replaceability (is replaceability a word?), you will continue to have
activities be your interface
|
Mark M. |
fragments are simply an organizational tool to help you make a single code base support multiple screen sizes
|
Adam W. |
One thing I was thinking of doing was making an
activity for each conceptual piece, and then making a "jumbo activity"
that looks nice on big screens.
|
Adam W. |
On phones, it would work nearly exactly the same
as it does now, but using fragments would possibly make it easier for me
to make the "tabletactivity"
|
Mark M. |
yes
|
Adam W. |
Awesome. I'm not too far off the mark then.
|
Mark M. |
however, you can't embed a third-party activity as a fragment in some activity of yours
|
Mark M. |
if your text-editing portion would be a full-screen activity regardless of screen size, you can stick with your existing plan
|
Nov 11 | 4:15 PM |
Mark M. |
if, however, your text-editing portion would
logically be only part of a screen on a tablet (e.g., to the right of a
ListFragment), then you will be stuck with solely your own text-editing
solution
|
Nov 11 | 4:15 PM |
Adam W. |
Would it be wrong to have an option for tablets to
force the "loosely coupled activities" from happening, as compared to
the integrated activity that has a bunch of fragments?
|
Mark M. |
um, I didn't follow that
|
Adam W. |
On phones, I plan on using fragments, but with most activities only having one fragment.
|
Mark M. |
makes sense
|
Adam W. |
If I don't do anything special, the same thing will happen on a tablet.
|
Mark M. |
well, the point of bothering with fragments in the first place will be do something special
|
Mark M. |
e.g., load a layout with multiple fragments in it
|
Adam W. |
However, most nice Android 3+ applications will
watch for the larger screens, and change the layout so I can reuse those
fragments and show more than one.
|
Mark M. |
right
|
Adam W. |
The downside for my application of the "more than
one fragment screen" is that it isn't as easy for third parties to
integrate themselves in.
|
Mark M. |
also right
|
Nov 11 | 4:20 PM |
Adam W. |
I suppose I could offer the option to users to not use that "more than one fragment screen"
|
Mark M. |
in principle, yes
|
Mark M. |
you have to ask yourself whether the resulting UX will be worth it
|
Adam W. |
Yeah. If I expect that to be common, I might as well ignore fragments all together.
|
Mark M. |
at least for that area of the app
|
Adam W. |
Is this something that other people are wondering about?
|
Mark M. |
integration like you're aiming for is an under-utilized feature of Android
|
Mark M. |
dealing with tablet screen sizes is an under-utilized feature of Android, though growing
|
Mark M. |
hence, the intersection of those two is not that popular
|
Adam W. |
ha
|
Adam W. |
understood
|
Mark M. |
in an ideal world, this would be a bigger problem, strange as that sounds
|
Adam W. |
I've written a few apps, not many, and never had a use for the loose-integration stuff I'm doing with this one
|
Adam W. |
but this one is unique with the ones I've written in that it has an "open workflow"
|
Adam W. |
and the intent system seems to be a really powerful way to allow the entire community to do what they want
|
Adam W. |
Alright, I think that's it. Thanks!
|
Mark M. |
happy to help!
|
Nov 11 | 4:25 PM |
David R. | has entered the room |
David R. |
Hi all
|
Mark M. |
howdy, David!
|
Nov 11 | 4:30 PM |
David R. |
I've got another question for you.
|
Mark M. |
go right aehad
|
Mark M. |
er, ahead
|
David R. |
Lets say I have a library that someone is building
with their project. Is there anyway to get the application Context and
the top viewgroup without passing information to the library?
|
Mark M. |
not really
|
Mark M. |
there's absolutely no way to arbitrarily get views, such as the top ViewGroup
|
Mark M. |
some people are creating true singletons out of
the Application singleton (i.e., static data member to access the
instance), though I'm a trifle nervous about that
|
Mark M. |
(no solid reason for the nervousness, just a feeling)
|
David R. |
Hmm, I have been passing the ViewGroup to my library and looping though them all using .getparent until I get the WindowDecor.
|
David R. |
But I was trying to find a different way.
|
Mark M. |
well, there's an ID for that, though I forget it off the top of my head
|
David R. |
android.R.id.context
|
David R. |
or content
|
David R. |
I cant remember either off the top of my head.
|
Mark M. |
yeah, I think it's content
|
Nov 11 | 4:35 PM |
Mark M. |
given the Activity, findViewById(android.R.id.content) gives you the DecorView
|
David R. |
Yeah, but calling (ViewGroup)findViewById(android.R.id.content); doesn't work inside the activity.
|
Mark M. |
however, you can't get it from an Application
|
David R. |
Always returns null.
|
Mark M. |
you'd have to wait until after setContentView()
|
David R. |
Ah,
|
scottt | has entered the room |
David R. |
Well since my library doesn't really display anything I never call setContentView().
|
Mark M. |
howdy, scottt!
|
scottt |
hello! no questions today; just lurking.
|
Mark M. |
then don't call your library until after setContentView()
|
Mark M. |
or something like that
|
David R. |
It is being called after the activity setContentView();
|
David R. |
oh well.
|
Mark M. |
I would expect that to work
|
Mark M. |
FWIW, here's a sample project where I use android.R.id.content: https://github.com/commonsguy/cw-advandroi…
|
Mark M. |
it's a sample from the next edition of the
Advanced Android book, showing how to use setRetainInstance(true) with
dynamic fragments for maintaining state across configuration changes
|
David R. |
My last question is, do you know if it is possible
to have a button/menu "float" above the application that the library is
part of.
|
David R. |
ohhh
|
Mark M. |
well, that's really the application's job
|
Mark M. |
the library has no way to know where it might be safe to display something
|
David R. |
hmm
|
Nov 11 | 4:40 PM |
David R. |
Alright thanks.
|
Mark M. |
if anyone has any questions, chime in
|
scottt |
he he, i'm finalizing a contract for my first
non-trivial professional android dev gig. it's basically tweaking and
production-izing a mostly-done system and perhaps staying around to
manage on-going dev
|
Mark M. |
congrats!
|
David R. |
Mark, does each activity have its own Window Decor?
|
scottt |
thanks!
|
Mark M. |
beats me
|
David R. |
DecorView I should say
|
David R. |
hmm
|
Nov 11 | 4:45 PM |
Mark M. |
off the cuff, my guess is "yes", but I've never
examined them that way, and I'm not sure I would rely upon whatever the
current behavior is
|
David R. |
I'm not relying on it yet, just been testing it all out.
|
David R. |
Using TapJacking to send all motionevents to the library in the application and send back the information.
|
David R. |
Trying to allow it to record the interaction for testing applications.
|
Mark M. |
oh, wait, this is your testing library
|
David R. |
Cant figure out how to stop/start the recording.
|
David R. |
Thats why I thought of the floating menu.
|
David R. |
Yes this is my testing library.
|
Mark M. |
well, the problem there is -- what if the menu is above something that needs to be tested?
|
David R. |
Well, I am going to have it either A.) Be moving
able B.) Allow you to like pull it and have it flip from being on the
bottom to being on the top.
|
David R. |
Question is though, how to I keep it on the screen.
|
David R. |
I tried to do it in the tapjacking service but that didn't work at all.
|
Mark M. |
actually, that would appear to be the right answer, though
|
Mark M. |
what didn't work with that approach?
|
David R. |
How would you do it though TapJacking?
|
Mark M. |
Tapjacking involves adding a View to the Window
|
Nov 11 | 4:50 PM |
Mark M. |
most tapjacking involves that being transparent
|
Mark M. |
it doesn't have to be
|
David R. |
Well when I could click a box or somthing that I had drawn on the tapjacking layout it wouldn't notice that it was a button.
|
Mark M. |
right
|
Mark M. |
and, AFAIK, it doesn't have to be just a plain View
|
Mark M. |
though I haven't tried anything else (e.g., RelativeLayout holding a Button that would be your toggle)
|
David R. |
Hmm I tried that but I couldn't get the button listener to get any hits.
|
Mark M. |
if you tried an OnClickListener, that's not surprising
|
David R. |
Well not the relativelayout but I did inflate a button on the view.
|
Mark M. |
it won't respond as a normal widget AFAIK
|
Mark M. |
but touch events should register
|
Mark M. |
just as they do on the transparent tapjacking view
|
David R. |
What, just in the touchEvent test to see if that area was touched
|
Mark M. |
right
|
David R. |
Yeah I guess that is one way.
|
David R. |
Sweet thanks, that a good idea.
|
David R. |
Would I be able to use an xml layout to draw it?
|
Mark M. |
I haven't tried using a LayoutInflater from a service that way
|
Mark M. |
you can try it, but it might not work
|
David R. |
I'll give it a shot.
|
Nov 11 | 4:55 PM |
David R. |
Thank you Mark!
|
Mark M. |
happy to help!
|
Mark M. |
we're running low on time -- any other questions?
|
David R. |
No I am good thank you.
|
scottt |
What's the meaning of life?
|
Mark M. |
life has no meaning, because life is merely a breakfast cereal, or possibly a board game
|
scottt |
lol! i was expecting "42"
|
Mark M. |
no, that's how many roads must a man walk down
|
scottt |
later, everyone
|
Nov 11 | 5:00 PM |
scottt |
(btw, i'm going to steal that response)
|
Mark M. |
you're welcome to it
|
Mark M. |
have a pleasant weekend, all!
|
scottt |
u2
|
scottt | has left the room |
Adam W. | has left the room |
David R. | has left the room |
Mark M. | turned off guest access |