[android-developers] Re: Intercept/override context menu on EditText long-press?

2011-04-24 Thread Keith Wiley
We're talking around each other a little bit as the posts interweave.
Reading the thread in post order will come off needlessly
argumentative in posterity.  Unless I find that my solution is not
working as expected, I'm declared peace made.

Cheers!

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Intercept/override context menu on EditText long-press?

2011-04-24 Thread Keith Wiley
On Apr 24, 5:00 pm, Mark Murphy  wrote:
> On Sun, Apr 24, 2011 at 7:49 PM, Keith Wiley  wrote:
> > ...and to wrap up the philosophical argument that this thread
> > unintentionally flared, I really don't see why double or triple tap
> > long presses should be expected to exhibit redundant behavior with
> > that of single tap long presses.
>
> That seems reasonable. Your opening line of the thread ("I want to
> intercept an EditText long-press and do something with it other than
> present a contextual menu") didn't explain that,

I admit, I did not qualify my question with much backround.

> BTW, just so I'm on the right page: a double-tap long-press would be
> tap + long-press? And triple-tap long-press is tap + tap + long-press?

Yes, precisely.  Double-tap long-press in my lingo is down-up-dooown.
Triple is down-up-down-up-dooown.  I used similar actions for a
different app almost a year and a half ago (WildSpectra) but they
weren't on an EditText, they were just on a custom view, so the
context menu issue never came up before.

Regarding the actual solution, unless I have mistaken what I am
seeing, it does look like my solution works: override
showContextMenu().

Cheers!

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Intercept/override context menu on EditText long-press?

2011-04-24 Thread Keith Wiley
On Apr 24, 4:38 pm, Mark Murphy  wrote:
> On Sun, Apr 24, 2011 at 6:36 PM, Keith Wiley  wrote:

> You have all this stuff for every other touch operation known to
> humanity, apparently, yet you can't just leave the long-press alone to
> do what an EditText is supposed to do on a long-press? Why not move
> your long-press functions to a quadruple tap or something? What is
> so magical about you hacking a long-press that is worth
> breaking the existing expectations of the users?

It sounds like you didn't understand my problem.  The contextual menu
was being triggered on the double and trip tap long presses also.
That was fundamental to my problem.  I couldn't prevent it from
happening under reasonable circumstances.  That was what I needed help
with.

> You assume that I am here exclusively to help you. I am also here to
> put opinions in the record for those who read this thread in the
> future (e.g., via a search). I don't want developers thinking that
> messing with system menus is a good idea.

Well, I understand that, but you didn't do both.  You didn't make a
clear philosophical argument and then explain how to achieve the
technical goal of a double-tap long press that does not trigger a
contextual menu.  You stopped half way through.  That was frustrating
from my point of view.

I take your point about the single-tap long press.  I will either
forcibly prevent it from being over-rided in my UI configuration
settings or I will accompany with red flashing alarm-bell associated
warnings that it should only be done if the user is certain they know
what they are doing (I hate telling genuine power users that they
can't do what they want, I love configured UIs to my own nuanced
behaviors, it's the same reason my trackball has gazillions of DOF on
it).  I had already put in a warning message when overriding the long-
press command but you have my thinking that I should make the warning
more aggressive now...or perhaps even lock it out entirely just for
the sake of conformity.  I'll take it under consideration.

Thanks.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Intercept/override context menu on EditText long-press?

2011-04-24 Thread Mark Murphy
On Sun, Apr 24, 2011 at 7:49 PM, Keith Wiley  wrote:
> ...and to wrap up the philosophical argument that this thread
> unintentionally flared, I really don't see why double or triple tap
> long presses should be expected to exhibit redundant behavior with
> that of single tap long presses.

That seems reasonable. Your opening line of the thread ("I want to
intercept an EditText long-press and do something with it other than
present a contextual menu") didn't explain that, and I misunderstood
where you were trying to clarify ("I want to provide additional
functionality on double or triple tap long presses,
but it won't work if the contextual menu is forced upon all long presses").

BTW, just so I'm on the right page: a double-tap long-press would be
tap + long-press? And triple-tap long-press is tap + tap + long-press?

And is this a DDR game applied to an EditText? If so, did you license
any cool music? :-)

Regardless, my apologies for misreading that line.

> Mark, I have always appreciated your input and I'm sorry my original
> question offended you.

It's more that I've been running into UI-pattern-jacking a lot over on
StackOverflow in recent months, so I'm overly sensitive on the issue.

> I hope you aren't too offended by all of this.

Not at all. I'm more concerned about *you* being offended, since I'm
the one who misread the key line.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Intercept/override context menu on EditText long-press?

2011-04-24 Thread Keith Wiley
Just to wrap up this thread for anyone else who finds it and is
looking for relevant information, I was able to achieve the intended
goal by overriding showContextMenu() and either passing the call up to
the super class or dropping the call on the floor.  So when my app
detects a double or triple tap in advance of the call to
showContextMenu(), I simply ignore the call and proceed with the
alternate behavior instead.

...and to wrap up the philosophical argument that this thread
unintentionally flared, I really don't see why double or triple tap
long presses should be expected to exhibit redundant behavior with
that of single tap long presses.  The scenario is perfectly analogous
to single, double, and triple taps (sans long press), or mouse-
clicks.  Clearly, no one expects double taps to exhibit behavior
redundant with single taps.  If that were the case, double tap support
would never have been programmed into the API in the first place (and
let's be honest with ourselves, double-mouse-clicks have been a common
UI for 25 years!).  Triple clicks and triple taps, I concede, are a
bit more contentious in that they are not particularly wide-spread,
but they are not unheard of either and I felt entitled to offer such
support to my app's power users who might benefit from the added
flexibility and ease of use.

Mark, I have always appreciated your input and I'm sorry my original
question offended you.  It was technical, not philosophical, and I am
always weary of attempts to thread-jack an original question because
threads rarely recover and the original question generally goes
unanswered as a consequence.  I would have been more than happy to
politely debate the philosophical and design issues with you, but such
was a tangent from the purely technical question I was asking and I
saw no reason to confuse the two topics; I just wanted an answer to my
question (and perhaps faith that I was not running afoul of wise
design specs even if I had not fully qualified the scenario pertaining
to my question).  I hope you aren't too offended by all of this.

Best of luck.

Cheers!

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Intercept/override context menu on EditText long-press?

2011-04-24 Thread Mark Murphy
On Sun, Apr 24, 2011 at 6:36 PM, Keith Wiley  wrote:
> I understand your point, but you aren't being completely fair.  My
> Edit text can detect not only single also double and triple taps (I
> had to hack triple tap detection from scratch of course).  I want to
> provide additional functionality on double or triple tap long presses,
> but it won't work if the contextual menu is forced upon all long
> presses.  Furthermore my app offers a fully configurable UI where
> single/double/triple taps/long-presses/drags can be assigned to
> numerous complex functions in a way that greatly empowers the user.

So?

You have all this stuff for every other touch operation known to
humanity, apparently, yet you can't just leave the long-press alone to
do what an EditText is supposed to do on a long-press? Why not move
your long-press functions to a quadruple tap or something? What is
so magical about you hacking a long-press that is worth
breaking the existing expectations of the users?

> So, with all due respect, we can debate the philosophy how to present
> such UIs in a parallel or separate discussion

You assume that I am here exclusively to help you. I am also here to
put opinions in the record for those who read this thread in the
future (e.g., via a search). I don't want developers thinking that
messing with system menus is a good idea.

> Do you know how to do what I'm trying to do?

The only thing I can think of -- and it's a long shot -- is to call
unregisterForContextMenu() sometime relatively late in the process.
This can also be achieved by calling
setOnCreateContextMenuListener(null) on the EditText itself. I can't
quite see where an EditText/TextView actually declares that it *has* a
context menu. I get the distinct impression from the code I'm reading
that it's somewhat bypassing the normal context menu system. But, in
the off chance you get lucky, if you unregister it sometime after it
has been registered, that might suppress the built-in context menu.

But I really wish you wouldn't.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Intercept/override context menu on EditText long-press?

2011-04-24 Thread Keith Wiley


On Apr 24, 3:02 pm, Mark Murphy  wrote:
> On Sun, Apr 24, 2011 at 5:54 PM, Keith Wiley  wrote:
> > I want to intercept an EditText long-press and do something with it
> > other than present a contextual menu.
>
> Please don't. Users will expect the standard EditText context menu to
> appear, so they can do silly things like edit the text. Android
> developers get ripped to shreds by users and the media for having zero
> UI discipline, breaking existing UI patterns and causing no two apps
> to work the same -- your proposal is a case in point.
>
> If your goal is for users to not edit the text, then don't use an EditText.
>
> If your goal is for users to edit the text, leave the context menu
> alone, and find some other way to trigger whatever it is that you are
> trying to do.

I understand your point, but you aren't being completely fair.  My
Edit text can detect not only single also double and triple taps (I
had to hack triple tap detection from scratch of course).  I want to
provide additional functionality on double or triple tap long presses,
but it won't work if the contextual menu is forced upon all long
presses.  Furthermore my app offers a fully configurable UI where
single/double/triple taps/long-presses/drags can be assigned to
numerous complex functions in a way that greatly empowers the user.

So, with all due respect, we can debate the philosophy how to present
such UIs in a parallel or separate discussion, but it is tangential to
my question of how to technically achieve such powerful goals.

Do you know how to do what I'm trying to do?

Thank you.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Intercept/override context menu on EditText long-press?

2011-04-24 Thread Keith Wiley
Sorry, quick followup.  The EditText in question is a subclass of my
own creation, not just a generic EditText.  It already extends
EditText and implements TextWatcher, OnKeyListener, OnGestureListener,
and GestureDetector.OnDoubleTapListener for various uses.

Thanks again.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en