am d4a4e2d5: Merge "Fixed crash in BT tests due to window feature request for progress bar (causes crash in clockwork)." into lmp-sprout-dev
* commit 'd4a4e2d54c6f3f7d210229ad876496609ca4ef07':
Fixed crash in BT tests due to window feature request for progress bar (causes crash in clockwork).
diff --git a/apps/CtsVerifier/res/layout/bt_device_picker.xml b/apps/CtsVerifier/res/layout/bt_device_picker.xml
index ecca0e5..48a4b43 100644
--- a/apps/CtsVerifier/res/layout/bt_device_picker.xml
+++ b/apps/CtsVerifier/res/layout/bt_device_picker.xml
@@ -19,6 +19,13 @@
android:orientation="vertical"
>
+ <ProgressBar android:id="@+id/bt_progress_bar"
+ android:indeterminate="true"
+ android:layout_height="4dp"
+ android:layout_width="match_parent"
+ style="@android:style/Widget.DeviceDefault.ProgressBar.Horizontal"
+ />
+
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bt_paired_devices"
diff --git a/apps/CtsVerifier/res/layout/bt_messages.xml b/apps/CtsVerifier/res/layout/bt_messages.xml
index cb46811..1504431 100644
--- a/apps/CtsVerifier/res/layout/bt_messages.xml
+++ b/apps/CtsVerifier/res/layout/bt_messages.xml
@@ -18,6 +18,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
>
+
+ <ProgressBar android:id="@+id/bt_progress_bar"
+ android:indeterminate="true"
+ android:layout_height="4dp"
+ android:layout_width="match_parent"
+ style="@android:style/Widget.DeviceDefault.ProgressBar.Horizontal"
+ />
+
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bt_sent_messages"
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/DevicePickerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/DevicePickerActivity.java
index be71f66..a5dea4b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/DevicePickerActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/DevicePickerActivity.java
@@ -29,12 +29,12 @@
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
-import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
+import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
@@ -61,12 +61,15 @@
private TextView mEmptyNewView;
+ private ProgressBar mProgressBar;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.bt_device_picker);
+ mProgressBar = (ProgressBar) findViewById(R.id.bt_progress_bar);
+
mPairedDevicesAdapter = new ArrayAdapter<Device>(this, R.layout.bt_device_name);
ListView pairedDevicesListView = (ListView) findViewById(R.id.bt_paired_devices);
pairedDevicesListView.setAdapter(mPairedDevicesAdapter);
@@ -182,10 +185,10 @@
public void onReceive(Context context, Intent intent) {
if (BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(intent.getAction())) {
mEmptyNewView.setText(R.string.bt_scanning);
- setProgressBarIndeterminateVisibility(true);
+ mProgressBar.setVisibility(View.VISIBLE);
} else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(intent.getAction())) {
mEmptyNewView.setText(R.string.bt_no_devices);
- setProgressBarIndeterminateVisibility(false);
+ mProgressBar.setVisibility(View.INVISIBLE);
} else if (BluetoothDevice.ACTION_FOUND.equals(intent.getAction())) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/MessageTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/MessageTestActivity.java
index 2c6324b..4e0b78f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/MessageTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/MessageTestActivity.java
@@ -33,10 +33,10 @@
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
-import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
+import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
@@ -71,6 +71,8 @@
private AlertDialog mInstructionsDialog;
+ private ProgressBar mProgressBar;
+
private String mDeviceAddress;
private final boolean mSecure;
@@ -89,10 +91,11 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.bt_messages);
setPassFailButtonClickListeners();
+ mProgressBar = (ProgressBar) findViewById(R.id.bt_progress_bar);
+
if (mServer) {
setTitle(mSecure ? R.string.bt_secure_server : R.string.bt_insecure_server);
} else {
@@ -217,18 +220,18 @@
switch (state) {
case BluetoothChatService.STATE_LISTEN:
setEmptyViewText(R.string.bt_waiting);
- setProgressBarIndeterminateVisibility(true);
+ mProgressBar.setVisibility(View.VISIBLE);
showInstructionsDialog();
break;
case BluetoothChatService.STATE_CONNECTING:
setEmptyViewText(R.string.bt_connecting);
- setProgressBarIndeterminateVisibility(true);
+ mProgressBar.setVisibility(View.VISIBLE);
break;
case BluetoothChatService.STATE_CONNECTED:
setEmptyViewText(R.string.bt_no_messages);
- setProgressBarIndeterminateVisibility(false);
+ mProgressBar.setVisibility(View.INVISIBLE);
hideInstructionsDialog();
sendInitialMessageFromClient();
@@ -236,7 +239,7 @@
case BluetoothChatService.STATE_NONE:
setEmptyViewText(R.string.bt_no_messages);
- setProgressBarIndeterminateVisibility(false);
+ mProgressBar.setVisibility(View.INVISIBLE);
break;
}
}