1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-14 05:55:54 +00:00

Do not immediately finish() activity after creating or deleting repo/node.

This caused problems with restart dialogs ("activity has leaked window").
Instead, the activity is finished anyway as soon as the syncthing API
becomes unavailable due to restarting.

We will have to revisit this when syncthing does not need to be restarted
any more.
This commit is contained in:
Felix Ableitner 2014-09-24 19:13:52 +03:00
parent ccfd28abbc
commit 9ea8af4774
2 changed files with 1 additions and 9 deletions

View file

@ -170,7 +170,6 @@ public class NodeSettingsFragment extends PreferenceFragment implements
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
mSyncthingService.getApi().deleteNode(mNode, getActivity()); mSyncthingService.getApi().deleteNode(mNode, getActivity());
getActivity().finish();
} }
}) })
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)
@ -273,17 +272,12 @@ public class NodeSettingsFragment extends PreferenceFragment implements
/** /**
* Callback for {@link RestApi#editNode}. * Callback for {@link RestApi#editNode}.
* Displays an error message if present, or finishes the Activity on success in edit mode. * Displays an error toast if error message present.
*
* @param normalizedId The normalized node ID, or null on error.
* @param error An error message, or null on success.
*/ */
@Override @Override
public void onNodeIdNormalized(String normalizedId, String error) { public void onNodeIdNormalized(String normalizedId, String error) {
if (error != null) { if (error != null) {
Toast.makeText(getActivity(), error, Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), error, Toast.LENGTH_LONG).show();
} else if (mIsCreate) {
getActivity().finish();
} }
} }

View file

@ -190,7 +190,6 @@ public class RepoSettingsFragment extends PreferenceFragment
return true; return true;
} }
mSyncthingService.getApi().editRepo(mRepo, true, getActivity()); mSyncthingService.getApi().editRepo(mRepo, true, getActivity());
getActivity().finish();
return true; return true;
case R.id.delete: case R.id.delete:
new AlertDialog.Builder(getActivity()) new AlertDialog.Builder(getActivity())
@ -199,7 +198,6 @@ public class RepoSettingsFragment extends PreferenceFragment
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
mSyncthingService.getApi().deleteRepo(mRepo, getActivity()); mSyncthingService.getApi().deleteRepo(mRepo, getActivity());
getActivity().finish();
} }
}) })
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)