Merge "Fix Bluetooth enable dialog to match Android style guide." into jb-mr1.1-dev
This commit is contained in:
@@ -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>
|
|
@@ -23,6 +23,12 @@
|
|||||||
<!-- Strings for Dialog create button -->
|
<!-- Strings for Dialog create button -->
|
||||||
<string name="create">Create</string>
|
<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 --> <skip />
|
||||||
<!-- Device Info screen. Used for a status item's value when the proper value is not known -->
|
<!-- Device Info screen. Used for a status item's value when the proper value is not known -->
|
||||||
<string name="device_info_default">Unknown</string>
|
<string name="device_info_default">Unknown</string>
|
||||||
@@ -216,8 +222,6 @@
|
|||||||
|
|
||||||
<!-- Used as setting title (for checkbox) on second screen after selecting Bluetooth settings -->
|
<!-- Used as setting title (for checkbox) on second screen after selecting Bluetooth settings -->
|
||||||
<string name="bluetooth">Bluetooth</string>
|
<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] -->
|
<!-- 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>
|
<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] -->
|
<!-- 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>
|
<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] -->
|
<!-- 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>
|
<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) -->
|
<!-- Bluetooth settings screen, option name to pick discoverability timeout duration (a list dialog comes up) -->
|
||||||
<string name="bluetooth_visibility_timeout">Visibility timeout</string>
|
<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 settings screen, check box label whether or not to allow
|
||||||
bluetooth voice dialing when lock screen is up-->
|
bluetooth voice dialing when lock screen is up-->
|
||||||
<string name="bluetooth_lock_voice_dialing">Lock voice dialing</string>
|
<string name="bluetooth_lock_voice_dialing">Lock voice dialing</string>
|
||||||
@@ -303,29 +303,26 @@
|
|||||||
<!-- Strings for BluetoothDevicePicker -->
|
<!-- Strings for BluetoothDevicePicker -->
|
||||||
<string name="device_picker">Bluetooth device chooser</string>
|
<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 -->
|
<!-- 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 -->
|
<!-- 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 -->
|
<!-- 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 -->
|
<!-- 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="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 on your phone wants to make your phone \u201calways discoverable\u201d by other Bluetooth devices. Allow?"</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 -->
|
<!-- 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 -->
|
<!-- 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 -->
|
<!-- 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="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 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="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] -->
|
<!-- 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>
|
<string name="bluetooth_turning_on">"Turning Bluetooth on\u2026"</string>
|
||||||
|
@@ -149,8 +149,6 @@ public class RequestPermissionActivity extends Activity implements
|
|||||||
|
|
||||||
private void createDialog() {
|
private void createDialog() {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
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) {
|
if (mNeededToEnableBluetooth) {
|
||||||
// RequestPermissionHelperActivity has gotten confirmation from user
|
// RequestPermissionHelperActivity has gotten confirmation from user
|
||||||
@@ -167,8 +165,8 @@ public class RequestPermissionActivity extends Activity implements
|
|||||||
builder.setMessage(
|
builder.setMessage(
|
||||||
getString(R.string.bluetooth_ask_discovery, mTimeout));
|
getString(R.string.bluetooth_ask_discovery, mTimeout));
|
||||||
}
|
}
|
||||||
builder.setPositiveButton(getString(R.string.yes), this);
|
builder.setPositiveButton(getString(R.string.allow), this);
|
||||||
builder.setNegativeButton(getString(R.string.no), this);
|
builder.setNegativeButton(getString(R.string.deny), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDialog = builder.create();
|
mDialog = builder.create();
|
||||||
|
@@ -72,26 +72,20 @@ public class RequestPermissionHelperActivity extends AlertActivity implements
|
|||||||
|
|
||||||
void createDialog() {
|
void createDialog() {
|
||||||
final AlertController.AlertParams p = mAlertParams;
|
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) {
|
if (mEnableOnly) {
|
||||||
tv.setText(getString(R.string.bluetooth_ask_enablement));
|
p.mMessage = getString(R.string.bluetooth_ask_enablement);
|
||||||
} else {
|
} else {
|
||||||
if (mTimeout == BluetoothDiscoverableEnabler.DISCOVERABLE_TIMEOUT_NEVER) {
|
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 {
|
} 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.mPositiveButtonListener = this;
|
||||||
p.mNegativeButtonText = getString(R.string.no);
|
p.mNegativeButtonText = getString(R.string.deny);
|
||||||
p.mNegativeButtonListener = this;
|
p.mNegativeButtonListener = this;
|
||||||
|
|
||||||
setupAlert();
|
setupAlert();
|
||||||
|
@@ -32,19 +32,19 @@
|
|||||||
style="@android:style/ButtonBar">
|
style="@android:style/ButtonBar">
|
||||||
|
|
||||||
<Button android:id="@+id/enable"
|
<Button android:id="@+id/enable"
|
||||||
android:layout_width="0dip"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/enable" />
|
android:text="@string/enable" />
|
||||||
|
|
||||||
<Button android:id="@+id/discoverable"
|
<Button android:id="@+id/discoverable"
|
||||||
android:layout_width="0dip"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/discoverable" />
|
android:text="@string/discoverable" />
|
||||||
|
|
||||||
<Button android:id="@+id/scan"
|
<Button android:id="@+id/scan"
|
||||||
android:layout_width="0dip"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/start_scan" />
|
android:text="@string/start_scan" />
|
||||||
|
@@ -36,6 +36,9 @@ public class BluetoothRequestPermissionTest extends Activity {
|
|||||||
BluetoothAdapter mAdapter;
|
BluetoothAdapter mAdapter;
|
||||||
private ArrayAdapter<String> mMsgAdapter;
|
private ArrayAdapter<String> mMsgAdapter;
|
||||||
|
|
||||||
|
// Discoverable button alternates between 20 second timeout and no timeout.
|
||||||
|
private boolean mDiscoveryWithTimeout = true;
|
||||||
|
|
||||||
private class BtOnClickListener implements OnClickListener {
|
private class BtOnClickListener implements OnClickListener {
|
||||||
final boolean mEnableOnly; // enable or enable + discoverable
|
final boolean mEnableOnly; // enable or enable + discoverable
|
||||||
|
|
||||||
@@ -103,7 +106,10 @@ public class BluetoothRequestPermissionTest extends Activity {
|
|||||||
} else {
|
} else {
|
||||||
addMsg("Starting activity to enable bt + discovery");
|
addMsg("Starting activity to enable bt + discovery");
|
||||||
i.setAction(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
|
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);
|
startActivityForResult(i, 1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user