From 6718811c2943ddaf7056c7da033a29c4258b80a5 Mon Sep 17 00:00:00 2001 From: Unrud Date: Wed, 19 Jul 2017 04:18:37 +0200 Subject: [PATCH] Show error when folder is out of sync (#925) * Show error when folder is out of sync * Translate status_outofsync Copied from Syncthing GUI * Colorize status message of folders --- .../nutomic/syncthingandroid/model/Model.java | 2 ++ .../views/FoldersAdapter.java | 21 +++++++++++++++++-- src/main/res/values-bg/strings.xml | 1 + src/main/res/values-cs/strings.xml | 1 + src/main/res/values-de/strings.xml | 1 + src/main/res/values-el/strings.xml | 1 + src/main/res/values-es-rMX/strings.xml | 1 + src/main/res/values-es/strings.xml | 1 + src/main/res/values-fi/strings.xml | 1 + src/main/res/values-fr/strings.xml | 1 + src/main/res/values-hu/strings.xml | 1 + src/main/res/values-it/strings.xml | 1 + src/main/res/values-ja/strings.xml | 1 + src/main/res/values-ko/strings.xml | 1 + src/main/res/values-nb/strings.xml | 1 + src/main/res/values-nl/strings.xml | 1 + src/main/res/values-nn/strings.xml | 1 + src/main/res/values-pl/strings.xml | 1 + src/main/res/values-pt-rBR/strings.xml | 1 + src/main/res/values-pt/strings.xml | 1 + src/main/res/values-ru/strings.xml | 1 + src/main/res/values-sk/strings.xml | 1 + src/main/res/values-sv/strings.xml | 1 + src/main/res/values-tr/strings.xml | 1 + src/main/res/values-vi/strings.xml | 1 + src/main/res/values-zh-rCN/strings.xml | 1 + src/main/res/values/strings.xml | 1 + 27 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/model/Model.java b/src/main/java/com/nutomic/syncthingandroid/model/Model.java index 093c3df9..fbeeef8b 100644 --- a/src/main/java/com/nutomic/syncthingandroid/model/Model.java +++ b/src/main/java/com/nutomic/syncthingandroid/model/Model.java @@ -12,6 +12,8 @@ public class Model { public long needBytes; public long needFiles; public long needDeletes; + public long needDirectories; + public long needSymlinks; public String state; public String invalid; } diff --git a/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java b/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java index 41aee6a4..6e88975c 100644 --- a/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java +++ b/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java @@ -50,7 +50,6 @@ public class FoldersAdapter extends ArrayAdapter { Folder folder = getItem(position); Model model = mModels.get(folder.id); binding.label.setText(TextUtils.isEmpty(folder.label) ? folder.id : folder.label); - binding.state.setTextColor(ContextCompat.getColor(getContext(), R.color.text_green)); binding.directory.setText(folder.path); binding.openFolder.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_VIEW); @@ -66,7 +65,25 @@ public class FoldersAdapter extends ArrayAdapter { int percentage = (model.globalBytes != 0) ? Math.round(100 * model.inSyncBytes / model.globalBytes) : 100; - binding.state.setText(getLocalizedState(getContext(), model.state, percentage)); + long neededItems = model.needFiles + model.needDirectories + model.needSymlinks + model.needDeletes; + if (model.state.equals("idle") && neededItems > 0) { + binding.state.setText(getContext().getString(R.string.status_outofsync)); + binding.state.setTextColor(ContextCompat.getColor(getContext(), R.color.text_red)); + } else { + binding.state.setText(getLocalizedState(getContext(), model.state, percentage)); + switch(model.state) { + case "idle": + binding.state.setTextColor(ContextCompat.getColor(getContext(), R.color.text_green)); + break; + case "scanning": + case "cleaning": + case "syncing": + binding.state.setTextColor(ContextCompat.getColor(getContext(), R.color.text_blue)); + break; + default: + binding.state.setTextColor(ContextCompat.getColor(getContext(), R.color.text_red)); + } + } binding.items.setVisibility(VISIBLE); binding.items.setText(getContext() .getString(R.string.files, model.inSyncFiles, model.globalFiles)); diff --git a/src/main/res/values-bg/strings.xml b/src/main/res/values-bg/strings.xml index de620afc..6eba7566 100644 --- a/src/main/res/values-bg/strings.xml +++ b/src/main/res/values-bg/strings.xml @@ -304,6 +304,7 @@ Синхронизиране (%1$d%%) Грешка Неясно + Несинхронизирано %1$s / %2$s diff --git a/src/main/res/values-cs/strings.xml b/src/main/res/values-cs/strings.xml index 2474aceb..94a91d72 100644 --- a/src/main/res/values-cs/strings.xml +++ b/src/main/res/values-cs/strings.xml @@ -314,6 +314,7 @@ Všechny zaznamenané chyby prosím hlašte přes Github. Synchronizuje se (%1$d%%) Chyba Neznámý + Nesesynchronizováno %1$s / %2$s Syncthing nelze zastavit když je povolený běh na pozadí. diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index f85ce98a..bff970d2 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -308,6 +308,7 @@ Bitte melden Sie auftretende Probleme via Github. Synchronisiere (%1$d%%) Fehler Unbekannt + Nicht synchronisiert %1$s / %2$s Syncthing zu stoppen wird nicht unterstützt solange das Ausführen im Hintergrund aktiviert ist. diff --git a/src/main/res/values-el/strings.xml b/src/main/res/values-el/strings.xml index d5eead01..cfb60100 100644 --- a/src/main/res/values-el/strings.xml +++ b/src/main/res/values-el/strings.xml @@ -319,6 +319,7 @@ Συγχρονισμός (%1$d%%) Σφάλμα Άγνωστο + Μη συγχρονισμένα %1$s / %2$s Ο τερματισμός του Syncthing δεν υποστηρίζεται όταν έχει ενεργοποιηθεί η εκτέλεση στο παρασκήνιο. diff --git a/src/main/res/values-es-rMX/strings.xml b/src/main/res/values-es-rMX/strings.xml index 2be23f0c..1bbf4b26 100644 --- a/src/main/res/values-es-rMX/strings.xml +++ b/src/main/res/values-es-rMX/strings.xml @@ -283,6 +283,7 @@ Sincronizando (%1$d%%) Error Desconocido + No sincronizado %1$s / %2$s diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml index 41e391aa..5b285969 100644 --- a/src/main/res/values-es/strings.xml +++ b/src/main/res/values-es/strings.xml @@ -310,6 +310,7 @@ Sincronizando (%1$d%%) Error Desconocido + No sincronizado %1$s / %2$s No está soportado detener Syncthing mientras está activada la ejecución en segundo plano. diff --git a/src/main/res/values-fi/strings.xml b/src/main/res/values-fi/strings.xml index ca519294..09cffa6f 100644 --- a/src/main/res/values-fi/strings.xml +++ b/src/main/res/values-fi/strings.xml @@ -305,6 +305,7 @@ Ilmoitathan ystävällisesti kaikista havaitsemistasi ongelmista Githubin kautta Synkronoidaan (%1$d%%) Virhe Tuntematon + Ei ajan tasalla %1$s / %2$s Syncthingin pysäyttäminen ei ole käytettävissä kun käynti taustalla on valittuna. diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml index 717f5d0c..89b70b71 100644 --- a/src/main/res/values-fr/strings.xml +++ b/src/main/res/values-fr/strings.xml @@ -319,6 +319,7 @@ S\'il vous plaît, soumettez les problèmes que vous rencontrez via Github.Synchronisation (%1$d%%) Erreur Inconnu + Désynchronisé %1$s / %2$s L\'arrêt de Syncthing n\'est pas supporté quand le fonctionnement en tâche de fond est activé. diff --git a/src/main/res/values-hu/strings.xml b/src/main/res/values-hu/strings.xml index 549182b4..40890ba0 100644 --- a/src/main/res/values-hu/strings.xml +++ b/src/main/res/values-hu/strings.xml @@ -224,5 +224,6 @@ Szinkronizálás (%1$d%%) Hiba Ismeretlen + Nincs szinkronban diff --git a/src/main/res/values-it/strings.xml b/src/main/res/values-it/strings.xml index e783946d..575495b2 100644 --- a/src/main/res/values-it/strings.xml +++ b/src/main/res/values-it/strings.xml @@ -319,6 +319,7 @@ Si prega di segnalare eventuali problemi che si incontrano via Github. Sincronizzazione (%1$d%%) Errore Sconosciuto + Non sincronizzato %1$s / %2$s Arrestare Syncthing non è possibile quando è abilitato il funzionamento in background. diff --git a/src/main/res/values-ja/strings.xml b/src/main/res/values-ja/strings.xml index d7c7f201..b479bd45 100644 --- a/src/main/res/values-ja/strings.xml +++ b/src/main/res/values-ja/strings.xml @@ -337,6 +337,7 @@ 同期中 (%1$d%%) エラー 不明 + 未同期 %1$s / %2$s バックグラウンドでの実行が有効になっているとき、Syncthing の停止はサポートされていません。 diff --git a/src/main/res/values-ko/strings.xml b/src/main/res/values-ko/strings.xml index f81c7aa0..8518b641 100644 --- a/src/main/res/values-ko/strings.xml +++ b/src/main/res/values-ko/strings.xml @@ -337,6 +337,7 @@ 동기화 중 (%1$d%%) 오류 알 수 없음 + 동기화 오류 %1$s / %2$s 백그라운드에서 실행이 활성화되어 있을 때는 Syncthing 중단은 지원되지 않습니다. diff --git a/src/main/res/values-nb/strings.xml b/src/main/res/values-nb/strings.xml index c5991d1f..1f74e7d4 100644 --- a/src/main/res/values-nb/strings.xml +++ b/src/main/res/values-nb/strings.xml @@ -291,6 +291,7 @@ Synkroniserer (%1$d%%) Feil Ukjent + Ikke synkronisert %1$s / %2$s Du kan ikke stoppe Syncthing når «kjør i bakgrunnen» er skrudd på. diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml index 6074cfcd..df0d4005 100644 --- a/src/main/res/values-nl/strings.xml +++ b/src/main/res/values-nl/strings.xml @@ -318,6 +318,7 @@ Als je problemen tegenkomt, meld ze dan via GitHub. Bezig met synchroniseren (%1$d%%) Fout Onbekend + Niet gesynchroniseerd %1$s / %2$s Syncthing stoppen terwijl uitvoeren in achtergrond is ingeschakeld wordt niet ondersteund. diff --git a/src/main/res/values-nn/strings.xml b/src/main/res/values-nn/strings.xml index dc6d3ed2..cc7824a3 100644 --- a/src/main/res/values-nn/strings.xml +++ b/src/main/res/values-nn/strings.xml @@ -290,6 +290,7 @@ Synkroniserer (%1$d%%) Feil Ukjend + Ikkje synkronisert %1$s / %2$s Du kan ikkje stoppe Syncthing når «køyr i bakgrunnen» er skrudd på. diff --git a/src/main/res/values-pl/strings.xml b/src/main/res/values-pl/strings.xml index 37244e26..3b49eb42 100644 --- a/src/main/res/values-pl/strings.xml +++ b/src/main/res/values-pl/strings.xml @@ -307,6 +307,7 @@ Proszę zgłaszać napotkane błędy programu za pośrednictwem serwisu Github.< Synchronizowanie (%1$d%%) Błąd Nieznany + Niezsynchronizowane %1$s / %2$s Zatrzymywanie programu nie jest obsługiwane podczas działania w tle. diff --git a/src/main/res/values-pt-rBR/strings.xml b/src/main/res/values-pt-rBR/strings.xml index 83e51463..3727c228 100644 --- a/src/main/res/values-pt-rBR/strings.xml +++ b/src/main/res/values-pt-rBR/strings.xml @@ -319,6 +319,7 @@ Por favor, nos avise sobre quaisquer problemas que você encontrar via Github.Sincronizando (%1$d%%) Erro Desconhecido + Fora de sincronia %1$s / %2$s Não é possível parar o Syncthing enquanto ele estiver configurado para rodar em segundo plano. diff --git a/src/main/res/values-pt/strings.xml b/src/main/res/values-pt/strings.xml index 283b7386..7a7d7878 100644 --- a/src/main/res/values-pt/strings.xml +++ b/src/main/res/values-pt/strings.xml @@ -313,6 +313,7 @@ Reporte, através do Github, quaisquer problemas que encontre, por favor.Sincronizando (%1$d%%) Erro Desconhecido + Fora de sincronia %1$s / %2$s Parar o Syncthing não é suportado quando está activada a opção para correr em segundo plano. diff --git a/src/main/res/values-ru/strings.xml b/src/main/res/values-ru/strings.xml index 7b4aa753..72404e3c 100644 --- a/src/main/res/values-ru/strings.xml +++ b/src/main/res/values-ru/strings.xml @@ -319,6 +319,7 @@ Синхронизация (%1$d%%) Ошибка Неизвестно + Нет синхронизации %1$s / %2$s Остановка Syncthing не поддерживается, если включено выполнение в фоновом режиме. diff --git a/src/main/res/values-sk/strings.xml b/src/main/res/values-sk/strings.xml index 92bf8e72..f0fa2a48 100644 --- a/src/main/res/values-sk/strings.xml +++ b/src/main/res/values-sk/strings.xml @@ -268,5 +268,6 @@ Naozaj chcete resetovať databázu s indexom súborov? Synchronizuje sa (%1$d%%) Chyba Neznámy + Nesynchronizované diff --git a/src/main/res/values-sv/strings.xml b/src/main/res/values-sv/strings.xml index 40d5bbe7..2a1d9f65 100644 --- a/src/main/res/values-sv/strings.xml +++ b/src/main/res/values-sv/strings.xml @@ -340,6 +340,7 @@ Vänligen rapportera eventuella problem du stöter på via Github. Synkroniserar (%1$d%%) Fel Okänd + Osynkroniserad %1$s / %2$s Det går inte att stoppa Syncthing när körning i bakgrunden är aktiverad. diff --git a/src/main/res/values-tr/strings.xml b/src/main/res/values-tr/strings.xml index 8f1d107d..8876717c 100644 --- a/src/main/res/values-tr/strings.xml +++ b/src/main/res/values-tr/strings.xml @@ -312,6 +312,7 @@ Eğer herhangi bir sorunla karşılaşırsan Github aracılığıyla bildir.Eşzamanlama gerçekleştiriliyor (%1$d%%) Hata Bilinmiyor + Eşzamanlama Dışı %1$s / %2$s Arka planda çalışma etkinken Syncthing\'i durdurma desteklenmiyor. diff --git a/src/main/res/values-vi/strings.xml b/src/main/res/values-vi/strings.xml index 63f9346c..79afa5d9 100644 --- a/src/main/res/values-vi/strings.xml +++ b/src/main/res/values-vi/strings.xml @@ -283,6 +283,7 @@ Đang đ.bộ (%1$d%%) Lỗi Không rõ + Mất đồng bộ %1$s / %2$s diff --git a/src/main/res/values-zh-rCN/strings.xml b/src/main/res/values-zh-rCN/strings.xml index fa1d4b8c..9fd3becd 100644 --- a/src/main/res/values-zh-rCN/strings.xml +++ b/src/main/res/values-zh-rCN/strings.xml @@ -339,6 +339,7 @@ 正在同步 (%1$d%%) 错误 未知 + 未同步 %1$s / %2$s 当启用后台运行时不支持停止 Syncthing。 diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 7281e539..083a1a39 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -556,6 +556,7 @@ Please report any problems you encounter via Github. Syncing (%1$d%%) Error Unknown + Out of Sync %1$s / %2$s