1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-11 04:25:53 +00:00

Don't show duplicate restart dialog when changing settings

This commit is contained in:
Felix Ableitner 2016-10-27 03:54:51 +09:00
parent 877cf224a5
commit 66a7cf45db
3 changed files with 4 additions and 9 deletions

View file

@ -404,7 +404,7 @@ public class MainActivity extends SyncthingActivity
startActivity(new Intent(Intent.ACTION_VIEW, uri)); startActivity(new Intent(Intent.ACTION_VIEW, uri));
break; break;
} }
getApi().editOptions(options, this); getApi().editSettings(getApi().getGui(), options, this);
}; };
getApi().getUsageReport(report -> { getApi().getUsageReport(report -> {

View file

@ -165,7 +165,7 @@ public class SettingsFragment extends PreferenceFragment
mGui = mApi.getGui(); mGui = mApi.getGui();
Joiner joiner = Joiner.on(", "); Joiner joiner = Joiner.on(", ");
mDeviceName.setTitle(mApi.getLocalDevice().name); //mDeviceName.setTitle(mApi.getLocalDevice().name);
mListenAddresses.setText(joiner.join(mOptions.listenAddresses)); mListenAddresses.setText(joiner.join(mOptions.listenAddresses));
mMaxRecvKbps.setText(Integer.toString(mOptions.maxRecvKbps)); mMaxRecvKbps.setText(Integer.toString(mOptions.maxRecvKbps));
mMaxSendKbps.setText(Integer.toString(mOptions.maxSendKbps)); mMaxSendKbps.setText(Integer.toString(mOptions.maxSendKbps));
@ -219,8 +219,7 @@ public class SettingsFragment extends PreferenceFragment
? Options.USAGE_REPORTING_ACCEPTED ? Options.USAGE_REPORTING_ACCEPTED
: Options.USAGE_REPORTING_DENIED; : Options.USAGE_REPORTING_DENIED;
mApi.editOptions(mOptions, getActivity()); mApi.editSettings(mGui, mOptions, getActivity());
mApi.editGui(mGui, getActivity());
return true; return true;
} }

View file

@ -274,12 +274,8 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
addFolder(newFolder); addFolder(newFolder);
} }
public void editGui(Config.Gui newGui, Activity activity) { public void editSettings(Config.Gui newGui, Options newOptions, Activity activity) {
mConfig.gui = newGui; mConfig.gui = newGui;
requireRestart(activity);
}
public void editOptions(Options newOptions, Activity activity) {
mConfig.options = newOptions; mConfig.options = newOptions;
requireRestart(activity); requireRestart(activity);
} }