Office Hours — Today, April 17

Thursday, April 12

Apr 17
3:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
Ed T.
has entered the room
Ed T.
Hi Mark
Mark M.
hello, Ed!
how can I help you today?
Ed T.
I have two 'widgets' in an event storm....
more or less
4:00 PM
Ed T.
I'm used to doing something like this... with text widgets... .removeTextChangedListener(this);
Mark M.
um, I'm not sure what an "event storm" is
Ed T.
call back events are stomping on each other
I've got two paths a user can do input
one via a percentage slider
and another via direct text edit
seekbar slider
is there a clean way to make a widget not react to changes without nuking the listener?
does that question even make sense
Mark M.
have a smarter listener, perhaps
Ed T.
Mark M.
otherwise, no
if the problem is that the listener is doing something that you don't want done in all situations, encode that logic in the listener
(or in something that the listener invokes, such as a method on your controller/presenter/whatever)
Ed T.
imagine you have the famous TIP application
you can move a slider
that updates the TextEdit field
or you can directly edit the TextEdit field
I need them to be "in sync"
4:05 PM
Ed T.
so the slider can change the text amount
and the text amount can change the slider
I'll just add a flag to short circuit the listener
so much for MVC
I'm use to updating a model
then when I'm doing firing a listener or telling an adapter... to update it's views or fire listeners
Mark M.
I guess that I don't really understand the problem, other than perhaps figuring out the simplest way to implement "debounce" logic with the EditText, so you only update the SeekBar after the user is done typing
Ed T.
the seekbar is at the top
it works fine
the issue happens on the EditText value change
not smooth
flicker and some other odd behaviors
but that is what is causing it
Mark M.
are you attempting to update the SeekBar on every text change?
IOW, for every character typed (or deleted), you try to update the SeekBar immediately?
4:10 PM
Ed T.
so imagine that application where you put in an Amount
then a slider for the TIP
moving seekbar changes tip amount as well as shows percentage
then you can also directly edit the tip amount
Mark M.
only update the SeekBar after the user is done typing
Ed T.
doing that would update the SeekBar
Mark M.
where "done typing" is determined by "have not received a new text-change event after X milliseconds", for some value of X that works for you via experimentation (e.g., 500)
if you happen to be using RxJava, Jake Wharton's RxBinding stuff makes adding this "debounce" logic fairly easy, as I understand it
Ed T.
Thanks Mark
4:15 PM
Mark M.
which is a SeekBar/EditText combination widget
or, examine that library's code and see how it handles debounce
4:30 PM
Ed T.
has left the room
4:55 PM
Mark M.
turned off guest access

Thursday, April 12


Office Hours

People in this transcript

  • Ed Tidwell
  • Mark Murphy