refresh ui after device list update only if list has changed

This commit is contained in:
Daniel Gultsch 2018-10-03 11:53:02 +02:00
parent b2cbd60f94
commit 7fa8811f64
3 changed files with 13 additions and 6 deletions

View File

@ -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() {

View File

@ -211,7 +211,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)) {

View File

@ -1110,13 +1110,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);
@ -1149,8 +1149,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) {