| Chunk |
|---|
| Conflicting content |
|---|
}
}
<<<<<<< HEAD
private void stopSelectionActionMode() {
if (mSelectionActionMode != null) {
mSelectionActionMode.finish();
}
}
private class SelectionActionModeCallback implements ActionMode.Callback {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
if (mSelectionModifierCursorController == null) {
Log.w(LOG_TAG, "TextView has no selection controller. Action mode cancelled.");
return false;
}
if (!requestFocus()) {
return false;
}
mode.setTitle(mContext.getString(com.android.internal.R.string.textSelectionCABTitle));
mode.setSubtitle(null);
selectCurrentWord();
boolean atLeastOne = false;
if (canSelectText()) {
menu.add(0, ID_SELECT_ALL, 0, com.android.internal.R.string.selectAll).
setIcon(com.android.internal.R.drawable.ic_menu_select_all).
setAlphabeticShortcut('a');
atLeastOne = true;
}
if (canCut()) {
menu.add(0, ID_CUT, 0, com.android.internal.R.string.cut).
setIcon(com.android.internal.R.drawable.ic_menu_cut).
setAlphabeticShortcut('x');
atLeastOne = true;
}
if (canCopy()) {
menu.add(0, ID_COPY, 0, com.android.internal.R.string.copy).
setIcon(com.android.internal.R.drawable.ic_menu_copy).
setAlphabeticShortcut('c');
atLeastOne = true;
}
if (canPaste()) {
menu.add(0, ID_PASTE, 0, com.android.internal.R.string.paste).
setIcon(com.android.internal.R.drawable.ic_menu_paste).
setAlphabeticShortcut('v');
atLeastOne = true;
}
if (atLeastOne) {
mSelectionModifierCursorController.show();
return true;
} else {
return false;
}
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return true;
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
final int itemId = item.getItemId();
if (itemId == ID_SELECT_ALL) {
Selection.setSelection((Spannable) mText, 0, mText.length());
// Update controller positions after selection change.
if (mSelectionModifierCursorController != null) {
mSelectionModifierCursorController.show();
}
return true;
}
ClipboardManager clipboard = (ClipboardManager) getContext().
getSystemService(Context.CLIPBOARD_SERVICE);
int min = 0;
int max = mText.length();
if (isFocused()) {
final int selStart = getSelectionStart();
final int selEnd = getSelectionEnd();
min = Math.max(0, Math.min(selStart, selEnd));
max = Math.max(0, Math.max(selStart, selEnd));
}
switch (item.getItemId()) {
case ID_PASTE:
ClipData clip = clipboard.getPrimaryClip();
if (clip != null) {
boolean didfirst = false;
for (int i=0; i |
| Solution content |
|---|
}
}
private void stopSelectionActionMode() {
if (mSelectionActionMode != null) {
mSelectionActionMode.finish();
}
}
private class SelectionActionModeCallback implements ActionMode.Callback {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
if (mSelectionModifierCursorController == null) {
Log.w(LOG_TAG, "TextView has no selection controller. Action mode cancelled.");
return false;
}
if (!requestFocus()) {
return false;
}
mode.setTitle(mContext.getString(com.android.internal.R.string.textSelectionCABTitle));
mode.setSubtitle(null);
selectCurrentWord();
boolean atLeastOne = false;
if (canSelectText()) {
menu.add(0, ID_SELECT_ALL, 0, com.android.internal.R.string.selectAll).
setIcon(com.android.internal.R.drawable.ic_menu_select_all).
setAlphabeticShortcut('a');
atLeastOne = true;
}
if (canCut()) {
menu.add(0, ID_CUT, 0, com.android.internal.R.string.cut).
setIcon(com.android.internal.R.drawable.ic_menu_cut).
setAlphabeticShortcut('x');
atLeastOne = true;
}
if (canCopy()) {
menu.add(0, ID_COPY, 0, com.android.internal.R.string.copy).
setIcon(com.android.internal.R.drawable.ic_menu_copy).
setAlphabeticShortcut('c');
atLeastOne = true;
}
if (canPaste()) {
menu.add(0, ID_PASTE, 0, com.android.internal.R.string.paste).
setIcon(com.android.internal.R.drawable.ic_menu_paste).
setAlphabeticShortcut('v');
atLeastOne = true;
}
if (atLeastOne) {
mSelectionModifierCursorController.show();
return true;
} else {
return false;
}
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return true;
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
final int itemId = item.getItemId();
if (itemId == ID_SELECT_ALL) {
Selection.setSelection((Spannable) mText, 0, mText.length());
// Update controller positions after selection change.
if (mSelectionModifierCursorController != null) {
mSelectionModifierCursorController.show();
}
return true;
}
ClipboardManager clipboard = (ClipboardManager) getContext().
getSystemService(Context.CLIPBOARD_SERVICE);
int min = 0;
int max = mText.length();
if (isFocused()) {
final int selStart = getSelectionStart();
final int selEnd = getSelectionEnd();
min = Math.max(0, Math.min(selStart, selEnd));
max = Math.max(0, Math.max(selStart, selEnd));
}
switch (item.getItemId()) {
case ID_PASTE:
ClipData clip = clipboard.getPrimaryClip();
if (clip != null) {
boolean didfirst = false;
for (int i=0; i |
| File |
|---|
| TextView.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Class signature |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
private void hideControllers() {
hideInsertionPointCursorController();
<<<<<<< HEAD
stopSelectionActionMode();
=======
hideSelectionModifierCursorController();
>>>>>>> 0acb0d7a4b9cb684bff6e70b4c41002fb45adc04
}
private int getOffsetForHorizontal(int line, int x) { |
| Solution content |
|---|
private void hideControllers() {
hideInsertionPointCursorController();
hideSelectionModifierCursorController();
}
private int getOffsetForHorizontal(int line, int x) { |
| File |
|---|
| TextView.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |