1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Display a message in the titlebar when K-9 Mail is not performing any message synchronization. This state will happen when no network is available, when background ops/background data/auto-sync settings turn off synchronization, or when no account is set for polling or pushing.

This revision respects the intention of r3011 that when K-9 Mail is
set for pushing only no message is displayed, as that condition is a
normal state.  However, it provides valuable feedback in other cases
that synchronization is off-line, as was done in r1433.

Although the case when the user has intentionally set no account for
polling or pushing can be considered "normal" and therefore unworthy
of a message, it turns out to be a significant burden to detect that
situation when the network is offline, since we normally do not even
try to figure out the account configurations in that case.  Therefore,
without making substantial, otherwise unwarranted, changes to
MailService.java, "Syncing off" would be displayed sometimes to such a
user, and sometimes not.  Since it is presumably a rare case, and
there is minimal harm to display the "Syncing off" message, the
message will be consistently displayed when no account is set for
polling or pushing.

Note to translators:
"Syncing off" is different than "Polling off".  The new phrase "Syncing
off" means that K-9 Mail is not performing any synchronization with
any mail server.  The prior non-English phrases for "Polling off" are
currently in-place as translations for "Syncing off", as it seems that
the meanings are close enough that it would be better to show the
obsolete translations that to fallback to the English "Syncing off".
However, better translations of "Syncing off" would be welcome.
This commit is contained in:
Dan Applebaum 2011-02-04 08:26:16 +00:00 committed by Jesse Vincent
parent 33e5520a9d
commit ea3619b733
16 changed files with 38 additions and 21 deletions

View File

@ -43,7 +43,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Příští dotaz @ <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Příští dotaz @ <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Bez dotazování)</string> <string name="status_syncing_off">\u0020(Bez dotazování)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Další</string> <!-- Used as part of a multi-step process --> <string name="next_action">Další</string> <!-- Used as part of a multi-step process -->

View File

@ -38,7 +38,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Nächster Abruf @ <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Nächster Abruf @ <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Abrufen deaktiviert)</string> <string name="status_syncing_off">\u0020(Abrufen deaktiviert)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Weiter</string> <!-- Used as part of a multi-step process --> <string name="next_action">Weiter</string> <!-- Used as part of a multi-step process -->

View File

@ -38,7 +38,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Próxima comprobación @ <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Próxima comprobación @ <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Comprobación finalizada)</string> <string name="status_syncing_off">\u0020(Comprobación finalizada)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Siguiente</string> <!-- Used as part of a multi-step process --> <string name="next_action">Siguiente</string> <!-- Used as part of a multi-step process -->

View File

@ -38,7 +38,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Seuraava tarkistus @ <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Seuraava tarkistus @ <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Tarkistus pois päältä)</string> <string name="status_syncing_off">\u0020(Tarkistus pois päältä)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Seuraava</string> <!-- Used as part of a multi-step process --> <string name="next_action">Seuraava</string> <!-- Used as part of a multi-step process -->

View File

@ -57,7 +57,7 @@
<string name="status_processing_account">\u0020(Prép <xliff:g id="account">%s</xliff:g>:<xliff:g id="command">%s</xliff:g><xliff:g id="progress">%s</xliff:g>)</string> <string name="status_processing_account">\u0020(Prép <xliff:g id="account">%s</xliff:g>:<xliff:g id="command">%s</xliff:g><xliff:g id="progress">%s</xliff:g>)</string>
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Prochaine récupération à <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Prochaine récupération à <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Récupération désactivée)</string> <string name="status_syncing_off">\u0020(Récupération désactivée)</string>
<string name="next_action">Suivant</string> <string name="next_action">Suivant</string>
<string name="okay_action">OK</string> <string name="okay_action">OK</string>
<string name="cancel_action">Annuler</string> <string name="cancel_action">Annuler</string>

View File

