unified copy text and share with context menu entries
This commit is contained in:
		
							parent
							
								
									cec9b9b35a
								
							
						
					
					
						commit
						7c31a981bb
					
				| @ -602,7 +602,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); | ||||
| @ -613,12 +612,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa | ||||
| 			MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission); | ||||
| 			MenuItem deleteFile = menu.findItem(R.id.delete_file); | ||||
| 			MenuItem showErrorMessage = menu.findItem(R.id.show_error_message); | ||||
| 			if (!treatAsFile | ||||
| 					&& !GeoHelper.isGeoUri(m.getBody()) | ||||
| 					&& !m.treatAsDownloadable()) { | ||||
| 				copyText.setVisible(true); | ||||
| 				selectText.setVisible(ListSelectionManager.isSupported()); | ||||
| 			} | ||||
| 			if (m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) { | ||||
| 				retryDecryption.setVisible(true); | ||||
| 			} | ||||
| @ -627,7 +620,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa | ||||
| 					&& (m.getConversation().getMucOptions().nonanonymous() || m.getConversation().getMode() == Conversation.MODE_SINGLE)) { | ||||
| 				correctMessage.setVisible(true); | ||||
| 			} | ||||
| 			if (treatAsFile || (GeoHelper.isGeoUri(m.getBody()))) { | ||||
| 			if (treatAsFile || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable())) { | ||||
| 				shareWith.setVisible(true); | ||||
| 			} | ||||
| 			if (m.getStatus() == Message.STATUS_SEND_FAILED) { | ||||
| @ -668,9 +661,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; | ||||
| @ -717,6 +707,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 { | ||||
| @ -740,14 +733,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) { | ||||
|  | ||||
| @ -1,10 +1,6 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" > | ||||
| 
 | ||||
|     <item | ||||
|         android:id="@+id/copy_text" | ||||
|         android:title="@string/copy_text" | ||||
|         android:visible="false"/> | ||||
|      <item | ||||
|         android:id="@+id/select_text" | ||||
|         android:title="@string/select_text" | ||||
|  | ||||
| @ -364,7 +364,6 @@ | ||||
| 	<string name="check_x_filesize">Check %s size</string> | ||||
| 	<string name="check_x_filesize_on_host">Check %1$s size on %2$s</string> | ||||
| 	<string name="message_options">Message options</string> | ||||
| 	<string name="copy_text">Copy text</string> | ||||
| 	<string name="select_text">Select text</string> | ||||
| 	<string name="quote">Quote</string> | ||||
| 	<string name="copy_original_url">Copy original URL</string> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Gultsch
						Daniel Gultsch