From 47f48cff3f999e6d6d8e42aa22bdda5fdfc2e335 Mon Sep 17 00:00:00 2001 From: Gabriele M Date: Thu, 6 Jul 2017 21:52:13 +0200 Subject: [PATCH] Fix first updates list load --- src/org/lineageos/updater/UpdatesActivity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/org/lineageos/updater/UpdatesActivity.java b/src/org/lineageos/updater/UpdatesActivity.java index eec1946..cf83e29 100644 --- a/src/org/lineageos/updater/UpdatesActivity.java +++ b/src/org/lineageos/updater/UpdatesActivity.java @@ -152,10 +152,10 @@ public class UpdatesActivity extends AppCompatActivity { } }; - private void loadUpdatesList(boolean manualRefresh) throws IOException, JSONException { + private void loadUpdatesList(File jsonFile, boolean manualRefresh) + throws IOException, JSONException { Log.d(TAG, "Adding remote updates"); UpdaterControllerInt controller = mUpdaterService.getUpdaterController(); - File jsonFile = Utils.getCachedUpdateList(this); boolean newUpdates = false; for (UpdateDownload update : Utils.parseJson(jsonFile, true)) { newUpdates |= controller.addUpdate(update); @@ -178,7 +178,7 @@ public class UpdatesActivity extends AppCompatActivity { File jsonFile = Utils.getCachedUpdateList(this); if (jsonFile.exists()) { try { - loadUpdatesList(false); + loadUpdatesList(jsonFile, false); Log.d(TAG, "Cached list parsed"); } catch (IOException | JSONException e) { Log.e(TAG, "Error while parsing json list", e); @@ -227,7 +227,7 @@ public class UpdatesActivity extends AppCompatActivity { public void run() { try { Log.d(TAG, "List downloaded"); - loadUpdatesList(manualRefresh); + loadUpdatesList(jsonFileTmp, manualRefresh); long millis = System.currentTimeMillis(); PreferenceManager.getDefaultSharedPreferences(UpdatesActivity.this) .edit()