mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-23 04:41:16 +00:00
Don't reset scroll position when updating device/folder list (fixes #579).
This commit is contained in:
parent
deda1582df
commit
02c93dee6e
3 changed files with 7 additions and 1 deletions
|
@ -104,11 +104,14 @@ public class DeviceListFragment extends ListFragment implements SyncthingService
|
|||
setListAdapter(mAdapter);
|
||||
}
|
||||
|
||||
// Prevent scroll position reset due to list update from clear().
|
||||
mAdapter.setNotifyOnChange(false);
|
||||
mAdapter.clear();
|
||||
List<RestApi.Device> devices = activity.getApi().getDevices(false);
|
||||
Collections.sort(devices, DEVICES_COMPARATOR);
|
||||
mAdapter.addAll(devices);
|
||||
mAdapter.updateConnections(activity.getApi());
|
||||
mAdapter.notifyDataSetChanged();
|
||||
setListShown(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -105,11 +105,14 @@ public class FolderListFragment extends ListFragment implements SyncthingService
|
|||
setListAdapter(mAdapter);
|
||||
}
|
||||
|
||||
// Prevent scroll position reset due to list update from clear().
|
||||
mAdapter.setNotifyOnChange(false);
|
||||
mAdapter.clear();
|
||||
List<RestApi.Folder> folders = activity.getApi().getFolders();
|
||||
Collections.sort(folders, FOLDERS_COMPARATOR);
|
||||
mAdapter.addAll(folders);
|
||||
mAdapter.updateModel(activity.getApi());
|
||||
mAdapter.notifyDataSetChanged();
|
||||
setListShown(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,6 @@ public class DevicesAdapter extends ArrayAdapter<RestApi.Device>
|
|||
@Override
|
||||
public void onReceiveConnections(Map<String, RestApi.Connection> connections) {
|
||||
mConnections = connections;
|
||||
notifyDataSetInvalidated();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue