aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-05-09 21:00:04 +0200
committerChristian Schneppe <christian@pix-art.de>2017-05-09 21:00:04 +0200
commit39d48e727039bc6c81ab04694fb7929f8414df8d (patch)
tree052c81948f864911c8abcc649b7a607bd78f5c66 /src/main
parenta2e7c6c800c09bac24334484dd5ae739a6ac5355 (diff)
unified copy text and share with context menu entries
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java26
-rw-r--r--src/main/res/menu/message_context.xml14
-rw-r--r--src/main/res/values-de/strings.xml1
-rw-r--r--src/main/res/values/strings.xml2
4 files changed, 12 insertions, 31 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) {
diff --git a/src/main/res/menu/message_context.xml b/src/main/res/menu/message_context.xml
index 0c3220683..a7e46bc7f 100644
--- a/src/main/res/menu/message_context.xml
+++ b/src/main/res/menu/message_context.xml
@@ -2,26 +2,22 @@
<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"
android:visible="false" />
<item
+ android:id="@+id/share_with"
+ android:title="@string/share_with"
+ android:visible="false"/>
+ <item
android:id="@+id/retry_decryption"
- android:title="Retry decryption"
+ android:title="@string/retry_decryption"
android:visible="false" />
<item
android:id="@+id/correct_message"
android:title="@string/correct_message"
android:visible="false" />
<item
- android:id="@+id/share_with"
- android:title="@string/share_with"
- android:visible="false" />
- <item
android:id="@+id/copy_url"
android:title="@string/copy_original_url"
android:visible="false" />
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index 85cb45e7d..0ec2bfd25 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -279,7 +279,6 @@
<string name="not_connected_try_again">Nicht verbunden, bitte später versuchen</string>
<string name="check_x_filesize">%s-Größe prüfen</string>
<string name="message_options">Nachrichtenoptionen</string>
- <string name="copy_text">Text kopieren</string>
<string name="copy_original_url">Original-URL kopieren</string>
<string name="send_again">Erneut senden</string>
<string name="file_url">Datei-URL</string>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 299be7392..0dbf82efd 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -349,7 +349,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="copy_original_url">Copy original URL</string>
<string name="send_again">Send again</string>
<string name="file_url">File URL</string>
@@ -775,4 +774,5 @@
<string name="send_failed_resend">delivery failed, resending…</string>
<string name="pref_show_connection_options_summary">Show hostname and port settings when setting up an account</string>
<string name="pref_show_connection_options">Extended connection settings</string>
+ <string name="retry_decryption">Retry decryption</string>
</resources>