Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTC Sense Copy/Paste API's

Is there a way to access the copy/paste api/UI in an Android / HTC Sense based phone?

I really like the way a long press works in a large canvas while using Sense. Is there a way to programmatically detect code is running on a Sense-based phone and call out to those APIs?

like image 771
Paul Kilroy Avatar asked Aug 13 '10 13:08

Paul Kilroy


2 Answers

No, very certainly not. There is only one copy/paste API in Android, though implementation details may differ between skins, if you can call it an API even because it comes for free if you choose the right UI elements.

I also do not know what you mean by "the way a long press works in a large canvas while using Sense". When I compare copying text and selecting text in stock Android and HTC Sense it mostly is the same (except for colors etc.). Could you make your question more specific?

Edit: Maybe you meant this: Add my app to HTC cut & paste sendto menu

like image 129
pjv Avatar answered Nov 20 '22 04:11

pjv


Ok, I have to be honest here, I haven't played with android yet, although I'm planning to do that soon. However I have been working on the Microsoft Surface table.

If the standard android library does not implement functionality to detect some sort of touch and hold event I suggest the following:

I think you could easily implement such helper yourself. What you will probably want to do is add a listener to the touch event of that canvas. At the moment a finger touches the canvas, you start running a timer. When the timer ends, you fire your desired event. However, this will also need you to implement a few other things. When the finger moves outside a certain threshold, or the finger is lifted again, the timer needs to be stopped and cleaned up so it won't fire anymore.

In this scenario you have created the touch and hold scenario for yourself. All you have to pay attention to is that you break it off on added touch-manipulation.

(I really reckon the standard touch library must contain something similar to this functionality though!)


From what I was able to find with a few searches was:

@Override
public void onLongPress(MotionEvent e)
{
    //Call your own custom copy paste dialog here.
}

(Otherwise you might find something to your liking in the GestureDetector?)

The copypaste functionality uses the ClipboardManager. All you need is to create a popup menu containing copy and paste images with the associated text and a hooks to that ClipboardManager.

like image 1
wvdhouten Avatar answered Nov 20 '22 06:11

wvdhouten