Merge "Keyboard navigation for CompanionDeviceTestActivity"
This commit is contained in:
committed by
Android (Google) Code Review
commit
2f95ea7688
@@ -29,6 +29,7 @@ import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
@@ -75,6 +76,14 @@ public class DeviceChooserActivity extends Activity {
|
||||
mDeviceListView = findViewById(R.id.device_list);
|
||||
final DeviceDiscoveryService.DevicesAdapter adapter = getService().mDevicesAdapter;
|
||||
mDeviceListView.setAdapter(adapter);
|
||||
mDeviceListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long l) {
|
||||
getService().mSelectedDevice =
|
||||
(DeviceFilterPair) adapterView.getItemAtPosition(pos);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
adapter.registerDataSetObserver(new DataSetObserver() {
|
||||
@Override
|
||||
public void onChanged() {
|
||||
@@ -157,4 +166,4 @@ public class DeviceChooserActivity extends Activity {
|
||||
new Intent().putExtra(CompanionDeviceManager.EXTRA_DEVICE, selectedDevice.device));
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,10 +349,6 @@ public class DeviceDiscoveryService extends Service {
|
||||
? WIFI_ICON
|
||||
: BLUETOOTH_ICON,
|
||||
null, null, null);
|
||||
textView.setOnClickListener((view) -> {
|
||||
mSelectedDevice = device;
|
||||
notifyDataSetChanged();
|
||||
});
|
||||
}
|
||||
|
||||
//TODO move to a layout file
|
||||
|
||||
Reference in New Issue
Block a user