summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget
diff options
context:
space:
mode:
authorLuca Zanolin <zano@google.com>2013-02-20 12:27:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-02-20 12:27:35 +0000
commit1b916301e044d1f6f672c9708c993090ecdf30cf (patch)
treefb959fda4b3c4488af2e37653bbde701d3c485a8 /core/java/android/widget
parent8cd8135b95da5b471804604b06084eecbe1cc23b (diff)
downloadframeworks_base-1b916301e044d1f6f672c9708c993090ecdf30cf.zip
frameworks_base-1b916301e044d1f6f672c9708c993090ecdf30cf.tar.gz
frameworks_base-1b916301e044d1f6f672c9708c993090ecdf30cf.tar.bz2
Revert "Enable correction/deleting notification via EasyEditSpan."
This reverts commit 8cd8135b95da5b471804604b06084eecbe1cc23b Change-Id: I6361cc47d58281ab37cb9ae0a67541b43f873147
Diffstat (limited to 'core/java/android/widget')
-rw-r--r--core/java/android/widget/Editor.java73
1 files changed, 10 insertions, 63 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index dc305a5..862e2c8 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -20,8 +20,6 @@ import com.android.internal.util.ArrayUtils;
import com.android.internal.widget.EditableInputConnection;
import android.R;
-import android.app.PendingIntent;
-import android.app.PendingIntent.CanceledException;
import android.content.ClipData;
import android.content.ClipData.Item;
import android.content.Context;
@@ -1892,23 +1890,10 @@ public class Editor {
// Make sure there is only at most one EasyEditSpan in the text
if (mPopupWindow.mEasyEditSpan != null) {
- mPopupWindow.mEasyEditSpan.setDeleteEnabled(false);
+ text.removeSpan(mPopupWindow.mEasyEditSpan);
}
mPopupWindow.setEasyEditSpan((EasyEditSpan) span);
- mPopupWindow.setOnDeleteListener(new EasyEditDeleteListener() {
- @Override
- public void onDeleteClick(EasyEditSpan span) {
- Editable editable = (Editable) mTextView.getText();
- int start = editable.getSpanStart(span);
- int end = editable.getSpanEnd(span);
- if (start >= 0 && end >= 0) {
- sendNotification(EasyEditSpan.TEXT_DELETED, span);
- mTextView.deleteText_internal(start, end);
- }
- editable.removeSpan(span);
- }
- });
if (mTextView.getWindowVisibility() != View.VISIBLE) {
// The window is not visible yet, ignore the text change.
@@ -1942,10 +1927,8 @@ public class Editor {
@Override
public void onSpanChanged(Spannable text, Object span, int previousStart, int previousEnd,
int newStart, int newEnd) {
- if (mPopupWindow != null && span instanceof EasyEditSpan) {
- EasyEditSpan easyEditSpan = (EasyEditSpan) span;
- sendNotification(EasyEditSpan.TEXT_MODIFIED, easyEditSpan);
- text.removeSpan(easyEditSpan);
+ if (mPopupWindow != null && span == mPopupWindow.mEasyEditSpan) {
+ text.removeSpan(mPopupWindow.mEasyEditSpan);
}
}
@@ -1955,31 +1938,6 @@ public class Editor {
mTextView.removeCallbacks(mHidePopup);
}
}
-
- private void sendNotification(int textChangedType, EasyEditSpan span) {
- try {
- PendingIntent pendingIntent = span.getPendingIntent();
- if (pendingIntent != null) {
- Intent intent = new Intent();
- intent.putExtra(EasyEditSpan.EXTRA_TEXT_CHANGED_TYPE, textChangedType);
- pendingIntent.send(mTextView.getContext(), 0, intent);
- }
- } catch (CanceledException e) {
- // This should not happen, as we should try to send the intent only once.
- Log.w(TAG, "PendingIntent for notification cannot be sent", e);
- }
- }
- }
-
- /**
- * Listens for the delete event triggered by {@link EasyEditPopupWindow}.
- */
- private interface EasyEditDeleteListener {
-
- /**
- * Clicks the delete pop-up.
- */
- void onDeleteClick(EasyEditSpan span);
}
/**
@@ -1992,7 +1950,6 @@ public class Editor {
com.android.internal.R.layout.text_edit_action_popup_text;
private TextView mDeleteTextView;
private EasyEditSpan mEasyEditSpan;
- private EasyEditDeleteListener mOnDeleteListener;
@Override
protected void createPopupWindow() {
@@ -2027,26 +1984,16 @@ public class Editor {
mEasyEditSpan = easyEditSpan;
}
- private void setOnDeleteListener(EasyEditDeleteListener listener) {
- mOnDeleteListener = listener;
- }
-
@Override
public void onClick(View view) {
- if (view == mDeleteTextView
- && mEasyEditSpan != null && mEasyEditSpan.isDeleteEnabled()
- && mOnDeleteListener != null) {
- mOnDeleteListener.onDeleteClick(mEasyEditSpan);
- }
- }
-
- @Override
- public void hide() {
- if (mEasyEditSpan != null) {
- mEasyEditSpan.setDeleteEnabled(false);
+ if (view == mDeleteTextView) {
+ Editable editable = (Editable) mTextView.getText();
+ int start = editable.getSpanStart(mEasyEditSpan);
+ int end = editable.getSpanEnd(mEasyEditSpan);
+ if (start >= 0 && end >= 0) {
+ mTextView.deleteText_internal(start, end);
+ }
}
- mOnDeleteListener = null;
- super.hide();
}
@Override