From d689a1f151f0d865980b54234afe05c9442a9871 Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Wed, 24 Oct 2018 11:07:36 +0200 Subject: [PATCH] Reworked background services via Android-Job. This finally adds support for newer Android versions (respecting Doze mode et al.) and stops crashing the app on Android 8. Fixes #462 and fixes #464. --- app/build.gradle | 9 +- app/src/main/AndroidManifest.xml | 7 +- .../app/settings/NotificationSettings.java | 4 +- .../core/app/settings/SystemSettings.java | 5 +- .../transdroid/core/gui/TorrentsActivity.java | 10 +- .../transdroid/core/gui/TransdroidApp.java | 50 ++++++++++ .../NotificationSettingsActivity.java | 16 +--- .../gui/settings/SystemSettingsActivity.java | 9 +- .../core/service/AlarmReceiver.java | 50 ---------- .../transdroid/core/service/AppUpdateJob.java | 60 ++++++++++++ ...teService.java => AppUpdateJobRunner.java} | 92 +++++++++---------- .../transdroid/core/service/BootReceiver.java | 91 ++---------------- .../core/service/RssCheckerJob.java | 61 ++++++++++++ ...rService.java => RssCheckerJobRunner.java} | 70 +++++++------- .../core/service/ScheduledJobCreator.java | 41 +++++++++ .../core/service/ServerCheckerJob.java | 56 +++++++++++ ...rvice.java => ServerCheckerJobRunner.java} | 85 ++++++++--------- app/src/main/res/values-bg/strings.xml | 3 +- app/src/main/res/values-cs/strings.xml | 3 +- app/src/main/res/values-da/strings.xml | 3 +- app/src/main/res/values-de/strings.xml | 3 +- app/src/main/res/values-es/strings.xml | 3 +- app/src/main/res/values-et/strings.xml | 3 +- app/src/main/res/values-fa/strings.xml | 3 +- app/src/main/res/values-fi/strings.xml | 3 +- app/src/main/res/values-fr/strings.xml | 3 +- app/src/main/res/values-he/strings.xml | 3 +- app/src/main/res/values-hu/strings.xml | 3 +- app/src/main/res/values-it/strings.xml | 3 +- app/src/main/res/values-ja/strings.xml | 3 +- app/src/main/res/values-ko/strings.xml | 3 +- app/src/main/res/values-nl/strings.xml | 3 +- app/src/main/res/values-pl/strings.xml | 3 +- app/src/main/res/values-pt-rBR/strings.xml | 3 +- app/src/main/res/values-pt/strings.xml | 3 +- app/src/main/res/values-ru/strings.xml | 3 +- app/src/main/res/values-sl/strings.xml | 3 +- app/src/main/res/values-sv/strings.xml | 3 +- app/src/main/res/values-tr/strings.xml | 3 +- app/src/main/res/values-uk/strings.xml | 3 +- app/src/main/res/values-vi/strings.xml | 3 +- app/src/main/res/values-zh-rCN/strings.xml | 3 +- app/src/main/res/values-zh-rHK/strings.xml | 3 +- app/src/main/res/values/strings.xml | 6 +- build.gradle | 2 +- 45 files changed, 448 insertions(+), 354 deletions(-) create mode 100644 app/src/main/java/org/transdroid/core/gui/TransdroidApp.java delete mode 100644 app/src/main/java/org/transdroid/core/service/AlarmReceiver.java create mode 100644 app/src/main/java/org/transdroid/core/service/AppUpdateJob.java rename app/src/main/java/org/transdroid/core/service/{AppUpdateService.java => AppUpdateJobRunner.java} (79%) create mode 100644 app/src/main/java/org/transdroid/core/service/RssCheckerJob.java rename app/src/main/java/org/transdroid/core/service/{RssCheckerService.java => RssCheckerJobRunner.java} (68%) create mode 100644 app/src/main/java/org/transdroid/core/service/ScheduledJobCreator.java create mode 100644 app/src/main/java/org/transdroid/core/service/ServerCheckerJob.java rename app/src/main/java/org/transdroid/core/service/{ServerCheckerService.java => ServerCheckerJobRunner.java} (84%) diff --git a/app/build.gradle b/app/build.gradle index 796e06cb..d511a703 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -53,8 +53,8 @@ android { } dependencies { - implementation 'org.androidannotations:androidannotations-api:4.4.0' - implementation 'org.androidannotations:ormlite-api:4.4.0' + implementation 'org.androidannotations:androidannotations-api:4.5.2' + implementation 'org.androidannotations:ormlite-api:4.5.2' implementation 'com.j256.ormlite:ormlite-core:4.48' implementation 'com.j256.ormlite:ormlite-android:4.48' implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' @@ -66,7 +66,8 @@ dependencies { implementation('com.github.afollestad.material-dialogs:core:0.9.6.0@aar') { transitive = true } - annotationProcessor 'org.androidannotations:androidannotations:4.4.0' - annotationProcessor 'org.androidannotations:ormlite:4.4.0' + implementation 'com.evernote:android-job:1.2.6' + annotationProcessor 'org.androidannotations:androidannotations:4.5.2' + annotationProcessor 'org.androidannotations:ormlite:4.5.2' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d55663f2..99bbbdec 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -44,6 +44,7 @@ android:required="false" /> - - - - - - . + */ +package org.transdroid.core.gui; + +import android.app.Application; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import com.evernote.android.job.JobConfig; +import com.evernote.android.job.JobManager; +import com.evernote.android.job.util.JobLogger; +import org.androidannotations.annotations.Bean; +import org.androidannotations.annotations.EApplication; +import org.transdroid.core.gui.log.Log; +import org.transdroid.core.service.ScheduledJobCreator; + +@EApplication +public class TransdroidApp extends Application { + + @Bean + protected Log log; + + @Override + public void onCreate() { + super.onCreate(); + + // Configure Android-Job + JobConfig.addLogger(new JobLogger() { + @Override + public void log(int priority, @NonNull String tag, @NonNull String message, @Nullable Throwable t) { + log.d(tag, message); + } + }); + JobManager.create(this).addJobCreator(new ScheduledJobCreator()); + } + +} diff --git a/app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java b/app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java index f2717f04..b31d8223 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java @@ -29,6 +29,8 @@ import org.androidannotations.annotations.OptionsItem; import org.transdroid.R; import org.transdroid.core.app.settings.NotificationSettings; import org.transdroid.core.service.BootReceiver; +import org.transdroid.core.service.RssCheckerJob; +import org.transdroid.core.service.ServerCheckerJob; @EActivity public class NotificationSettingsActivity extends PreferenceCompatActivity implements OnSharedPreferenceChangeListener { @@ -73,18 +75,8 @@ public class NotificationSettingsActivity extends PreferenceCompatActivity imple @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { - - boolean disabled = !notificationSettings.isEnabledForRss() && !notificationSettings.isEnabledForTorrents(); - updatePrefsEnabled(disabled); - - if (disabled) { - // Disabled all background notifications; disable the alarms that start the service - BootReceiver.cancelBackgroundServices(getApplicationContext()); - } - - // (Re-)enable the alarms for the background services - // Note that this still respects the user preference - BootReceiver.startBackgroundServices(getApplicationContext(), true); + ServerCheckerJob.schedule(getApplicationContext()); + RssCheckerJob.schedule(getApplicationContext()); } @SuppressWarnings("deprecation") diff --git a/app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java b/app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java index 82da4cbb..61d91633 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java @@ -25,7 +25,6 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; -import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceManager; @@ -47,7 +46,7 @@ import org.transdroid.core.gui.log.ErrorLogSender; import org.transdroid.core.gui.navigation.NavigationHelper; import org.transdroid.core.gui.search.BarcodeHelper; import org.transdroid.core.gui.search.SearchHistoryProvider; -import org.transdroid.core.service.BootReceiver; +import org.transdroid.core.service.AppUpdateJob; import java.io.FileNotFoundException; import java.io.IOException; @@ -85,11 +84,7 @@ public class SystemSettingsActivity extends PreferenceCompatActivity { private OnPreferenceClickListener onCheckUpdatesClick = new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - if (((CheckBoxPreference) preference).isChecked()) { - BootReceiver.startAppUpdatesService(getApplicationContext()); - } else { - BootReceiver.cancelAppUpdates(getApplicationContext()); - } + AppUpdateJob.schedule(getApplicationContext()); return true; } }; diff --git a/app/src/main/java/org/transdroid/core/service/AlarmReceiver.java b/app/src/main/java/org/transdroid/core/service/AlarmReceiver.java deleted file mode 100644 index b64fb4b3..00000000 --- a/app/src/main/java/org/transdroid/core/service/AlarmReceiver.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2010-2013 Eric Kok et al. - * - * Transdroid is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Transdroid is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Transdroid. If not, see . - */ -package org.transdroid.core.service; - -import org.androidannotations.annotations.EReceiver; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -/** - * Acts simply as an intermediary to start the appropriate background service when an alarm goes off. - * @author Eric Kok - */ -@EReceiver -public class AlarmReceiver extends BroadcastReceiver { - - @Override - public void onReceive(Context context, Intent intent) { - switch (intent.getIntExtra("service", -1)) { - case BootReceiver.ALARM_SERVERCHECKER: - context.startService(new Intent(context, ServerCheckerService_.class)); - break; - case BootReceiver.ALARM_RSSCHECKER: - context.startService(new Intent(context, RssCheckerService_.class)); - break; - case BootReceiver.ALARM_APPUPDATES: - context.startService(new Intent(context, AppUpdateService_.class)); - break; - default: - // No valid service start ID - break; - } - } - -} diff --git a/app/src/main/java/org/transdroid/core/service/AppUpdateJob.java b/app/src/main/java/org/transdroid/core/service/AppUpdateJob.java new file mode 100644 index 00000000..6dc478ff --- /dev/null +++ b/app/src/main/java/org/transdroid/core/service/AppUpdateJob.java @@ -0,0 +1,60 @@ +/* + * Copyright 2010-2013 Eric Kok et al. + * + * Transdroid is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Transdroid is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Transdroid. If not, see . + */ +package org.transdroid.core.service; + +import android.content.Context; +import android.support.annotation.NonNull; +import com.evernote.android.job.Job; +import com.evernote.android.job.JobManager; +import com.evernote.android.job.JobRequest; +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 java.util.concurrent.TimeUnit; + +public class AppUpdateJob extends Job { + + static final String TAG = "app_update_checker"; + + private static Integer scheduledJobId; + + public static void schedule(Context context) { + SystemSettings systemSettings = SystemSettings_.getInstance_(context); + NavigationHelper_ navigationHelper = NavigationHelper_.getInstance_(context); + if (systemSettings.checkForUpdates() && navigationHelper.enableUpdateChecker()) { + Log_.getInstance_(context).d(TAG, "Schedule app update checker job"); + scheduledJobId = new JobRequest.Builder(AppUpdateJob.TAG) + .setPeriodic(TimeUnit.DAYS.toMillis(1)) + .setRequiredNetworkType(JobRequest.NetworkType.CONNECTED) + .setUpdateCurrent(true) + .build() + .schedule(); + } else if (scheduledJobId != null) { + Log_.getInstance_(context).d(TAG, "Cancel rss checker job"); + JobManager.instance().cancel(scheduledJobId); + } + } + + @NonNull + @Override + protected Result onRunJob(@NonNull Params params) { + return AppUpdateJobRunner_.getInstance_(getContext()).run(); + } + +} diff --git a/app/src/main/java/org/transdroid/core/service/AppUpdateService.java b/app/src/main/java/org/transdroid/core/service/AppUpdateJobRunner.java similarity index 79% rename from app/src/main/java/org/transdroid/core/service/AppUpdateService.java rename to app/src/main/java/org/transdroid/core/service/AppUpdateJobRunner.java index 8bea9efd..0967b7c9 100644 --- a/app/src/main/java/org/transdroid/core/service/AppUpdateService.java +++ b/app/src/main/java/org/transdroid/core/service/AppUpdateJobRunner.java @@ -1,29 +1,33 @@ -/* +/* * Copyright 2010-2013 Eric Kok et al. - * + * * Transdroid is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * Transdroid is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with Transdroid. If not, see . */ package org.transdroid.core.service; -import java.io.IOException; -import java.io.InputStream; -import java.util.Calendar; -import java.util.Date; -import java.util.Random; - +import android.app.Notification; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.net.Uri; +import com.evernote.android.job.Job; import org.androidannotations.annotations.Bean; -import org.androidannotations.annotations.EService; +import org.androidannotations.annotations.EBean; +import org.androidannotations.annotations.RootContext; import org.androidannotations.annotations.SystemService; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; @@ -37,24 +41,22 @@ import org.transdroid.core.gui.log.Log; import org.transdroid.core.gui.navigation.NavigationHelper; import org.transdroid.daemon.util.HttpHelper; -import android.app.IntentService; -import android.app.Notification; -import android.app.Notification.Builder; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Intent; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager.NameNotFoundException; -import android.net.Uri; +import java.io.IOException; +import java.io.InputStream; +import java.util.Calendar; +import java.util.Date; +import java.util.Random; -@EService -public class AppUpdateService extends IntentService { +@EBean +public class AppUpdateJobRunner { private static final String LATEST_URL_APP = "https://raw.githubusercontent.com/erickok/transdroid/master/latest-app.html"; private static final String LATEST_URL_SEARCH = "https://raw.githubusercontent.com/erickok/transdroid/master/latest-search.html"; 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"; + @RootContext + protected Context context; @Bean protected Log log; @Bean @@ -68,21 +70,16 @@ public class AppUpdateService extends IntentService { @SystemService protected NotificationManager notificationManager; - public AppUpdateService() { - super("AppUpdateService"); - } - - @Override - protected void onHandleIntent(Intent intent) { + Job.Result run() { // Only run this service if app updates are handled via transdroid.org at all if (!navigationHelper.enableUpdateChecker()) - return; - + return Job.Result.FAILURE; + if (!connectivityHelper.shouldPerformBackgroundActions() || !systemSettings.checkForUpdates()) { log.d(this, "Skip the app update service, as background data is disabled, the service is explicitly " + "disabled or we are not connected."); - return; + return Job.Result.RESCHEDULE; } Date lastChecked = systemSettings.getLastCheckedForAppUpdates(); @@ -91,7 +88,7 @@ public class AppUpdateService extends IntentService { if (lastChecked != null && lastChecked.after(lastDay.getTime())) { log.d(this, "Skip the update service, as we already checked the last 24 hours (or to be exact at " + lastChecked.toString() + ")."); - return; + return Job.Result.RESCHEDULE; } DefaultHttpClient httpclient = new DefaultHttpClient(); @@ -107,33 +104,33 @@ public class AppUpdateService extends IntentService { // New version of the app? try { - PackageInfo appPackage = getPackageManager().getPackageInfo(getPackageName(), 0); + PackageInfo appPackage = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); log.d(this, "Local Transdroid is at " + appPackage.versionCode + " and the reported latest version is " + appVersion); if (appPackage.versionCode < appVersion) { // New version available! Notify the user. - newNotification(getString(R.string.update_app_newversion), - getString(R.string.update_app_newversion), - getString(R.string.update_updateto, app[1].trim()), + newNotification(context.getString(R.string.update_app_newversion), + context.getString(R.string.update_app_newversion), + context.getString(R.string.update_updateto, app[1].trim()), DOWNLOAD_URL_APP + "?" + Integer.toString(random.nextInt()), 90000); } - } catch (NameNotFoundException e) { + } catch (PackageManager.NameNotFoundException e) { // Not installed... this can never happen since this Service is part of the app itself } // New version of the search module? try { - PackageInfo searchPackage = getPackageManager().getPackageInfo("org.transdroid.search", 0); + PackageInfo searchPackage = context.getPackageManager().getPackageInfo("org.transdroid.search", 0); log.d(this, "Local Transdroid Seach is at " + searchPackage.versionCode + " and the reported latest version is " + searchVersion); if (searchPackage.versionCode < searchVersion) { // New version available! Notify the user. - newNotification(getString(R.string.update_search_newversion), - getString(R.string.update_search_newversion), - getString(R.string.update_updateto, search[1].trim()), + newNotification(context.getString(R.string.update_search_newversion), + context.getString(R.string.update_search_newversion), + context.getString(R.string.update_updateto, search[1].trim()), DOWNLOAD_URL_SEARCH + "?" + Integer.toString(random.nextInt()), 90001); } - } catch (NameNotFoundException e) { + } catch (PackageManager.NameNotFoundException e) { // The search module isn't installed yet at all; ignore and wait for the user to manually // install it (when the first search is initiated) } @@ -145,18 +142,21 @@ public class AppUpdateService extends IntentService { } catch (Exception e) { // Cannot check right now for some reason; log and ignore log.d(this, "Cannot retrieve latest app or search module version code from the site: " + e.toString()); + return Job.Result.FAILURE; } + return Job.Result.SUCCESS; } /** * Retrieves the latest version number of the app or search module by checking an online text file that looks like * '160|1.1.15' for version code 160 and version name 1.1.15. + * * @param httpclient An already instantiated HTTP client - * @param url The URL of the the text file that contains the current latest version code and name + * @param url The URL of the the text file that contains the current latest version code and name * @return A string array with two elements: the version code and the version number * @throws ClientProtocolException Thrown when the provided URL is invalid - * @throws IOException Thrown when the last version information could not be retrieved + * @throws IOException Thrown when the last version information could not be retrieved */ private String[] retrieveLatestVersion(AbstractHttpClient httpclient, String url) throws IOException { HttpResponse request = httpclient.execute(new HttpGet(url)); @@ -168,9 +168,9 @@ public class AppUpdateService extends IntentService { @SuppressWarnings("deprecation") private void newNotification(String ticker, String title, String text, String downloadUrl, int notifyID) { - PendingIntent pi = PendingIntent.getActivity(this, notifyID, + PendingIntent pi = PendingIntent.getActivity(context, notifyID, new Intent(Intent.ACTION_VIEW, Uri.parse(downloadUrl)), PendingIntent.FLAG_UPDATE_CURRENT); - Builder builder = new Notification.Builder(this).setSmallIcon(R.drawable.ic_stat_notification) + Notification.Builder builder = new Notification.Builder(context).setSmallIcon(R.drawable.ic_stat_notification) .setTicker(ticker).setContentTitle(title).setContentText(text) .setLights(notificationSettings.getDesiredLedColour(), 600, 1000) .setSound(notificationSettings.getSound()).setAutoCancel(true).setContentIntent(pi); diff --git a/app/src/main/java/org/transdroid/core/service/BootReceiver.java b/app/src/main/java/org/transdroid/core/service/BootReceiver.java index 2c16852a..3ee7b64a 100644 --- a/app/src/main/java/org/transdroid/core/service/BootReceiver.java +++ b/app/src/main/java/org/transdroid/core/service/BootReceiver.java @@ -1,113 +1,40 @@ -/* +/* * Copyright 2010-2013 Eric Kok et al. - * + * * Transdroid is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * Transdroid is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with Transdroid. If not, see . */ package org.transdroid.core.service; -import android.app.AlarmManager; -import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.os.SystemClock; - -import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EReceiver; -import org.transdroid.core.app.settings.*; -import org.transdroid.core.gui.log.*; -import org.transdroid.core.gui.navigation.*; /** * Receives the intent that the device has been started in order to set up proper alarms for all background services. + * * @author Eric Kok */ @EReceiver public class BootReceiver extends BroadcastReceiver { - public static final int ALARM_SERVERCHECKER = 0; - public static final int ALARM_RSSCHECKER = 1; - public static final int ALARM_APPUPDATES = 2; - - public static PendingIntent piServerChecker = null, piRssChecker = null, piAppUpdates = null; - - @Bean - protected Log log; - - 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 - // (or should reload it forcefully) - if ((notificationSettings.isEnabledForRss() || notificationSettings.isEnabledForTorrents()) && - (forceReload || (piServerChecker == null && piRssChecker == null))) { - - Log_.getInstance_(context) - .d("BootReceiver", "Boot signal received, starting server and rss checker background services"); - // Schedule repeating alarms, with the first being (somewhat) in 1 second from now - piServerChecker = PendingIntent.getBroadcast(context, ALARM_SERVERCHECKER, - new Intent(context, AlarmReceiver_.class).putExtra("service", ALARM_SERVERCHECKER), 0); - piRssChecker = PendingIntent.getBroadcast(context, ALARM_RSSCHECKER, - new Intent(context, AlarmReceiver_.class).putExtra("service", ALARM_RSSCHECKER), 0); - alarms.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + 1000, - notificationSettings.getInvervalInMilliseconds(), piServerChecker); - alarms.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + 1000, - notificationSettings.getInvervalInMilliseconds(), piRssChecker); - - } - } - - public static void startAppUpdatesService(Context context) { - SystemSettings systemSettings = SystemSettings_.getInstance_(context); - AlarmManager alarms = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - if (NavigationHelper_.getInstance_(context).enableUpdateChecker() && systemSettings.checkForUpdates() && - piAppUpdates == null) { - - Log_.getInstance_(context).d("BootReceiver", "Boot signal received, starting app update checker service"); - // Schedule a daily, with the first being (somewhat) in 1 second from now - piAppUpdates = PendingIntent.getBroadcast(context, ALARM_APPUPDATES, - new Intent(context, AlarmReceiver_.class).putExtra("service", ALARM_APPUPDATES), 0); - alarms.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + 1000, - AlarmManager.INTERVAL_DAY, piAppUpdates); - - } - } - - public static void cancelBackgroundServices(Context context) { - AlarmManager alarms = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - if (piServerChecker != null) { - alarms.cancel(piServerChecker); - piServerChecker = null; - } - if (piRssChecker != null) { - alarms.cancel(piRssChecker); - piRssChecker = null; - } - } - - public static void cancelAppUpdates(Context context) { - if (piAppUpdates != null) { - AlarmManager alarms = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - alarms.cancel(piAppUpdates); - piAppUpdates = null; - } - } - @Override public void onReceive(Context context, Intent intent) { - startBackgroundServices(context, false); - startAppUpdatesService(context); + // Ensure user-requested background jobs are scheduled + ServerCheckerJob.schedule(context); + RssCheckerJob.schedule(context); + AppUpdateJob.schedule(context); } } diff --git a/app/src/main/java/org/transdroid/core/service/RssCheckerJob.java b/app/src/main/java/org/transdroid/core/service/RssCheckerJob.java new file mode 100644 index 00000000..4fd170eb --- /dev/null +++ b/app/src/main/java/org/transdroid/core/service/RssCheckerJob.java @@ -0,0 +1,61 @@ +/* + * Copyright 2010-2013 Eric Kok et al. + * + * Transdroid is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Transdroid is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Transdroid. If not, see . + */ +package org.transdroid.core.service; + +import android.content.Context; +import android.support.annotation.NonNull; +import com.evernote.android.job.Job; +import com.evernote.android.job.JobManager; +import com.evernote.android.job.JobRequest; +import org.transdroid.core.app.settings.NotificationSettings; +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 java.util.concurrent.TimeUnit; + +public class RssCheckerJob extends Job { + + static final String TAG = "rss_checker"; + + private static Integer scheduledJobId; + + public static void schedule(Context context) { + NotificationSettings notificationSettings = NotificationSettings_.getInstance_(context); + if (notificationSettings.isEnabledForRss()) { + Log_.getInstance_(context).d(TAG, "Schedule rss checker job"); + scheduledJobId = new JobRequest.Builder(RssCheckerJob.TAG) + .setPeriodic(notificationSettings.getInvervalInMilliseconds()) + .setRequiredNetworkType(JobRequest.NetworkType.CONNECTED) + .setUpdateCurrent(true) + .build() + .schedule(); + } else if (scheduledJobId != null) { + Log_.getInstance_(context).d(TAG, "Cancel rss checker job"); + JobManager.instance().cancel(scheduledJobId); + } + } + + @NonNull + @Override + protected Result onRunJob(@NonNull Params params) { + return RssCheckerJobRunner_.getInstance_(getContext()).run(); + } + +} diff --git a/app/src/main/java/org/transdroid/core/service/RssCheckerService.java b/app/src/main/java/org/transdroid/core/service/RssCheckerJobRunner.java similarity index 68% rename from app/src/main/java/org/transdroid/core/service/RssCheckerService.java rename to app/src/main/java/org/transdroid/core/service/RssCheckerJobRunner.java index 33349b8e..7f3b3ca2 100644 --- a/app/src/main/java/org/transdroid/core/service/RssCheckerService.java +++ b/app/src/main/java/org/transdroid/core/service/RssCheckerJobRunner.java @@ -1,51 +1,50 @@ -/* +/* * Copyright 2010-2013 Eric Kok et al. - * + * * Transdroid is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * Transdroid is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with Transdroid. If not, see . */ package org.transdroid.core.service; -import android.app.IntentService; import android.app.Notification; -import android.app.Notification.Builder; import android.app.NotificationManager; import android.app.PendingIntent; +import android.content.Context; import android.content.Intent; - +import com.evernote.android.job.Job; import org.androidannotations.annotations.Bean; -import org.androidannotations.annotations.EService; +import org.androidannotations.annotations.EBean; +import org.androidannotations.annotations.RootContext; import org.androidannotations.annotations.SystemService; import org.transdroid.R; import org.transdroid.core.app.settings.ApplicationSettings; import org.transdroid.core.app.settings.NotificationSettings; import org.transdroid.core.app.settings.RssfeedSetting; import org.transdroid.core.gui.log.Log; -import org.transdroid.core.gui.rss.*; +import org.transdroid.core.gui.rss.RssfeedsActivity_; import org.transdroid.core.rssparser.Item; import org.transdroid.core.rssparser.RssParser; import org.transdroid.daemon.util.Collections2; +import java.util.Date; import java.util.LinkedHashSet; import java.util.Set; -/** - * A background service that checks all user-configured RSS feeds for new items. - * @author Eric Kok - */ -@EService -public class RssCheckerService extends IntentService { +@EBean +public class RssCheckerJobRunner { + @RootContext + protected Context context; @Bean protected Log log; @Bean @@ -57,23 +56,17 @@ public class RssCheckerService extends IntentService { @SystemService protected NotificationManager notificationManager; - public RssCheckerService() { - super("RssCheckerService"); - } - - @SuppressWarnings("deprecation") - @Override - protected void onHandleIntent(Intent intent) { + Job.Result run() { if (!connectivityHelper.shouldPerformBackgroundActions() || !notificationSettings.isEnabledForRss()) { log.d(this, "Skip the RSS checker service, as background data is disabled, the service is disabled or we are not connected."); - return; + return Job.Result.RESCHEDULE; } // Check every RSS feed for new items int unread = 0; - Set hasUnread = new LinkedHashSet(); + Set hasUnread = new LinkedHashSet<>(); for (RssfeedSetting feed : applicationSettings.getRssfeedSettings()) { try { @@ -90,14 +83,24 @@ public class RssCheckerService extends IntentService { } // Find the last item that is newer than the last viewed date + boolean usePublishDate = false; + if (parser.getChannel().getItems().size() > 0) { + Date pubDate = parser.getChannel().getItems().get(0).getPubdate(); + usePublishDate = pubDate != null && pubDate.getTime() > 0; + } for (Item item : parser.getChannel().getItems()) { - if (item.getPubdate() != null && item.getPubdate().before(feed.getLastViewed())) { + if (usePublishDate + && item.getPubdate() != null + && item.getPubdate().before(feed.getLastViewed())) { + break; + } else if (!usePublishDate + && item.getTheLink() != null + && feed.getLastViewedItemUrl() != null + && item.getTheLink().equals(feed.getLastViewedItemUrl())) { break; } else { unread++; - if (!hasUnread.contains(feed.getName())) { - hasUnread.add(feed.getName()); - } + hasUnread.add(feed.getName()); } } @@ -111,16 +114,16 @@ public class RssCheckerService extends IntentService { if (unread == 0) { // No new items; just exit - return; + return Job.Result.SUCCESS; } // Provide a notification, since there are new RSS items PendingIntent pi = PendingIntent - .getActivity(this, 80000, new Intent(this, RssfeedsActivity_.class), PendingIntent.FLAG_UPDATE_CURRENT); - String title = getResources().getQuantityString(R.plurals.rss_service_new, unread, Integer.toString(unread)); + .getActivity(context, 80000, new Intent(context, RssfeedsActivity_.class), PendingIntent.FLAG_UPDATE_CURRENT); + String title = context.getResources().getQuantityString(R.plurals.rss_service_new, unread, Integer.toString(unread)); String forString = Collections2.joinString(hasUnread, ", "); - Builder builder = new Notification.Builder(this).setSmallIcon(R.drawable.ic_stat_notification).setTicker(title) - .setContentTitle(title).setContentText(getString(R.string.rss_service_newfor, forString)) + Notification.Builder builder = new Notification.Builder(context).setSmallIcon(R.drawable.ic_stat_notification).setTicker(title) + .setContentTitle(title).setContentText(context.getString(R.string.rss_service_newfor, forString)) .setNumber(unread).setLights(notificationSettings.getDesiredLedColour(), 600, 1000) .setSound(notificationSettings.getSound()).setAutoCancel(true).setContentIntent(pi); if (notificationSettings.shouldVibrate()) { @@ -128,6 +131,7 @@ public class RssCheckerService extends IntentService { } notificationManager.notify(80001, builder.getNotification()); + return Job.Result.SUCCESS; } } diff --git a/app/src/main/java/org/transdroid/core/service/ScheduledJobCreator.java b/app/src/main/java/org/transdroid/core/service/ScheduledJobCreator.java new file mode 100644 index 00000000..89cc4d66 --- /dev/null +++ b/app/src/main/java/org/transdroid/core/service/ScheduledJobCreator.java @@ -0,0 +1,41 @@ +/* + * Copyright 2010-2013 Eric Kok et al. + * + * Transdroid is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Transdroid is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Transdroid. If not, see . + */ +package org.transdroid.core.service; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import com.evernote.android.job.Job; +import com.evernote.android.job.JobCreator; + +public class ScheduledJobCreator implements JobCreator { + + @Nullable + @Override + public Job create(@NonNull String tag) { + switch (tag) { + case AppUpdateJob.TAG: + return new AppUpdateJob(); + case RssCheckerJob.TAG: + return new RssCheckerJob(); + case ServerCheckerJob.TAG: + return new ServerCheckerJob(); + default: + return null; + } + } + +} diff --git a/app/src/main/java/org/transdroid/core/service/ServerCheckerJob.java b/app/src/main/java/org/transdroid/core/service/ServerCheckerJob.java new file mode 100644 index 00000000..c6d484c4 --- /dev/null +++ b/app/src/main/java/org/transdroid/core/service/ServerCheckerJob.java @@ -0,0 +1,56 @@ +/* + * Copyright 2010-2013 Eric Kok et al. + * + * Transdroid is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Transdroid is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Transdroid. If not, see . + */ +package org.transdroid.core.service; + +import android.content.Context; +import android.support.annotation.NonNull; +import com.evernote.android.job.Job; +import com.evernote.android.job.JobManager; +import com.evernote.android.job.JobRequest; +import org.transdroid.core.app.settings.NotificationSettings; +import org.transdroid.core.app.settings.NotificationSettings_; +import org.transdroid.core.gui.log.Log_; + +public class ServerCheckerJob extends Job { + + static final String TAG = "server_checker"; + + private static Integer scheduledJobId; + + public static void schedule(Context context) { + NotificationSettings notificationSettings = NotificationSettings_.getInstance_(context); + if (notificationSettings.isEnabledForTorrents()) { + Log_.getInstance_(context).d(TAG, "Schedule server checker job"); + scheduledJobId = new JobRequest.Builder(ServerCheckerJob.TAG) + .setPeriodic(notificationSettings.getInvervalInMilliseconds()) + .setRequiredNetworkType(JobRequest.NetworkType.CONNECTED) + .setUpdateCurrent(true) + .build() + .schedule(); + } else if (scheduledJobId != null) { + Log_.getInstance_(context).d(TAG, "Cancel server checker job"); + JobManager.instance().cancel(scheduledJobId); + } + } + + @NonNull + @Override + protected Result onRunJob(@NonNull Params params) { + return ServerCheckerJobRunner_.getInstance_(getContext()).run(); + } + +} diff --git a/app/src/main/java/org/transdroid/core/service/ServerCheckerService.java b/app/src/main/java/org/transdroid/core/service/ServerCheckerJobRunner.java similarity index 84% rename from app/src/main/java/org/transdroid/core/service/ServerCheckerService.java rename to app/src/main/java/org/transdroid/core/service/ServerCheckerJobRunner.java index c1a82211..4dd14cc9 100644 --- a/app/src/main/java/org/transdroid/core/service/ServerCheckerService.java +++ b/app/src/main/java/org/transdroid/core/service/ServerCheckerJobRunner.java @@ -1,26 +1,31 @@ -/* +/* * Copyright 2010-2013 Eric Kok et al. - * + * * Transdroid is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * Transdroid is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with Transdroid. If not, see . */ package org.transdroid.core.service; -import java.util.ArrayList; -import java.util.List; - +import android.app.Notification; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.text.TextUtils; +import com.evernote.android.job.Job; import org.androidannotations.annotations.Bean; -import org.androidannotations.annotations.EService; +import org.androidannotations.annotations.EBean; +import org.androidannotations.annotations.RootContext; import org.androidannotations.annotations.SystemService; import org.json.JSONArray; import org.json.JSONException; @@ -29,7 +34,7 @@ import org.transdroid.R; import org.transdroid.core.app.settings.ApplicationSettings; import org.transdroid.core.app.settings.NotificationSettings; import org.transdroid.core.app.settings.ServerSetting; -import org.transdroid.core.gui.*; +import org.transdroid.core.gui.TorrentsActivity_; import org.transdroid.core.gui.log.Log; import org.transdroid.daemon.IDaemonAdapter; import org.transdroid.daemon.Torrent; @@ -37,24 +42,14 @@ import org.transdroid.daemon.task.DaemonTaskResult; import org.transdroid.daemon.task.RetrieveTask; import org.transdroid.daemon.task.RetrieveTaskSuccessResult; -import android.annotation.TargetApi; -import android.app.IntentService; -import android.app.Notification; -import android.app.Notification.Builder; -import android.app.Notification.InboxStyle; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Intent; -import android.os.Build; -import android.text.TextUtils; +import java.util.ArrayList; +import java.util.List; -/** - * A background service that checks all user-configured servers (if so desired) for new and finished torrents. - * @author Eric Kok - */ -@EService -public class ServerCheckerService extends IntentService { +@EBean +public class ServerCheckerJobRunner { + @RootContext + protected Context context; @Bean protected Log log; @Bean @@ -66,19 +61,12 @@ public class ServerCheckerService extends IntentService { @SystemService protected NotificationManager notificationManager; - public ServerCheckerService() { - super("ServerCheckerService"); - } - - @SuppressWarnings("deprecation") - @TargetApi(Build.VERSION_CODES.JELLY_BEAN) - @Override - protected void onHandleIntent(Intent intent) { + Job.Result run() { if (!connectivityHelper.shouldPerformBackgroundActions() || !notificationSettings.isEnabledForTorrents()) { log.d(this, "Skip the server checker service, as background data is disabled, the service is disabled or we are not connected."); - return; + return Job.Result.RESCHEDULE; } int notifyBase = 10000; @@ -94,7 +82,7 @@ public class ServerCheckerService extends IntentService { JSONArray lastStats = applicationSettings.getServerLastStats(server); // Synchronously retrieve torrents listing - IDaemonAdapter adapter = server.createServerAdapter(connectivityHelper.getConnectedNetworkName(), this); + IDaemonAdapter adapter = server.createServerAdapter(connectivityHelper.getConnectedNetworkName(), context); DaemonTaskResult result = RetrieveTask.create(adapter).execute(log); if (!(result instanceof RetrieveTaskSuccessResult)) { // Cannot retrieve torrents at this time @@ -132,7 +120,7 @@ public class ServerCheckerService extends IntentService { } catch (JSONException e) { // Can't build the JSON object; this should not happen and we can safely ignore it } - + // See if this torrent was done the last time we checked if (lastStats != null) { Boolean wasDone = findLastDoneStat(lastStats, torrent); @@ -146,7 +134,7 @@ public class ServerCheckerService extends IntentService { // This torrent is now done, but wasn't before doneTorrents.add(torrent); } - + } // Store the now-current statistics on torrents for the next time we check this server @@ -155,26 +143,26 @@ public class ServerCheckerService extends IntentService { // Notify on new and now-done torrents for this server log.d(this, server.getName() + ": " + newTorrents.size() + " new torrents, " + doneTorrents.size() + " newly finished torrents."); - Intent i = new Intent(this, TorrentsActivity_.class); + Intent i = new Intent(context, TorrentsActivity_.class); i.putExtra("org.transdroid.START_SERVER", server.getOrder()); // Should start the main activity directly into this server - PendingIntent pi = PendingIntent.getActivity(this, notifyBase + server.getOrder(), i, - Intent.FLAG_ACTIVITY_NEW_TASK); + PendingIntent pi = PendingIntent.getActivity(context, notifyBase + server.getOrder(), i, + PendingIntent.FLAG_CANCEL_CURRENT); ArrayList affectedTorrents = new ArrayList<>(newTorrents.size() + doneTorrents.size()); affectedTorrents.addAll(newTorrents); affectedTorrents.addAll(doneTorrents); - + String title; if (newTorrents.size() > 0 && doneTorrents.size() > 0) { // Note: use the 'one' plural iif 1 new torrent was added and 1 was newly finished - title = getResources().getQuantityString(R.plurals.status_service_finished, + title = context.getResources().getQuantityString(R.plurals.status_service_finished, newTorrents.size() + doneTorrents.size() == 2 ? 1 : 2, Integer.toString(newTorrents.size()), Integer.toString(doneTorrents.size())); } else if (newTorrents.size() > 0) { - title = getResources().getQuantityString(R.plurals.status_service_added, newTorrents.size(), + title = context.getResources().getQuantityString(R.plurals.status_service_added, newTorrents.size(), Integer.toString(newTorrents.size())); } else if (doneTorrents.size() > 0) { - title = getResources().getQuantityString(R.plurals.status_service_finished, doneTorrents.size(), + title = context.getResources().getQuantityString(R.plurals.status_service_finished, doneTorrents.size(), Integer.toString(doneTorrents.size())); } else { // No notification to show @@ -185,9 +173,9 @@ public class ServerCheckerService extends IntentService { forString += affected.getName() + ", "; } forString = forString.substring(0, forString.length() - 2); - + // Build the basic notification - Builder builder = new Notification.Builder(this).setSmallIcon(R.drawable.ic_stat_notification) + Notification.Builder builder = new Notification.Builder(context).setSmallIcon(R.drawable.ic_stat_notification) .setTicker(title).setContentTitle(title).setContentText(forString) .setNumber(affectedTorrents.size()) .setLights(notificationSettings.getDesiredLedColour(), 600, 1000) @@ -198,7 +186,7 @@ public class ServerCheckerService extends IntentService { // Add at most 5 lines with the affected torrents Notification notification; if (android.os.Build.VERSION.SDK_INT >= 16) { - InboxStyle inbox = new Notification.InboxStyle(builder); + Notification.InboxStyle inbox = new Notification.InboxStyle(builder); if (affectedTorrents.size() < 6) { for (Torrent affectedTorrent : affectedTorrents) { inbox.addLine(affectedTorrent.getName()); @@ -207,7 +195,7 @@ public class ServerCheckerService extends IntentService { for (int j = 0; j < 4; j++) { inbox.addLine(affectedTorrents.get(j).getName()); } - inbox.addLine(getString(R.string.status_service_andothers, affectedTorrents.get(5).getName())); + inbox.addLine(context.getString(R.string.status_service_andothers, affectedTorrents.get(5).getName())); } notification = inbox.build(); } else { @@ -217,6 +205,7 @@ public class ServerCheckerService extends IntentService { } + return Job.Result.SUCCESS; } private Boolean findLastDoneStat(JSONArray lastStats, Torrent torrent) { diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 41ef1c05..17316d7d 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -223,8 +223,7 @@ Като desharedgbit001.xirvik.com Като 001.seedstuff.ca - 1 минута - 10 минути + 15 минути 30 минути 1 час 3 часа diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 47fdf764..c64fd102 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -287,8 +287,7 @@ Nelze načíst nastavení složky Xirvik SCGI; opakujte akci později nebo zkontrolujte nastavení adresy vašeho serveru Např.: Like 001.seedstuff.ca - 1 minuta - 10 minut + 15 minut 30 minut 1 hodina 3 hodiny diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index a2583a36..2fd11920 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -303,8 +303,7 @@ Kan ikke hente indstillingen for Xirvik SCGI; Prøv igen senere, eller ret din server adresseindstilling Eks. 001.seedstuff.ca - 1 minut - 10 minutter + 15 minutter 30 minutter 1 time 3 timer diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index b77c0b21..b43d03ce 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -319,8 +319,7 @@ Die Xirvik SCGI-Ordner-Einstellung kann nicht abgerufen werden; Bitte versuchen Sie es später erneut, oder korrigieren Sie ihre Serveradresse Like 001.seedstuff.ca - 1 Minute - 10 Minuten + 15 Minuten 30 Minuten 1 Stunde 3 Stunden diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index cbb35656..0ab48c0b 100755 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -258,8 +258,7 @@ Cliente a conectarse Dirección del servidor - 1 minuto - 10 minutos + 15 minutos 30 minutos 1 hora 3 horas diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index 9e96a404..90cf56fc 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -186,8 +186,7 @@ Nagu desharedgbit001.xirvik.com Nagu 001.seedstuff.ca - 1 minut - 10 minutit + 15 minutit 30 minutit 1 tund 3 tundi diff --git a/app/src/main/res/values-fa/strings.xml b/app/src/main/res/values-fa/strings.xml index c8993fd2..a6055ef4 100644 --- a/app/src/main/res/values-fa/strings.xml +++ b/app/src/main/res/values-fa/strings.xml @@ -308,8 +308,7 @@ نمی‌توان تنظیمات پوشه‌ی SCGIی Xirvik را دریافت کرد؛ لطفا ً بعدا ً دوباره امتحان کنید یا تنظیمات نشانی کارگزار را درست کنید مانند 001.seedstuff.ca - 1 دقیقه - 10 دقیقه + 15 دقیقه 30 دقیقه 1 ساعت 3 ساعت diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index fa6778e8..32facaf6 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -144,8 +144,7 @@ Kuten desharedgbit001.xirvik.com Kuten 001.seedstuff.ca - 1 minuutti - 10 minuuttia + 15 minuuttia 30 minuuttia 1 tunti 3 tuntia diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 03b230e1..5a30c62d 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -303,8 +303,7 @@ Impossible de récupérer le paramètre dossier de Xirvik SCGI ; Veuillez réessayer ultérieurement ou corriger le réglage d\'adresse de votre serveur Comme 001.seedstuff.ca - 1 minute - 10 minutes + 15 minutes 30 minutes 1 heure 3 heures diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index 506a9f1f..995c5293 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -257,8 +257,7 @@ לדוגמא: desharedgbit001.xirvik.com לדוגמא: 001.seedstuff.ca - דקה - 10 דקות + 15 דקות חצי שעה שעה 3 שעות diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 132972ff..2f530ea1 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -319,8 +319,7 @@ Nem lehet letölteni a Xirvik SCGI mappa beállításait; próbálja meg újra később, vagy javítsa ki a szerver címének beállításait Például 001.seedstuff.ca - 1 perc - 10 perc + 15 perc 30 perc 1 óra 3 óra diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 78c6fcd1..8dcd6652 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -319,8 +319,7 @@ Impossibile recuperare la cartella Xirvik SCGI; riprovare più tardi o correggere l\'indirizzo del server Esempio: 001.seedstuff.ca - 1 minuto - 10 minuto + 15 minuto 30 minuto 1 ora 3 ore diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 09435a3a..f308c9f8 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -311,8 +311,7 @@ Xirvik SCGI フォルダー設定を読み取りできません。後で再度実行するか、サーバー・アドレス設定を確認してください 001.seedstuff.ca のように - 1 分 - 10 分 + 15 分 30 分 1 時間 3 時間 diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index c99f2426..3ce6cd74 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -311,8 +311,7 @@ Xirvik SCGI 폴더 설정을 받아오지 못했습니다; 다음에 다시 시도해 보시거나 서버 주소 설정을 고쳐보세요 예) 001.seedstuff.ca - 1분 - 10분 + 15분 30분 1시간 3시간 diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 4e0096b9..cd375caa 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -315,8 +315,7 @@ Kan de Xirvik SCGI mount instelling niet laden; probeer later nog eens en controleer je serveradres Zoals 001.seedstuff.ca - 1 minuut - 10 minuten + 15 minuten 30 minuten 1 uur 3 uur diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 6df7f5e9..5baa69b3 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -284,8 +284,7 @@ Jak desharedgbit001.xirvik.com Jak 001.seedstuff.ca - 1 minuta - 10 minut + 15 minut 30 minut 1 godzina 3 godziny diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 5f311d61..828a1f9a 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -319,8 +319,7 @@ Não foi possível recuperar a pasta de configuração do Xirvik SCGI; por favor, tente novamente mais tarde ou corrija a configuração de endereço do servidor Como 001.seedstuff.ca - 1 minuto - 10 minutos + 15 minutos 30 minutos 1 hora 3 horas diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 19197680..27f98a89 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -319,8 +319,7 @@ Não é possível obter a configuração de pasta Xirvik SCGI; por favor, tente novamente mais tarde ou corrija a sua configuração de endereço do servidor Por ex. 001.seedstuff.ca - 1 minuto - 10 minutos + 15 minutos 30 minutos 1 hora 3 horas diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 2d5af22f..fca9b9cf 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -327,8 +327,7 @@ Не удается получить настройки папок Xirvik SCGI. Пожалуйста, повторите попытку позже или измените адрес сервера. Как 001.seedstuff.ca - 1 минута - 10 минут + 15 минут 30 минут 1 час 3 часа diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index 0c748b44..a891da48 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -335,8 +335,7 @@ Ne morem pridobiti Xirvik SCGI nastavitev map; poskusite pozneje ali popravite naslov strežnika Npr. 001.seedstuff.ca - 1 minuta - 10 minut + 15 minut 30 minut 1 ura 3 ure diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 86af2a66..9aeae273 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -319,8 +319,7 @@ Går inte att hämta Xirvik SCGI mappinställningen. Försök igen senare eller korrigera din serveradress Som 001.seedstuff.ca - 1 minut - 10 minuter + 15 minuter 30 minuter 1 timme 3 timmar diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index fbcc355a..28f2e5f2 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -318,8 +318,7 @@ Xirvik SCGI klasör ayarı alınamıyor; Lütfen daha sonra yeniden deneyin veya sunucu adresi ayarını doğrulayın 001.seedstuff.CA gibi - 1 dakika - 10 dakika + 15 dakika 30 dakika 1 saat 3 saat diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 34b2a5bb..17cea14d 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -158,8 +158,7 @@ Експортувати налаштування Налаштування вдало експортовано - 1 minute - 10 minutes + 15 minutes 30 minutes 1 hour 3 hours diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 7a62a947..37781e8c 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -247,8 +247,7 @@ Trình điều khiển torrent Địa chỉ máy chủ - 1 phút - 10 phút + 15 phút 30 phút 1 giờ 3 giờ diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 16ddfd57..e8fb41fe 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -295,8 +295,7 @@ 无法检索Xirvik SCGI的文件夹设置,请稍后再试或更正您的服务器地址 例如:001.seedstuff.ca - 每分钟 - 每10分钟 + 每15分钟 每30分钟 每小时 每3小时 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 95b8fa72..d2da67be 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -153,8 +153,7 @@ 30 秒 - 1 分鐘 - 10 分鐘 + 15 分鐘 30 分鐘 1 小時 3 小時 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8dbbd4f3..762ca46d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -428,8 +428,7 @@ type_linux - 1 minute - 10 minutes + 15 minutes 30 minutes 1 hour 3 hours @@ -437,8 +436,7 @@ 1 day - 60 - 600 + 900 1800 3600 10800 diff --git a/build.gradle b/build.gradle index 4b97834d..b0ba1669 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.0' + classpath 'com.android.tools.build:gradle:3.2.1' } }