Browser: add save path setting feature and full indicator
1. The saving path can be preseted,
both the internal storage and the SD card are supported
2. Reminder if the download file size exceed the available
memory.
CRs-fixed: 507953 507954
Change-Id: Ic2f807cb0ee2408cc6e4455a4c67bab5a0d01a8f
diff --git a/res/layout/download_settings.xml b/res/layout/download_settings.xml
new file mode 100644
index 0000000..ad47363
--- /dev/null
+++ b/res/layout/download_settings.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2013, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:divider="?android:attr/dividerHorizontal"
+ android:orientation="vertical"
+ android:showDividers="middle" >
+ <LinearLayout android:id="@+id/title_holder"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingLeft="5dip"
+ android:paddingRight="5dip"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ >
+ <TextView android:id="@+id/download_settings_title"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:gravity="center_vertical"
+ android:drawableLeft="@drawable/ic_bookmark_on_holo_dark"
+ android:text="@string/download_settings_title"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ </LinearLayout>
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1" >
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+ <TableLayout
+ android:id="@+id/download_table_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="20dip"
+ android:paddingRight="20dip"
+ android:paddingTop="10dip"
+ android:shrinkColumns="1"
+ android:stretchColumns="1" >
+
+ <TableRow android:layout_marginBottom="10dip" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1"
+ android:text="@string/download_edit_filename_label"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="18sp" >
+ </TextView>
+
+ <EditText
+ android:id="@+id/download_filename_edit"
+ android:layout_width="260dip"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1"
+ android:inputType="textCapSentences"
+ android:selectAllOnFocus="true"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="18sp" >
+ </EditText>
+ </TableRow>
+
+ <TableRow
+ android:layout_marginBottom="10dip" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1"
+ android:text="@string/download_filepath_label"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="18sp" >
+ </TextView>
+
+ <EditText
+ android:id="@+id/download_filepath_selected"
+ android:layout_width="260dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:editable="false"
+ android:ellipsize="end"
+ android:focusableInTouchMode="false"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@android:color/holo_blue_light"
+ android:textSize="18sp" >
+ </EditText>
+ </TableRow>
+
+ <TableRow
+ android:layout_marginBottom="10dip" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:text="@string/download_filesize"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="18sp" >
+ </TextView>
+ <TextView
+ android:id="@+id/download_estimate_size_content"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:text="@string/download_filesize"
+ android:paddingLeft="10dip"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="18sp" >
+ </TextView>
+ </TableRow>
+
+ <TableRow
+ android:layout_marginBottom="10dip" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:text="@string/download_timeneeded"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="18sp" >
+ </TextView>
+ <TextView
+ android:id="@+id/download_estimate_time_content"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:paddingLeft="10dip"
+ android:text="@string/download_timeneeded"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="18sp" >
+ </TextView>
+ </TableRow>
+ </TableLayout>
+ </ScrollView>
+ </FrameLayout>
+
+ <LinearLayout
+ style="?android:attr/buttonBarStyle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal" >
+
+ <Button
+ android:id="@+id/download_cancle"
+ style="?android:attr/buttonBarButtonStyle"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right"
+ android:layout_weight="1"
+ android:maxLines="1"
+ android:text="@string/download_cancel" />
+
+ <Button
+ android:id="@+id/download_start"
+ style="?android:attr/buttonBarButtonStyle"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_gravity="left"
+ android:layout_weight="1"
+ android:maxLines="1"
+ android:text="@string/download_start" />
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 84f117c..e3df6d7 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -432,4 +432,31 @@
<string name="save_to_bookmarks_title">保存书签</string>
<string name="duplicated_folder_warning">该文件夹已经存在</string>
<string name="overwrite_bookmark_msg">该书签的标签或者地址已经存在,是否覆盖?</string>
+
+ <!-- Add for download save path setting Feature -->
+ <string name="invalid_path">"无效路径!"</string>
+ <string name="path_wrong">"路径错误"</string>
+ <string name="pref_download_title">下载路径设置</string>
+ <string name="pref_download_path_setting_screen_title">自定义下载路径</string>
+ <string name="download_start">确定</string>
+ <string name="download_cancel">取消</string>
+ <string name="download_timeneeded">时间</string>
+ <string name="download_filesize">大小</string>
+ <string name="download_filepath_label">路径</string>
+ <string name="download_edit_filename_label">名称</string>
+ <string name="download_default_path">/Download</string>
+ <string name="download_no_enough_memory">存储空间不足</string>
+ <string name="download_settings_title">下载设置</string>
+ <string name="save_page_needs_title">文件名称不能为空!</string>
+ <string name="filename_empty_title">文件名为空</string>
+ <string name="filename_empty_msg">文件名不能为空,请重新输入!</string>
+ <string name="unknow_length">未知</string>
+ <string name="download_file_exist_msg">文件已经存在,请重新输入文件名!</string>
+ <string name="download_file_exist">文件已经存在</string>
+ <string name ="time_min">分钟</string>
+ <string name="download_path_phone_stroage_label">/内置存储器</string>
+ <string name="download_path_sd_card_label">/SD卡</string>
+ <string name="download_path_unavailable_dlg_title">浏览器的下载路径不可达</string>
+ <string name="download_path_unavailable_dlg_msg">请重新设置浏览器的下载路径</string>
+ <string name="activity_not_found">没有找到处理 Intent <xliff:g id="NOACTIVITY">%s</xliff:g> 的Activity.</string>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index cf8d0ab..2aa0ddb 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1046,4 +1046,33 @@
<string name="save_to_bookmarks_title">Save to Bookmarks</string>
<string name="duplicated_folder_warning">The folder has already exists</string>
<string name="overwrite_bookmark_msg">This bookmark\'s name or address already exists, overwrite it?</string>
+
+ <!-- Add for download save path setting Feature -->
+ <string name="invalid_path">"Path is invalid!"</string>
+ <string name="path_wrong">"Wrong Path"</string>
+ <string name="pref_download_title">Download Path Settings</string>
+ <string name="pref_download_path_setting_screen_title">Custom Download Path</string>
+ <string name="download_start">OK</string>
+ <string name="download_cancel">Cancel</string>
+ <string name="download_timeneeded">Time</string>
+ <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_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="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">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_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>
</resources>
diff --git a/res/xml/download_settings_preferences.xml b/res/xml/download_settings_preferences.xml
new file mode 100644
index 0000000..0cd99a9
--- /dev/null
+++ b/res/xml/download_settings_preferences.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2013, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <PreferenceCategory
+ android:title="@string/pref_download_title"
+ android:key="download_path_setting_category">
+ <PreferenceScreen
+ android:key="download_path_setting_screen"
+ android:title="@string/pref_download_path_setting_screen_title"/>
+
+ </PreferenceCategory>
+
+</PreferenceScreen>