am 31ccc9f0: am a7e2ab6e: am 8af7432c: Merge "Fix "Select All" in extracted mode" into mnc-dev

* commit '31ccc9f0e015a4dee041f8324bcedf76d8dcb137':
  Fix "Select All" in extracted mode
This commit is contained in:
Andrei Stingaceanu
2015-07-14 14:44:27 +00:00
committed by Android Git Automerger

View File

@@ -29,7 +29,7 @@ import android.widget.EditText;
public class ExtractEditText extends EditText {
private InputMethodService mIME;
private int mSettingExtractedText;
public ExtractEditText(Context context) {
super(context, null);
}
@@ -45,11 +45,11 @@ public class ExtractEditText extends EditText {
public ExtractEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
void setIME(InputMethodService ime) {
mIME = ime;
}
/**
* Start making changes that will not be reported to the client. That
* is, {@link #onSelectionChanged(int, int)} will not result in sending
@@ -58,7 +58,7 @@ public class ExtractEditText extends EditText {
public void startInternalChanges() {
mSettingExtractedText += 1;
}
/**
* Finish making changes that will not be reported to the client. That
* is, {@link #onSelectionChanged(int, int)} will not result in sending
@@ -67,7 +67,7 @@ public class ExtractEditText extends EditText {
public void finishInternalChanges() {
mSettingExtractedText -= 1;
}
/**
* Implement just to keep track of when we are setting text from the
* client (vs. seeing changes in ourself from the user).
@@ -80,7 +80,7 @@ public class ExtractEditText extends EditText {
mSettingExtractedText--;
}
}
/**
* Report to the underlying text editor about selection changes.
*/
@@ -89,7 +89,7 @@ public class ExtractEditText extends EditText {
mIME.onExtractedSelectionChanged(selStart, selEnd);
}
}
/**
* Redirect clicks to the IME for handling there. First allows any
* on click handler to run, though.
@@ -101,9 +101,10 @@ public class ExtractEditText extends EditText {
}
return false;
}
@Override public boolean onTextContextMenuItem(int id) {
if (mIME != null && mIME.onExtractTextContextMenuItem(id)) {
// Select all shouldn't be handled by the original edit text, but by the extracted one.
if (id != android.R.id.selectAll && mIME != null && mIME.onExtractTextContextMenuItem(id)) {
// Mode was started on Extracted, needs to be stopped here.
// Cut will change the text, which stops selection mode.
if (id == android.R.id.copy || id == android.R.id.paste) stopTextActionMode();
@@ -111,7 +112,7 @@ public class ExtractEditText extends EditText {
}
return super.onTextContextMenuItem(id);
}
/**
* We are always considered to be an input method target.
*/
@@ -119,14 +120,14 @@ public class ExtractEditText extends EditText {
public boolean isInputMethodTarget() {
return true;
}
/**
* Return true if the edit text is currently showing a scroll bar.
*/
public boolean hasVerticalScrollBar() {
return computeVerticalScrollRange() > computeVerticalScrollExtent();
}
/**
* Pretend like the window this view is in always has focus, so its
* highlight and cursor will be displayed.