aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-10-04 12:52:05 +0200
committerChristian Schneppe <christian@pix-art.de>2018-10-04 12:52:05 +0200
commita1a0892d3586e2c1e67ff895f6c739282907c836 (patch)
tree21befbb8ba4db910b836bfa68a21ae03c5b1b618 /src/main/java
parent018942c7d0127e6a5ac93dfaf496394655e1e4c7 (diff)
refresh ui after device list update only if list has changed
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java13
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java1
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java5
3 files changed, 13 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
index 02062eba1..333c65fd9 100644
--- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
@@ -483,9 +483,18 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
publishOwnDeviceId(deviceIds);
}
}
+ final Set<Integer> oldSet = this.deviceIds.get(jid);
+ final boolean changed = oldSet == null || oldSet.hashCode() != hash;
this.deviceIds.put(jid, deviceIds);
- mXmppConnectionService.updateConversationUi(); //update the lock icon
- mXmppConnectionService.keyStatusUpdated(null);
+ if (changed) {
+ mXmppConnectionService.updateConversationUi(); //update the lock icon
+ mXmppConnectionService.keyStatusUpdated(null);
+ if (me) {
+ mXmppConnectionService.updateAccountUi();
+ }
+ } else {
+ Log.d(Config.LOGTAG, "skipped device list update because it hasn't changed");
+ }
}
public void wipeOtherPepDevices() {
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index df85f2f25..dca999069 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -303,7 +303,6 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Received PEP device list " + deviceIds + " update from " + from + ", processing... ");
AxolotlService axolotlService = account.getAxolotlService();
axolotlService.registerDevices(from, deviceIds);
- mXmppConnectionService.updateAccountUi();
} else if (Namespace.BOOKMARKS.equals(node)) {
Log.d(Config.LOGTAG, "received bookmarks from " + from);
if (account.getJid().asBareJid().equals(from)) {
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index 52bff613c..efd4d3b8d 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -1128,13 +1128,13 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
- assert (0 <= position && position < fragments.length);
FragmentTransaction trans = fragmentManager.beginTransaction();
trans.remove(fragments[position]);
trans.commit();
fragments[position] = null;
}
+ @NonNull
@Override
public Fragment instantiateItem(@NonNull ViewGroup container, int position) {
Fragment fragment = getItem(position);
@@ -1167,8 +1167,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
}
}
- public Fragment getItem(int position) {
- assert (0 <= position && position < fragments.length);
+ Fragment getItem(int position) {
if (fragments[position] == null) {
final MyListFragment listFragment = new MyListFragment();
if (position == 1) {