Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,13 @@ private void runEstimate(String name, String box) {
dismissDialog();
showConsent(name, box, transfer, archive, free, freeAfter);
}
@Override public void onOverlap() {
if (estimateCanceled) return;
dismissDialog();
// K2GO-583: Retry cannot help, so clear the drawn region and show the reason with OK only.
resetMapSelection();
errorDialog(R.string.k2go_fqr_estimate_error_title, str(R.string.k2go_fqr_overlap));
}
@Override public void onError(String message) {
if (estimateCanceled) return;
dismissDialog();
Expand Down Expand Up @@ -1168,8 +1175,8 @@ private void errorDialog(int titleRes, CharSequence message) {

/** K2GO-317 follow-up: an estimate failed (usually offline). Keep the drawn region and offer Retry
* (re-run the estimate for the same name + box), so the user does not redraw; "Not now" gives up and
* clears the selection, like the consent dialog's bail-outs. The body is a LOCALIZED string (the data
* layer's friendlyError is raw English); reuses install_msg_no_connection, translated in every locale. */
* clears the selection, like the consent dialog's bail-outs. Reuses install_msg_no_connection,
* translated in every locale. */
private void retryableEstimateError(String name, String box) {
new BrandDialog(themed)
.setTitle(R.string.k2go_fqr_estimate_error_title)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public final class MapsRegionClient {
/** Size estimate (bytes) for the consent step. */
public interface EstimateListener {
void onEstimate(long transfer, long archive, long free, long freeAfter);
/** K2GO-583: the region overlaps a downloaded region; a retry cannot help. */
void onOverlap();
void onError(String message);
}

Expand Down Expand Up @@ -78,8 +80,9 @@ public void estimate(@NonNull String box, @NonNull EstimateListener l) {
f = resp.optLong("free", 0), fa = resp.optLong("free_after", 0);
main.post(() -> l.onEstimate(t, a, f, fa));
} catch (Exception e) {
final String m = friendlyError(e.getMessage());
main.post(() -> l.onError(m));
final String m = e.getMessage();
if (isOverlap(m)) main.post(l::onOverlap);
else main.post(() -> l.onError(m));
}
});
}
Expand Down Expand Up @@ -245,11 +248,11 @@ private void deliver(Consumer<DownloadListener> c) {
});
}

