diff options
author | Jake Hamby <jhamby@google.com> | 2012-11-29 14:14:10 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-11-29 14:14:10 -0800 |
commit | 0206284a661b3370a175bb8c28c005aa6b45d9d3 (patch) | |
tree | 3e090d6931b1e4e48e45f9b8206d9790bbe24b88 | |
parent | af6048010773606acf3a88df6954e1f7f3597a9f (diff) | |
parent | 95c1003f1c6ea957065fa752d89c9f64b599461c (diff) | |
download | packages_apps_Settings-0206284a661b3370a175bb8c28c005aa6b45d9d3.zip packages_apps_Settings-0206284a661b3370a175bb8c28c005aa6b45d9d3.tar.gz packages_apps_Settings-0206284a661b3370a175bb8c28c005aa6b45d9d3.tar.bz2 |
Merge "Fix Bluetooth enable dialog to match Android style guide." into jb-mr1.1-dev
6 files changed, 32 insertions, 70 deletions
diff --git a/res/layout/bluetooth_discoverable.xml b/res/layout/bluetooth_discoverable.xml deleted file mode 100644 index b3ddbb9..0000000 --- a/res/layout/bluetooth_discoverable.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2009, 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. -*/ ---> - -<ScrollView - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_height="match_parent" - android:layout_width="match_parent"> - - <TextView - android:id="@+id/message" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="20dip" - android:paddingEnd="20dip" - android:gravity="center_horizontal" - android:textAppearance="?android:attr/textAppearanceMedium" /> -</ScrollView> diff --git a/res/values/strings.xml b/res/values/strings.xml index 42ae4f0..e39b9eb 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -23,6 +23,12 @@ <!-- Strings for Dialog create button --> <string name="create">Create</string> + <!-- Strings for Dialog allow button --> + <string name="allow">Allow</string> + + <!-- Strings for Dialog deny button --> + <string name="deny">Deny</string> + <!-- Device Info --> <skip /> <!-- Device Info screen. Used for a status item's value when the proper value is not known --> <string name="device_info_default">Unknown</string> @@ -216,8 +222,6 @@ <!-- Used as setting title (for checkbox) on second screen after selecting Bluetooth settings --> <string name="bluetooth">Bluetooth</string> - <!-- Bluetooth settings screen, check box label when the Bluetooth device can be seen by others --> - <string name="bluetooth_visibility">Discoverable</string> <!-- Bluetooth settings screen, summary after selecting Discoverable check box [CHAR LIMIT=50] --> <string name="bluetooth_is_discoverable">Visible to all nearby Bluetooth devices (<xliff:g id="discoverable_time_period">%1$s</xliff:g>)</string> <!-- Bluetooth settings screen, summary when Discoverable duration is set to "forever" [CHAR LIMIT=50] --> @@ -226,12 +230,8 @@ <string name="bluetooth_not_visible_to_other_devices">Not visible to other Bluetooth devices</string> <!-- Bluetooth settings screen, summary text when not discoverable with paired devices [CHAR LIMIT=50] --> <string name="bluetooth_only_visible_to_paired_devices">Only visible to paired devices</string> - <!-- Bluetooth settings screen, Discoverable checkbox summary text --> - <string name="bluetooth_not_discoverable">Make device discoverable</string> <!-- Bluetooth settings screen, option name to pick discoverability timeout duration (a list dialog comes up) --> <string name="bluetooth_visibility_timeout">Visibility timeout</string> - <!-- Bluetooth settings screen, Discoverable timout list dialog summary text --> - <string name="bluetooth_visibility_timeout_summary">Set how long device will be discoverable</string> <!-- Bluetooth settings screen, check box label whether or not to allow bluetooth voice dialing when lock screen is up--> <string name="bluetooth_lock_voice_dialing">Lock voice dialing</string> @@ -303,29 +303,26 @@ <!-- Strings for BluetoothDevicePicker --> <string name="device_picker">Bluetooth device chooser</string> - <!-- Strings for dialog title when asking to the user whether to allow an app to enable discovery mode --> - <string name="bluetooth_permission_request">"Bluetooth permission request"</string> - <!-- Strings for asking to the user whether to allow an app to enable bluetooth --> - <string name="bluetooth_ask_enablement">"An app wants to turn on Bluetooth. Allow?"</string> + <string name="bluetooth_ask_enablement">An app wants to turn on Bluetooth.</string> <!-- Strings for asking to the user whether to allow an app to enable discovery mode --> - <string name="bluetooth_ask_discovery" product="tablet">"An app on your tablet wants to make your tablet discoverable by other Bluetooth devices for <xliff:g id="timeout">%1$d</xliff:g> seconds. Allow?"</string> + <string name="bluetooth_ask_discovery" product="tablet">An app wants to make your tablet visible to other Bluetooth devices for <xliff:g id="timeout">%1$d</xliff:g> seconds.</string> <!-- Strings for asking to the user whether to allow an app to enable discovery mode --> - <string name="bluetooth_ask_discovery" product="default">"An app on your phone wants to make your phone discoverable by other Bluetooth devices for <xliff:g id="timeout">%1$d</xliff:g> seconds. Allow?"</string> + <string name="bluetooth_ask_discovery" product="default">An app wants to make your phone visible to other Bluetooth devices for <xliff:g id="timeout">%1$d</xliff:g> seconds.</string> <!-- Strings for asking to the user whether to allow an app to enable lasting discovery mode --> - <string name="bluetooth_ask_lasting_discovery" product="tablet">"An app on your tablet wants to make your tablet \u201calways discoverable\u201d by other Bluetooth devices. Allow?"</string> - <string name="bluetooth_ask_lasting_discovery" product="default">"An app on your phone wants to make your phone \u201calways discoverable\u201d by other Bluetooth devices. Allow?"</string> + <string name="bluetooth_ask_lasting_discovery" product="tablet">An app wants to make your tablet visible to other Bluetooth devices. You can change this later in Bluetooth settings.</string> + <string name="bluetooth_ask_lasting_discovery" product="default">An app wants to make your phone visible to other Bluetooth devices. You can change this later in Bluetooth settings.</string> <!-- Strings for asking to the user whether to allow an app to enable bluetooth and discovery mode --> - <string name="bluetooth_ask_enablement_and_discovery" product="tablet">"An app on your tablet wants to turn on Bluetooth and make your tablet discoverable by other devices for <xliff:g id="timeout">%1$d</xliff:g> seconds. Allow?"</string> + <string name="bluetooth_ask_enablement_and_discovery" product="tablet">An app wants to turn on Bluetooth and make your tablet visible to other devices for <xliff:g id="timeout">%1$d</xliff:g> seconds.</string> <!-- Strings for asking to the user whether to allow an app to enable bluetooth and discovery mode --> - <string name="bluetooth_ask_enablement_and_discovery" product="default">"An app on your phone wants to turn on Bluetooth and make your phone discoverable by other devices for <xliff:g id="timeout">%1$d</xliff:g> seconds. Allow?"</string> + <string name="bluetooth_ask_enablement_and_discovery" product="default">An app wants to turn on Bluetooth and make your phone visible to other devices for <xliff:g id="timeout">%1$d</xliff:g> seconds.</string> <!-- Strings for asking to the user whether to allow an app to enable bluetooth and discovery mode --> - <string name="bluetooth_ask_enablement_and_lasting_discovery" product="tablet">"An app on your tablet wants to turn on Bluetooth and make your tablet discoverable by other devices. Allow?"</string> - <string name="bluetooth_ask_enablement_and_lasting_discovery" product="default">"An app on your phone wants to turn on Bluetooth and make your phone discoverable by other devices. Allow?"</string> + <string name="bluetooth_ask_enablement_and_lasting_discovery" product="tablet">An app wants to turn on Bluetooth and make your tablet visible to other devices. You can change this later in Bluetooth settings.</string> + <string name="bluetooth_ask_enablement_and_lasting_discovery" product="default">An app wants to turn on Bluetooth and make your phone visible to other devices. You can change this later in Bluetooth settings.</string> <!-- Strings for msg to display to user while bluetooth is turning on [CHAR LIMIT=60] --> <string name="bluetooth_turning_on">"Turning Bluetooth on\u2026"</string> diff --git a/src/com/android/settings/bluetooth/RequestPermissionActivity.java b/src/com/android/settings/bluetooth/RequestPermissionActivity.java index 08c10fb..9f266a5 100644 --- a/src/com/android/settings/bluetooth/RequestPermissionActivity.java +++ b/src/com/android/settings/bluetooth/RequestPermissionActivity.java @@ -149,8 +149,6 @@ public class RequestPermissionActivity extends Activity implements private void createDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setIcon(android.R.drawable.ic_dialog_info); - builder.setTitle(getString(R.string.bluetooth_permission_request)); if (mNeededToEnableBluetooth) { // RequestPermissionHelperActivity has gotten confirmation from user @@ -167,8 +165,8 @@ public class RequestPermissionActivity extends Activity implements builder.setMessage( getString(R.string.bluetooth_ask_discovery, mTimeout)); } - builder.setPositiveButton(getString(R.string.yes), this); - builder.setNegativeButton(getString(R.string.no), this); + builder.setPositiveButton(getString(R.string.allow), this); + builder.setNegativeButton(getString(R.string.deny), this); } mDialog = builder.create(); diff --git a/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java b/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java index 5c4b828..f108513 100644 --- a/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java +++ b/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java @@ -72,26 +72,20 @@ public class RequestPermissionHelperActivity extends AlertActivity implements void createDialog() { final AlertController.AlertParams p = mAlertParams; - p.mIconId = android.R.drawable.ic_dialog_info; - p.mTitle = getString(R.string.bluetooth_permission_request); - - View view = getLayoutInflater().inflate(R.layout.bluetooth_discoverable, null); - p.mView = view; - TextView tv = (TextView) view.findViewById(R.id.message); if (mEnableOnly) { - tv.setText(getString(R.string.bluetooth_ask_enablement)); + p.mMessage = getString(R.string.bluetooth_ask_enablement); } else { if (mTimeout == BluetoothDiscoverableEnabler.DISCOVERABLE_TIMEOUT_NEVER) { - tv.setText(getString(R.string.bluetooth_ask_enablement_and_lasting_discovery)); + p.mMessage = getString(R.string.bluetooth_ask_enablement_and_lasting_discovery); } else { - tv.setText(getString(R.string.bluetooth_ask_enablement_and_discovery, mTimeout)); + p.mMessage = getString(R.string.bluetooth_ask_enablement_and_discovery, mTimeout); } } - p.mPositiveButtonText = getString(R.string.yes); + p.mPositiveButtonText = getString(R.string.allow); p.mPositiveButtonListener = this; - p.mNegativeButtonText = getString(R.string.no); + p.mNegativeButtonText = getString(R.string.deny); p.mNegativeButtonListener = this; setupAlert(); diff --git a/tests/res/layout/bluetooth_request_permission_test.xml b/tests/res/layout/bluetooth_request_permission_test.xml index 0a5aec0..b62db19 100644 --- a/tests/res/layout/bluetooth_request_permission_test.xml +++ b/tests/res/layout/bluetooth_request_permission_test.xml @@ -32,19 +32,19 @@ style="@android:style/ButtonBar"> <Button android:id="@+id/enable" - android:layout_width="0dip" + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/enable" /> <Button android:id="@+id/discoverable" - android:layout_width="0dip" + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/discoverable" /> <Button android:id="@+id/scan" - android:layout_width="0dip" + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/start_scan" /> diff --git a/tests/src/com/android/settings/tests/BluetoothRequestPermissionTest.java b/tests/src/com/android/settings/tests/BluetoothRequestPermissionTest.java index 8064e3a..a2cdafe 100644 --- a/tests/src/com/android/settings/tests/BluetoothRequestPermissionTest.java +++ b/tests/src/com/android/settings/tests/BluetoothRequestPermissionTest.java @@ -36,6 +36,9 @@ public class BluetoothRequestPermissionTest extends Activity { BluetoothAdapter mAdapter; private ArrayAdapter<String> mMsgAdapter; + // Discoverable button alternates between 20 second timeout and no timeout. + private boolean mDiscoveryWithTimeout = true; + private class BtOnClickListener implements OnClickListener { final boolean mEnableOnly; // enable or enable + discoverable @@ -103,7 +106,10 @@ public class BluetoothRequestPermissionTest extends Activity { } else { addMsg("Starting activity to enable bt + discovery"); i.setAction(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); - i.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 20); + // Discoverability duration toggles between 20 seconds and no timeout. + int timeout = (mDiscoveryWithTimeout ? 20 : 0); + i.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, timeout); + mDiscoveryWithTimeout = !mDiscoveryWithTimeout; } startActivityForResult(i, 1); } |