@ -42,7 +42,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Prossima verifica alle <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Prossima verifica alle <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Verifica disattivata)</string> <string name="status_syncing_off">\u0020(Verifica disattivata)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Successivo</string> <!-- Used as part of a multi-step process --> <string name="next_action">Successivo</string> <!-- Used as part of a multi-step process -->

View File

@ -42,7 +42,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(次回受信 @ <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(次回受信 @ <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(受信済)</string> <string name="status_syncing_off">\u0020(受信済)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">次へ</string> <string name="next_action">次へ</string>

View File

@ -38,7 +38,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Volgende poll @ <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Volgende poll @ <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Polling uit)</string> <string name="status_syncing_off">\u0020(Polling uit)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Volgende</string> <!-- Used as part of a multi-step process --> <string name="next_action">Volgende</string> <!-- Used as part of a multi-step process -->

View File

@ -44,7 +44,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Sprawdzę o <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Sprawdzę o <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Pobieranie wyłączone)</string> <string name="status_syncing_off">\u0020(Pobieranie wyłączone)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Dalej</string> <!-- Used as part of a multi-step process --> <string name="next_action">Dalej</string> <!-- Used as part of a multi-step process -->

View File

@ -35,13 +35,13 @@
<string name="status_loading_account_folder_headers">\u0020(Buscando cabeçalhos <xliff:g id="account">%s</xliff:g>:<xliff:g id="folder">%s</xliff:g><xliff:g id="progress">%s</xliff:g>)</string> <string name="status_loading_account_folder_headers">\u0020(Buscando cabeçalhos <xliff:g id="account">%s</xliff:g>:<xliff:g id="folder">%s</xliff:g><xliff:g id="progress">%s</xliff:g>)</string>
<string name="status_sending_account">\u0020(Enviando <xliff:g id="account">%s</xliff:g><xliff:g id="progress">%s</xliff:g>)</string> <string name="status_sending_account">\u0020(Enviando <xliff:g id="account">%s</xliff:g><xliff:g id="progress">%s</xliff:g>)</string>
<string name="status_processing_account">\u0020(Proc <xliff:g id="account">%s</xliff:g>:<xliff:g id="command">%s</xliff:g><xliff:g id="progress">%s</xliff:g>)</string> <string name="status_processing_account">\u0020(Proc <xliff:g id="account">%s</xliff:g>:<xliff:g id="command">%s</xliff:g><xliff:g id="progress">%s</xliff:g>)</string>
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Nova verif. às @ <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Nova verif. às @ <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Verificação desligada)</string> <string name="status_syncing_off">\u0020(Verificação desligada)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Próximo</string> <!-- Used as part of a multi-step process --> <string name="next_action">Próximo</string> <!-- Used as part of a multi-step process -->
<string name="previous_action">Anterior</string> <!-- Used as part of a multi-step process --> <string name="previous_action">Anterior</string> <!-- Used as part of a multi-step process -->
<string name="okay_action">OK</string> <!-- User to confirm acceptance of dialog boxes, warnings, errors, etc. --> <string name="okay_action">OK</string> <!-- User to confirm acceptance of dialog boxes, warnings, errors, etc. -->
<string name="cancel_action">Cancelar</string> <string name="cancel_action">Cancelar</string>

View File

@ -31,7 +31,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Следующий запрос @ <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Следующий запрос @ <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Отключить авто-запрос)</string> <string name="status_syncing_off">\u0020(Отключить авто-запрос)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Следующий</string> <!-- Used as part of a multi-step process --> <string name="next_action">Следующий</string> <!-- Used as part of a multi-step process -->

View File

@ -38,7 +38,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Nästa kontroll @ <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Nästa kontroll @ <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Kontroll av)</string> <string name="status_syncing_off">\u0020(Kontroll av)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Nästa</string> <!-- Used as part of a multi-step process --> <string name="next_action">Nästa</string> <!-- Used as part of a multi-step process -->

View File

