more SAF implementation

* full support for Directory API (Android Lollipop or later)
* best effort to handle any kind errors (missing file, revoked permissions, etc) and recover the download
* implemented directory choosing
* fix download database version upgrading
* misc. cleanup
* do not release permission on the old save path (if the user change the download directory) under SAF api
This commit is contained in:
kapodamy 2019-04-09 18:38:34 -03:00
parent f6b32823ba
commit d00dc798f4
28 changed files with 946 additions and 589 deletions

View file

@ -176,13 +176,17 @@
</string-array>
<!-- FileName Downloads -->
<string name="settings_file_charset_key" translatable="false">file_rename</string>
<string name="settings_file_charset_key" translatable="false">file_rename_charset</string>
<string name="settings_file_replacement_character_key" translatable="false">file_replacement_character</string>
<string name="settings_file_replacement_character_default_value" translatable="false">_</string>
<string name="charset_letters_and_digits_value" translatable="false">CHARSET_LETTERS_AND_DIGITS</string>
<string name="charset_most_special_value" translatable="false">CHARSET_MOST_SPECIAL</string>
<string-array name="settings_filename_charset" translatable="false">
<item>@string/charset_letters_and_digits_value</item>
<item>@string/charset_most_special_characters_value</item>
<item>@string/charset_most_special_value</item>
</string-array>
<string-array name="settings_filename_charset_name" translatable="false">
@ -190,8 +194,8 @@
<item>@string/charset_most_special_characters</item>
</string-array>
<string name="default_file_charset_value" translatable="false">@string/charset_most_special_characters_value</string>
<string name="default_file_charset_value" translatable="false">@string/charset_most_special_value</string>
<string name="downloads_maximum_retry" translatable="false">downloads_max_retry</string>
<string name="downloads_maximum_retry_default" translatable="false">3</string>
<string-array name="downloads_maximum_retry_list" translatable="false">

View file

@ -305,8 +305,7 @@
<string name="settings_file_charset_title">Allowed characters in filenames</string>
<string name="settings_file_replacement_character_summary">Invalid characters are replaced with this value</string>
<string name="settings_file_replacement_character_title">Replacement character</string>
<string name="charset_letters_and_digits_value" translatable="false">[^\\w\\d]+</string>
<string name="charset_most_special_characters_value" translatable="false">[\\n\\r|\\?*&lt;":&gt;/']+</string>
<string name="charset_letters_and_digits">Letters and digits</string>
<string name="charset_most_special_characters">Most special characters</string>
<string name="toast_no_player">No app installed to play this file</string>