Sep 28 | 9:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Sep 28 | 10:05 AM |
Evan | has entered the room |
Evan |
howdy, Mark
|
Mark M. |
howdy, Evan!
|
Mark M. |
how can I help you today?
|
Sep 28 | 10:10 AM |
Evan |
Mark, I'm having a good bit of trouble getting my SeekBar to take on the appearance that my designer has planned for me...
|
Sep 28 | 10:10 AM |
Mark M. |
those darn designers
|
Mark M. |
always making trouble
|
Mark M. |
:-)
|
Evan |
hahaha
|
Evan |
here's what it's supposed to look like: drop.io/mwqzswr
|
Mark M. |
eek
|
Evan |
i see that you can set a progress drawable, but
when i do that, it almost seems to override the other two states, and
thus void the purpose of having them explicitly defined...
|
Evan |
forget the magnifying glass ;-)
|
Mark M. |
oh, ok
|
Mark M. |
that was the source of the eek
|
Mark M. |
which "other two states" are you referring to?
|
Evan |
though that is a distant, unrelated question
|
Evan |
basically the unloaded and loaded, but not yet played states
|
Evan |
i know the "played" state is "progress"
|
Mark M. |
SeekBar doesn't know about "unloaded" and "loaded" and "not yet played"
|
Evan |
and I've changed the scrubber to look right, but it still seems to want to control how it is positioned, etc.
|
Mark M. |
I have successfully changed the colors on a ProgressBar, and SeekBar should follow the same pattern AFAIK
|
Mark M. |
<layer-list> XML drawable
|
Evan |
oh wow!
|
Mark M. |
android:id="@android:id/background" for the normal state
|
Evan |
really?
|
Sep 28 | 10:15 AM |
Mark M. |
android:id="@android:id/progress" for primary progress
|
Mark M. |
android:id="@android:id/secondaryProgress" for secondary progress
|
Evan |
ah--there's the distinction--primary and secondary progress
|
Mark M. |
right
|
Mark M. |
in my case, this was also for a video player
|
Evan |
cool--I'll try that out
|
Mark M. |
they used secondary progress for buffering, and primary progress for the playback position
|
Evan |
that'll be the same for my case
|
Mark M. |
in my case, the three layers were each <shape> drawables, with defined stroke, corners, and gradients
|
Mark M. |
this was for a consulting contract, so I can't give you the full file
|
Evan |
ah!
|
Evan |
i understand...
|
Evan |
so it is doable then...
|
Evan |
i've been having this history of thinking something is doable in an Android control, then having to write it myself
|
Evan |
like a horizontal list view
|
Mark M. |
a "horizontal list view" sounds a bit like Gallery
|
Evan |
now that magnifying glass--is anything like that even remotely doable in Android's framework?
|
Mark M. |
can you have a circle? yes
|
Evan |
it's a lot like gallery, except with some key behaviors changed
|
Mark M. |
can you have stuff inside a circle? yes
|
Mark M. |
can you have stuff inside a circle that represents
a magnified view of something else that would have been obscured by the
circle? eek
|
Evan |
but filling that circle with a zoomed-in version of the area around the scrubber?
|
Evan |
haha
|
Mark M. |
I have no idea how to pull that off
|
Mark M. |
it's not to say it's impossible, just that I haven't the foggiest notion even of where to start looking
|
Evan |
but ostensibly, the circle could be drawn to look a lot LIKE it is just a magnified version...
|
Sep 28 | 10:20 AM |
Mark M. |
well, if it weren't for the overlap with the SeekBar, yes
|
Mark M. |
I'm not even sure how the user uses what you have in that screenshot
|
Mark M. |
if you drag the thumb, does the magnified area move?
|
Evan |
hmm... so having it's visibility become visible when the seekbar is being dragged... no dice?
|
Mark M. |
and if so, what happens at the beginning and end, when the circle impacts the edges of the screen?
|
Evan |
that's the idea
|
Evan |
i would assume the edge outside the screen would just be clipped
|
Evan |
but that's a long can of worms that my designers are already not expecting me to do... so maybe on a rainy day or something
|
Mark M. |
well, having a circle become visible/invisible when the thumb is dragged should be possible
|
Mark M. |
yeah, and those worms have sharp pointy teeth
|
Evan |
so another question on selectable list items, and
representing the selection/focus state other than a drawable that is
painted over the entirety of the list item with some opacity...
|
Mark M. |
I have examples of that in The Busy Coder's Guide to Advanced Android Development
|
Evan |
oh really?
|
Mark M. |
on the whole, it's not a recommended technique, since it may confuse users
|
Evan |
hmm... i must have overlooked them
|
Mark M. |
chapter on ListView
|
Sep 28 | 10:25 AM |
Mark M. |
I should have the Flying Fickle Finger of Fate example, using a hand to point at the selected item
|
Evan | |
Evan |
that blue background is the "pressed" state
|
Mark M. |
pressed?
|
Evan |
whereas a green background in the same place would be the focused state
|
Evan |
like if the user presses the middle directional button to "select" that list item
|
Mark M. |
no, that's the "selected" state
|
Mark M. |
not sure if "pressed" is used in ListView
|
Mark M. |
I see that mostly on Button/ImageButton
|
Evan |
oh really?
|
Evan |
so that distinction is actually quite important in getting this to work right?
|
Mark M. |
getting the state right is important, yes
|
Evan |
either way you say there is an example in the BCGAAD?
|
Mark M. | |
Mark M. |
first, the link above is for ColorStateList, but it lists all of the possible states
|
Mark M. |
with regard to BCGAAD, I have an example of using
an OnSelectionChanged listener to adjust row Views to show the current
selection
|
Mark M. |
it'd be better if you could get it working with StateListDrawable/ColorStateList and states, but my technique generally works
|
Evan |
and that technique is mentioned in BCGAAD?
|
Mark M. |
the OnSelectionChanged approach, yes
|
Mark M. |
there is some light hand-waving regarding StateListDrawale and ColorStateList, but not much
|
Mark M. |
need to beef that up someday
|
Evan |
but not the StateListDrawable/ColorStateList approach
|
Evan |
ah gotcha
|
Evan |
just knowing that it is doable gives me the steam to move forward
|
Sep 28 | 10:30 AM |
Will T. | has entered the room |
Mark M. |
howdy, Will T!
|
Mark M. |
Will: got a question?
|
Evan |
i have another one whenever i have the floor again... (let Will go first though)
|
Will T. |
Hi Mark, you responded to a Stack Overflow question I had last night (http://stackoverflow.com/questions/3810480…)
with something I though I had tried (just overriding the view with a
ListView). The problem was overriding the Adapter to handle the enabling
and disabling. What am I misunderstanding?
|
Will T. |
Thanks Evan...
|
Mark M. |
you should not need to override the adapter
|
Sep 28 | 10:35 AM |
Mark M. |
ListView in CHOICE_MODE_MULTIPLE stores the checked states itself
|
Mark M. |
you need to use a layout with a CheckedTextView
|
Will T. |
I understand that and have seen it. My problem seems to be when I try to limit how many are checked.
|
Mark M. |
use setItemChecked() to pre-check anything
|
Mark M. |
oh
|
Mark M. |
oops
|
Will T. |
Ah, that is probably what I missed
|
Mark M. |
more, I missed that in your question
|
Will T. |
ok
|
Mark M. |
alas, there's no event on a check
|
Mark M. |
which stinks
|
Mark M. |
so, yeah, you're probably going to have to reinvent the checked-item wheel
|
Will T. |
which is why I went the harder way and created a
child of ListView to handle the adapter. That way in the isEnabled I
could do my checking
|
Mark M. |
isEnabled() has nothing to do with checkboxes, though
|
Will T. |
But when I mark one of the checkboxes as checked in isEnabled, it does not stick
|
Mark M. |
that indicates whether the row itself is clickable
|
Evan |
howcome Mark's answer isn't on that stackoverflow page?
|
Mark M. |
Evan: it was a comment
|
Evan |
oh
|
Mark M. |
Will: you might want to take a peek at The Busy Coder's Guide to Android Development, in the Fancy ListViews chapter
|
Mark M. |
I show there how to have a RatingBar in rows of a ListView
|
Will T. |
I started there... :)
|
Mark M. |
the same technique should work for you with CheckBox widgets
|
Will T. |
Do I need to do something in:
|
Will T. |
View paste
|
Mark M. |
only if you want to toggle the checkbox if they click on the row itself
|
Mark M. |
you need to hook up OnCheckChanged listeners on each checkbox
|
Sep 28 | 10:40 AM |
Will T. |
Should I manage my enabling & disabling there, instead of in isEnabled?
|
Mark M. |
yes
|
Will T. |
ooooh! that sounds nasty
|
Mark M. |
yeah, well
|
Mark M. |
I never promised you a rose garden
|
Will T. |
ok, if that is the way, that is what I have to do. <shrug>
|
Will T. |
Thanks!
|
Will T. |
:)
|
Mark M. |
isEnabled() could conceivably work, but I don't think it will get called when you need it called, that's all
|
Will T. |
its getting called but changes I make in it are not reflected
|
Mark M. |
and, isEnabled() would probably need to enable/disable the checkbox as well
|
Will T. |
that is what I was trying but the checks don't stick when I set them there
|
Mark M. |
define "don't stick"
|
Will T. |
If something is checked on the UI. It does not
remain checked after the isEnabled code runs. That was true before I
decided to try to "reset" it in isEnabled which is what the code is
currently doing.
|
Will T. |
When I return to the UI the checkbox is not checked
|
Mark M. |
oh, well, there are problems in your code :-(
|
Mark M. |
you can't go by the checkboxes to determine what is checked
|
Mark M. |
checkboxes get recycled
|
Mark M. |
you need to be storing the checked states in your data model
|
Will T. |
ok
|
Mark M. |
again, I refer you to the RateList sample from The Busy Coder's Guide to Android Development
|
Will T. |
I'll double check what I missed from the sample
|
Will T. |
Thanks, again
|
Sep 28 | 10:45 AM |
Will T. |
Is there a way to copy the conversation?
|
Mark M. |
I'll be posting a link to the transcript on the [cw-android] Google Group after the chat is over
|
Will T. |
ok, great!
|
Mark M. |
Evan: you had another question?
|
Evan |
yeeessss
|
Frank S. | has entered the room |
Frank S. |
Hi Mark. Thanks for the email
|
Evan |
alright, so I've got this control that is essentially a LinearLayout that I'm adding children to (as a "Stack")
|
Mark M. |
howdy, Frank S!
|
Evan |
and I call methods that update result in updates to the child widget list (as in how many children are in it) fairly frequently
|
Evan |
it seems though that the changes are not taking effect, randomly
|
Evan |
I'll add widgets to it, and despite giving them the proper layout params (which ive verified while debugging)
|
Evan |
their width and height are 0
|
Evan |
and this is despite calls to requestLayout() and invalidate() on various parts of that hierarchy...
|
Evan |
is there some minutiae I am overlooking here?
|
Mark M. |
tough to answer that
|
Mark M. |
you might consider using hierarchyviewer to help debug
|
Evan |
am I maybe hitting some weird throttling mechanism I didn't know existed?
|
Mark M. |
"throttling"?
|
Sep 28 | 10:50 AM |
Mark M. |
bear in mind that you can't find out the width and height until the widgets are laid out on the screen
|
Evan |
right, and they're not getting laid out
|
Mark M. |
so, if the width and height are physically correct
(according to hierarchyviewer), but you cannot access the values from
code, you're asking too early
|
Mark M. |
ok
|
Evan |
i've verified that i've added them, and everything has wrap_content
|
Mark M. |
then break open hierarchyviewer, double-check your
rules, and figure out who is eating the space, or if there's another
problem (e.g., you're invisible, you're behind something else)
|
Evan |
interesting... never heard of that
|
Evan |
HierarchyViewer
|
Mark M. | |
Mark M. |
covered in the Development Tools chapter of The Busy Coder's Guide to Android Development
|
Evan |
ah... must have overlooked that part!
|
Evan |
;-)
|
Evan |
thanks!
|
Mark M. |
Frank: did you have a question?
|
Frank S. |
yes
|
Frank S. |
what do you feel is the best way to create a pdf of the current screen
|
Frank S. |
we basically want to take a screen shot and convert that into a pdf
|
Frank S. |
but I believe that screen res will play a negative part in that process
|
Mark M. |
open DDMS, take a screenshot, open that in some image viewer, and print to PDF
|
Mark M. |
with some Java coding, you could create a tool to run on the desktop that would automate some of that
|
Frank S. |
that will not be an option. We need to do this programatically and without root access
|
Mark M. |
if you are looking for it to run on the device, you're out of luck
|
Mark M. |
not possible
|
Frank S. |
it there something we can do to generate a pdf
|
Sep 28 | 10:55 AM |
Frank S. |
like reconstrust the views and layout and object
|
Frank S. |
and just convert that into a pdf
|
Mark M. |
that depends on how many developer-months you have
|
Mark M. |
for example, you could try to leverage the preview pane from Ecipse
|
Mark M. |
er, Eclipse
|
Mark M. |
however, that has limits, particularly with custom widgets
|
Mark M. |
and, that too does not run on the device
|
Frank S. |
it doesn't have to be the current screen since we already have the information populating all the field.
|
Frank S. |
no. it needs to run on the device. We are working on a banking app
|
Mark M. |
if this is your own activity, there is a way to
get an image of what you have drawn -- I was thinking you were trying to
get the images of other activities
|
Frank S. |
to write checks
|
Mark M. |
what does that have to do with screenshots and PDFs?
|
Frank S. |
the screen shot is the current view of the check
|
Mark M. |
so?
|
Frank S. |
we want to generate a pdf of the current screen
|
Frank S. |
because that will be the "check"
|
Mark M. |
that makes no sense
|
Frank S. |
That will work, because this will be our own activity
|
Mark M. |
you already have an image of the check
|
Mark M. |
that's what you are showing on the screen
|
Mark M. |
why are you taking a screenshot of an image you already have?
|
Frank S. |
The screen is displaying our generate check will all the information
|
Mark M. |
oh
|
Frank S. |
no. that was my question I guess
|
Frank S. |
we can generate an image to convert to a pdf from what we were displaying on the screen
|
Sep 28 | 11:00 AM |
Mark M. |
you might be able to use getDrawingCache() to get a Bitmap from your base View
|
Frank S. |
ok great. That gives us a nice place to start plugging away
|
Mark M. |
rather than generate the PDF on-device, though, I suspect you may want to have a server do that
|
Mark M. |
might be slow
|
Mark M. |
or, just send all the details to the server, and have it generate the PDF
|
Mark M. |
skipping the screenshot
|
Mark M. |
OK, that wraps up the chat for today
|
Frank S. |
point taken. We will test this. Since banking information is sensitive we were trying to avoid as much as possible
|
Frank S. |
thanks mark
|
Mark M. |
next one is Thursday, in the evening US Eastern Time
|
Mark M. |
have a pleasant day, all!
|
Evan | has left the room |
Will T. | has left the room |
Frank S. | has left the room |
Mark M. | turned off guest access |