Browse Source

Adding file size to download dialog thanks to @alinux78

master
anthony restaino 8 years ago
parent
commit
65a8b04099
  1. 12
      app/src/main/java/acr/browser/lightning/download/LightningDownloadListener.java
  2. 2
      app/src/main/res/values-ar/strings.xml
  3. 2
      app/src/main/res/values-de/strings.xml
  4. 2
      app/src/main/res/values-es/strings.xml
  5. 2
      app/src/main/res/values-fr/strings.xml
  6. 2
      app/src/main/res/values-gr/strings.xml
  7. 2
      app/src/main/res/values-hu/strings.xml
  8. 2
      app/src/main/res/values-it/strings.xml
  9. 2
      app/src/main/res/values-ja/strings.xml
  10. 2
      app/src/main/res/values-ko/strings.xml
  11. 2
      app/src/main/res/values-pl/strings.xml
  12. 2
      app/src/main/res/values-pt/strings.xml
  13. 2
      app/src/main/res/values-ru/strings.xml
  14. 2
      app/src/main/res/values-sr/strings.xml
  15. 2
      app/src/main/res/values-tr/strings.xml
  16. 2
      app/src/main/res/values-zh-rCN/strings.xml
  17. 2
      app/src/main/res/values-zh-rTW/strings.xml
  18. 3
      app/src/main/res/values/strings.xml

12
app/src/main/java/acr/browser/lightning/download/LightningDownloadListener.java

