mirror of
https://github.com/readrops/Readrops.git
synced 2025-02-06 21:43:24 +01:00
Dispose sync ressources when destroying activity
This commit is contained in:
parent
8c8d6d65c2
commit
480dddc95d
@ -94,6 +94,7 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
|
||||
private boolean updating;
|
||||
|
||||
private ActionMode actionMode;
|
||||
private Disposable syncDisposable;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -530,6 +531,8 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
|
||||
.subscribe(new Observer<Feed>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
syncDisposable = d;
|
||||
|
||||
if (viewModel.isAccountLocal() && feedNb > 0) {
|
||||
syncProgressLayout.setVisibility(View.VISIBLE);
|
||||
syncProgressBar.setProgress(0);
|
||||
@ -639,6 +642,14 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (syncDisposable != null && !syncDisposable.isDisposed())
|
||||
syncDisposable.dispose();
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public enum ListSortType {
|
||||
NEWEST_TO_OLDEST,
|
||||
OLDEST_TO_NEWEST
|
||||
|
Loading…
x
Reference in New Issue
Block a user