From e131849171c21e6237d7041e9008a3c46b78d7ca Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Wed, 12 Nov 2014 23:09:07 +0200 Subject: [PATCH] Fixed wrong devices being checked for a node (fixes #89). Also, don't show the local device in device selection. --- .../syncthingandroid/fragments/FolderSettingsFragment.java | 3 ++- .../java/com/nutomic/syncthingandroid/syncthing/RestApi.java | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/FolderSettingsFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/FolderSettingsFragment.java index 17d1fa98..f10019d1 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/FolderSettingsFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/FolderSettingsFragment.java @@ -151,6 +151,8 @@ public class FolderSettingsFragment extends PreferenceFragment List devicesList = mSyncthingService.getApi().getDevices(); for (RestApi.Device n : devicesList) { ExtendedCheckBoxPreference cbp = new ExtendedCheckBoxPreference(getActivity(), n); + // Calling addPreference later causes it to change the checked state. + mDevices.addPreference(cbp); cbp.setTitle(n.Name); cbp.setKey(KEY_NODE_SHARED); cbp.setOnPreferenceChangeListener(FolderSettingsFragment.this); @@ -160,7 +162,6 @@ public class FolderSettingsFragment extends PreferenceFragment cbp.setChecked(true); } } - mDevices.addPreference(cbp); } mVersioning.setChecked(mFolder.Versioning instanceof RestApi.SimpleVersioning); if (mVersioning.isChecked()) { diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java index b72928eb..976242e7 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java @@ -482,7 +482,6 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener, JSONObject n = devices.getJSONObject(j); r.DeviceIds.add(n.getString("DeviceID")); } - r.DeviceIds.add(mLocalDeviceId); r.ReadOnly = json.getBoolean("ReadOnly"); r.RescanIntervalS = json.getInt("RescanIntervalS");