diff --git a/app/src/main/java/org/fdroid/fdroid/UpdateService.java b/app/src/main/java/org/fdroid/fdroid/UpdateService.java index 3759f61ed..05f459e11 100644 --- a/app/src/main/java/org/fdroid/fdroid/UpdateService.java +++ b/app/src/main/java/org/fdroid/fdroid/UpdateService.java @@ -84,6 +84,7 @@ public class UpdateService extends JobIntentService { private static final int NOTIFY_ID_UPDATING = 0; + private static UpdateService updateService; private static Handler toastHandler; private NotificationManager notificationManager; @@ -189,6 +190,8 @@ public class UpdateService extends JobIntentService { /** * Whether or not a repo update is currently in progress. Used to show feedback throughout * the app to users, so they know something is happening. + * + * @see set a global variable when it is running that your client can check */ public static boolean isUpdating() { return updateService != null; @@ -240,8 +243,6 @@ public class UpdateService extends JobIntentService { } - private static UpdateService updateService; - public static void stopNow(Context context) { if (updateService != null) { updateService.stopSelf(JOB_ID); diff --git a/app/src/main/java/org/fdroid/fdroid/views/main/MainActivity.java b/app/src/main/java/org/fdroid/fdroid/views/main/MainActivity.java index beb172523..888dd0aec 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/main/MainActivity.java +++ b/app/src/main/java/org/fdroid/fdroid/views/main/MainActivity.java @@ -158,13 +158,8 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationB bottomNavigation.selectTab(adapter.adapterPositionFromItemId(selectedMenuId)); } - /** - * The first time the app is run, we will have an empty app list. To deal with this, we will - * attempt to update with the default repo. However, if we have tried this at least once, then - * don't try to do it automatically again. - */ private void initialRepoUpdateIfRequired() { - if (!Preferences.get().isIndexNeverUpdated()) { + if (Preferences.get().isIndexNeverUpdated() && !UpdateService.isUpdating()) { Utils.debugLog(TAG, "We haven't done an update yet. Forcing repo update."); UpdateService.updateNow(this); }