微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.content.UndoManager的实例源码

项目:Tada    文件TextView.java   
/**
 * Associate an {@link android.content.UndoManager} with this TextView.  Once
 * done,all edit operations on the TextView will result in appropriate
 * {@link android.content.UndoOperation} objects pushed on the given UndoManager's
 * stack.
 *
 * @param undoManager The {@link android.content.UndoManager} to associate with
 * this TextView,or null to clear any existing association.
 * @param tag String tag identifying this particular TextView owner in the
 * UndoManager.  This is used to keep the correct association with the
 * {@link android.content.UndoOwner} of any operations inside of the UndoManager.
 *
 * @hide
 */
public final void setUndoManager(UndoManager undoManager,String tag) {
    if (undoManager != null) {
        createEditorIfNeeded();
        mEditor.mUndoManager = undoManager;
        mEditor.mUndoOwner = undoManager.getowner(tag,this);
        mEditor.mUndoInputFilter = new Editor.UndoInputFilter(mEditor);
        if (!(mText instanceof Editable)) {
            setText(mText,BufferType.EDITABLE);
        }

        setFilters((Editable) mText,mFilters);
    } else if (mEditor != null) {
        // XXX need to destroy all associated state.
        mEditor.mUndoManager = null;
        mEditor.mUndoOwner = null;
        mEditor.mUndoInputFilter = null;
    }
}
项目:Tada    文件TextView.java   
/**
 * Retrieve the {@link android.content.UndoManager} that is currently associated
 * with this TextView.  By default there is no associated UndoManager,so null
 * is returned.  One can be associated with the TextView through
 * {@link #setUndoManager(android.content.UndoManager,String)}
 *
 * @hide
 */
public final UndoManager getUndoManager() {
    return mEditor == null ? null : mEditor.mUndoManager;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。