mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-13 13:35:53 +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:
parent
ccfd28abbc
commit
9ea8af4774
2 changed files with 1 additions and 9 deletions
src/main/java/com/nutomic/syncthingandroid/fragments
|
@ -170,7 +170,6 @@ public class NodeSettingsFragment extends PreferenceFragment implements
|
|||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
mSyncthingService.getApi().deleteNode(mNode, getActivity());
|
||||
getActivity().finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
|
@ -273,17 +272,12 @@ public class NodeSettingsFragment extends PreferenceFragment implements
|
|||
|
||||
/**
|
||||
* Callback for {@link RestApi#editNode}.
|
||||
* Displays an error message if present, or finishes the Activity on success in edit mode.
|
||||
*
|
||||
* @param normalizedId The normalized node ID, or null on error.
|
||||
* @param error An error message, or null on success.
|
||||
* Displays an error toast if error message present.
|
||||
*/
|
||||
@Override
|
||||
public void onNodeIdNormalized(String normalizedId, String error) {
|
||||
if (error != null) {
|
||||
Toast.makeText(getActivity(), error, Toast.LENGTH_LONG).show();
|
||||
} else if (mIsCreate) {
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,6 @@ public class RepoSettingsFragment extends PreferenceFragment
|
|||
return true;
|
||||
}
|
||||
mSyncthingService.getApi().editRepo(mRepo, true, getActivity());
|
||||
getActivity().finish();
|
||||
return true;
|
||||
case R.id.delete:
|
||||
new AlertDialog.Builder(getActivity())
|
||||
|
@ -199,7 +198,6 @@ public class RepoSettingsFragment extends PreferenceFragment
|
|||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
mSyncthingService.getApi().deleteRepo(mRepo, getActivity());
|
||||
getActivity().finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
|
|
Loading…
Reference in a new issue