Browse Source

downloads - show message if file doesn't exist

master
DF1E 8 years ago
parent
commit
334dbb3780
  1. 7
      app/src/main/java/acr/browser/lightning/view/LightningWebClient.java
  2. 3
      app/src/main/res/values-de/strings.xml
  3. 1
      app/src/main/res/values/strings.xml

7
app/src/main/java/acr/browser/lightning/view/LightningWebClient.java

@ -366,8 +366,7 @@ public class LightningWebClient extends WebViewClient {
String newMimeType = MimeTypeMap.getSingleton() String newMimeType = MimeTypeMap.getSingleton()
.getMimeTypeFromExtension(Utils.guessFileExtension(file.toString())); .getMimeTypeFromExtension(Utils.guessFileExtension(file.toString()));
Intent intent = new Intent(); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri contentUri = FileProvider.getUriForFile(mActivity, BuildConfig.APPLICATION_ID + ".fileprovider", file); Uri contentUri = FileProvider.getUriForFile(mActivity, BuildConfig.APPLICATION_ID + ".fileprovider", file);
intent.setDataAndType(contentUri, newMimeType); intent.setDataAndType(contentUri, newMimeType);
@ -377,8 +376,10 @@ public class LightningWebClient extends WebViewClient {
} catch (Exception e) { } catch (Exception e) {
System.out.println("LightningWebClient: cannot open downloaded file"); System.out.println("LightningWebClient: cannot open downloaded file");
} }
return true; } else {
Utils.showSnackbar(mActivity, R.string.message_open_download_fail);
} }
return true;
} }
return false; return false;
} }

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

@ -160,7 +160,7 @@
<string name="export_bookmarks">Exportiere Datensicherung</string> <string name="export_bookmarks">Exportiere Datensicherung</string>
<string name="import_backup">Importiere Lesezeichen aus Datensicherung</string> <string name="import_backup">Importiere Lesezeichen aus Datensicherung</string>
<string name="bookmark_export_path">Lesezeichen exportiert nach</string> <string name="bookmark_export_path">Lesezeichen exportiert nach</string>
<string name="bookmark_settings">Lesezeichen Einstellungen</string> <string name="bookmark_settings">Lesezeichen</string>
<string name="import_bookmark_error">Lesezeichen konnten nicht importiert werden</string> <string name="import_bookmark_error">Lesezeichen konnten nicht importiert werden</string>
<string name="title_chooser">Wähle Datei aus</string> <string name="title_chooser">Wähle Datei aus</string>
<string name="settings_general">Allgemein</string> <string name="settings_general">Allgemein</string>
@ -246,4 +246,5 @@
<string name="host">Host:</string> <string name="host">Host:</string>
<string name="hosts_source">Quelle für Werbeblocker</string> <string name="hosts_source">Quelle für Werbeblocker</string>
<string name="settings_display">Anzeige</string> <string name="settings_display">Anzeige</string>
<string name="message_open_download_fail">Diese Datei existiert nicht mehr</string>
</resources> </resources>

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

@ -229,6 +229,7 @@
<string name="action_delete_all_bookmarks">Delete all bookmarks</string> <string name="action_delete_all_bookmarks">Delete all bookmarks</string>
<string name="flash_not_supported">Flash Player is not supported by your system</string> <string name="flash_not_supported">Flash Player is not supported by your system</string>
<string name="upsell_plus_version">Upgrade to Lightning Plus to block ads</string> <string name="upsell_plus_version">Upgrade to Lightning Plus to block ads</string>
<string name="message_open_download_fail">This file doesn\'t exist anymore</string>
<string name="faq">FAQ</string> <string name="faq">FAQ</string>
<string name="faq_description">Frequently asked questions</string> <string name="faq_description">Frequently asked questions</string>

Loading…
Cancel
Save