mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixes theme change issue (#4029)
Catch Service Unregistered exception in Activity's onDestroy
This commit is contained in:
parent
9375a8ba11
commit
0b5f56b682
1 changed files with 20 additions and 9 deletions
|
|
@ -140,6 +140,12 @@ public class ContributionsFragment
|
||||||
public void onServiceDisconnected(ComponentName componentName) {
|
public void onServiceDisconnected(ComponentName componentName) {
|
||||||
// this should never happen
|
// this should never happen
|
||||||
Timber.e(new RuntimeException("UploadService died but the rest of the process did not!"));
|
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;
|
private boolean shouldShowMediaDetailsFragment;
|
||||||
|
|
@ -466,17 +472,21 @@ public class ContributionsFragment
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
compositeDisposable.clear();
|
try{
|
||||||
getChildFragmentManager().removeOnBackStackChangedListener(this);
|
compositeDisposable.clear();
|
||||||
locationManager.unregisterLocationManager();
|
getChildFragmentManager().removeOnBackStackChangedListener(this);
|
||||||
locationManager.removeLocationListener(this);
|
locationManager.unregisterLocationManager();
|
||||||
super.onDestroy();
|
locationManager.removeLocationListener(this);
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
if (isUploadServiceConnected) {
|
if (isUploadServiceConnected) {
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
getActivity().unbindService(uploadServiceConnection);
|
getActivity().unbindService(uploadServiceConnection);
|
||||||
isUploadServiceConnected = false;
|
isUploadServiceConnected = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (IllegalArgumentException | IllegalStateException exception) {
|
||||||
|
Timber.e(exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -534,6 +544,7 @@ public class ContributionsFragment
|
||||||
|
|
||||||
@Override public void onDestroyView() {
|
@Override public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
isUploadServiceConnected = false;
|
||||||
presenter.onDetachView();
|
presenter.onDetachView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue