Merge "Fix settings handling of wifi events"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ab9d975..4b2ccfe 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -967,19 +967,6 @@
</intent-filter>
</activity>
- <!-- NFC settings -->
- <activity android:name="Settings$NfcSharingSettingsActivity"
- android:label="@string/ndef_push_settings_title"
- android:clearTaskOnLaunch="true">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <action android:name="android.settings.NFCSHARING_SETTINGS" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.nfc.NdefPush" />
- </activity>
-
<!-- Accessibility tutorial -->
<activity android:name="AccessibilityTutorialActivity"
android:label="@string/accessibility_tutorial_title"
diff --git a/res/drawable-hdpi/tap1.png b/res/drawable-hdpi/tap1.png
deleted file mode 100644
index 2395c0f..0000000
--- a/res/drawable-hdpi/tap1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/tap2.png b/res/drawable-hdpi/tap2.png
deleted file mode 100644
index afaa243..0000000
--- a/res/drawable-hdpi/tap2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/tap3.png b/res/drawable-hdpi/tap3.png
deleted file mode 100644
index a6b530e..0000000
--- a/res/drawable-hdpi/tap3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/tap4.png b/res/drawable-hdpi/tap4.png
deleted file mode 100644
index b07d8a6..0000000
--- a/res/drawable-hdpi/tap4.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/tap5.png b/res/drawable-hdpi/tap5.png
deleted file mode 100644
index f1c8825..0000000
--- a/res/drawable-hdpi/tap5.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/tap6.png b/res/drawable-hdpi/tap6.png
deleted file mode 100644
index cc22a0b..0000000
--- a/res/drawable-hdpi/tap6.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/data_usage_sweep_background.xml b/res/drawable/data_usage_sweep_background.xml
new file mode 100644
index 0000000..86f1d09
--- /dev/null
+++ b/res/drawable/data_usage_sweep_background.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+
+ <item android:state_window_focused="false" android:drawable="@android:color/transparent" />
+
+ <item android:state_focused="true" android:state_enabled="false" android:drawable="@*android:drawable/list_selector_background_disabled" />
+ <item android:state_focused="true" android:drawable="@*android:drawable/list_selector_background_focused" />
+ <item android:drawable="@android:color/transparent" />
+
+</selector>
diff --git a/res/drawable/ndef_push_anim.xml b/res/drawable/ndef_push_anim.xml
deleted file mode 100644
index 6aa7d4f..0000000
--- a/res/drawable/ndef_push_anim.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<animation-list
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:oneshot="false">
- <item android:drawable="@drawable/tap1" android:duration="200" />
- <item android:drawable="@drawable/tap2" android:duration="200" />
- <item android:drawable="@drawable/tap3" android:duration="200" />
- <item android:drawable="@drawable/tap4" android:duration="200" />
- <item android:drawable="@drawable/tap5" android:duration="200" />
- <item android:drawable="@drawable/tap6" android:duration="600" />
-</animation-list>
diff --git a/res/layout/data_usage_bytes_editor.xml b/res/layout/data_usage_bytes_editor.xml
new file mode 100644
index 0000000..6207391b
--- /dev/null
+++ b/res/layout/data_usage_bytes_editor.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:gravity="center"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <NumberPicker
+ android:id="@+id/bytes"
+ android:layout_width="48dip"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:focusable="true"
+ android:focusableInTouchMode="true" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@*android:string/megabyteShort" />
+
+</LinearLayout>
diff --git a/res/layout/data_usage_chart.xml b/res/layout/data_usage_chart.xml
index a1a7ec4..38f1c11 100644
--- a/res/layout/data_usage_chart.xml
+++ b/res/layout/data_usage_chart.xml
@@ -59,6 +59,30 @@
settings:fillColorSecondary="#60ba7f3e" />
<com.android.settings.widget.ChartSweepView
+ android:id="@+id/sweep_warning"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:nextFocusUp="@+id/sweep_limit"
+ settings:sweepDrawable="@drawable/data_sweep_warning"
+ settings:followAxis="vertical"
+ settings:neighborMargin="5dip"
+ settings:labelSize="60dip"
+ settings:labelTemplate="@string/data_usage_sweep_warning"
+ settings:labelColor="#f7931d" />
+
+ <com.android.settings.widget.ChartSweepView
+ android:id="@+id/sweep_limit"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:nextFocusDown="@+id/sweep_warning"
+ settings:sweepDrawable="@drawable/data_sweep_limit"
+ settings:followAxis="vertical"
+ settings:neighborMargin="5dip"
+ settings:labelSize="60dip"
+ settings:labelTemplate="@string/data_usage_sweep_limit"
+ settings:labelColor="#c01a2c" />
+
+ <com.android.settings.widget.ChartSweepView
android:id="@+id/sweep_left"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -74,26 +98,4 @@
settings:followAxis="horizontal"
settings:neighborMargin="5dip" />
- <com.android.settings.widget.ChartSweepView
- android:id="@+id/sweep_warning"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- settings:sweepDrawable="@drawable/data_sweep_warning"
- settings:followAxis="vertical"
- settings:neighborMargin="5dip"
- settings:labelSize="60dip"
- settings:labelTemplate="@string/data_usage_sweep_warning"
- settings:labelColor="#f7931d" />
-
- <com.android.settings.widget.ChartSweepView
- android:id="@+id/sweep_limit"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- settings:sweepDrawable="@drawable/data_sweep_limit"
- settings:followAxis="vertical"
- settings:neighborMargin="5dip"
- settings:labelSize="60dip"
- settings:labelTemplate="@string/data_usage_sweep_limit"
- settings:labelColor="#c01a2c" />
-
</com.android.settings.widget.ChartDataUsageView>
diff --git a/res/layout/ndefpush.xml b/res/layout/ndefpush.xml
deleted file mode 100644
index 6892850..0000000
--- a/res/layout/ndefpush.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:paddingLeft="6dip"
- android:paddingRight="6dip"
- android:layout_width="match_parent" android:layout_height="wrap_content"
- android:scrollbars="vertical" >
-
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fillViewport="true">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <TextView android:id="@+id/ndef_push_explained"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="20dip"
- android:gravity="top"
- android:text="@string/ndef_push_explained"
- />
- <ImageView android:id="@+id/ndef_push_image"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- />
- <TextView android:id="@+id/ndef_push_safety"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="20dip"
- android:gravity="top"
- android:text="@string/ndef_push_top"
- />
- </LinearLayout>
-
- </ScrollView>
-
-</LinearLayout>
-
diff --git a/res/layout/ownerinfo.xml b/res/layout/ownerinfo.xml
index 14cdbcb..1001a21 100644
--- a/res/layout/ownerinfo.xml
+++ b/res/layout/ownerinfo.xml
@@ -61,6 +61,7 @@
android:hint="@string/owner_info_settings_edit_text_hint"
android:lines="8"
android:maxLines="8"
+ android:inputType="textNoSuggestions|textMultiLine"
/>
</LinearLayout>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 1c6bc24..44db767 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -146,21 +146,15 @@
</string-array>
<string-array name="entries_font_size">
- <item>Extremely Small</item>
- <item>Extra Small</item>
- <item>Small</item>
- <item>Normal</item>
- <item>Large</item>
- <item>Extra Large</item>
- <item>Extremely Large</item>
+ <item msgid="6490061470416867723">Small</item>
+ <item msgid="3579015730662088893">Normal</item>
+ <item msgid="1678068858001018666">Large</item>
+ <item msgid="490158884605093126">Extra Large</item>
</string-array>
<string-array name="entryvalues_font_size" translatable="false">
- <item>0.70</item>
<item>0.85</item>
- <item>0.95</item>
<item>1.0</item>
- <item>1.05</item>
<item>1.15</item>
<item>1.30</item>
</string-array>
@@ -526,6 +520,22 @@
<item>IPV4V6</item>
</string-array>
+ <!-- Bearer Info used in APN editor -->
+ <string-array name="bearer_entries">
+ <item>LTE</item>
+ <item>eHRPD</item>
+ <item>Unspecified</item>
+ </string-array>
+
+ <string-array translatable="false" name="bearer_values">
+ <!-- Do not translate. -->
+ <item>14</item>
+ <!-- Do not translate. -->
+ <item>13</item>
+ <!-- Do not translate. -->
+ <item>0</item>
+ </string-array>
+
<!-- Apps on SD instalaltion location options in ApplicationSettings -->
<string-array name="app_install_location_entries">
<item>Internal device storage</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c59ba49..863d66c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1110,15 +1110,6 @@
<!-- NFC settings -->
<!-- Used in the 1st-level settings screen to turn on NFC -->
<string name="nfc_quick_toggle_title">NFC</string>
- <!-- Used to enter the NdefPush sharing preferences screen -->
- <string name="ndef_push_settings_title">ShareTap</string>
- <string name="ndef_push_settings_summary"></string>
- <string name="ndef_push_on_summary">On</string>
- <string name="ndef_push_off_summary">Off</string>
- <!-- Used in the NdefPush sharing preferences screen -->
- <string name="ndef_push_label">ShareTap</string>
- <string name="ndef_push_explained">Share content by touching two NFC-enabled devices back to back.</string>
- <string name="ndef_push_top">The app on the top device\'s screen sends content to the bottom device.\n\nYour data is safe: nothing is shared unless both devices are on and unlocked.\n\nYou can turn this feature off in Settings > More > ShareTap.</string>
<!-- Wi-Fi Settings --> <skip />
<!-- Used in the 1st-level settings screen to turn on Wi-Fi -->
<string name="wifi_quick_toggle_title">Wi-Fi</string>
@@ -1548,10 +1539,8 @@
<!-- Sound settings screen, setting option summary text when check box is clear -->
<string name="dock_sounds_enable_summary_off" product="default">Don\'t play sound when inserting or removing phone from dock</string>
- <!-- Acounts & Sync settings screen setting option name to go into the screen for data sync settings-->
+ <!-- Acounts & Sync settings screen setting title. This screen will list the different accounts (mail, gmail...) used on that phone and their sync settings -->
<string name="sync_settings">Accounts & sync</string>
- <!-- Main Settings screen setting option summary text for the itme to go into the screen with data sync settings-->
- <string name="sync_settings_summary">Add or remove accounts and change account settings</string>
<!-- Main Settings screen, setting option name to go into search settings -->
<string name="search_settings">Search</string>
@@ -1883,6 +1872,12 @@
<string name="apn_type">APN type</string>
<!-- Edit access point labels: The protocol of the APN, e.g., "IPv4", "IPv6", or "IPv4/IPv6". -->
<string name="apn_protocol">APN protocol</string>
+ <!-- Edit enable/disable of APN -->
+ <string name="carrier_enabled">APN Enable/Disable</string>
+ <string name="carrier_enabled_summaryOn">APN Enabled</string>
+ <string name="carrier_enabled_summaryOff">APN Disabled</string>
+ <!-- Edit Beaerer Info of APN -->
+ <string name="bearer">Bearer</string>
<!-- Edit access point screen menu option to delete this APN -->
<string name="menu_delete">Delete APN</string>
<!-- APNs screen menu option to create a brand spanking new APN -->
@@ -2048,9 +2043,9 @@
<!-- Security & location settings screen, section header for settings relating to location -->
<string name="location_title">My Location</string>
<!-- [CHAR LIMIT=30] Security & location settings screen, setting check box label for Google location service (cell ID, wifi, etc.) -->
- <string name="location_network_based">Google location service</string>
+ <string name="location_network_based">Google\'s location service</string>
<!-- [CHAR LIMIT=100] Security & location settings screen, setting summary for Google location service check box-->
- <string name="location_neighborhood_level">Let apps use Wi-Fi and mobile networks to determine your approximate location</string>
+ <string name="location_neighborhood_level">Let apps use data from sources such as Wi-Fi and mobile networks to determine your approximate location</string>
<!-- Security & location settings screen, setting summary when Use wireless networks check box is selected, for wifi-only devices [CHAR LIMIT=100] -->
<string name="location_neighborhood_level_wifi">Location determined by Wi-Fi</string>
<!-- [CHAR LIMIT=30] Security & location settings screen, setting check box label for GPS satellites -->
@@ -2741,10 +2736,16 @@
<xliff:g id="service" example="TalkBack">%1$s</xliff:g>?</string>
<!-- Summary for a warning message about security implications of enabling an accessibility service,
displayed as a dialog message when the user selects to enable an accessibility service (tablet). [CHAR LIMIT=NONE] -->
- <string name="accessibility_service_security_warning_summary">
+ <string name="accessibility_service_security_warning_summary" product="tablet">
<xliff:g id="accessibility_service_name">%1$s</xliff:g> can
collect all of the text you type, except passwords. This includes personal data such as credit card
- numbers. It can also collect data about your interactions with the device.</string>
+ numbers. It can also collect data about your interactions with the tablet.</string>
+ <!-- Summary for a warning message about security implications of enabling an accessibility service,
+ displayed as a dialog message when the user selects to enable an accessibility service (phone). [CHAR LIMIT=NONE] -->
+ <string name="accessibility_service_security_warning_summary" product="default">
+ <xliff:g id="accessibility_service_name">%1$s</xliff:g> can
+ collect all of the text you type, except passwords. This includes personal data such as credit card
+ numbers. It can also collect data about your interactions with the phone.</string>
<!-- Title for a warning about disabling an accessibility service displayed as a dialog message when the user
selects to disable that service. This avoids accidental disabling. [CHAR LIMIT=NONE] -->
@@ -2755,16 +2756,20 @@
<string name="accessibility_service_disable_warning_summary">Touching OK will
stop <xliff:g id="service" example="TalkBack">%1$s</xliff:g>.</string>
+ <!-- Title for the prompt shown as a placeholder if no accessibility serivices are installed. [CHAR LIMIT=50] -->
+ <string name="accessibility_no_services_installed">No services installed</string>
+
<!-- Title for the prompt that lets users know that they have no accessibility related apps
installed and that they can install TalkBack from Market. [CHAR LIMIT=50] -->
- <string name="accessibility_service_no_apps_title">No accessibility applications</string>
+ <string name="accessibility_service_no_apps_title">Need a screen reader?</string>
<!-- Message for the prompt that lets users know that they have no accessibility related apps
installed and that they can install TalkBack from Market. [CHAR LIMIT=NONE] -->
- <string name="accessibility_service_no_apps_message">You don\'t have accessibility
- applications installed. Do you want to download a screen reader from the Android Market?</string>
+ <string name="accessibility_service_no_apps_message">TalkBack provides spoken feedback to
+ help blind and low-vision users. Do you want to install it for free from Android
+ Market?</string>
<!-- Title for a warning about downloading accessibility scripts displayed as a dialog message
- when the user selects to enable script downloading. [CHAR LIMIT=40] -->
+ when the user selects to enable script downloading. [CHAR LIMIT=50] -->
<string name="accessibility_script_injection_security_warning_title">Install accessibility scripts?</string>
<!-- Warning message about security implications of downloading accessibility scripts,
displayed as a dialog message when the user selects to enable script downloading. [CHAR LIMIT=NONE] -->
@@ -2774,10 +2779,8 @@
<!-- Warning message that the interaction model changes on enabling touch exploration. [CHAR LIMIT=NONE] -->
<string name="accessibility_touch_exploration_warning">This feature changes the
way your device responds to touch. Turn on?</string>
- <!-- Default description for an accessiiblity serivice if the latter doesn't provide one. [CHAR LIMIT=NONE] -->
- <string name="accessibility_service_default_description">This accessibility service has no
- description.\n\nAccessibility services provide various types of feedback when you interact
- with the device. </string>
+ <!-- Default description for an accessibility serivice if the latter doesn't provide one. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_service_default_description">No description provided.</string>
<!-- Accessibility settings: button for lauching settings for an accessibility service -->
<string name="settings_button">Settings</string>
@@ -2792,7 +2795,7 @@
<!-- Message to show when battery usage data is not available [CHAR LIMIT=30] -->
<string name="power_usage_not_available">Battery usage data not available</string>
<!-- Display the battery level and status [CHAR_LIMIT=30] -->
- <string name="power_usage_level_and_status">Battery level <xliff:g id="level">%1$s</xliff:g> - <xliff:g id="status">%2$s</xliff:g></string>
+ <string name="power_usage_level_and_status"><xliff:g id="level">%1$s</xliff:g> - <xliff:g id="status">%2$s</xliff:g></string>
<!-- Battery usage since unplugged -->
<string name="battery_since_unplugged">Battery use since unplugged</string>
<!-- Battery usage since user reset the stats -->
@@ -3296,9 +3299,6 @@
<string name="sync_is_failing">Sync is currently experiencing problems. It will be back shortly.</string>
<!-- Button label to add an account [CHAR LIMIT=20] -->
<string name="add_account_label">Add account</string>
- <!-- Header title for those settings relating to general syncing.
- [CHAR LIMIT=30] -->
- <string name="header_general_sync_settings">General sync settings</string>
<!-- Data synchronization settings screen, title of setting that controls whether background data should be used [CHAR LIMIT=30] -->
<string name="background_data">Background data</string>
<!-- Data synchronization settings screen, summary of setting that controls whether background data should be used [CHAR LIMIT=60] -->
@@ -3307,13 +3307,8 @@
<string name="background_data_dialog_title">Attention</string>
<!-- Data synchronization settings screen, message of dialog that confirms the user's unchecking of background data [CHAR LIMIT=200] -->
<string name="background_data_dialog_message">Disabling background data extends battery life and lowers data use. Some applications may still use the background data connection.</string>
- <!-- Data synchronization settings screen, setting option name
- [CHAR LIMIT=30] -->
- <string name="sync_automatically">Auto-sync</string>
- <!-- Data synchronization settings screen, setting option summary text when check box is selected [CHAR LIMIT=60] -->
- <string name="sync_automatically_summary">Applications sync data automatically</string>
- <!-- Header title for list of accounts on Accounts & Synchronization settings [CHAR LIMIT=30] -->
- <string name="header_manage_accounts">Manage accounts</string>
+ <!-- Title for a checkbox that enables data synchronization in the account and sync screen [CHAR LIMIT=35] -->
+ <string name="sync_automatically">Auto-sync app data</string>
<!-- Sync status messages on Accounts & Synchronization settings --><skip />
<!-- Sync status shown when sync is enabled [CHAR LIMIT=20] -->
@@ -3526,6 +3521,8 @@
<string name="data_usage_app_restrict_dialog_title">Restrict background data?</string>
<!-- Body of dialog shown when user restricts background data usage of a specific application. [CHAR LIMIT=NONE] -->
<string name="data_usage_app_restrict_dialog">This feature may negatively impact applications which depend on background data usage.\n\nMore appropriate data usage controls may be found within this application\'s settings.</string>
+ <!-- Body of dialog shown when user attempts to restrict background data before a network data limit has been set. [CHAR LIMIT=NONE] -->
+ <string name="data_usage_restrict_denied_dialog">Restricting background data is only available when you\'ve set a network data limit.</string>
<!-- Title of dialog for editing data usage cycle reset date. [CHAR LIMIT=48] -->
<string name="data_usage_cycle_editor_title">Usage cycle reset date</string>
@@ -3534,6 +3531,11 @@
<!-- Positive button title for data usage cycle editor, confirming that changes should be saved. [CHAR LIMIT=32] -->
<string name="data_usage_cycle_editor_positive">Set</string>
+ <!-- Title of dialog for editing data usage warning in bytes. [CHAR LIMIT=48] -->
+ <string name="data_usage_warning_editor_title">Set data usage warning</string>
+ <!-- Title of dialog for editing data usage limit in bytes. [CHAR LIMIT=48] -->
+ <string name="data_usage_limit_editor_title">Set data usage limit</string>
+
<!-- Title of dialog shown before user limits data usage. [CHAR LIMIT=48] -->
<string name="data_usage_limit_dialog_title">Limiting data usage</string>
<!-- Body of dialog shown before user limits mobile data usage. [CHAR LIMIT=NONE] -->
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index bd054ad..45f1dce 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -30,22 +30,26 @@
<CheckBoxPreference
android:key="toggle_large_text_preference"
android:title="@string/accessibility_toggle_large_text_title"
- android:persistent="false"/>
+ android:persistent="false"
+ android:order="1"/>
<CheckBoxPreference
android:key="toggle_power_button_ends_call_preference"
android:title="@string/accessibility_power_button_ends_call_title"
- android:persistent="false"/>
+ android:persistent="false"
+ android:order="2"/>
<CheckBoxPreference
android:key="toggle_auto_rotate_screen_preference"
android:title="@string/accelerometer_title"
- android:persistent="false"/>
+ android:persistent="false"
+ android:order="3"/>
<PreferenceScreen
android:key="toggle_touch_exploration_preference"
android:title="@string/accessibility_touch_exploration_title"
- android:fragment="com.android.settings.AccessibilitySettings$ToggleTouchExplorationFragment" >
+ android:fragment="com.android.settings.AccessibilitySettings$ToggleTouchExplorationFragment"
+ android:order="4" >
<extra android:name="title" android:value="@string/accessibility_touch_exploration_title" />
<extra android:name="summary" android:value="@string/accessibility_touch_exploration_summary" />
<extra android:name="enable_warning_title" android:value="@android:string/dialog_alert_title" />
@@ -58,7 +62,8 @@
android:title="@string/accessibility_long_press_timeout_title"
android:entries="@array/long_press_timeout_selector_titles"
android:entryValues="@array/long_press_timeout_selector_values"
- android:persistent="false"/>
+ android:persistent="false"
+ android:order="5"/>
<com.android.settings.AccessibilityEnableScriptInjectionPreference
android:key="toggle_script_injection_preference"
@@ -68,7 +73,8 @@
android:dialogMessage="@string/accessibility_script_injection_security_warning_summary"
android:positiveButtonText="@string/accessibility_script_injection_button_allow"
android:negativeButtonText="@string/accessibility_script_injection_button_disallow"
- android:persistent="false"/>
+ android:persistent="false"
+ android:order="6"/>
</PreferenceCategory>
diff --git a/res/xml/apn_editor.xml b/res/xml/apn_editor.xml
index f000dd0..e3ba934 100644
--- a/res/xml/apn_editor.xml
+++ b/res/xml/apn_editor.xml
@@ -121,4 +121,17 @@
android:entries="@array/apn_protocol_entries"
android:entryValues="@array/apn_protocol_values"
/>
+ <CheckBoxPreference
+ android:title="@string/carrier_enabled"
+ android:key="carrier_enabled"
+ android:enabled="false"
+ android:summaryOn="@string/carrier_enabled_summaryOn"
+ android:summaryOff="@@string/carrier_enabled_summaryOff"
+ />
+ <ListPreference
+ android:title="@string/bearer"
+ android:key="bearer"
+ android:entries="@array/bearer_entries"
+ android:entryValues="@array/bearer_values"
+ />
</PreferenceScreen>
diff --git a/res/xml/manage_accounts_settings.xml b/res/xml/manage_accounts_settings.xml
index ebb702a..0ec46b7 100644
--- a/res/xml/manage_accounts_settings.xml
+++ b/res/xml/manage_accounts_settings.xml
@@ -16,15 +16,4 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
- <PreferenceCategory
- android:title="@string/header_general_sync_settings" />
-
- <CheckBoxPreference android:key="syncAutomaticallyCheckBox"
- android:persistent="false"
- android:title="@string/sync_automatically"
- android:summary="@string/sync_automatically_summary"/>
-
- <PreferenceCategory android:key="manageAccountsCategory"
- android:title="@string/header_manage_accounts" />
-
</PreferenceScreen>
diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml
index 1e71863..7b361f2 100644
--- a/res/xml/wireless_settings.xml
+++ b/res/xml/wireless_settings.xml
@@ -38,13 +38,6 @@
android:title="@string/nfc_quick_toggle_title"
android:persistent="false" />
- <PreferenceScreen
- android:fragment="com.android.settings.nfc.NdefPush"
- android:key="ndef_push_settings"
- android:title="@string/ndef_push_settings_title"
- android:summary="@string/ndef_push_settings_summary" >
- </PreferenceScreen>
-
<CheckBoxPreference
android:key="toggle_wifi_p2p"
android:title="@string/wifi_p2p_settings_title"
diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java
index e87b3e8..3718ced 100644
--- a/src/com/android/settings/AccessibilitySettings.java
+++ b/src/com/android/settings/AccessibilitySettings.java
@@ -84,7 +84,7 @@
// the AccessibilityServiceInfo we need for proper presentation.
private static final long DELAY_UPDATE_SERVICES_PREFERENCES_MILLIS = 1000;
- private static final char ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR = ':';
+ private static final String ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR = ":";
private static final String KEY_ACCESSIBILITY_TUTORIAL_LAUNCHED_ONCE =
"key_accessibility_tutorial_launched_once";
@@ -126,7 +126,7 @@
// Auxiliary members.
private final SimpleStringSplitter mStringColonSplitter =
- new SimpleStringSplitter(ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR);
+ new SimpleStringSplitter(ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR.charAt(0));
private final Map<String, String> mLongPressTimeoutValuetoTitleMap =
new HashMap<String, String>();
@@ -153,6 +153,7 @@
private Preference mToggleTouchExplorationPreference;
private ListPreference mSelectLongPressTimeoutPreference;
private AccessibilityEnableScriptInjectionPreference mToggleScriptInjectionPreference;
+ private Preference mNoServicesMessagePreference;
private int mLongPressTimeoutDefault;
@@ -376,7 +377,7 @@
containerView.setGravity(Gravity.CENTER);
TextView summaryView = (TextView) view.findViewById(R.id.summary);
- String title = getString(R.string.accessibility_service_no_apps_title);
+ String title = getString(R.string.accessibility_no_services_installed);
summaryView.setText(title);
}
};
@@ -389,8 +390,6 @@
}
}
- private Preference mNoServicesMessagePreference;
-
private void updateSystemPreferences() {
// Large text.
try {
@@ -417,16 +416,22 @@
mToggleAutoRotateScreenPreference.setChecked(autoRotationEnabled);
// Touch exploration enabled.
- final boolean touchExplorationEnabled = (Settings.Secure.getInt(getContentResolver(),
- Settings.Secure.TOUCH_EXPLORATION_ENABLED, 0) == 1);
- if (touchExplorationEnabled) {
- mToggleTouchExplorationPreference.setSummary(
- getString(R.string.accessibility_service_state_on));
- mToggleTouchExplorationPreference.getExtras().putBoolean(EXTRA_CHECKED, true);
+ if (AccessibilityManager.getInstance(getActivity()).isEnabled()) {
+ mSystemsCategory.addPreference(mToggleTouchExplorationPreference);
+ final boolean touchExplorationEnabled = (Settings.Secure.getInt(getContentResolver(),
+ Settings.Secure.TOUCH_EXPLORATION_ENABLED, 0) == 1);
+ if (touchExplorationEnabled) {
+ mToggleTouchExplorationPreference.setSummary(
+ getString(R.string.accessibility_service_state_on));
+ mToggleTouchExplorationPreference.getExtras().putBoolean(EXTRA_CHECKED, true);
+ } else {
+ mToggleTouchExplorationPreference.setSummary(
+ getString(R.string.accessibility_service_state_off));
+ mToggleTouchExplorationPreference.getExtras().putBoolean(EXTRA_CHECKED, false);
+ }
+
} else {
- mToggleTouchExplorationPreference.setSummary(
- getString(R.string.accessibility_service_state_off));
- mToggleTouchExplorationPreference.getExtras().putBoolean(EXTRA_CHECKED, false);
+ mSystemsCategory.removePreference(mToggleTouchExplorationPreference);
}
// Long press timeout.
@@ -443,7 +448,8 @@
}
private void offerInstallAccessibilitySerivceOnce() {
- if (mServicesCategory.getPreferenceCount() > 0) {
+ // There is always one preference - if no services it is just a message.
+ if (mServicesCategory.getPreference(0) != mNoServicesMessagePreference) {
return;
}
SharedPreferences preferences = getActivity().getPreferences(Context.MODE_PRIVATE);
@@ -566,6 +572,11 @@
if (enabledServices == null) {
enabledServices = "";
}
+ // Due to a legacy bug we can get an enabled services value ending with a
+ // separator. Make sure to catch and fix that before handling.
+ if (enabledServices.endsWith(ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR)) {
+ enabledServices = enabledServices.substring(0, enabledServices.length() - 1);
+ }
final int length = enabledServices.length();
if (enabled) {
if (enabledServices.contains(preferenceKey)) {
@@ -578,7 +589,6 @@
// Enabling the first service enables accessibility.
Settings.Secure.putInt(getContentResolver(),
Settings.Secure.ACCESSIBILITY_ENABLED, 1);
-
} else if (length > 0) {
enabledServices += ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR + preferenceKey;
Settings.Secure.putString(getContentResolver(),
diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java
index 13b7aa5..751fd17 100644
--- a/src/com/android/settings/ApnEditor.java
+++ b/src/com/android/settings/ApnEditor.java
@@ -29,6 +29,7 @@
import android.os.SystemProperties;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
+import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.provider.Telephony;
@@ -50,6 +51,8 @@
private final static String SAVED_POS = "pos";
private final static String KEY_AUTH_TYPE = "auth_type";
private final static String KEY_PROTOCOL = "apn_protocol";
+ private final static String KEY_CARRIER_ENABLED = "carrier_enabled";
+ private final static String KEY_BEARER = "bearer";
private static final int MENU_DELETE = Menu.FIRST;
private static final int MENU_SAVE = Menu.FIRST + 1;
@@ -72,6 +75,8 @@
private ListPreference mAuthType;
private EditTextPreference mApnType;
private ListPreference mProtocol;
+ private CheckBoxPreference mCarrierEnabled;
+ private ListPreference mBearer;
private String mCurMnc;
private String mCurMcc;
@@ -103,6 +108,8 @@
Telephony.Carriers.AUTH_TYPE, // 14
Telephony.Carriers.TYPE, // 15
Telephony.Carriers.PROTOCOL, // 16
+ Telephony.Carriers.CARRIER_ENABLED, // 17
+ Telephony.Carriers.BEARER, // 18
};
private static final int ID_INDEX = 0;
@@ -121,6 +128,8 @@
private static final int AUTH_TYPE_INDEX = 14;
private static final int TYPE_INDEX = 15;
private static final int PROTOCOL_INDEX = 16;
+ private static final int CARRIER_ENABLED_INDEX = 17;
+ private static final int BEARER_INDEX = 18;
@Override
@@ -150,6 +159,11 @@
mProtocol = (ListPreference) findPreference(KEY_PROTOCOL);
mProtocol.setOnPreferenceChangeListener(this);
+ mCarrierEnabled = (CheckBoxPreference) findPreference(KEY_CARRIER_ENABLED);
+
+ mBearer = (ListPreference) findPreference(KEY_BEARER);
+ mBearer.setOnPreferenceChangeListener(this);
+
mRes = getResources();
final Intent intent = getIntent();
@@ -247,6 +261,8 @@
}
mProtocol.setValue(mCursor.getString(PROTOCOL_INDEX));
+ mCarrierEnabled.setChecked(mCursor.getInt(CARRIER_ENABLED_INDEX)==1);
+ mBearer.setValue(mCursor.getString(BEARER_INDEX));
}
mName.setSummary(checkNull(mName.getText()));
@@ -276,6 +292,8 @@
mProtocol.setSummary(
checkNull(protocolDescription(mProtocol.getValue())));
+ mBearer.setSummary(
+ checkNull(bearerDescription(mBearer.getValue())));
}
/**
@@ -297,6 +315,20 @@
}
}
+ private String bearerDescription(String raw) {
+ int mBearerIndex = mBearer.findIndexOfValue(raw);
+ if (mBearerIndex == -1) {
+ return null;
+ } else {
+ String[] values = mRes.getStringArray(R.array.bearer_entries);
+ try {
+ return values[mBearerIndex];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+ }
+
public boolean onPreferenceChange(Preference preference, Object newValue) {
String key = preference.getKey();
if (KEY_AUTH_TYPE.equals(key)) {
@@ -320,6 +352,16 @@
mProtocol.setSummary(protocol);
mProtocol.setValue((String) newValue);
}
+
+ if (KEY_BEARER.equals(key)) {
+ String bearer = bearerDescription((String) newValue);
+ if (bearer == null) {
+ return false;
+ }
+ mBearer.setValue((String) newValue);
+ mBearer.setSummary(bearer);
+ }
+
return true;
}
@@ -450,6 +492,11 @@
}
}
+ String bearerVal = mBearer.getValue();
+ if (bearerVal != null) {
+ values.put(Telephony.Carriers.BEARER, Integer.parseInt(bearerVal));
+ }
+
getContentResolver().update(mUri, values, null, null);
return true;
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index 5e44df3..0f95cc0 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -67,6 +67,11 @@
mKeyStore = KeyStore.getInstance();
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this.getActivity());
+ // Defaults to needing to confirm credentials
+ final boolean confirmCredentials = getActivity().getIntent()
+ .getBooleanExtra(CONFIRM_CREDENTIALS, true);
+ mPasswordConfirmed = !confirmCredentials;
+
if (savedInstanceState != null) {
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
}
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index 0e08075..bbc3606 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -20,6 +20,7 @@
import static android.net.ConnectivityManager.TYPE_MOBILE;
import static android.net.ConnectivityManager.TYPE_WIMAX;
import static android.net.NetworkPolicy.LIMIT_DISABLED;
+import static android.net.NetworkPolicy.WARNING_DISABLED;
import static android.net.NetworkPolicyManager.EXTRA_NETWORK_TEMPLATE;
import static android.net.NetworkPolicyManager.POLICY_NONE;
import static android.net.NetworkPolicyManager.POLICY_REJECT_METERED_BACKGROUND;
@@ -129,6 +130,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.List;
import java.util.Locale;
import libcore.util.Objects;
@@ -156,7 +158,10 @@
private static final String TAG_CONFIRM_DATA_ROAMING = "confirmDataRoaming";
private static final String TAG_CONFIRM_LIMIT = "confirmLimit";
private static final String TAG_CYCLE_EDITOR = "cycleEditor";
+ private static final String TAG_WARNING_EDITOR = "warningEditor";
+ private static final String TAG_LIMIT_EDITOR = "limitEditor";
private static final String TAG_CONFIRM_RESTRICT = "confirmRestrict";
+ private static final String TAG_DENIED_RESTRICT = "deniedRestrict";
private static final String TAG_CONFIRM_APP_RESTRICT = "confirmAppRestrict";
private static final String TAG_APP_DETAILS = "appDetails";
@@ -295,7 +300,10 @@
mTabHost.setOnTabChangedListener(mTabListener);
mHeader = (ViewGroup) inflater.inflate(R.layout.data_usage_header, mListView, false);
- mListView.addHeaderView(mHeader, null, false);
+ mHeader.setClickable(true);
+
+ mListView.addHeaderView(mHeader, null, true);
+ mListView.setItemsCanFocus(true);
if (mInsetSide > 0) {
// inset selector and divider drawables
@@ -316,7 +324,10 @@
mDisableAtLimit = new CheckBox(inflater.getContext());
mDisableAtLimit.setClickable(false);
+ mDisableAtLimit.setFocusable(false);
mDisableAtLimitView = inflatePreference(inflater, mNetworkSwitches, mDisableAtLimit);
+ mDisableAtLimitView.setClickable(true);
+ mDisableAtLimitView.setFocusable(true);
mDisableAtLimitView.setOnClickListener(mDisableAtLimitListener);
mNetworkSwitches.addView(mDisableAtLimitView);
}
@@ -346,7 +357,10 @@
mAppRestrict = new CheckBox(inflater.getContext());
mAppRestrict.setClickable(false);
+ mAppRestrict.setFocusable(false);
mAppRestrictView = inflatePreference(inflater, mAppSwitches, mAppRestrict);
+ mAppRestrictView.setClickable(true);
+ mAppRestrictView.setFocusable(true);
mAppRestrictView.setOnClickListener(mAppRestrictListener);
mAppSwitches.addView(mAppRestrictView);
}
@@ -456,7 +470,11 @@
case R.id.data_usage_menu_restrict_background: {
final boolean restrictBackground = !item.isChecked();
if (restrictBackground) {
- ConfirmRestrictFragment.show(this);
+ if (hasLimitedNetworks()) {
+ ConfirmRestrictFragment.show(this);
+ } else {
+ DeniedRestrictFragment.show(this);
+ }
} else {
// no confirmation to drop restriction
setRestrictBackground(false);
@@ -619,7 +637,6 @@
if (LOGD) Log.d(TAG, "updateBody() with currentTab=" + currentTab);
mDataEnabledView.setVisibility(View.VISIBLE);
- mDisableAtLimitView.setVisibility(View.VISIBLE);
if (TAB_MOBILE.equals(currentTab)) {
setPreferenceTitle(mDataEnabledView, R.string.data_usage_enable_mobile);
@@ -735,7 +752,7 @@
setPreferenceTitle(mAppRestrictView, R.string.data_usage_app_restrict_background);
setPreferenceSummary(mAppRestrictView,
getString(R.string.data_usage_app_restrict_background_summary,
- buildLimitedNetworksList()));
+ buildLimitedNetworksString()));
mAppRestrictView.setVisibility(View.VISIBLE);
mAppRestrict.setChecked(getAppRestrictBackground());
@@ -745,12 +762,6 @@
}
}
- private void setPolicyCycleDay(int cycleDay) {
- if (LOGD) Log.d(TAG, "setPolicyCycleDay()");
- mPolicyEditor.setPolicyCycleDay(mTemplate, cycleDay);
- updatePolicy(true);
- }
-
private void setPolicyWarningBytes(long warningBytes) {
if (LOGD) Log.d(TAG, "setPolicyWarningBytes()");
mPolicyEditor.setPolicyWarningBytes(mTemplate, warningBytes);
@@ -863,15 +874,8 @@
private void updatePolicy(boolean refreshCycle) {
if (isAppDetailMode()) {
mNetworkSwitches.setVisibility(View.GONE);
- // we fall through to update cycle list for detail mode
} else {
mNetworkSwitches.setVisibility(View.VISIBLE);
-
- // when heading back to summary without cycle refresh, kick details
- // update to repopulate list.
- if (!refreshCycle) {
- updateDetailData();
- }
}
// TODO: move enabled state directly into policy
@@ -907,6 +911,8 @@
* item, updating the inspection range on {@link #mChart}.
*/
private void updateCycleList(NetworkPolicy policy) {
+ // stash away currently selected cycle to try restoring below
+ final CycleItem previousItem = (CycleItem) mCycleSpinner.getSelectedItem();
mCycleAdapter.clear();
final Context context = mCycleSpinner.getContext();
@@ -954,8 +960,18 @@
// force pick the current cycle (first item)
if (mCycleAdapter.getCount() > 0) {
- mCycleSpinner.setSelection(0);
- mCycleListener.onItemSelected(mCycleSpinner, null, 0, 0);
+ final int position = mCycleAdapter.findNearestPosition(previousItem);
+ mCycleSpinner.setSelection(position);
+
+ // only force-update cycle when changed; skipping preserves any
+ // user-defined inspection region.
+ final CycleItem selectedItem = mCycleAdapter.getItem(position);
+ if (!Objects.equal(selectedItem, previousItem)) {
+ mCycleListener.onItemSelected(mCycleSpinner, null, position, 0);
+ } else {
+ // but still kick off loader for detailed list
+ updateDetailData();
+ }
} else {
updateDetailData();
}
@@ -1002,9 +1018,16 @@
final boolean restrictBackground = !mAppRestrict.isChecked();
if (restrictBackground) {
- // enabling restriction; show confirmation dialog which
- // eventually calls setRestrictBackground() once user confirms.
- ConfirmAppRestrictFragment.show(DataUsageSummary.this);
+ if (hasLimitedNetworks()) {
+ // enabling restriction; show confirmation dialog which
+ // eventually calls setRestrictBackground() once user
+ // confirms.
+ ConfirmAppRestrictFragment.show(DataUsageSummary.this);
+ } else {
+ // no limited networks; show dialog to guide user towards
+ // setting a network limit. doesn't mutate restrict state.
+ DeniedRestrictFragment.show(DataUsageSummary.this);
+ }
} else {
setAppRestrictBackground(false);
}
@@ -1211,13 +1234,22 @@
public void onLimitChanged() {
setPolicyLimitBytes(mChart.getLimitBytes());
}
- };
+ /** {@inheritDoc} */
+ public void requestWarningEdit() {
+ WarningEditorFragment.show(DataUsageSummary.this);
+ }
+
+ /** {@inheritDoc} */
+ public void requestLimitEdit() {
+ LimitEditorFragment.show(DataUsageSummary.this);
+ }
+ };
/**
* List item that reflects a specific data usage cycle.
*/
- public static class CycleItem {
+ public static class CycleItem implements Comparable<CycleItem> {
public CharSequence label;
public long start;
public long end;
@@ -1236,6 +1268,20 @@
public String toString() {
return label.toString();
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof CycleItem) {
+ final CycleItem another = (CycleItem) o;
+ return start == another.start && end == another.end;
+ }
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ public int compareTo(CycleItem another) {
+ return Long.compare(start, another.start);
+ }
}
private static final StringBuilder sBuilder = new StringBuilder(50);
@@ -1291,6 +1337,25 @@
add(mChangeItem);
}
}
+
+ /**
+ * Find position of {@link CycleItem} in this adapter which is nearest
+ * the given {@link CycleItem}.
+ */
+ public int findNearestPosition(CycleItem target) {
+ if (target != null) {
+ final int count = getCount();
+ for (int i = count - 1; i >= 0; i--) {
+ final CycleItem item = getItem(i);
+ if (item instanceof CycleChangeItem) {
+ continue;
+ } else if (item.compareTo(target) >= 0) {
+ return i;
+ }
+ }
+ }
+ return 0;
+ }
}
private static class AppUsageItem implements Comparable<AppUsageItem> {
@@ -1528,12 +1593,11 @@
* Dialog to edit {@link NetworkPolicy#cycleDay}.
*/
public static class CycleEditorFragment extends DialogFragment {
- private static final String EXTRA_CYCLE_DAY = "cycleDay";
+ private static final String EXTRA_TEMPLATE = "template";
public static void show(DataUsageSummary parent) {
- final NetworkPolicy policy = parent.mPolicyEditor.getPolicy(parent.mTemplate);
final Bundle args = new Bundle();
- args.putInt(CycleEditorFragment.EXTRA_CYCLE_DAY, policy.cycleDay);
+ args.putParcelable(EXTRA_TEMPLATE, parent.mTemplate);
final CycleEditorFragment dialog = new CycleEditorFragment();
dialog.setArguments(args);
@@ -1544,6 +1608,8 @@
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Context context = getActivity();
+ final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
+ final NetworkPolicyEditor editor = target.mPolicyEditor;
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
final LayoutInflater dialogInflater = LayoutInflater.from(builder.getContext());
@@ -1551,11 +1617,12 @@
final View view = dialogInflater.inflate(R.layout.data_usage_cycle_editor, null, false);
final NumberPicker cycleDayPicker = (NumberPicker) view.findViewById(R.id.cycle_day);
- final int oldCycleDay = getArguments().getInt(EXTRA_CYCLE_DAY, 1);
+ final NetworkTemplate template = getArguments().getParcelable(EXTRA_TEMPLATE);
+ final int cycleDay = editor.getPolicyCycleDay(template);
cycleDayPicker.setMinValue(1);
cycleDayPicker.setMaxValue(31);
- cycleDayPicker.setValue(oldCycleDay);
+ cycleDayPicker.setValue(cycleDay);
cycleDayPicker.setWrapSelectorWheel(true);
builder.setTitle(R.string.data_usage_cycle_editor_title);
@@ -1565,10 +1632,8 @@
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
final int cycleDay = cycleDayPicker.getValue();
- final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
- if (target != null) {
- target.setPolicyCycleDay(cycleDay);
- }
+ editor.setPolicyCycleDay(template, cycleDay);
+ target.updatePolicy(true);
}
});
@@ -1577,6 +1642,125 @@
}
/**
+ * Dialog to edit {@link NetworkPolicy#warningBytes}.
+ */
+ public static class WarningEditorFragment extends DialogFragment {
+ private static final String EXTRA_TEMPLATE = "template";
+
+ public static void show(DataUsageSummary parent) {
+ final Bundle args = new Bundle();
+ args.putParcelable(EXTRA_TEMPLATE, parent.mTemplate);
+
+ final WarningEditorFragment dialog = new WarningEditorFragment();
+ dialog.setArguments(args);
+ dialog.setTargetFragment(parent, 0);
+ dialog.show(parent.getFragmentManager(), TAG_WARNING_EDITOR);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final Context context = getActivity();
+ final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
+ final NetworkPolicyEditor editor = target.mPolicyEditor;
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ final LayoutInflater dialogInflater = LayoutInflater.from(builder.getContext());
+
+ final View view = dialogInflater.inflate(R.layout.data_usage_bytes_editor, null, false);
+ final NumberPicker bytesPicker = (NumberPicker) view.findViewById(R.id.bytes);
+
+ final NetworkTemplate template = getArguments().getParcelable(EXTRA_TEMPLATE);
+ final long warningBytes = editor.getPolicyWarningBytes(template);
+ final long limitBytes = editor.getPolicyLimitBytes(template);
+
+ bytesPicker.setMinValue(0);
+ if (limitBytes != LIMIT_DISABLED) {
+ bytesPicker.setMaxValue((int) (limitBytes / MB_IN_BYTES) - 1);
+ } else {
+ bytesPicker.setMaxValue(Integer.MAX_VALUE);
+ }
+ bytesPicker.setValue((int) (warningBytes / MB_IN_BYTES));
+ bytesPicker.setWrapSelectorWheel(false);
+
+ builder.setTitle(R.string.data_usage_warning_editor_title);
+ builder.setView(view);
+
+ builder.setPositiveButton(R.string.data_usage_cycle_editor_positive,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ // clear focus to finish pending text edits
+ bytesPicker.clearFocus();
+
+ final long bytes = bytesPicker.getValue() * MB_IN_BYTES;
+ editor.setPolicyWarningBytes(template, bytes);
+ target.updatePolicy(false);
+ }
+ });
+
+ return builder.create();
+ }
+ }
+
+ /**
+ * Dialog to edit {@link NetworkPolicy#limitBytes}.
+ */
+ public static class LimitEditorFragment extends DialogFragment {
+ private static final String EXTRA_TEMPLATE = "template";
+
+ public static void show(DataUsageSummary parent) {
+ final Bundle args = new Bundle();
+ args.putParcelable(EXTRA_TEMPLATE, parent.mTemplate);
+
+ final LimitEditorFragment dialog = new LimitEditorFragment();
+ dialog.setArguments(args);
+ dialog.setTargetFragment(parent, 0);
+ dialog.show(parent.getFragmentManager(), TAG_LIMIT_EDITOR);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final Context context = getActivity();
+ final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
+ final NetworkPolicyEditor editor = target.mPolicyEditor;
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ final LayoutInflater dialogInflater = LayoutInflater.from(builder.getContext());
+
+ final View view = dialogInflater.inflate(R.layout.data_usage_bytes_editor, null, false);
+ final NumberPicker bytesPicker = (NumberPicker) view.findViewById(R.id.bytes);
+
+ final NetworkTemplate template = getArguments().getParcelable(EXTRA_TEMPLATE);
+ final long warningBytes = editor.getPolicyWarningBytes(template);
+ final long limitBytes = editor.getPolicyLimitBytes(template);
+
+ bytesPicker.setMaxValue(Integer.MAX_VALUE);
+ if (warningBytes != WARNING_DISABLED) {
+ bytesPicker.setMinValue((int) (warningBytes / MB_IN_BYTES) + 1);
+ } else {
+ bytesPicker.setMinValue(0);
+ }
+ bytesPicker.setValue((int) (limitBytes / MB_IN_BYTES));
+ bytesPicker.setWrapSelectorWheel(false);
+
+ builder.setTitle(R.string.data_usage_limit_editor_title);
+ builder.setView(view);
+
+ builder.setPositiveButton(R.string.data_usage_cycle_editor_positive,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ // clear focus to finish pending text edits
+ bytesPicker.clearFocus();
+
+ final long bytes = bytesPicker.getValue() * MB_IN_BYTES;
+ editor.setPolicyLimitBytes(template, bytes);
+ target.updatePolicy(false);
+ }
+ });
+
+ return builder.create();
+ }
+ }
+ /**
* Dialog to request user confirmation before disabling data.
*/
public static class ConfirmDataDisableFragment extends DialogFragment {
@@ -1661,7 +1845,7 @@
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
if (target != null) {
- final CharSequence limitedNetworks = target.buildLimitedNetworksList();
+ final CharSequence limitedNetworks = target.buildLimitedNetworksString();
builder.setMessage(
getString(R.string.data_usage_restrict_background, limitedNetworks));
}
@@ -1681,6 +1865,31 @@
}
/**
+ * Dialog to inform user that {@link #POLICY_REJECT_METERED_BACKGROUND}
+ * change has been denied, usually based on
+ * {@link DataUsageSummary#hasLimitedNetworks()}.
+ */
+ public static class DeniedRestrictFragment extends DialogFragment {
+ public static void show(DataUsageSummary parent) {
+ final DeniedRestrictFragment dialog = new DeniedRestrictFragment();
+ dialog.setTargetFragment(parent, 0);
+ dialog.show(parent.getFragmentManager(), TAG_DENIED_RESTRICT);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final Context context = getActivity();
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setTitle(R.string.data_usage_app_restrict_background);
+ builder.setMessage(R.string.data_usage_restrict_denied_dialog);
+ builder.setPositiveButton(android.R.string.ok, null);
+
+ return builder.create();
+ }
+ }
+
+ /**
* Dialog to request user confirmation before setting
* {@link #POLICY_REJECT_METERED_BACKGROUND}.
*/
@@ -1879,10 +2088,32 @@
}
/**
+ * Test if any networks are currently limited.
+ */
+ private boolean hasLimitedNetworks() {
+ return !buildLimitedNetworksList().isEmpty();
+ }
+
+ /**
* Build string describing currently limited networks, which defines when
* background data is restricted.
*/
- private CharSequence buildLimitedNetworksList() {
+ private CharSequence buildLimitedNetworksString() {
+ final List<CharSequence> limited = buildLimitedNetworksList();
+
+ // handle case where no networks limited
+ if (limited.isEmpty()) {
+ limited.add(getText(R.string.data_usage_list_none));
+ }
+
+ return TextUtils.join(limited);
+ }
+
+ /**
+ * Build list of currently limited networks, which defines when background
+ * data is restricted.
+ */
+ private List<CharSequence> buildLimitedNetworksList() {
final Context context = getActivity();
final String subscriberId = getActiveSubscriberId(context);
@@ -1904,12 +2135,7 @@
limited.add(getText(R.string.data_usage_tab_ethernet));
}
- // handle case where no networks limited
- if (limited.isEmpty()) {
- limited.add(getText(R.string.data_usage_list_none));
- }
-
- return TextUtils.join(limited);
+ return limited;
}
/**
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index 0f5a491..ccbc87a 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -43,7 +43,6 @@
private static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane";
private static final String KEY_TOGGLE_NFC = "toggle_nfc";
- private static final String KEY_NDEF_PUSH_SETTINGS = "ndef_push_settings";
private static final String KEY_VPN_SETTINGS = "vpn_settings";
private static final String KEY_TOGGLE_WIFI_P2P = "toggle_wifi_p2p";
private static final String KEY_WIFI_P2P_SETTINGS = "wifi_p2p_settings";
@@ -101,12 +100,11 @@
final Activity activity = getActivity();
mAirplaneModePreference = (CheckBoxPreference) findPreference(KEY_TOGGLE_AIRPLANE);
CheckBoxPreference nfc = (CheckBoxPreference) findPreference(KEY_TOGGLE_NFC);
- PreferenceScreen ndefPush = (PreferenceScreen) findPreference(KEY_NDEF_PUSH_SETTINGS);
CheckBoxPreference wifiP2p = (CheckBoxPreference) findPreference(KEY_TOGGLE_WIFI_P2P);
mAirplaneModeEnabler = new AirplaneModeEnabler(activity, mAirplaneModePreference);
- mNfcEnabler = new NfcEnabler(activity, nfc, ndefPush);
+ mNfcEnabler = new NfcEnabler(activity, nfc);
String toggleable = Settings.System.getString(activity.getContentResolver(),
Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
@@ -124,14 +122,12 @@
// Manually set dependencies for NFC when not toggleable.
if (toggleable == null || !toggleable.contains(Settings.System.RADIO_NFC)) {
findPreference(KEY_TOGGLE_NFC).setDependency(KEY_TOGGLE_AIRPLANE);
- findPreference(KEY_NDEF_PUSH_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
}
// Remove NFC if its not available
mNfcAdapter = NfcAdapter.getDefaultAdapter(activity);
if (mNfcAdapter == null) {
getPreferenceScreen().removePreference(nfc);
- getPreferenceScreen().removePreference(ndefPush);
mNfcEnabler = null;
}
diff --git a/src/com/android/settings/accounts/ManageAccountsSettings.java b/src/com/android/settings/accounts/ManageAccountsSettings.java
index 4902d8a..0f52fe5 100644
--- a/src/com/android/settings/accounts/ManageAccountsSettings.java
+++ b/src/com/android/settings/accounts/ManageAccountsSettings.java
@@ -18,7 +18,6 @@
import android.accounts.Account;
import android.accounts.AccountManager;
-import android.accounts.AuthenticatorDescription;
import android.accounts.OnAccountsUpdateListener;
import android.app.Activity;
import android.content.ContentResolver;
@@ -28,10 +27,8 @@
import android.content.SyncStatusInfo;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
-import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.util.Log;
import android.view.LayoutInflater;
@@ -40,7 +37,6 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
import android.widget.TextView;
import com.android.settings.AccountPreference;
@@ -48,38 +44,22 @@
import com.android.settings.R;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
public class ManageAccountsSettings extends AccountPreferenceBase
implements OnAccountsUpdateListener, DialogCreatable {
- private static final String TAG = ManageAccountsSettings.class.getSimpleName();
-
- private static final String AUTHORITIES_FILTER_KEY = "authorities";
- private static final boolean LDEBUG = Log.isLoggable(TAG, Log.DEBUG);
-
- private static final String AUTO_SYNC_CHECKBOX_KEY = "syncAutomaticallyCheckBox";
- private static final String MANAGE_ACCOUNTS_CATEGORY_KEY = "manageAccountsCategory";
-
private static final int MENU_ADD_ACCOUNT = Menu.FIRST;
+ private static final int MENU_SYNC_APP = MENU_ADD_ACCOUNT + 1;
private static final int REQUEST_SHOW_SYNC_SETTINGS = 1;
- private PreferenceCategory mManageAccountsCategory;
private String[] mAuthorities;
private TextView mErrorInfoView;
- private Button mAddAccountButton;
- private CheckBoxPreference mAutoSyncCheckbox;
+ private MenuItem mSyncAppMenuItem;
private SettingsDialogFragment mDialogFragment;
- private AuthenticatorDescription[] mAuthDescs;
- private Map<String, AuthenticatorDescription> mTypeToAuthDescription
- = new HashMap<String, AuthenticatorDescription>();
- private HashMap<String, ArrayList<String>> mAccountTypeToAuthorities = null;
-
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -111,9 +91,6 @@
mErrorInfoView = (TextView)view.findViewById(R.id.sync_settings_error_info);
mErrorInfoView.setVisibility(View.GONE);
- mAutoSyncCheckbox = (CheckBoxPreference) findPreference(AUTO_SYNC_CHECKBOX_KEY);
-
- mManageAccountsCategory = (PreferenceCategory)findPreference(MANAGE_ACCOUNTS_CATEGORY_KEY);
mAuthorities = activity.getIntent().getStringArrayExtra(AUTHORITIES_FILTER_KEY);
updateAuthDescriptions();
@@ -127,10 +104,7 @@
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferences, Preference preference) {
- if (preference == mAutoSyncCheckbox) {
- ContentResolver.setMasterSyncAutomatically(mAutoSyncCheckbox.isChecked());
- onSyncStateUpdated();
- } else if (preference instanceof AccountPreference) {
+ if (preference instanceof AccountPreference) {
startAccountSettings((AccountPreference) preference);
} else {
return false;
@@ -158,17 +132,25 @@
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- MenuItem actionItem =
- menu.add(0, MENU_ADD_ACCOUNT, 0, R.string.add_account_label);
- actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
+ MenuItem addAccountItem = menu.add(0, MENU_ADD_ACCOUNT, 0, R.string.add_account_label);
+ addAccountItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+ mSyncAppMenuItem = menu.add(0, MENU_SYNC_APP, 0, R.string.sync_automatically).
+ setCheckable(true).setChecked(ContentResolver.getMasterSyncAutomatically());
+ mSyncAppMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- if (item.getItemId() == MENU_ADD_ACCOUNT) {
+ final int itemId = item.getItemId();
+ if (itemId == MENU_ADD_ACCOUNT) {
onAddAccountClicked();
return true;
+ } else if (itemId == MENU_SYNC_APP) {
+ // Use the opposite, the checked state has not yet been changed
+ ContentResolver.setMasterSyncAutomatically(!item.isChecked());
+ onSyncStateUpdated();
+ return true;
} else {
return super.onOptionsItemSelected(item);
}
@@ -179,8 +161,9 @@
// Catch any delayed delivery of update messages
if (getActivity() == null) return;
// Set background connection state
- boolean masterSyncAutomatically = ContentResolver.getMasterSyncAutomatically();
- mAutoSyncCheckbox.setChecked(masterSyncAutomatically);
+ if (mSyncAppMenuItem != null) {
+ mSyncAppMenuItem.setChecked(ContentResolver.getMasterSyncAutomatically());
+ }
// iterate over all the preferences, setting the state properly for each
SyncInfo currentSync = ContentResolver.getCurrentSync();
@@ -196,8 +179,8 @@
userFacing.add(sa.authority);
}
}
- for (int i = 0, count = mManageAccountsCategory.getPreferenceCount(); i < count; i++) {
- Preference pref = mManageAccountsCategory.getPreference(i);
+ for (int i = 0, count = getPreferenceScreen().getPreferenceCount(); i < count; i++) {
+ Preference pref = getPreferenceScreen().getPreference(i);
if (! (pref instanceof AccountPreference)) {
continue;
}
@@ -211,7 +194,7 @@
for (String authority : authorities) {
SyncStatusInfo status = ContentResolver.getSyncStatus(account, authority);
boolean syncEnabled = ContentResolver.getSyncAutomatically(account, authority)
- && masterSyncAutomatically
+ && ContentResolver.getMasterSyncAutomatically()
&& (ContentResolver.getIsSyncable(account, authority) > 0);
boolean authorityIsPending = ContentResolver.isSyncPending(account, authority);
boolean activelySyncing = currentSync != null
@@ -251,7 +234,7 @@
@Override
public void onAccountsUpdated(Account[] accounts) {
if (getActivity() == null) return;
- mManageAccountsCategory.removeAll();
+ getPreferenceScreen().removeAll();
for (int i = 0, n = accounts.length; i < n; i++) {
final Account account = accounts[i];
final ArrayList<String> auths = getAuthoritiesForAccountType(account.type);
@@ -271,7 +254,7 @@
final Drawable icon = getDrawableForType(account.type);
final AccountPreference preference =
new AccountPreference(getActivity(), account, icon, auths);
- mManageAccountsCategory.addPreference(preference);
+ getPreferenceScreen().addPreference(preference);
}
}
onSyncStateUpdated();
@@ -280,8 +263,8 @@
@Override
protected void onAuthDescriptionsUpdated() {
// Update account icons for all account preference items
- for (int i = 0; i < mManageAccountsCategory.getPreferenceCount(); i++) {
- AccountPreference pref = (AccountPreference) mManageAccountsCategory.getPreference(i);
+ for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); i++) {
+ AccountPreference pref = (AccountPreference) getPreferenceScreen().getPreference(i);
pref.setProviderIcon(getDrawableForType(pref.getAccount().type));
pref.setSummary(getLabelForType(pref.getAccount().type));
}
diff --git a/src/com/android/settings/net/NetworkPolicyEditor.java b/src/com/android/settings/net/NetworkPolicyEditor.java
index bb5a2c3..5ba8ca4 100644
--- a/src/com/android/settings/net/NetworkPolicyEditor.java
+++ b/src/com/android/settings/net/NetworkPolicyEditor.java
@@ -149,6 +149,10 @@
template, cycleDay, WARNING_DISABLED, LIMIT_DISABLED, SNOOZE_NEVER);
}
+ public int getPolicyCycleDay(NetworkTemplate template) {
+ return getPolicy(template).cycleDay;
+ }
+
public void setPolicyCycleDay(NetworkTemplate template, int cycleDay) {
final NetworkPolicy policy = getOrCreatePolicy(template);
policy.cycleDay = cycleDay;
@@ -156,6 +160,10 @@
writeAsync();
}
+ public long getPolicyWarningBytes(NetworkTemplate template) {
+ return getPolicy(template).warningBytes;
+ }
+
public void setPolicyWarningBytes(NetworkTemplate template, long warningBytes) {
final NetworkPolicy policy = getOrCreatePolicy(template);
policy.warningBytes = warningBytes;
@@ -163,6 +171,10 @@
writeAsync();
}
+ public long getPolicyLimitBytes(NetworkTemplate template) {
+ return getPolicy(template).limitBytes;
+ }
+
public void setPolicyLimitBytes(NetworkTemplate template, long limitBytes) {
final NetworkPolicy policy = getOrCreatePolicy(template);
policy.limitBytes = limitBytes;
diff --git a/src/com/android/settings/nfc/NdefPush.java b/src/com/android/settings/nfc/NdefPush.java
deleted file mode 100644
index bbe3f32..0000000
--- a/src/com/android/settings/nfc/NdefPush.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.nfc;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.app.Fragment;
-import android.graphics.drawable.AnimationDrawable;
-import android.nfc.NfcAdapter;
-import android.os.Bundle;
-import android.os.Handler;
-import android.preference.PreferenceActivity;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.CompoundButton;
-import android.widget.ImageView;
-import android.widget.Switch;
-import com.android.settings.R;
-
-public class NdefPush extends Fragment
- implements CompoundButton.OnCheckedChangeListener {
- private View mView;
- private AnimationDrawable mAnimation;
- private ImageView mImageView;
- private NfcAdapter mNfcAdapter;
- private Switch mActionBarSwitch;
-
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Activity activity = getActivity();
-
- mActionBarSwitch = new Switch(activity);
-
- if (activity instanceof PreferenceActivity) {
- PreferenceActivity preferenceActivity = (PreferenceActivity) activity;
- if (preferenceActivity.onIsHidingHeaders() || !preferenceActivity.onIsMultiPane()) {
- final int padding = activity.getResources().getDimensionPixelSize(
- R.dimen.action_bar_switch_padding);
- mActionBarSwitch.setPadding(0, 0, padding, 0);
- activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
- ActionBar.DISPLAY_SHOW_CUSTOM);
- activity.getActionBar().setCustomView(mActionBarSwitch, new ActionBar.LayoutParams(
- ActionBar.LayoutParams.WRAP_CONTENT,
- ActionBar.LayoutParams.WRAP_CONTENT,
- Gravity.CENTER_VERTICAL | Gravity.RIGHT));
- activity.getActionBar().setTitle(R.string.ndef_push_settings_title);
- }
- }
-
- mActionBarSwitch.setOnCheckedChangeListener(this);
-
- mNfcAdapter = NfcAdapter.getDefaultAdapter(getActivity());
- mActionBarSwitch.setChecked(mNfcAdapter.isNdefPushEnabled());
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- mView = inflater.inflate(R.layout.ndefpush, container, false);
- initView(mView);
- return mView;
- }
-
- private void initView(View view) {
- mActionBarSwitch.setOnCheckedChangeListener(this);
- mActionBarSwitch.setChecked(mNfcAdapter.isNdefPushEnabled());
- }
-
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
-
- mImageView = (ImageView) getActivity().findViewById(R.id.ndef_push_image);
- mImageView.setBackgroundResource(R.drawable.ndef_push_anim);
- mAnimation = (AnimationDrawable) mImageView.getBackground();
-
- }
-
- @Override
- public void onPause() {
- super.onPause();
- mAnimation.stop();
- }
-
- @Override
- public void onResume() {
- super.onResume();
- // This is nasty: the animation can only be started once the fragment
- // is attached to the window, and there are no callbacks for that.
- mImageView.post(new Runnable() {
- public void run() {
- mAnimation.start();
- }
- });
- }
-
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean desiredState) {
- boolean success = false;
- mActionBarSwitch.setEnabled(false);
- if (desiredState) {
- success = mNfcAdapter.enableNdefPush();
- } else {
- success = mNfcAdapter.disableNdefPush();
- }
- if (success) {
- mActionBarSwitch.setChecked(desiredState);
- }
- mActionBarSwitch.setEnabled(true);
- }
-}
diff --git a/src/com/android/settings/nfc/NfcEnabler.java b/src/com/android/settings/nfc/NfcEnabler.java
index 9cf117d..c7a2d60 100644
--- a/src/com/android/settings/nfc/NfcEnabler.java
+++ b/src/com/android/settings/nfc/NfcEnabler.java
@@ -21,13 +21,8 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.nfc.NfcAdapter;
-import android.os.Handler;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import android.util.Log;
-
-import com.android.settings.R;
/**
* NfcEnabler is a helper to manage the Nfc on/off checkbox preference. It is
@@ -35,14 +30,10 @@
* current state.
*/
public class NfcEnabler implements Preference.OnPreferenceChangeListener {
- private static final String TAG = "NfcEnabler";
-
private final Context mContext;
private final CheckBoxPreference mCheckbox;
- private final PreferenceScreen mNdefPush;
private final NfcAdapter mNfcAdapter;
private final IntentFilter mIntentFilter;
- private final Handler mHandler = new Handler();
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
@@ -55,17 +46,14 @@
}
};
- public NfcEnabler(Context context, CheckBoxPreference checkBoxPreference,
- PreferenceScreen ndefPush) {
+ public NfcEnabler(Context context, CheckBoxPreference checkBoxPreference) {
mContext = context;
mCheckbox = checkBoxPreference;
- mNdefPush = ndefPush;
mNfcAdapter = NfcAdapter.getDefaultAdapter(context);
if (mNfcAdapter == null) {
// NFC is not supported
mCheckbox.setEnabled(false);
- mNdefPush.setEnabled(false);
mIntentFilter = null;
return;
}
@@ -109,28 +97,18 @@
case NfcAdapter.STATE_OFF:
mCheckbox.setChecked(false);
mCheckbox.setEnabled(true);
- mNdefPush.setEnabled(false);
- mNdefPush.setSummary(R.string.ndef_push_settings_summary);
break;
case NfcAdapter.STATE_ON:
mCheckbox.setChecked(true);
mCheckbox.setEnabled(true);
- mNdefPush.setEnabled(true);
- if (mNfcAdapter.isNdefPushEnabled()) {
- mNdefPush.setSummary(R.string.ndef_push_on_summary);
- } else {
- mNdefPush.setSummary(R.string.ndef_push_off_summary);
- }
break;
case NfcAdapter.STATE_TURNING_ON:
mCheckbox.setChecked(true);
mCheckbox.setEnabled(false);
- mNdefPush.setEnabled(false);
break;
case NfcAdapter.STATE_TURNING_OFF:
mCheckbox.setChecked(false);
mCheckbox.setEnabled(false);
- mNdefPush.setEnabled(false);
break;
}
}
diff --git a/src/com/android/settings/widget/ChartDataUsageView.java b/src/com/android/settings/widget/ChartDataUsageView.java
index e831cc1..43ce97c 100644
--- a/src/com/android/settings/widget/ChartDataUsageView.java
+++ b/src/com/android/settings/widget/ChartDataUsageView.java
@@ -69,6 +69,8 @@
public void onInspectRangeChanged();
public void onWarningChanged();
public void onLimitChanged();
+ public void requestWarningEdit();
+ public void requestLimitEdit();
}
private DataUsageChartListener mListener;
@@ -123,6 +125,15 @@
mSweepWarning.addOnSweepListener(mVertListener);
mSweepLimit.addOnSweepListener(mVertListener);
+ mSweepWarning.setDragInterval(5 * MB_IN_BYTES);
+ mSweepLimit.setDragInterval(5 * MB_IN_BYTES);
+
+ // TODO: make time sweeps adjustable through dpad
+ mSweepLeft.setClickable(false);
+ mSweepLeft.setFocusable(false);
+ mSweepRight.setClickable(false);
+ mSweepRight.setFocusable(false);
+
// tell everyone about our axis
mGrid.init(mHoriz, mVert);
mSeries.init(mHoriz, mVert);
@@ -276,6 +287,7 @@
}
private OnSweepListener mHorizListener = new OnSweepListener() {
+ /** {@inheritDoc} */
public void onSweep(ChartSweepView sweep, boolean sweepDone) {
updatePrimaryRange();
@@ -284,6 +296,11 @@
mListener.onInspectRangeChanged();
}
}
+
+ /** {@inheritDoc} */
+ public void requestEdit(ChartSweepView sweep) {
+ // ignored
+ }
};
private void sendUpdateAxisDelayed(ChartSweepView sweep, boolean force) {
@@ -298,6 +315,7 @@
}
private OnSweepListener mVertListener = new OnSweepListener() {
+ /** {@inheritDoc} */
public void onSweep(ChartSweepView sweep, boolean sweepDone) {
if (sweepDone) {
clearUpdateAxisDelayed(sweep);
@@ -313,6 +331,15 @@
sendUpdateAxisDelayed(sweep, false);
}
}
+
+ /** {@inheritDoc} */
+ public void requestEdit(ChartSweepView sweep) {
+ if (sweep == mSweepWarning && mListener != null) {
+ mListener.requestWarningEdit();
+ } else if (sweep == mSweepLimit && mListener != null) {
+ mListener.requestLimitEdit();
+ }
+ }
};
@Override
@@ -540,7 +567,7 @@
final CharSequence unit;
final long unitFactor;
- if (value <= 100 * MB_IN_BYTES) {
+ if (value < 1000 * MB_IN_BYTES) {
unit = res.getText(com.android.internal.R.string.megabyteShort);
unitFactor = MB_IN_BYTES;
} else {
@@ -551,6 +578,7 @@
final double result = (double) value / unitFactor;
final double resultRounded;
final CharSequence size;
+
if (result < 10) {
size = String.format("%.1f", result);
resultRounded = (unitFactor * Math.round(result * 10)) / 10;
diff --git a/src/com/android/settings/widget/ChartSweepView.java b/src/com/android/settings/widget/ChartSweepView.java
index 2190588..22a6478 100644
--- a/src/com/android/settings/widget/ChartSweepView.java
+++ b/src/com/android/settings/widget/ChartSweepView.java
@@ -83,11 +83,22 @@
public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1;
+ private int mTouchMode = MODE_NONE;
+
+ private static final int MODE_NONE = 0;
+ private static final int MODE_DRAG = 1;
+ private static final int MODE_LABEL = 2;
+
+ private long mDragInterval = 1;
+
public interface OnSweepListener {
public void onSweep(ChartSweepView sweep, boolean sweepDone);
+ public void requestEdit(ChartSweepView sweep);
}
private OnSweepListener mListener;
+
+ private float mTrackingStart;
private MotionEvent mTracking;
public ChartSweepView(Context context) {
@@ -112,15 +123,28 @@
setLabelTemplate(a.getResourceId(R.styleable.ChartSweepView_labelTemplate, 0));
setLabelColor(a.getColor(R.styleable.ChartSweepView_labelColor, Color.BLUE));
+ // TODO: moved focused state directly into assets
+ setBackgroundResource(R.drawable.data_usage_sweep_background);
+
mOutlinePaint.setColor(Color.RED);
mOutlinePaint.setStrokeWidth(1f);
mOutlinePaint.setStyle(Style.STROKE);
a.recycle();
+ setClickable(true);
+ setFocusable(true);
+ setOnClickListener(mClickListener);
+
setWillNotDraw(false);
}
+ private OnClickListener mClickListener = new OnClickListener() {
+ public void onClick(View v) {
+ dispatchRequestEdit();
+ }
+ };
+
void init(ChartAxis axis) {
mAxis = Preconditions.checkNotNull(axis, "missing axis");
}
@@ -133,6 +157,10 @@
return mMargins;
}
+ public void setDragInterval(long dragInterval) {
+ mDragInterval = dragInterval;
+ }
+
/**
* Return the number of pixels that the "target" area is inset from the
* {@link View} edge, along the current {@link #setFollowAxis(int)}.
@@ -159,9 +187,16 @@
}
}
+ private void dispatchRequestEdit() {
+ if (mListener != null) {
+ mListener.requestEdit(this);
+ }
+ }
+
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
+ setFocusable(enabled);
requestLayout();
}
@@ -232,6 +267,7 @@
private void invalidateLabel() {
if (mLabelTemplate != null && mAxis != null) {
mLabelValue = mAxis.buildLabel(getResources(), mLabelTemplate, mValue);
+ setContentDescription(mLabelTemplate);
invalidateLabelOffset();
invalidate();
} else {
@@ -369,11 +405,16 @@
case MotionEvent.ACTION_DOWN: {
// only start tracking when in sweet spot
- final boolean accept;
+ final boolean acceptDrag;
+ final boolean acceptLabel;
if (mFollowAxis == VERTICAL) {
- accept = event.getX() > getWidth() - (mSweepPadding.right * 8);
+ acceptDrag = event.getX() > getWidth() - (mSweepPadding.right * 8);
+ acceptLabel = mLabelLayout != null ? event.getX() < mLabelLayout.getWidth()
+ : false;
} else {
- accept = event.getY() > getHeight() - (mSweepPadding.bottom * 8);
+ acceptDrag = event.getY() > getHeight() - (mSweepPadding.bottom * 8);
+ acceptLabel = mLabelLayout != null ? event.getY() < mLabelLayout.getHeight()
+ : false;
}
final MotionEvent eventInParent = event.copy();
@@ -385,8 +426,14 @@
return false;
}
- if (accept) {
+ if (acceptDrag) {
+ if (mFollowAxis == VERTICAL) {
+ mTrackingStart = getTop() - mMargins.top;
+ } else {
+ mTrackingStart = getLeft() - mMargins.left;
+ }
mTracking = event.copy();
+ mTouchMode = MODE_DRAG;
// starting drag should activate entire chart
if (!parent.isActivated()) {
@@ -394,47 +441,68 @@
}
return true;
+ } else if (acceptLabel) {
+ mTouchMode = MODE_LABEL;
+ return true;
} else {
+ mTouchMode = MODE_NONE;
return false;
}
}
case MotionEvent.ACTION_MOVE: {
+ if (mTouchMode == MODE_LABEL) {
+ return true;
+ }
+
getParent().requestDisallowInterceptTouchEvent(true);
// content area of parent
final Rect parentContent = getParentContentRect();
final Rect clampRect = computeClampRect(parentContent);
+ if (clampRect.isEmpty()) return true;
+ long value;
if (mFollowAxis == VERTICAL) {
final float currentTargetY = getTop() - mMargins.top;
- final float requestedTargetY = currentTargetY
+ final float requestedTargetY = mTrackingStart
+ (event.getRawY() - mTracking.getRawY());
final float clampedTargetY = MathUtils.constrain(
requestedTargetY, clampRect.top, clampRect.bottom);
setTranslationY(clampedTargetY - currentTargetY);
- setValue(mAxis.convertToValue(clampedTargetY - parentContent.top));
+ value = mAxis.convertToValue(clampedTargetY - parentContent.top);
} else {
final float currentTargetX = getLeft() - mMargins.left;
- final float requestedTargetX = currentTargetX
+ final float requestedTargetX = mTrackingStart
+ (event.getRawX() - mTracking.getRawX());
final float clampedTargetX = MathUtils.constrain(
requestedTargetX, clampRect.left, clampRect.right);
setTranslationX(clampedTargetX - currentTargetX);
- setValue(mAxis.convertToValue(clampedTargetX - parentContent.left));
+ value = mAxis.convertToValue(clampedTargetX - parentContent.left);
}
+ // round value from drag to nearest increment
+ value -= value % mDragInterval;
+ setValue(value);
+
dispatchOnSweep(false);
return true;
}
case MotionEvent.ACTION_UP: {
- mTracking = null;
- mValue = mLabelValue;
- dispatchOnSweep(true);
- setTranslationX(0);
- setTranslationY(0);
- requestLayout();
+ if (mTouchMode == MODE_LABEL) {
+ performClick();
+ } else if (mTouchMode == MODE_DRAG) {
+ mTrackingStart = 0;
+ mTracking = null;
+ mValue = mLabelValue;
+ dispatchOnSweep(true);
+ setTranslationX(0);
+ setTranslationY(0);
+ requestLayout();
+ }
+
+ mTouchMode = MODE_NONE;
return true;
}
default: {
@@ -501,7 +569,9 @@
final Rect dynamicRect = buildClampRect(
parentContent, getValidAfterDynamic(), getValidBeforeDynamic(), mNeighborMargin);
- rect.intersect(dynamicRect);
+ if (!rect.intersect(dynamicRect)) {
+ rect.setEmpty();
+ }
return rect;
}
@@ -587,7 +657,7 @@
mContentOffset.bottom -= offset;
mMargins.bottom += offset;
} else {
- final int heightAfter = heightBefore * 3;
+ final int heightAfter = heightBefore * 2;
setMeasuredDimension(widthBefore, heightAfter);
mContentOffset.offset(0, (heightAfter - heightBefore) / 2);
@@ -608,13 +678,11 @@
@Override
protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
final int width = getWidth();
final int height = getHeight();
- if (DRAW_OUTLINE) {
- canvas.drawRect(0, 0, width, height, mOutlinePaint);
- }
-
final int labelSize;
if (isEnabled() && mLabelLayout != null) {
final int count = canvas.save();
@@ -637,6 +705,11 @@
}
mSweep.draw(canvas);
+
+ if (DRAW_OUTLINE) {
+ mOutlinePaint.setColor(Color.RED);
+ canvas.drawRect(0, 0, width, height, mOutlinePaint);
+ }
}
public static float getLabelTop(ChartSweepView view) {