Expanded the details screen
This commit is contained in:
@@ -19,6 +19,18 @@ public class DetailsActivity extends Activity{
|
|||||||
|
|
||||||
private BluetoothLeDevice mDevice;
|
private BluetoothLeDevice mDevice;
|
||||||
|
|
||||||
|
private void append(StringBuilder sb, byte[] value){
|
||||||
|
append(sb, AdRecordUtils.byteArrayToHexString(value), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void append(StringBuilder sb, String label, String value){
|
||||||
|
if(value != null){
|
||||||
|
sb.append("\u2022" + label +":\t" + value + "\n");
|
||||||
|
} else {
|
||||||
|
sb.append(label + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -43,6 +55,11 @@ public class DetailsActivity extends Activity{
|
|||||||
append(sb, "Device Class", device.getBluetoothDeviceClassName());
|
append(sb, "Device Class", device.getBluetoothDeviceClassName());
|
||||||
append(sb, "Bonding State", device.getBluetoothDeviceBondState());
|
append(sb, "Bonding State", device.getBluetoothDeviceBondState());
|
||||||
|
|
||||||
|
append(sb, "", null);
|
||||||
|
append(sb, "Scan Record", null);
|
||||||
|
append(sb, "-----------------", null);
|
||||||
|
append(sb, device.getScanRecord());
|
||||||
|
|
||||||
append(sb, "", null);
|
append(sb, "", null);
|
||||||
append(sb, "Ad Records", null);
|
append(sb, "Ad Records", null);
|
||||||
append(sb, "-----------------", null);
|
append(sb, "-----------------", null);
|
||||||
@@ -50,29 +67,13 @@ public class DetailsActivity extends Activity{
|
|||||||
|
|
||||||
final Collection<AdRecord> adRecords = device.getAdRecordStore().getRecordsAsCollection();
|
final Collection<AdRecord> adRecords = device.getAdRecordStore().getRecordsAsCollection();
|
||||||
|
|
||||||
for(AdRecord record : adRecords){
|
for(final AdRecord record : adRecords){
|
||||||
append(sb,
|
append(sb, "#" +record.getType() + " " + record.getHumanReadableType(), null);
|
||||||
"Record Id'" +record.getType()+ "' - " + record.getHumanReadableType(), AdRecordUtils.getRecordDataAsString(record));
|
append(sb, AdRecordUtils.getRecordDataAsString(record), null);
|
||||||
|
append(sb, "", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mTvDetails.setText(sb.toString());
|
mTvDetails.setText(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void append(StringBuilder sb, String label, boolean value){
|
|
||||||
append(sb, label, String.valueOf(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void append(StringBuilder sb, String label, long value){
|
|
||||||
append(sb, label, String.valueOf(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void append(StringBuilder sb, String label, String value){
|
|
||||||
if(value != null){
|
|
||||||
sb.append("#" + label +":\t" + value + "\n");
|
|
||||||
} else {
|
|
||||||
sb.append(label + "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user