Wednesday, July 13, 2011

[android-developers] Re: Fading views after interaction stops for a time...

> So, my deep questions are: Is there a way to intercept the flow of
> messages to an activity at a lower layer than the touch events? If
> not, is there a way to intercept all of the touch events for a given
> view heirarchy so I can know for sure if the user is currently
> interacting with something?

I may have answered my main question by discovering that I can
override the dispatchTouchEvent method in my Activity. This gives me
events no matter what I'm interacting with. I just implemented:

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
Log.e("UI","dispatchTouchEvent");

mHandler.removeCallbacks(mTimeoutHandler);
mHandler.postDelayed(mTimeoutHandler, 2000);

return super.dispatchTouchEvent(ev);
}

With this I am able to postpone the timeout while the user is
interacting, indefinitely. Then two seconds after they let go of the
screen, the timeout handler gets called back and it will fade out the
buttons. That'll probably solve my issues for now. Is this solution a
bad one for some reason?

Cheers,

Neal

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate