public class

HtcTextSelectionWrapper

extends Object
java.lang.Object
   ↳ com.htc.textselection.HtcTextSelectionWrapper

Summary

Nested Classes
interface HtcTextSelectionWrapper.SelectionWatcher  
interface HtcTextSelectionWrapper.TextSelectionWatcher  
Constants
int FLAG_END_BY_OUTSIDE_TOUCH
int FLAG_INPUT_TYPE_NULL_SELECTION
int FLAG_TRIGGER_BY_LONG_CLICK
Public Constructors
HtcTextSelectionWrapper()
Public Methods
static void enableHtcTextSelection(TextView tv, boolean enable, int flags)
Sets whether or not the content of this view is selectable by the user with additional flags for additional function.
static void enableHtcTextSelection(TextView tv, boolean enable, boolean triggerByLongClick)
Sets whether or not the content of this view is selectable by the user.
static int findWordEnd(CharSequence text, int offset)
Find the end offset of the related word.
static int findWordStart(CharSequence text, int offset)
Find the beginning offset of the related word.
static boolean instanceofHtcTextSelectionManager(MovementMethod method)
static void setSelectionWatcher(HtcTextSelectionWrapper.TextSelectionWatcher watcher)
Sets whether or not (default) the content of this view is selectable by the user.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int FLAG_END_BY_OUTSIDE_TOUCH

Since: API Level 2.0

Constant Value: 8 (0x00000008)

public static final int FLAG_INPUT_TYPE_NULL_SELECTION

Since: API Level 2.0

Constant Value: 4 (0x00000004)

public static final int FLAG_TRIGGER_BY_LONG_CLICK

Since: API Level 2.0

Constant Value: 2 (0x00000002)

Public Constructors

public HtcTextSelectionWrapper ()

Since: API Level 2.0

Public Methods

public static void enableHtcTextSelection (TextView tv, boolean enable, int flags)

Since: API Level 2.0

Sets whether or not the content of this view is selectable by the user with additional flags for additional function. Note that this flag only work after honeycomb,because the HtcQuickAction is the default text selection mode before honeycomb. If this function is used BEFORE HONEYCOMB , NOTHING WILL HAPPEN. In Honeycomb, If the EditText is on the top of the screen. When the selection start, the EditText will be covered by ActionMode In this case,you can set the flag"FLAG_SHOW_QUICK_ACTION" that the ActionMode will be replaced with QuickAction. Since the EditText which is on the ActionBarContextView default uses QuickAction. If the EditText is on the ActionBarContextView, you don't need to set up this flag. EditText default is selectable except input-type-null EditText. You don't need to set any flag for general EditText. Besides, the long press behavior of general EditText is to select a current word. If you want input-type-null EditText also selectable, set the Flag "FLAG_INPUT_TYPE_NULL_SELECTION". If you want the HtcQuickAction window dismiss when touching outside of the HtcQuickAction. set the Flag "FLAG_END_BY_OUTSIDE_TOUCH".

Parameters
tv the target TextView
enable the TextView which is set
flags for special settings

public static void enableHtcTextSelection (TextView tv, boolean enable, boolean triggerByLongClick)

Since: API Level 2.0

Sets whether or not the content of this view is selectable by the user.

Parameters
tv the target TextView
enable the TextView
triggerByLongClick : TextSelection will triggered by long press.

public static int findWordEnd (CharSequence text, int offset)

Since: API Level 2.0

Find the end offset of the related word.

Parameters
text represent the Spannable of TextView.
offset represents offset of TextView.
Returns
  • the offset *after*- the related word's end, e.g. findWordEnd of "ABC" returns 3.

public static int findWordStart (CharSequence text, int offset)

Since: API Level 2.0

Find the beginning offset of the related word.

Parameters
text represent the Spannable of TextView.
offset represents offset of TextView.
Returns
  • the beginning offset of the related word, e.g. findWordStart of "ABC" returns 0.

public static boolean instanceofHtcTextSelectionManager (MovementMethod method)

Since: API Level 2.0

public static void setSelectionWatcher (HtcTextSelectionWrapper.TextSelectionWatcher watcher)

Since: API Level 2.0

Sets whether or not (default) the content of this view is selectable by the user. Note that this methods affect the #setFocusable(boolean), #setFocusableInTouchMode(boolean) #setClickable(boolean) and #setLongClickable(boolean) states and you may want to restore these if they were customized. See #isTextSelectable for details.