/** Map a raw HTTP error to something a first-run user can act on (overlap is the common one). */
private static String friendlyError(String raw) {
if (raw == null) return "size estimate failed";
if (raw.contains("409") || raw.toLowerCase().contains("overlap")) return "This region overlaps one you already have.";
return "size estimate failed";
/** K2GO-583: the estimate failed because the box overlaps a downloaded region. Read the text, not the
* status: the box answers "overlaps an existing region" (static/dashboard/routes.ts /maps/estimate),
* and other routes use 409 for a busy lock. */
static boolean isOverlap(String raw) {
return raw != null && raw.toLowerCase(java.util.Locale.ROOT).contains("overlap");
}

private static JSONObject httpJson(String method, String urlStr, JSONObject body) throws Exception {
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@
<string name="k2go_fqr_name_taken">«%1$s» مستخدم بالفعل. اختر اسمًا مختلفًا.</string>
<string name="k2go_fqr_calculating">جارٍ حساب حجم التنزيل…</string>
<string name="k2go_fqr_estimate_error_title">لا يمكن تنزيل هذه المنطقة</string>
<string name="k2go_fqr_overlap">هذه المنطقة تتداخل مع منطقة نزّلتها بالفعل.</string>
<string name="k2go_fqr_consent_title">تنزيل هذه المنطقة؟</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s للتنزيل، %3$s على القرص.</string>
<string name="k2go_fqr_consent_legend">هذه المنطقة: %1$s · المتاح بعدها: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-az/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,7 @@
<string name="k2go_fqr_name_taken">“%1$s” artıq istifadə olunur. Başqa ad seç.</string>
<string name="k2go_fqr_calculating">Yükləmə ölçüsü hesablanır…</string>
<string name="k2go_fqr_estimate_error_title">Bu region yüklənə bilmir</string>
<string name="k2go_fqr_overlap">Bu bölgə artıq endirdiyiniz bir bölgə ilə üst-üstə düşür.</string>
<string name="k2go_fqr_consent_title">Bu region yüklənsin?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — yükləmək üçün %2$s, diskdə %3$s.</string>
<string name="k2go_fqr_consent_legend">Bu region: %1$s · Sonra boş: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@
<string name="k2go_fqr_name_taken">„%1$s“ вече се използва. Изберете друго име.</string>
<string name="k2go_fqr_calculating">Изчисляване на размера за изтегляне…</string>
<string name="k2go_fqr_estimate_error_title">Този регион не може да се изтегли</string>
<string name="k2go_fqr_overlap">Този регион се припокрива с регион, който вече сте изтеглили.</string>
<string name="k2go_fqr_consent_title">Изтегляне на този регион?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s за изтегляне, %3$s на диска.</string>
<string name="k2go_fqr_consent_legend">Този регион: %1$s · Свободно след: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-bn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,7 @@
<string name="k2go_fqr_name_taken">“%1$s” ইতিমধ্যে ব্যবহৃত। একটি ভিন্ন নাম বেছে নিন।</string>
<string name="k2go_fqr_calculating">ডাউনলোডের আকার গণনা করা হচ্ছে…</string>
<string name="k2go_fqr_estimate_error_title">এই অঞ্চল ডাউনলোড করা যাচ্ছে না</string>
<string name="k2go_fqr_overlap">এই অঞ্চলটি আপনার আগে ডাউনলোড করা একটি অঞ্চলের সাথে ওভারল্যাপ করে।</string>
<string name="k2go_fqr_consent_title">এই অঞ্চল ডাউনলোড করবেন?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — ডাউনলোড করতে %2$s, ডিস্কে %3$s।</string>
<string name="k2go_fqr_consent_legend">এই অঞ্চল: %1$s · পরে খালি: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@
<string name="k2go_fqr_name_taken">„%1$s“ se už používá. Vyber jiný název.</string>
<string name="k2go_fqr_calculating">Výpočet velikosti stahování…</string>
<string name="k2go_fqr_estimate_error_title">Tuto oblast nelze stáhnout</string>
<string name="k2go_fqr_overlap">Tato oblast se překrývá s oblastí, kterou jste už stáhli.</string>
<string name="k2go_fqr_consent_title">Stáhnout tuto oblast?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s ke stažení, %3$s na disku.</string>
<string name="k2go_fqr_consent_legend">Tato oblast: %1$s · Volné poté: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@
<string name="k2go_fqr_name_taken">„%1$s“ wird bereits verwendet. Wähle einen anderen Namen.</string>
<string name="k2go_fqr_calculating">Download-Größe wird berechnet…</string>
<string name="k2go_fqr_estimate_error_title">Diese Region kann nicht heruntergeladen werden</string>
<string name="k2go_fqr_overlap">Diese Region überschneidet sich mit einer Region, die Sie bereits heruntergeladen haben.</string>
<string name="k2go_fqr_consent_title">Diese Region herunterladen?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s zum Herunterladen, %3$s auf dem Speicher.</string>
<string name="k2go_fqr_consent_legend">Diese Region: %1$s · Frei danach: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@
<string name="k2go_fqr_name_taken">Το «%1$s» χρησιμοποιείται ήδη. Διάλεξε άλλο όνομα.</string>
<string name="k2go_fqr_calculating">Υπολογισμός μεγέθους λήψης…</string>
<string name="k2go_fqr_estimate_error_title">Δεν είναι δυνατή η λήψη αυτής της περιοχής</string>
<string name="k2go_fqr_overlap">Αυτή η περιοχή επικαλύπτεται με μια περιοχή που έχετε ήδη κατεβάσει.</string>
<string name="k2go_fqr_consent_title">Λήψη αυτής της περιοχής;</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s για λήψη, %3$s στον δίσκο.</string>
<string name="k2go_fqr_consent_legend">Αυτή η περιοχή: %1$s · Ελεύθερα μετά: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,7 @@
<string name="k2go_fqr_name_taken">“%1$s” ya está en uso. Elige un nombre diferente.</string>
<string name="k2go_fqr_calculating">Calculando el tamaño de descarga…</string>
<string name="k2go_fqr_estimate_error_title">No se puede descargar esta región</string>
<string name="k2go_fqr_overlap">Esta región se superpone con una región que ya descargaste.</string>
<string name="k2go_fqr_consent_title">¿Descargar esta región?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s para descargar, %3$s en disco.</string>
<string name="k2go_fqr_consent_legend">Esta región: %1$s · Libre después: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@
<string name="k2go_fqr_name_taken">«%1$s» از قبل استفاده شده است. نام دیگری انتخاب کنید.</string>
<string name="k2go_fqr_calculating">در حال محاسبه حجم دانلود…</string>
<string name="k2go_fqr_estimate_error_title">دانلود این منطقه ممکن نیست</string>
<string name="k2go_fqr_overlap">این منطقه با منطقه‌ای که قبلاً دانلود کرده‌اید هم‌پوشانی دارد.</string>
<string name="k2go_fqr_consent_title">این منطقه دانلود شود؟</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s برای دانلود، %3$s روی دیسک.</string>
<string name="k2go_fqr_consent_legend">این منطقه: %1$s · آزاد پس از آن: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,7 @@
<string name="k2go_fqr_name_taken">« %1$s » est déjà utilisé. Choisissez un autre nom.</string>
<string name="k2go_fqr_calculating">Calcul de la taille du téléchargement…</string>
<string name="k2go_fqr_estimate_error_title">Impossible de télécharger cette région</string>
<string name="k2go_fqr_overlap">Cette région chevauche une région que vous avez déjà téléchargée.</string>
<string name="k2go_fqr_consent_title">Télécharger cette région ?</string>
<string name="k2go_fqr_consent_sub">« %1$s » — %2$s à télécharger, %3$s sur le disque.</string>
<string name="k2go_fqr_consent_legend">Cette région : %1$s · Libre après : %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-gu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,7 @@
<string name="k2go_fqr_name_taken">“%1$s” પહેલેથી વપરાયેલું છે. અલગ નામ પસંદ કરો.</string>
<string name="k2go_fqr_calculating">ડાઉનલોડ કદની ગણતરી થઈ રહી છે…</string>
<string name="k2go_fqr_estimate_error_title">આ પ્રદેશ ડાઉનલોડ કરી શકાતો નથી</string>
<string name="k2go_fqr_overlap">આ પ્રદેશ તમે પહેલેથી ડાઉનલોડ કરેલા પ્રદેશ સાથે ઓવરલેપ થાય છે.</string>
<string name="k2go_fqr_consent_title">આ પ્રદેશ ડાઉનલોડ કરવો છે?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — ડાઉનલોડ કરવા %2$s, ડિસ્ક પર %3$s.</string>
<string name="k2go_fqr_consent_legend">આ પ્રદેશ: %1$s · પછી ખાલી: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,7 @@
<string name="k2go_fqr_name_taken">“%1$s” पहले से उपयोग में है। कोई अलग नाम चुनें।</string>
<string name="k2go_fqr_calculating">डाउनलोड आकार की गणना हो रही है…</string>
<string name="k2go_fqr_estimate_error_title">यह क्षेत्र डाउनलोड नहीं कर सकते</string>
<string name="k2go_fqr_overlap">यह क्षेत्र उस क्षेत्र से ओवरलैप करता है जिसे आप पहले ही डाउनलोड कर चुके हैं।</string>
<string name="k2go_fqr_consent_title">यह क्षेत्र डाउनलोड करें?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — डाउनलोड के लिए %2$s, डिस्क पर %3$s।</string>
<string name="k2go_fqr_consent_legend">यह क्षेत्र: %1$s · बाद में खाली: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@
<string name="k2go_fqr_name_taken">A(z) „%1$s” már használatban van. Válassz másik nevet.</string>
<string name="k2go_fqr_calculating">Letöltési méret kiszámítása…</string>
<string name="k2go_fqr_estimate_error_title">Ez a régió nem tölthető le</string>
<string name="k2go_fqr_overlap">Ez a régió átfedésben van egy már letöltött régióval.</string>
<string name="k2go_fqr_consent_title">Letöltöd ezt a régiót?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s a letöltés, %3$s a lemezen.</string>
<string name="k2go_fqr_consent_legend">Ez a régió: %1$s · Utána szabad: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@
<string name="k2go_fqr_name_taken">“%1$s” sudah dipakai. Pilih nama lain.</string>
<string name="k2go_fqr_calculating">Menghitung ukuran unduhan…</string>
<string name="k2go_fqr_estimate_error_title">Tidak bisa mengunduh wilayah ini</string>
<string name="k2go_fqr_overlap">Wilayah ini tumpang tindih dengan wilayah yang sudah Anda unduh.</string>
<string name="k2go_fqr_consent_title">Unduh wilayah ini?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s untuk diunduh, %3$s di disk.</string>
<string name="k2go_fqr_consent_legend">Wilayah ini: %1$s · Kosong setelahnya: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@
<string name="k2go_fqr_name_taken">“%1$s” è già in uso. Scegli un nome diverso.</string>
<string name="k2go_fqr_calculating">Calcolo della dimensione del download…</string>
<string name="k2go_fqr_estimate_error_title">Impossibile scaricare questa regione</string>
<string name="k2go_fqr_overlap">Questa regione si sovrappone a una regione che hai già scaricato.</string>
<string name="k2go_fqr_consent_title">Scaricare questa regione?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s da scaricare, %3$s su disco.</string>
<string name="k2go_fqr_consent_legend">Questa regione: %1$s · Libero dopo: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@
<string name="k2go_fqr_name_taken">「%1$s」はすでに使われています。別の名前を選んでください。</string>
<string name="k2go_fqr_calculating">ダウンロードサイズを計算中…</string>
<string name="k2go_fqr_estimate_error_title">この地域をダウンロードできません</string>
<string name="k2go_fqr_overlap">この地域は、すでにダウンロードした地域と重なっています。</string>
<string name="k2go_fqr_consent_title">この地域をダウンロードしますか?</string>
<string name="k2go_fqr_consent_sub">「%1$s」 — ダウンロード %2$s、ディスク上 %3$s。</string>
<string name="k2go_fqr_consent_legend">この地域:%1$s · 完了後の空き:%2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@
<string name="k2go_fqr_name_taken">“%1$s”은(는) 이미 사용 중입니다. 다른 이름을 선택하세요.</string>
<string name="k2go_fqr_calculating">다운로드 크기를 계산하는 중…</string>
<string name="k2go_fqr_estimate_error_title">이 지역을 다운로드할 수 없음</string>
<string name="k2go_fqr_overlap">이 지역은 이미 다운로드한 지역과 겹칩니다.</string>
<string name="k2go_fqr_consent_title">이 지역을 다운로드하시겠어요?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — 다운로드 %2$s, 디스크 %3$s.</string>
<string name="k2go_fqr_consent_legend">이 지역: %1$s · 이후 여유: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-lt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@
<string name="k2go_fqr_name_taken">„%1$s“ jau naudojamas. Pasirinkite kitą pavadinimą.</string>
<string name="k2go_fqr_calculating">Skaičiuojamas atsisiuntimo dydis…</string>
<string name="k2go_fqr_estimate_error_title">Šio regiono atsisiųsti negalima</string>
<string name="k2go_fqr_overlap">Šis regionas persidengia su jau atsisiųstu regionu.</string>
<string name="k2go_fqr_consent_title">Atsisiųsti šį regioną?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s atsisiųsti, %3$s diske.</string>
<string name="k2go_fqr_consent_legend">Šis regionas: %1$s · Po to laisva: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@
<string name="k2go_fqr_name_taken">“%1$s” is al in gebruik. Kies een andere naam.</string>
<string name="k2go_fqr_calculating">Downloadgrootte berekenen…</string>
<string name="k2go_fqr_estimate_error_title">Kan deze regio niet downloaden</string>
<string name="k2go_fqr_overlap">Deze regio overlapt met een regio die je al hebt gedownload.</string>
<string name="k2go_fqr_consent_title">Deze regio downloaden?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s om te downloaden, %3$s op schijf.</string>
<string name="k2go_fqr_consent_legend">Deze regio: %1$s · Vrij daarna: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-no/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@
<string name="k2go_fqr_name_taken">«%1$s» er allerede i bruk. Velg et annet navn.</string>
<string name="k2go_fqr_calculating">Beregner nedlastingsstørrelse…</string>
<string name="k2go_fqr_estimate_error_title">Kan ikke laste ned denne regionen</string>
<string name="k2go_fqr_overlap">Denne regionen overlapper med en region du allerede har lastet ned.</string>
<string name="k2go_fqr_consent_title">Laste ned denne regionen?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s å laste ned, %3$s på disk.</string>
<string name="k2go_fqr_consent_legend">Denne regionen: %1$s · Ledig etterpå: %2$s</string>
Expand Down
1 change: 1 addition & 0 deletions controller/app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@
<string name="k2go_fqr_name_taken">„%1$s” jest już używana. Wybierz inną nazwę.</string>
<string name="k2go_fqr_calculating">Obliczanie rozmiaru pobierania…</string>
<string name="k2go_fqr_estimate_error_title">Nie można pobrać tego regionu</string>
<string name="k2go_fqr_overlap">Ten region nakłada się na region, który już pobrano.</string>
<string name="k2go_fqr_consent_title">Pobrać ten region?</string>
<string name="k2go_fqr_consent_sub">“%1$s” — %2$s do pobrania, %3$s na dysku.</string>
<string name="k2go_fqr_consent_legend">Ten region: %1$s · Wolne po: %2$s</string>
Expand Down
Loading
Loading