Browser: improve some strings and method
CRs-Fixed: 507953
Change-Id: I5ddc67af01b88a535e7d167173b849b446261d1c
diff --git a/res/values/strings.xml b/res/values/strings.xml
old mode 100644
new mode 100755
index fa46467..dab4f51
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1058,23 +1058,22 @@
<string name="download_filesize">Size</string>
<string name="download_filepath_label">Path</string>
<string name="download_edit_filename_label">Name</string>
- <string name="download_default_path">default</string>
- <string name="default_savepath_name">/Download</string>
+ <string name="download_default_path">/Download</string>
<string name="download_no_enough_memory">Download no enough memory</string>
<string name="download_settings_title">Download Settings</string>
- <string name="save_page_needs_title">Download File Name is Empty!</string>
- <string name="filename_empty_title">Download File Name is Null</string>
- <string name="filename_empty_msg">Download File Name Can not Be Null!Please Enter a Valid File Name!</string>
+ <string name="save_page_needs_title">Download File\'s Name Can not be Empty!</string>
+ <string name="filename_empty_title">Download File\'s Name is Empty</string>
+ <string name="filename_empty_msg">Download File\'s Name Can not Be Empty! Please Input a Valid File\'s Name!</string>
<string name="download_file_setting">Download File Settings</string>
<string name="unknow_length">Unknow</string>
- <string name="download_file_exist_msg">This File is Already Exist,Please Enter a New File Name!</string>
+ <string name="download_file_exist_msg">This File is Already Exist,Please Input a New File\'s Name!</string>
<string name="download_file_exist">File Exist</string>
<string name ="time_min">min</string>
<string name="download_path_phone_stroage_label">/Phone Stroage</string>
<string name="download_path_sd_card_label">/SD card</string>
- <string name="download_path_unavailable_dlg_title">Download Directory Unavailable</string>
+ <string name="download_path_unavailable_dlg_title">Download Directory is Unavailable</string>
<string name="download_path_unavailable_dlg_msg">Please modify the Download Directory of Browser</string>
- <string name="activity_not_found">Activity Not Found to Handle Intent <xliff:g id="NOACTIVITY">%s</xliff:g>.</string>
+ <string name="activity_not_found">Can\'t Find the Activity to Handle this Intent <xliff:g id="NOACTIVITY">%s</xliff:g>.</string>
<string name="network_switch_remind_type">wifi_browser_interaction_remind</string>
<!-- Toast message displayed when the full screen received message -->
<string name="received_message_full_screen">Receive a message from: <xliff:g id="FROM">%s</xliff:g>.</string>
diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java
index e3d31cd..15167a0 100644
--- a/src/com/android/browser/DownloadHandler.java
+++ b/src/com/android/browser/DownloadHandler.java
@@ -56,18 +56,6 @@
private static String mExternalStorage;
private final static String INVALID_PATH = "/storage";
- /**
- * Notify the host application a download should be done, or that
- * the data should be streamed if a streaming viewer is available.
- * @param activity Activity requesting the download.
- * @param url The full url to the content that should be downloaded
- * @param userAgent User agent of the downloading application.
- * @param contentDisposition Content-disposition http header, if present.
- * @param mimetype The mimetype of the content reported by the server
- * @param referer The referer associated with the downloaded url
- * @param privateBrowsing If the request is coming from a private browsing tab.
- */
-
public static void startingDownload(Activity activity,
String url, String userAgent, String contentDisposition,
String mimetype, String referer, boolean privateBrowsing, long contentLength,
@@ -126,6 +114,18 @@
showStartDownloadToast(activity);
}
+ /**
+ * Notify the host application a download should be done, or that
+ * the data should be streamed if a streaming viewer is available.
+ * @param activity Activity requesting the download.
+ * @param url The full url to the content that should be downloaded
+ * @param userAgent User agent of the downloading application.
+ * @param contentDisposition Content-disposition http header, if present.
+ * @param mimetype The mimetype of the content reported by the server
+ * @param referer The referer associated with the downloaded url
+ * @param privateBrowsing If the request is coming from a private browsing tab.
+ */
+
public static boolean onDownloadStart(final Activity activity, final String url,
final String userAgent, final String contentDisposition, final String mimetype,
final String referer, final boolean privateBrowsing, final long contentLength) {
@@ -393,16 +393,13 @@
.show();
}
- public static boolean manageNoEnoughMemory(Activity mContext, long contentLength, String root) {
- Log.i(LOGTAG, "----------- download file contentLength is ------------>" + contentLength);
+ public static boolean manageNoEnoughMemory(long contentLength, String root) {
long mAvailableBytes = getAvailableMemory(root);
if (mAvailableBytes > 0) {
if (contentLength > mAvailableBytes) {
- showNoEnoughMemoryDialog(mContext);
return true;
}
} else {
- showNoEnoughMemoryDialog(mContext);
return true;
}
return false;
@@ -539,7 +536,7 @@
defaultStorage = getExternalStorageDirectory(context);
}
- defaultDownloadPath = defaultStorage + context.getString(R.string.default_savepath_name);
+ defaultDownloadPath = defaultStorage + context.getString(R.string.download_default_path);
Log.e(LOGTAG, "defaultStorage directory is : " + defaultDownloadPath);
return defaultDownloadPath;
}
diff --git a/src/com/android/browser/DownloadSettings.java b/src/com/android/browser/DownloadSettings.java
index c1ddcb6..aecb543 100644
--- a/src/com/android/browser/DownloadSettings.java
+++ b/src/com/android/browser/DownloadSettings.java
@@ -168,9 +168,10 @@
DownloadHandler.showNoEnoughMemoryDialog(DownloadSettings.this);
return;
}
- boolean isNoEnoughMemory = DownloadHandler.manageNoEnoughMemory(DownloadSettings.this,
- contentLength, downloadPath);
+ boolean isNoEnoughMemory = DownloadHandler.manageNoEnoughMemory(contentLength,
+ downloadPath);
if (isNoEnoughMemory) {
+ DownloadHandler.showNoEnoughMemoryDialog(DownloadSettings.this);
return;
}