Refactoring

pull/194/merge
M66B 4 years ago
parent b93263f000
commit f2b08b338b

@ -376,6 +376,9 @@ public class FixedTextView extends AppCompatTextView {
public boolean onTextContextMenuItem(int id) { public boolean onTextContextMenuItem(int id) {
try { try {
if (id == android.R.id.copy) { if (id == android.R.id.copy) {
Context context = getContext();
ClipboardManager cbm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
int start = getSelectionStart(); int start = getSelectionStart();
int end = getSelectionEnd(); int end = getSelectionEnd();
if (start > end) { if (start > end) {
@ -384,8 +387,6 @@ public class FixedTextView extends AppCompatTextView {
end = s; end = s;
} }
Context context = getContext();
ClipboardManager cbm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
if (start != end && cbm != null) { if (start != end && cbm != null) {
CharSequence selected = getText().subSequence(start, end); CharSequence selected = getText().subSequence(start, end);
if (selected instanceof Spanned) { if (selected instanceof Spanned) {

Loading…
Cancel
Save