FileDocCategorySizeDatePackage
EasyEditSpan.javaAPI DocAndroid 5.1 API3770Thu Mar 12 22:22:10 GMT 2015android.text.style

EasyEditSpan

public class EasyEditSpan extends Object implements android.text.ParcelableSpan
Provides an easy way to edit a portion of text.

The {@link TextView} uses this span to allow the user to delete a chuck of text in one click.

{@link TextView} removes the span when the user deletes the whole text or modifies it.

This span can be also used to receive notification when the user deletes or modifies the text;

Fields Summary
public static final String
EXTRA_TEXT_CHANGED_TYPE
The extra key field in the pending intent that describes how the text changed.
public static final int
TEXT_DELETED
The value of {@link #EXTRA_TEXT_CHANGED_TYPE} when the text wrapped by this span is deleted.
public static final int
TEXT_MODIFIED
The value of {@link #EXTRA_TEXT_CHANGED_TYPE} when the text wrapped by this span is modified.
private final android.app.PendingIntent
mPendingIntent
private boolean
mDeleteEnabled
Constructors Summary
public EasyEditSpan()
Creates the span. No intent is sent when the wrapped text is modified or deleted.


                        
      
        mPendingIntent = null;
        mDeleteEnabled = true;
    
public EasyEditSpan(android.app.PendingIntent pendingIntent)

param
pendingIntent The intent will be sent when the wrapped text is deleted or modified. When the pending intent is sent, {@link #EXTRA_TEXT_CHANGED_TYPE} is added in the intent to describe how the text changed.

        mPendingIntent = pendingIntent;
        mDeleteEnabled = true;
    
public EasyEditSpan(android.os.Parcel source)
Constructor called from {@link TextUtils} to restore the span.

        mPendingIntent = source.readParcelable(null);
        mDeleteEnabled = (source.readByte() == 1);
    
Methods Summary
public intdescribeContents()

        return 0;
    
public android.app.PendingIntentgetPendingIntent()

return
the pending intent to send when the wrapped text is deleted or modified.
hide

        return mPendingIntent;
    
public intgetSpanTypeId()

        return TextUtils.EASY_EDIT_SPAN;
    
public booleanisDeleteEnabled()

return
True if the {@link TextView} should offer the ability to delete the text.
hide

        return mDeleteEnabled;
    
public voidsetDeleteEnabled(boolean value)
Enables or disables the deletion of the text.

hide

        mDeleteEnabled = value;
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        dest.writeParcelable(mPendingIntent, 0);
        dest.writeByte((byte) (mDeleteEnabled ? 1 : 0));