diff --git a/core/res/values/bools.xml b/core/res/values/bools.xml index 9629ade3..cda0f8f8 100644 --- a/core/res/values/bools.xml +++ b/core/res/values/bools.xml @@ -21,6 +21,8 @@ true false + + true true diff --git a/core/src/org/transdroid/core/app/settings/SystemSettings.java b/core/src/org/transdroid/core/app/settings/SystemSettings.java index d5e44d05..b121f3f3 100644 --- a/core/src/org/transdroid/core/app/settings/SystemSettings.java +++ b/core/src/org/transdroid/core/app/settings/SystemSettings.java @@ -70,14 +70,5 @@ public class SystemSettings { public void setLastCheckedForAppUpdates(Date lastChecked) { prefs.edit().putLong("system_lastappupdatecheck", lastChecked == null ? -1L : lastChecked.getTime()).commit(); } - - /** - * Whether the custom app update checker should be used to check for new app and search module versions. - * @return True if it should be checked against transdroid.org if there are app updates (as opposed to using the - * Play Store for updates), false otherwise - */ - public static boolean enableUpdateChecker(Context context) { - return !context.getPackageName().equals("org.transdroid.lite"); - } - + } diff --git a/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java b/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java index ec82c317..7910de72 100644 --- a/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java +++ b/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java @@ -162,6 +162,15 @@ public class NavigationHelper { return context.getResources().getBoolean(R.bool.seedboxes_available); } + /** + * Whether the custom app update checker should be used to check for new app and search module versions. + * @return True if it should be checked against transdroid.org if there are app updates (as opposed to using the + * Play Store for updates, for example), false otherwise + */ + public boolean enableUpdateChecker() { + return context.getResources().getBoolean(R.bool.updatecheck_available); + } + /** * Converts a string into a {@link Spannable} that displays the string in the Roboto Condensed font * @param string A plain text {@link String} diff --git a/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java b/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java index d77bcca9..b4880665 100644 --- a/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java +++ b/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java @@ -26,7 +26,6 @@ import org.json.JSONException; import org.transdroid.core.R; import org.transdroid.core.app.settings.ApplicationSettings; import org.transdroid.core.app.settings.SettingsPersistence; -import org.transdroid.core.app.settings.SystemSettings; import org.transdroid.core.gui.log.ErrorLogSender; import org.transdroid.core.gui.navigation.DialogHelper; import org.transdroid.core.gui.navigation.NavigationHelper; @@ -61,6 +60,8 @@ public class SystemSettingsActivity extends SherlockPreferenceActivity { protected static final int DIALOG_EXPORTSETTINGS = 3; protected static final String INSTALLHELP_URI = "http://www.transdroid.org/download/"; + @Bean + protected NavigationHelper navigationHelper; @Bean protected ApplicationSettings applicationSettings; @Bean @@ -79,7 +80,7 @@ public class SystemSettingsActivity extends SherlockPreferenceActivity { addPreferencesFromResource(R.xml.pref_system); // Handle outgoing links and preference changes - if (SystemSettings.enableUpdateChecker(this)) { + if (navigationHelper.enableUpdateChecker()) { findPreference("system_checkupdates").setOnPreferenceClickListener(onCheckUpdatesClick); } else { getPreferenceScreen().removePreference(findPreference("system_checkupdates")); diff --git a/core/src/org/transdroid/core/service/AppUpdateService.java b/core/src/org/transdroid/core/service/AppUpdateService.java index ef7a29e1..1180442d 100644 --- a/core/src/org/transdroid/core/service/AppUpdateService.java +++ b/core/src/org/transdroid/core/service/AppUpdateService.java @@ -34,6 +34,7 @@ import org.transdroid.core.R; import org.transdroid.core.app.settings.NotificationSettings; import org.transdroid.core.app.settings.SystemSettings; import org.transdroid.core.gui.log.Log; +import org.transdroid.core.gui.navigation.NavigationHelper; import org.transdroid.daemon.util.HttpHelper; import android.app.IntentService; @@ -54,6 +55,8 @@ public class AppUpdateService extends IntentService { private static final String DOWNLOAD_URL_APP = "http://www.transdroid.org/latest"; private static final String DOWNLOAD_URL_SEARCH = "http://www.transdroid.org/latest-search"; + @Bean + protected NavigationHelper navigationHelper; @Bean protected ConnectivityHelper connectivityHelper; @Bean @@ -70,9 +73,13 @@ public class AppUpdateService extends IntentService { @Override protected void onHandleIntent(Intent intent) { + // Only run this service if app updates are handled via transdroid.org at all + if (!navigationHelper.enableUpdateChecker()) + return; + if (!connectivityHelper.shouldPerformBackgroundActions() || !systemSettings.checkForUpdates()) { - Log.d(this, - "Skip the app update service, as background data is disabled, the service is disabled or we are not connected."); + Log.d(this, "Skip the app update service, as background data is disabled, the service is explicitly " + + "disabled or we are not connected."); return; } diff --git a/core/src/org/transdroid/core/service/BootReceiver.java b/core/src/org/transdroid/core/service/BootReceiver.java index 770b4da7..d90e499a 100644 --- a/core/src/org/transdroid/core/service/BootReceiver.java +++ b/core/src/org/transdroid/core/service/BootReceiver.java @@ -21,6 +21,7 @@ import org.transdroid.core.app.settings.NotificationSettings_; import org.transdroid.core.app.settings.SystemSettings; import org.transdroid.core.app.settings.SystemSettings_; import org.transdroid.core.gui.log.Log; +import org.transdroid.core.gui.navigation.NavigationHelper_; import android.app.AlarmManager; import android.app.PendingIntent; @@ -50,10 +51,10 @@ public class BootReceiver extends BroadcastReceiver { public static void startBackgroundServices(Context context, boolean forceReload) { NotificationSettings notificationSettings = NotificationSettings_.getInstance_(context); AlarmManager alarms = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - // Start the alarms if one of the notifications are enabled and we do not yet have the alarms running + // Start the alarms if one of the notifications are enabled and we do not yet have the alarms running // (or should reload it forcefully) - if ((notificationSettings.isEnabledForRss() || notificationSettings.isEnabledForTorrents()) && - (forceReload || (piServerChecker == null && piRssChecker == null))) { + if ((notificationSettings.isEnabledForRss() || notificationSettings.isEnabledForTorrents()) + && (forceReload || (piServerChecker == null && piRssChecker == null))) { Log.d(context, "Boot signal received, starting server and rss checker background services"); // Schedule repeating alarms, with the first being (somewhat) in 1 second from now @@ -72,7 +73,8 @@ public class BootReceiver extends BroadcastReceiver { public static void startAppUpdatesService(Context context) { SystemSettings systemSettings = SystemSettings_.getInstance_(context); AlarmManager alarms = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - if (SystemSettings.enableUpdateChecker(context) && systemSettings.checkForUpdates() && piAppUpdates == null) { + if (NavigationHelper_.getInstance_(context).enableUpdateChecker() && systemSettings.checkForUpdates() + && piAppUpdates == null) { Log.d(context, "Boot signal received, starting app update checker service"); // Schedule a daily, with the first being (somewhat) in 1 second from now diff --git a/full/res/values/bools.xml b/full/res/values/bools.xml index 73f46014..3e13dd04 100644 --- a/full/res/values/bools.xml +++ b/full/res/values/bools.xml @@ -17,6 +17,8 @@ --> + + true true diff --git a/lite/res/values/bools.xml b/lite/res/values/bools.xml index df85c6ba..27a2ff6a 100644 --- a/lite/res/values/bools.xml +++ b/lite/res/values/bools.xml @@ -17,6 +17,8 @@ --> + + false false