@ -8,6 +8,7 @@ import android.app.Activity; @@ -8,6 +8,7 @@ import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.text.format.Formatter;
import android.util.Log;
import android.webkit.DownloadListener;
import android.webkit.URLUtil;
@ -37,7 +38,7 @@ public class LightningDownloadListener implements DownloadListener { @@ -37,7 +38,7 @@ public class LightningDownloadListener implements DownloadListener {
@Override
public void onDownloadStart(final String url, final String userAgent,
final String contentDisposition, final String mimetype, long contentLength) {
final String contentDisposition, final String mimetype, final long contentLength) {
PermissionsManager.getInstance().requestPermissionsIfNecessaryForResult(mActivity,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE},
new PermissionsResultAction() {
@ -59,8 +60,15 @@ public class LightningDownloadListener implements DownloadListener { @@ -59,8 +60,15 @@ public class LightningDownloadListener implements DownloadListener {
};
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); // dialog
String downloadSize;
if (contentLength > 0) {
downloadSize = Formatter.formatFileSize(mActivity, contentLength);
} else {
downloadSize = mActivity.getString(R.string.unknown_size);
}
String message = mActivity.getString(R.string.dialog_download, downloadSize);
Dialog dialog = builder.setTitle(fileName)
.setMessage(mActivity.getResources().getString(R.string.dialog_download))
.setMessage(message)
.setPositiveButton(mActivity.getResources().getString(R.string.action_download),
dialogClickListener)
.setNegativeButton(mActivity.getResources().getString(R.string.action_cancel),

2
app/src/main/res/values-ar/strings.xml

@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
<string name="agent_custom">مخصص</string>
<string name="title_search_engine">محرك البحث</string>
<string name="action_ok">حسنا</string>
<string name="dialog_download">هل ترغب في تحميل هذا الملف؟</string>
<string name="dialog_download">هل ترغب في تحميل هذا الملف؟ (%1$s)</string>
<string name="action_cancel">إلغاء</string>
<string name="title_warning">تحذير</string>
<string name="dialog_adobe_not_installed">لم يتم العثور على مشغل الفلاش يرجى تثبيته من المتجر.</string>

2
app/src/main/res/values-de/strings.xml

@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
<string name="agent_custom">Andere</string>
<string name="title_search_engine">Suchmaschine</string>
<string name="action_ok">Ok</string>
<string name="dialog_download">Möchten Sie diese Datei herunterladen?</string>
<string name="dialog_download">Möchten Sie diese Datei herunterladen? (%1$s)</string>
<string name="action_cancel">Abbrechen</string>
<string name="title_warning">Warnung</string>
<string name="dialog_adobe_not_installed">Adobe Flash Player wurde nicht erkannt.\nBitte installieren Sie den Flash Player.</string>

2
app/src/main/res/values-es/strings.xml

@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
<string name="agent_custom">Personalizado</string>
<string name="title_search_engine">Motor de búsqueda</string>
<string name="action_ok">Aceptar</string>
<string name="dialog_download">¿Quieres descargar este archivo?</string>
<string name="dialog_download">¿Quieres descargar este archivo? (%1$s)</string>
<string name="action_cancel">Cancelar</string>
<string name="title_warning">Aviso</string>
<string name="dialog_adobe_not_installed">No se detecta Adobe Flash Player.\nPor favor, instálalo.</string>

2
app/src/main/res/values-fr/strings.xml

@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
<string name="agent_custom">Personnalisé</string>
<string name="title_search_engine">Moteur de recherche</string>
<string name="action_ok">OK</string>
<string name="dialog_download">Voulez-vous télécharger ce fichier ?</string>
<string name="dialog_download">Voulez-vous télécharger ce fichier ? (%1$s)</string>
<string name="action_cancel">Annuler</string>
<string name="title_warning">Avertissement</string>
<string name="dialog_adobe_not_installed">Adobe Flash Player n\'a pas été détecté.\nVeuillez installer Flash Player.</string>

2
app/src/main/res/values-gr/strings.xml

@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
<string name="agent_custom">Συγκεκριμένο</string>
<string name="title_search_engine">Μηχανή Αναζήτησης</string>
<string name="action_ok">OK</string>
<string name="dialog_download">Θα θέλατε να κατεβάσετε αυτό το αρχείο;</string>
<string name="dialog_download">Θα θέλατε να κατεβάσετε αυτό το αρχείο; (%1$s)</string>
<string name="action_cancel">Ακύρωση</string>
<string name="title_warning">Προσοχή</string>
<string name="dialog_adobe_not_installed">Δεν ανιχνεύτηκε ο Adobe Flash Player.\nΠαρακαλώ εγκαταστήστε τον Flash Player.</string>

2
app/src/main/res/values-hu/strings.xml

@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
<string name="agent_custom">Egyéni</string>
<string name="title_search_engine">Keresőmotor</string>
<string name="action_ok">OK</string>
<string name="dialog_download">Le szeretnéd tölteni ezt a fájlt?</string>
<string name="dialog_download">Le szeretnéd tölteni ezt a fájlt? (%1$s)</string>
<string name="action_cancel">Mégse</string>
<string name="title_warning">Figyelmeztetés</string>
<string name="dialog_adobe_not_installed">Az Adobe Flash Player nincs észlelve.\nKérjük telepítse a Flash Player-t.</string>

2
app/src/main/res/values-it/strings.xml

@ -72,7 +72,7 @@ @@ -72,7 +72,7 @@
<string name="agent_custom">Personalizzato</string>
<string name="title_search_engine">Motore di ricerca</string>
<string name="action_ok">OK</string>
<string name="dialog_download">Vuoi scaricarlo?</string>
<string name="dialog_download">Vuoi scaricarlo? (%1$s)</string>
<string name="action_cancel">Annulla</string>
<string name="title_warning">Attenzione</string>
<string name="dialog_adobe_not_installed">Adobe Flash Player non è stato trovato.\nSi prega di installarlo.</string>

2
app/src/main/res/values-ja/strings.xml

@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
<string name="agent_custom">カスタム</string>
<string name="title_search_engine">検索エンジン</string>
<string name="action_ok">OK</string>
<string name="dialog_download">このファイルをダウンロードしますか?</string>
<string name="dialog_download">このファイルをダウンロードしますか? (%1$s)</string>
<string name="action_cancel">キャンセル</string>
<string name="title_warning">警告</string>
<string name="dialog_adobe_not_installed">Adobe Flash Player が見つかりません\nFlash Player をインストールしてください</string>

2
app/src/main/res/values-ko/strings.xml

@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
<string name="agent_custom">임의의 UA</string>
<string name="title_search_engine">검색 엔진</string>
<string name="action_ok">확인</string>
<string name="dialog_download">파일을 다운로드할까요?</string>
<string name="dialog_download">파일을 다운로드할까요? (%1$s)</string>
<string name="action_cancel">취소</string>
<string name="title_warning">경고</string>
<string name="dialog_adobe_not_installed">Adobe Flash Player가 감지되지 않았습니다.\nFlash Player를 설치하세요.</string>

2
app/src/main/res/values-pl/strings.xml

@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
<string name="agent_custom">Własny identyfikator</string>
<string name="title_search_engine">Wyszukiwarka</string>
<string name="action_ok">OK</string>
<string name="dialog_download">Czy chcesz pobrać ten plik?</string>
<string name="dialog_download">Czy chcesz pobrać ten plik? (%1$s)</string>
<string name="action_cancel">Anuluj</string>
<string name="title_warning">Ostrzeżenie</string>
<string name="dialog_adobe_not_installed">Adobe Flash Player nie został wykryty.\nProszę go zainstalować.</string>

2
app/src/main/res/values-pt/strings.xml

@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
<string name="agent_custom">Personalizado</string>
<string name="title_search_engine">Mecanismo de pesquisa</string>
<string name="action_ok">OK</string>
<string name="dialog_download">Deseja descarregar este ficheiro?</string>
<string name="dialog_download">Deseja descarregar este ficheiro? (%1$s)</string>
<string name="action_cancel">Cancelar</string>
<string name="title_warning">Aviso</string>
<string name="dialog_adobe_not_installed">O Adobe Flash Player não foi detetado.\nTem que instalar o Flash Player.</string>

2
app/src/main/res/values-ru/strings.xml

@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
<string name="agent_custom">Выбрать</string>
<string name="title_search_engine">Поисковая система</string>
<string name="action_ok">OK</string>
<string name="dialog_download">Загрузить файл?</string>
<string name="dialog_download">Загрузить файл? (%1$s)</string>
<string name="action_cancel">Отмена</string>
<string name="title_warning">Внимание</string>
<string name="dialog_adobe_not_installed">"Adobe Flash Player не найден.\nУстановите Flash Player"</string>

2
app/src/main/res/values-sr/strings.xml

@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
<string name="agent_custom">Посебна</string>
<string name="title_search_engine">Мотор претраге</string>
<string name="action_ok">У реду</string>
<string name="dialog_download">Желите ли да преузмете овај фајл?</string>
<string name="dialog_download">Желите ли да преузмете овај фајл? (%1$s)</string>
<string name="action_cancel">Одустани</string>
<string name="title_warning">Упозорење</string>
<string name="dialog_adobe_not_installed">Адобов Флеш није откривен.\nИнсталирајте Флеш Плејер.</string>

2
app/src/main/res/values-tr/strings.xml

@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
<string name="agent_custom">Kişisel</string>
<string name="title_search_engine">Arama Motoru</string>
<string name="action_ok">Tamam</string>
<string name="dialog_download">Bu dosyayı indirmek ister misin?</string>
<string name="dialog_download">Bu dosyayı indirmek ister misin? (%1$s)</string>
<string name="action_cancel">İptal</string>
<string name="title_warning">Uyarı</string>
<string name="dialog_adobe_not_installed">Adobe Flash Player bulunamadı.\nLütfen Flash Player yükleyin.</string>

2
app/src/main/res/values-zh-rCN/strings.xml

@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
<string name="agent_custom">自定义 UA</string>
<string name="title_search_engine">搜索引擎</string>
<string name="action_ok">确认</string>
<string name="dialog_download">您是否需要下载此文件?</string>
<string name="dialog_download">您是否需要下载此文件? (%1$s)</string>
<string name="action_cancel">取消</string>
<string name="title_warning">警告</string>
<string name="dialog_adobe_not_installed">"未检测到您的设备中安装了 Adobe Flash Player,请先安装 Adobe Flash Player 后再启用此选项。"</string>

2
app/src/main/res/values-zh-rTW/strings.xml

@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
<string name="agent_custom">自定義 UA</string>
<string name="title_search_engine">搜索引擎</string>
<string name="action_ok">確認</string>
<string name="dialog_download">您是否需要下載此檔?</string>
<string name="dialog_download">您是否需要下載此檔? (%1$s)</string>
<string name="action_cancel">取消</string>
<string name="title_warning">警告</string>
<string name="dialog_adobe_not_installed">"未檢測到您的設備中安裝了 Adobe Flash Player,請先安裝 Adobe Flash Player 後再啟用此選項。"</string>

3
app/src/main/res/values/strings.xml

@ -72,7 +72,8 @@ @@ -72,7 +72,8 @@
<string name="agent_custom">Custom</string>
<string name="title_search_engine">Search Engine</string>
<string name="action_ok">OK</string>
<string name="dialog_download">Do you want to download this file?</string>
<string name="dialog_download">Do you want to download this file? (%1$s)</string>
<string name="unknown_size">Unknown Size</string>
<string name="action_cancel">Cancel</string>
<string name="title_warning">Warning</string>
<string name="dialog_adobe_not_installed">Adobe Flash Player was not detected.\nPlease install Flash Player.</string>

Loading…
Cancel
Save