save favorites count
This commit is contained in:
1 parent
5d8fe06d5c
commit
faddb37557
2 files changed
+24
No files matched your search
@@ -749,6 +749,10 @@ public class Settings {
|
||||
private static final String KEY_FAV_COUNT_7 = "fav_count_7";
|
||||
private static final String KEY_FAV_COUNT_8 = "fav_count_8";
|
||||
private static final String KEY_FAV_COUNT_9 = "fav_count_9";
|
||||
|
||||
private static final String KEY_FAV_LOCAL = "fav_local";
|
||||
private static final String KEY_FAV_CLOUD = "fav_cloud";
|
||||
|
||||
private static final int DEFAULT_FAV_COUNT = 0;
|
||||
|
||||
public static String[] getFavCat() {
|
||||
@@ -813,6 +817,22 @@ public class Settings {
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static int getFavLocalCount() {
|
||||
return sSettingsPre.getInt(KEY_FAV_LOCAL, DEFAULT_FAV_COUNT);
|
||||
}
|
||||
|
||||
public static void putFavLocalCount(int count) {
|
||||
sSettingsPre.edit().putInt(KEY_FAV_LOCAL, count).apply();
|
||||
}
|
||||
|
||||
public static int getFavCloudCount() {
|
||||
return sSettingsPre.getInt(KEY_FAV_CLOUD, DEFAULT_FAV_COUNT);
|
||||
}
|
||||
|
||||
public static void putFavCloudCount(int count) {
|
||||
sSettingsPre.edit().putInt(KEY_FAV_CLOUD, count).apply();
|
||||
}
|
||||
|
||||
private static final String KEY_RECENT_FAV_CAT = "recent_fav_cat";
|
||||
private static final int DEFAULT_RECENT_FAV_CAT = FavListUrlBuilder.FAV_CAT_ALL;
|
||||
|
||||
|
||||
@@ -180,6 +180,8 @@ public class FavoritesScene extends BaseScene implements
|
||||
mClient = EhApplication.getEhClient(context);
|
||||
mFavCatArray = Settings.getFavCat();
|
||||
mFavCountArray = Settings.getFavCount();
|
||||
mLocalSize = Settings.getFavLocalCount();
|
||||
mCloudSize = Settings.getFavCloudCount();
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
onInit();
|
||||
@@ -850,6 +852,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
for (int i = 0; i < 10; i++ ){
|
||||
mCloudSize = mCloudSize + mFavCountArray[i];
|
||||
}
|
||||
Settings.putFavCloudCount(mCloudSize);
|
||||
}
|
||||
|
||||
updateSearchBar();
|
||||
@@ -883,6 +886,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
mHelper.onGetPageData(taskId, Collections.EMPTY_LIST);
|
||||
} else {
|
||||
mLocalSize = list.size();
|
||||
Settings.putFavLocalCount(mLocalSize);
|
||||
mHelper.setPages(taskId, 1);
|
||||
mHelper.onGetPageData(taskId, list);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user