class SaveUrlCoroutine {
fun save(context: Context, activity: Activity, urlString: String, fileUri: Uri, userAgent: String, cookiesEnabled: Boolean) {
+ // Create a canceled boolean.
+ var canceled = false
+
// Use a coroutine to save the URL.
CoroutineScope(Dispatchers.Main).launch {
// Create a file name string.
// Create a saving file snackbar.
val savingFileSnackbar = Snackbar.make(webViewViewPager2, activity.getString(R.string.saving_file, 0, fileNameString), Snackbar.LENGTH_INDEFINITE)
+ .setAction(R.string.cancel) { canceled = true }
// Display the saving file snackbar.
savingFileSnackbar.show()
var bufferLength: Int
// Attempt to read data from the input stream and store it in the output stream. Also store the amount of data read in the buffer length variable.
- while (inputStream.read(conversionBufferByteArray).also { bufferLength = it } > 0) { // Proceed while the amount of data stored in the buffer in > 0.
+ while ((inputStream.read(conversionBufferByteArray).also { bufferLength = it } > 0) && !canceled) { // Proceed while the amount of data stored in the buffer in > 0.
// Write the contents of the conversion buffer to the file output stream.
outputStream.write(conversionBufferByteArray, 0, bufferLength)
// Dismiss the saving file snackbar.
savingFileSnackbar.dismiss()
- // Display the file saved snackbar.
- Snackbar.make(webViewViewPager2, activity.getString(R.string.saved, fileNameString), Snackbar.LENGTH_LONG).show()
+ // Display a final disposition snackbar.
+ if (canceled)
+ // Display the download cancelled snackbar.
+ Snackbar.make(webViewViewPager2, activity.getString(R.string.download_cancelled), Snackbar.LENGTH_SHORT).show()
+ else
+ // Display the file saved snackbar.
+ Snackbar.make(webViewViewPager2, activity.getString(R.string.saved, fileNameString), Snackbar.LENGTH_LONG).show()
}
} catch (exception: Exception) {
// Update the UI.
<!--
Copyright 2016-2023 Soren Stoutner <soren@stoutner.com>.
- Translation 2017-2022 Jose A. León. Copyright assigned to Soren Stoutner <soren@stoutner.com>.
+ Translation 2017-2023 Jose A. León. Copyright assigned to Soren Stoutner <soren@stoutner.com>.
This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
<string name="domain_name">Nombre de dominio</string>
<string name="domain_deleted">Dominio borrado</string>
<string name="domain_name_instructions">*. puede ser añadido a un dominio para incluir todos los subdominios (p.ej. *.stoutner.com)</string>
+ <string-array name="javascript_array">
+ <item>Por defecto del sistema</item>
+ <item>JavaScript habilitado</item>
+ <item>JavaScript deshabilitado</item>
+ </string-array>
+ <string-array name="cookies_array">
+ <item>Por defecto del sistema</item>
+ <item>Cookies habilitadas</item>
+ <item>Cookies deshabilitadas</item>
+ </string-array>
+ <string-array name="dom_storage_array">
+ <item>Por defecto del sistema</item>
+ <item>Almacenamiento DOM habilitado</item>
+ <item>Almacenamiento DOM deshabilitado</item>
+ </string-array>
+ <string-array name="form_data_array"> <!-- Form data can be removed once the minimum API >= 26. -->
+ <item>Por defecto del sistema</item>
+ <item>Datos de formulario habilitados</item>
+ <item>Datos de formulario deshabilitados</item>
+ </string-array>
+ <string-array name="easylist_array">
+ <item>Por defecto del sistema</item>
+ <item>EasyList habilitada</item>
+ <item>EasyList deshabilitada</item>
+ </string-array>
+ <string-array name="easyprivacy_array">
+ <item>Por defecto del sistema</item>
+ <item>EasyPrivacy habilitada</item>
+ <item>EasyPrivacy deshabilitada</item>
+ </string-array>
+ <string-array name="fanboys_annoyance_list_array">
+ <item>Por defecto del sistema</item>
+ <item>Lista molesta de Fanboy habilitada</item>
+ <item>Lista molesta de Fanboy deshabilitada</item>
+ </string-array>
+ <string-array name="fanboys_social_blocking_list_array">
+ <item>Por defecto del sistema</item>
+ <item>Lista de bloqueo social de Fanboy habilitada</item>
+ <item>Lista de bloqueo social de Fanboy deshabilitada</item>
+ </string-array>
+ <string-array name="ultralist_array">
+ <item>Por defecto del sistema</item>
+ <item>UltraList habilitada</item>
+ <item>UltraList deshabilitada</item>
+ </string-array>
+ <string-array name="ultraprivacy_array">
+ <item>Por defecto del sistema</item>
+ <item>Ultra Privacidad habilitada</item>
+ <item>Ultra Privacidad deshabilitada</item>
+ </string-array>
+ <string-array name="block_all_third_party_requests_array">
+ <item>Por defecto del sistema</item>
+ <item>Bloquear todas las solicitudes de terceras partes habilitada</item>
+ <item>Bloquear todas las solicitudes de terceras partes deshabilitada</item>
+ </string-array>
<string-array name="font_size_array">
<item>Por defecto del sistema</item>
<item>Tamaño de letra personalizado</item>
<string name="domain_name">Nome del Dominio</string>
<string name="domain_deleted">Dominio Eliminato</string>
<string name="domain_name_instructions">è possibile anteporre *. a un dominio per includere tutti i sottodomini (es. *.stoutner.com)</string>
+ <string-array name="javascript_array">
+ <item>Default di Sistema</item>
+ <item>JavaScript abilitato</item>
+ <item>JavaScript disabilitato</item>
+ </string-array>
+ <string-array name="cookies_array">
+ <item>Default di Sistema</item>
+ <item>Cookies abilitati</item>
+ <item>Cookies disabilitati</item>
+ </string-array>
+ <string-array name="dom_storage_array">
+ <item>Default di Sistema</item>
+ <item>DOM storage abilitato</item>
+ <item>DOM storage disabilitato</item>
+ </string-array>
+ <string-array name="form_data_array"> <!-- Form data can be removed once the minimum API >= 26. -->
+ <item>Default di Sistema</item>
+ <item>Dati dei Form abilitati</item>
+ <item>Dati dei Form disabilitati</item>
+ </string-array>
+ <string-array name="easylist_array">
+ <item>Default di Sistema</item>
+ <item>EasyList abilitata</item>
+ <item>EasyList disabilitata</item>
+ </string-array>
+ <string-array name="easyprivacy_array">
+ <item>Default di Sistema</item>
+ <item>EasyPrivacy abilitata</item>
+ <item>EasyPrivacy disabilitata</item>
+ </string-array>
+ <string-array name="fanboys_annoyance_list_array">
+ <item>Default di Sistema</item>
+ <item>Fanboy’s Annoyance List abilitata</item>
+ <item>Fanboy’s Annoyance List disabilitata</item>
+ </string-array>
+ <string-array name="fanboys_social_blocking_list_array">
+ <item>Default di Sistema</item>
+ <item>Fanboy’s Social Blocking List abilitata</item>
+ <item>Fanboy’s Social Blocking List disabilitata</item>
+ </string-array>
+ <string-array name="ultralist_array">
+ <item>Default di Sistema</item>
+ <item>UltraList abilitata</item>
+ <item>UltraList disabilitata</item>
+ </string-array>
+ <string-array name="ultraprivacy_array">
+ <item>Default di Sistema</item>
+ <item>UltraPrivacy abilitata</item>
+ <item>UltraPrivacy disabilitata</item>
+ </string-array>
+ <string-array name="block_all_third_party_requests_array">
+ <item>Default di Sistema</item>
+ <item>Bloccco di tutte le richieste di terze parti abilitato</item>
+ <item>Bloccco di tutte le richieste di terze parti disabilitato</item>
+ </string-array>
<string-array name="font_size_array">
<item>Impostazioni di default</item>
<item>Dimensione carattere personalizzata</item>
<string name="domain_name">Имя домена</string>
<string name="domain_deleted">Домен удален</string>
<string name="domain_name_instructions">добавьте *. для включения всех поддоменов (напр. *.stoutner.com)</string>
+ <string-array name="javascript_array">
+ <item>По умолчанию</item>
+ <item>JavaScript включен</item>
+ <item>JavaScript отключен</item>
+ </string-array>
+ <string-array name="cookies_array">
+ <item>По умолчанию</item>
+ <item>Cookie включены</item>
+ <item>Cookie отключены</item>
+ </string-array>
+ <string-array name="dom_storage_array">
+ <item>По умолчанию</item>
+ <item>DOM-хранилище включено</item>
+ <item>DOM-хранилище отключено</item>
+ </string-array>
+ <string-array name="form_data_array"> <!-- Form data can be removed once the minimum API >= 26. -->
+ <item>По умолчанию</item>
+ <item>Данные форм включены</item>
+ <item>Данные форм отключены</item>
+ </string-array>
+ <string-array name="easylist_array">
+ <item>По умолчанию</item>
+ <item>EasyList включен</item>
+ <item>EasyList отключен</item>
+ </string-array>
+ <string-array name="easyprivacy_array">
+ <item>По умолчанию</item>
+ <item>EasyPrivacy включен</item>
+ <item>EasyPrivacy отключен</item>
+ </string-array>
+ <string-array name="fanboys_annoyance_list_array">
+ <item>По умолчанию</item>
+ <item>Fanboy’s Annoyance List включен</item>
+ <item>Fanboy’s Annoyance List отключен</item>
+ </string-array>
+ <string-array name="fanboys_social_blocking_list_array">
+ <item>По умолчанию</item>
+ <item>Fanboy’s Social Blocking List включен</item>
+ <item>Fanboy’s Social Blocking List отключен</item>
+ </string-array>
+ <string-array name="ultralist_array">
+ <item>По умолчанию</item>
+ <item>UltraList включен</item>
+ <item>UltraList отключен</item>
+ </string-array>
+ <string-array name="ultraprivacy_array">
+ <item>По умолчанию</item>
+ <item>UltraPrivacy включен</item>
+ <item>UltraPrivacy отключен</item>
+ </string-array>
+ <string-array name="block_all_third_party_requests_array">
+ <item>По умолчанию</item>
+ <item>Блокировка всех сторонних запросов включена</item>
+ <item>Блокировка всех сторонних запросов отключена</item>
+ </string-array>
<string-array name="font_size_array">
<item>Настройки по умолчанию</item>
<item>Пользовательский размер шрифта</item>
<string name="saving_file_progress">Saving file:\u0020 %1$s bytes - %2$s</string>
<string name="saving_file_percentage_progress">Saving file:\u0020 %1$d%% - %2$s bytes / %3$s bytes - %4$s</string>
<string name="saved">%1$s saved.</string>
+ <string name="download_cancelled">Download cancelled.</string>
<string name="processing_image">Processing image:\u0020 %1$s</string>
<string name="error_saving_file">Error saving %1$s:\u0020 %2$s</string>
<string name="unknown_error">Unknown error</string>
# Use non-transitive R classes, which speed up the build process when the configuration has not changed.
android.nonTransitiveRClass=true
+# Use non-final resource IDs for faster incremental compilation.
+android.nonFinalResIds=true
+
android.defaults.buildfeatures.buildconfig=true
-android.nonFinalResIds=false