diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index a014f717c..4e40ac435 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -62,7 +62,7 @@
android:label="@string/title_activity_share_location"/>
+ android:label="@string/search_messages"/>
{
+ String fingerprint;
+ if (message.getEncryption() == Message.ENCRYPTION_PGP || message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
+ fingerprint = "pgp";
+ } else {
+ fingerprint = message.getFingerprint();
+ }
final boolean received = message.getStatus() <= Message.STATUS_RECEIVED;
if (received) {
if (message.getConversation() instanceof Conversation && message.getConversation().getMode() == Conversation.MODE_MULTI) {
@@ -949,30 +955,12 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
return;
} else {
if (!message.getContact().isSelf()) {
- String fingerprint;
- if (message.getEncryption() == Message.ENCRYPTION_PGP
- || message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
- fingerprint = "pgp";
- } else {
- fingerprint = message.getFingerprint();
- }
activity.switchToContactDetails(message.getContact(), fingerprint);
return;
}
}
}
- Account account = message.getConversation().getAccount();
- Intent intent = new Intent(activity, EditAccountActivity.class);
- intent.putExtra("jid", account.getJid().asBareJid().toString());
- String fingerprint;
- if (message.getEncryption() == Message.ENCRYPTION_PGP
- || message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
- fingerprint = "pgp";
- } else {
- fingerprint = message.getFingerprint();
- }
- intent.putExtra("fingerprint", fingerprint);
- startActivity(intent);
+ activity.switchToAccount(message.getConversation().getAccount(), fingerprint);
});
messageListAdapter.setOnContactPictureLongClicked(message -> {
if (message.getStatus() <= Message.STATUS_RECEIVED) {
diff --git a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java
index a481b8173..892be3fbb 100644
--- a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java
@@ -46,6 +46,7 @@ import java.util.List;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.ActivitySearchBinding;
+import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.services.MessageSearchTask;
import eu.siacs.conversations.ui.adapter.MessageAdapter;
@@ -57,7 +58,7 @@ import eu.siacs.conversations.ui.util.ListViewUtils;
import static eu.siacs.conversations.ui.util.SoftKeyboardUtils.hideSoftKeyboard;
import static eu.siacs.conversations.ui.util.SoftKeyboardUtils.showKeyboard;
-public class SearchActivity extends XmppActivity implements TextWatcher, OnSearchResultsAvailable {
+public class SearchActivity extends XmppActivity implements TextWatcher, OnSearchResultsAvailable, MessageAdapter.OnContactPictureClicked {
private ActivitySearchBinding binding;
private MessageAdapter messageListAdapter;
@@ -70,6 +71,7 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc
setSupportActionBar((Toolbar) this.binding.toolbar);
configureActionBar(getSupportActionBar());
this.messageListAdapter = new MessageAdapter(this, this.messages);
+ this.messageListAdapter.setOnContactPictureClicked(this);
this.binding.searchResults.setAdapter(messageListAdapter);
}
@@ -148,4 +150,26 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc
ListViewUtils.scrollToBottom(this.binding.searchResults);
});
}
+
+ @Override
+ public void onContactPictureClicked(Message message) {
+ String fingerprint;
+ if (message.getEncryption() == Message.ENCRYPTION_PGP || message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
+ fingerprint = "pgp";
+ } else {
+ fingerprint = message.getFingerprint();
+ }
+ if (message.getStatus() == Message.STATUS_RECEIVED) {
+ final Contact contact = message.getContact();
+ if (contact != null) {
+ if (contact.isSelf()) {
+ switchToAccount(message.getConversation().getAccount(), fingerprint);
+ } else {
+ switchToContactDetails(contact, fingerprint);
+ }
+ }
+ } else {
+ switchToAccount(message.getConversation().getAccount(), fingerprint);
+ }
+ }
}
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 4673580b5..f6be8d480 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -521,17 +521,24 @@ public abstract class XmppActivity extends ActionBarActivity {
startActivity(intent);
}
- public void switchToAccount(Account account) {
- switchToAccount(account, false);
+ public void switchToAccount(Account account, String fingerprint) {
+ switchToAccount(account, false, fingerprint);
}
- public void switchToAccount(Account account, boolean init) {
+ public void switchToAccount(Account account) {
+ switchToAccount(account, false, null);
+ }
+
+ public void switchToAccount(Account account, boolean init, String fingerprint) {
Intent intent = new Intent(this, EditAccountActivity.class);
intent.putExtra("jid", account.getJid().asBareJid().toString());
intent.putExtra("init", init);
if (init) {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
}
+ if (fingerprint != null) {
+ intent.putExtra("fingerprint", fingerprint);
+ }
startActivity(intent);
if (init) {
overridePendingTransition(0, 0);
diff --git a/src/main/java/eu/siacs/conversations/ui/util/ListViewUtils.java b/src/main/java/eu/siacs/conversations/ui/util/ListViewUtils.java
index 63317b6b8..4fae7f13a 100644
--- a/src/main/java/eu/siacs/conversations/ui/util/ListViewUtils.java
+++ b/src/main/java/eu/siacs/conversations/ui/util/ListViewUtils.java
@@ -36,7 +36,7 @@ import android.widget.ListView;
public class ListViewUtils {
public static void scrollToBottom(final ListView listView) {
- int count = listView.getAdapter().getCount();
+ final int count = listView.getAdapter().getCount();
if (count > 0) {
setSelection(listView, count - 1, true);
}
diff --git a/src/main/res/menu/fragment_conversations_overview.xml b/src/main/res/menu/fragment_conversations_overview.xml
index fe4cd62f1..39daf7d8c 100644
--- a/src/main/res/menu/fragment_conversations_overview.xml
+++ b/src/main/res/menu/fragment_conversations_overview.xml
@@ -31,7 +31,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
\ No newline at end of file
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 2dc483c49..c108740c2 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -703,6 +703,5 @@
Unable to start recording
Please wait…
Conversations needs access to the microphone
- Search
Search messages