@ -38,7 +38,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020下次接收时间<xliff:g id="nexttime">%s</xliff:g></string> <string name="status_next_poll">\u0020下次接收时间<xliff:g id="nexttime">%s</xliff:g></string>
<string name="status_polling_off">\u0020正在接收</string> <string name="status_syncing_off">\u0020正在接收</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">下一步</string> <!-- Used as part of a multi-step process --> <string name="next_action">下一步</string> <!-- Used as part of a multi-step process -->

View File

@ -42,7 +42,7 @@
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string> <string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">\u0020(Next poll @ <xliff:g id="nexttime">%s</xliff:g>)</string> <string name="status_next_poll">\u0020(Next poll @ <xliff:g id="nexttime">%s</xliff:g>)</string>
<string name="status_polling_off">\u0020(Polling off)</string> <string name="status_syncing_off">\u0020(Syncing off)</string>
<!-- Actions will be used as buttons and in menu items --> <!-- Actions will be used as buttons and in menu items -->
<string name="next_action">Next</string> <!-- Used as part of a multi-step process --> <string name="next_action">Next</string> <!-- Used as part of a multi-step process -->

View File

@ -71,9 +71,13 @@ public class ActivityListener extends MessagingListener
{ {
operation = context.getString(R.string.status_next_poll, timeFormat.format(nextPollTime)); operation = context.getString(R.string.status_next_poll, timeFormat.format(nextPollTime));
} }
else if (MailService.isSyncDisabled())
{
operation = context.getString(R.string.status_syncing_off);
}
else else
{ {
operation = ""; // context.getString(R.string.status_polling_off); operation = "";
} }
} }

View File

@ -35,6 +35,9 @@ public class MailService extends CoreService
private static final String CANCEL_CONNECTIVITY_NOTICE = "com.fsck.k9.intent.action.MAIL_SERVICE_CANCEL_CONNECTIVITY_NOTICE"; private static final String CANCEL_CONNECTIVITY_NOTICE = "com.fsck.k9.intent.action.MAIL_SERVICE_CANCEL_CONNECTIVITY_NOTICE";
private static long nextCheck = -1; private static long nextCheck = -1;
private static boolean pushingRequested = false;
private static boolean pollingRequested = false;
private static boolean syncBlocked = false;
public static void actionReset(Context context, Integer wakeLockId) public static void actionReset(Context context, Integer wakeLockId)
{ {
@ -149,6 +152,8 @@ public class MailService extends CoreService
} }
syncBlocked = !(doBackground && hasConnectivity);
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "MailService.onStart(" + intent + ", " + startId Log.i(K9.LOG_TAG, "MailService.onStart(" + intent + ", " + startId
+ "), hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground); + "), hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground);
@ -300,6 +305,7 @@ public class MailService extends CoreService
if (shortestInterval == -1) if (shortestInterval == -1)
{ {
nextCheck = -1; nextCheck = -1;
pollingRequested = false;
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "No next check scheduled for package " + getApplication().getPackageName()); Log.i(K9.LOG_TAG, "No next check scheduled for package " + getApplication().getPackageName());
cancel(); cancel();
@ -316,6 +322,7 @@ public class MailService extends CoreService
+ ", lastCheckEnd = " + new Date(lastCheckEnd) + ", lastCheckEnd = " + new Date(lastCheckEnd)
+ ", considerLastCheckEnd = " + considerLastCheckEnd); + ", considerLastCheckEnd = " + considerLastCheckEnd);
nextCheck = nextTime; nextCheck = nextTime;
pollingRequested = true;
try try
{ {
if (K9.DEBUG) if (K9.DEBUG)
@ -346,6 +353,11 @@ public class MailService extends CoreService
} }
} }
public static boolean isSyncDisabled()
{
return syncBlocked || (!pollingRequested && !pushingRequested);
}
private void stopPushers(final Integer startId) private void stopPushers(final Integer startId)
{ {
execute(getApplication(), new Runnable() execute(getApplication(), new Runnable()
@ -412,6 +424,7 @@ public class MailService extends CoreService
{ {
PushService.startService(MailService.this); PushService.startService(MailService.this);
} }
pushingRequested = pushing;
} }
} }
, K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); , K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId);