HTC Sense Copy/Paste API's
Asked Answered
H

3

6

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?

Harner answered 13/8, 2010 at 13:23 Comment(0)
S
2

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

Sinistrorse answered 26/9, 2010 at 17:30 Comment(1)
No, I think he meant how to move the icons and widgetsDinesen
E
1

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.

Editheditha answered 16/9, 2010 at 13:15 Comment(0)
S
0

I'm new to Android development as well, but I think what you are looking for is the R.id class. Here's the API documentation link:

http://developer.android.com/reference/android/R.id.html

This looks like how it's used:

menu.add(0, android.R.id.copy, menuIndex++, android.R.string.copy);

menu.add(0, android.R.id.paste, menuIndex++, android.R.string.paste);

Good luck with your app!

Sam

Shoemaker answered 23/9, 2010 at 13:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.