diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-05-09 21:00:04 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-05-09 21:00:04 +0200 |
commit | 39d48e727039bc6c81ab04694fb7929f8414df8d (patch) | |
tree | 052c81948f864911c8abcc649b7a607bd78f5c66 /src/main/java/de | |
parent | a2e7c6c800c09bac24334484dd5ae739a6ac5355 (diff) |
unified copy text and share with context menu entries
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index e7526e315..4ba88d49a 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -623,7 +623,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa && t == null; activity.getMenuInflater().inflate(R.menu.message_context, menu); menu.setHeaderTitle(R.string.message_options); - MenuItem copyText = menu.findItem(R.id.copy_text); MenuItem selectText = menu.findItem(R.id.select_text); MenuItem retryDecryption = menu.findItem(R.id.retry_decryption); MenuItem correctMessage = menu.findItem(R.id.correct_message); @@ -634,11 +633,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa MenuItem downloadFile = menu.findItem(R.id.download_file); MenuItem deleteFile = menu.findItem(R.id.delete_file); MenuItem showErrorMessage = menu.findItem(R.id.show_error_message); - if (!treatAsFile - && !GeoHelper.isGeoUri(m.getBody()) - && !XmppUri.isXmppUri(m.getBody()) - && !m.treatAsDownloadable()) { - copyText.setVisible(true); + if (!treatAsFile && !GeoHelper.isGeoUri(m.getBody()) && !m.treatAsDownloadable()) { selectText.setVisible(ListSelectionManager.isSupported()); } if (m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) { @@ -654,10 +649,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa && !(GeoHelper.isGeoUri(m.getBody()) || XmppUri.isXmppUri(m.getBody()))) { correctMessage.setVisible(true); } - if (treatAsFile - || GeoHelper.isGeoUri(m.getBody()) - || XmppUri.isXmppUri(m.getBody())) { + if (treatAsFile || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable())) { shareWith.setVisible(true); + } if (m.getStatus() == Message.STATUS_SEND_FAILED && !m.isFileOrImage()) { sendAgain.setVisible(true); @@ -699,9 +693,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa case R.id.share_with: shareWith(selectedMessage); return true; - case R.id.copy_text: - copyText(selectedMessage); - return true; case R.id.select_text: selectText(selectedMessage); return true; @@ -748,6 +739,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa if (GeoHelper.isGeoUri(message.getBody())) { shareIntent.putExtra(Intent.EXTRA_TEXT, message.getBody()); shareIntent.setType("text/plain"); + } else if (!message.isFileOrImage()) { + shareIntent.putExtra(Intent.EXTRA_TEXT, message.getMergedBody().toString()); + shareIntent.setType("text/plain"); } else { final DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message); try { @@ -771,14 +765,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } } - private void copyText(Message message) { - if (activity.copyTextToClipboard(message.getMergedBody().toString(), - R.string.message_text)) { - Toast.makeText(activity, R.string.message_copied_to_clipboard, - Toast.LENGTH_SHORT).show(); - } - } - private void selectText(Message message) { final int index; synchronized (this.messageList) { |