Fixes theme change issue (#4029)

Catch Service Unregistered exception in Activity's onDestroy
This commit is contained in:
neslihanturan 2020-11-25 08:02:12 +03:00 committed by GitHub
parent 9375a8ba11
commit 0b5f56b682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -140,6 +140,12 @@ public class ContributionsFragment
public void onServiceDisconnected(ComponentName componentName) {
// this should never happen
Timber.e(new RuntimeException("UploadService died but the rest of the process did not!"));
isUploadServiceConnected = false;
}
@Override
public void onBindingDied(final ComponentName name) {
isUploadServiceConnected = false;
}
};
private boolean shouldShowMediaDetailsFragment;
@ -466,6 +472,7 @@ public class ContributionsFragment
@Override
public void onDestroy() {
try{
compositeDisposable.clear();
getChildFragmentManager().removeOnBackStackChangedListener(this);
locationManager.unregisterLocationManager();
@ -478,6 +485,9 @@ public class ContributionsFragment
isUploadServiceConnected = false;
}
}
} catch (IllegalArgumentException | IllegalStateException exception) {
Timber.e(exception);
}
}
@Override
@ -534,6 +544,7 @@ public class ContributionsFragment
@Override public void onDestroyView() {
super.onDestroyView();
isUploadServiceConnected = false;
presenter.onDetachView();
}