Commit cddf6b58 authored by Grigory Fedorov's avatar Grigory Fedorov

Merge branch 'feature/otr_fix' into develop

parents d5d31d71 a26b1857
......@@ -31,8 +31,7 @@ public class SMProgress extends BaseEntity implements EntityNotificationItem {
@Override
public Intent getIntent() {
return QuestionViewer.createCancelIntent(
Application.getInstance(), account, user);
return QuestionViewer.createCancelIntent(Application.getInstance(), account, user);
}
@Override
......@@ -43,8 +42,7 @@ public class SMProgress extends BaseEntity implements EntityNotificationItem {
@Override
public String getText() {
return Application.getInstance().getString(
R.string.otr_verification_in_progress);
return Application.getInstance().getString(R.string.otr_verification_in_progress);
}
}
......@@ -35,8 +35,7 @@ public class SMRequest extends BaseEntity implements EntityNotificationItem {
@Override
public Intent getIntent() {
return QuestionViewer.createIntent(
Application.getInstance(), account, user, question != null,
true, question);
Application.getInstance(), account, user, question != null, true, question);
}
@Override
......
......@@ -14,14 +14,6 @@
*/
package com.xabber.android.data.message;
import net.java.otr4j.OtrException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Message.Type;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smackx.packet.MUCUser;
import com.xabber.android.data.LogManager;
import com.xabber.android.data.NetworkException;
import com.xabber.android.data.SettingsManager;
......@@ -35,6 +27,14 @@ import com.xabber.xmpp.archive.SaveMode;
import com.xabber.xmpp.delay.Delay;
import com.xabber.xmpp.muc.MUC;
import net.java.otr4j.OtrException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Message.Type;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smackx.packet.MUCUser;
/**
* Represents normal chat.
*
......@@ -141,8 +141,7 @@ public class RegularChat extends AbstractChat {
updateThreadId(thread);
boolean unencrypted = false;
try {
text = OTRManager.getInstance().transformReceiving(account,
user, text);
text = OTRManager.getInstance().transformReceiving(account, user, text);
} catch (OtrException e) {
if (e.getCause() instanceof OTRUnencryptedException) {
text = ((OTRUnencryptedException) e.getCause()).getText();
......@@ -154,7 +153,7 @@ public class RegularChat extends AbstractChat {
}
}
// System message received.
if (text == null)
if (text == null || text.trim().equals(""))
return true;
if (!"".equals(resource))
this.resource = resource;
......
......@@ -356,21 +356,29 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
chatScrollIndicatorAdapter.update(chatViewerAdapter.getActiveChats());
selectPage();
} else {
updateRegisteredChats();
updateRegisteredRecentChatsFragments();
updateStatusBar();
for (ChatViewerFragment chat : registeredChats) {
if (chat.isEqual(selectedChat) && incoming) {
chat.playIncomingAnimation();
if (chat.isEqual(selectedChat)) {
chat.updateChat();
if (incoming) {
chat.playIncomingAnimation();
}
}
}
updateRegisteredRecentChatsFragments();
updateStatusBar();
}
}
@Override
public void onContactsChanged(Collection<BaseEntity> entities) {
updateRegisteredChats();
for (BaseEntity contact : entities) {
for (ChatViewerFragment chat : registeredChats) {
if (chat.isEqual(contact)) {
chat.updateChat();
}
}
}
updateRegisteredRecentChatsFragments();
updateStatusBar();
}
......
......@@ -23,6 +23,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.xabber.android.R;
import com.xabber.android.data.LogManager;
import com.xabber.android.data.SettingsManager;
import com.xabber.android.data.account.AccountItem;
import com.xabber.android.data.account.AccountManager;
......@@ -139,6 +140,7 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
incomingMessage.messageBalloon.setVisibility(View.GONE);
incomingMessage.messageTime.setVisibility(View.GONE);
incomingMessage.avatar.setVisibility(View.GONE);
LogManager.w(this, "Empty message! Hidden, but need to correct");
} else {
incomingMessage.messageBalloon.setVisibility(View.VISIBLE);
incomingMessage.messageTime.setVisibility(View.VISIBLE);
......@@ -285,7 +287,7 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
return null;
}
public static class BasicMessage extends RecyclerView.ViewHolder {
public static class BasicMessage extends RecyclerView.ViewHolder {
public TextView messageText;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment