mirror of https://github.com/readrops/Readrops.git
Remember if the app was syncing when destroying and recreating the activity
This commit is contained in:
parent
480dddc95d
commit
00fae40637
|
@ -8,6 +8,7 @@
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:name=".utils.ReadropsApp"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_readrops"
|
android:icon="@drawable/ic_readrops"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|
|
@ -69,6 +69,8 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
|
||||||
|
|
||||||
public static final String ACCOUNT_KEY = "account";
|
public static final String ACCOUNT_KEY = "account";
|
||||||
|
|
||||||
|
private static final String SYNCING_KEY = "SYNCING";
|
||||||
|
|
||||||
private RecyclerView recyclerView;
|
private RecyclerView recyclerView;
|
||||||
private MainItemListAdapter adapter;
|
private MainItemListAdapter adapter;
|
||||||
private SwipeRefreshLayout refreshLayout;
|
private SwipeRefreshLayout refreshLayout;
|
||||||
|
@ -191,6 +193,10 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
|
||||||
refreshLayout.setRefreshing(true);
|
refreshLayout.setRefreshing(true);
|
||||||
onRefresh();
|
onRefresh();
|
||||||
accountWeakReference.clear();
|
accountWeakReference.clear();
|
||||||
|
} else if (currentAccount == null && savedInstanceState != null && savedInstanceState.getBoolean(SYNCING_KEY)) {
|
||||||
|
refreshLayout.setRefreshing(true);
|
||||||
|
onRefresh();
|
||||||
|
savedInstanceState.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -650,6 +656,14 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
|
if (refreshLayout.isRefreshing())
|
||||||
|
outState.putBoolean(SYNCING_KEY, true);
|
||||||
|
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
public enum ListSortType {
|
public enum ListSortType {
|
||||||
NEWEST_TO_OLDEST,
|
NEWEST_TO_OLDEST,
|
||||||
OLDEST_TO_NEWEST
|
OLDEST_TO_NEWEST
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.readrops.app.utils;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
|
||||||
|
import io.reactivex.plugins.RxJavaPlugins;
|
||||||
|
|
||||||
|
public class ReadropsApp extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
|
||||||
|
RxJavaPlugins.setErrorHandler(e -> { });
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue