summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Slaughter <eds@google.com>2010-09-01 16:21:07 -0700
committerElliott Slaughter <eds@google.com>2010-09-01 16:21:07 -0700
commitaba242c3435b444fdc7b0c7620175d3aa6358017 (patch)
treef2e9abb4179c3b7161f6e60a6037faacbf1874de
parent3d6df16f1c9a64cf2dc5b41a2078f4c49b0c296a (diff)
downloadpackages_apps_browser-aba242c3435b444fdc7b0c7620175d3aa6358017.zip
packages_apps_browser-aba242c3435b444fdc7b0c7620175d3aa6358017.tar.gz
packages_apps_browser-aba242c3435b444fdc7b0c7620175d3aa6358017.tar.bz2
Fix for saving a WebArchive when the external storage isn't mounted.
Change-Id: I572da2013b5ba988c899ba2f64453dfc908b4fec
-rw-r--r--src/com/android/browser/BrowserActivity.java29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 2260200..3535725 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -1414,17 +1414,26 @@ public class BrowserActivity extends Activity
if (LOGD_ENABLED) {
Log.d(LOGTAG, "Save as Web Archive");
}
- String directory = getExternalFilesDir(null).getAbsolutePath() + File.separator;
- getTopWindow().saveWebArchive(directory, true, new ValueCallback<String>() {
- @Override
- public void onReceiveValue(String value) {
- if (value != null) {
- Toast.makeText(BrowserActivity.this, R.string.webarchive_saved, Toast.LENGTH_SHORT).show();
- } else {
- Toast.makeText(BrowserActivity.this, R.string.webarchive_failed, Toast.LENGTH_SHORT).show();
+ String state = Environment.getExternalStorageState();
+ if (Environment.MEDIA_MOUNTED.equals(state)) {
+ String directory = Environment.getExternalStoragePublicDirectory(
+ Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + File.separator;
+ getTopWindow().saveWebArchive(directory, true, new ValueCallback<String>() {
+ @Override
+ public void onReceiveValue(String value) {
+ if (value != null) {
+ Toast.makeText(BrowserActivity.this, R.string.webarchive_saved,
+ Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(BrowserActivity.this, R.string.webarchive_failed,
+ Toast.LENGTH_SHORT).show();
+ }
}
- }
- });
+ });
+ } else {
+ Toast.makeText(BrowserActivity.this, R.string.webarchive_failed,
+ Toast.LENGTH_SHORT).show();
+ }
break;
case R.id.page_info_menu_id: