Added more information in the list item
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
<GridLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:columnCount="4" >
|
||||
android:columnCount="2" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -57,6 +57,27 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="12sp"
|
||||
android:typeface="monospace" />
|
||||
</GridLayout>
|
||||
|
||||
<GridLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:columnCount="4" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
android:text="Updated:"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_last_update"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -81,6 +102,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:columnCount="4" >
|
||||
|
||||
<!-- ROW 1 -->
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -97,6 +120,8 @@
|
||||
android:paddingRight="5dp"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<!-- ROW 2 -->
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -128,6 +153,8 @@
|
||||
android:paddingRight="5dp"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<!-- ROW 3 -->
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -158,6 +185,24 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<!-- ROW 4 -->
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
android:text="Descriptor:"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ibeacon_distance_descriptor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnSpan="3"
|
||||
android:paddingRight="5dp"
|
||||
android:textSize="12sp" />
|
||||
</GridLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ import android.widget.TextView;
|
||||
// Adapter for holding devices found through scanning.
|
||||
public class LeDeviceListAdapter extends BaseAdapter {
|
||||
private static final DecimalFormat DOUBLE_TWO_DIGIT_ACCURACY = new DecimalFormat("#.##");
|
||||
|
||||
private static final String TIME_FORMAT = "yyyy-MM-dd hh:mm:ss";
|
||||
|
||||
private final List<BluetoothLeDevice> mLeDevices;
|
||||
private final LayoutInflater mInflator;
|
||||
|
||||
@@ -71,12 +72,14 @@ public class LeDeviceListAdapter extends BaseAdapter {
|
||||
viewHolder.deviceName = (TextView) view.findViewById(R.id.device_name);
|
||||
viewHolder.deviceRssi = (TextView) view.findViewById(R.id.device_rssi);
|
||||
viewHolder.deviceIcon = (ImageView) view.findViewById(R.id.device_icon);
|
||||
viewHolder.deviceLastUpdated = (TextView) view.findViewById(R.id.device_last_update);
|
||||
viewHolder.ibeaconMajor = (TextView) view.findViewById(R.id.ibeacon_major);
|
||||
viewHolder.ibeaconMinor = (TextView) view.findViewById(R.id.ibeacon_minor);
|
||||
viewHolder.ibeaconDistance = (TextView) view.findViewById(R.id.ibeacon_distance);
|
||||
viewHolder.ibeaconUUID = (TextView) view.findViewById(R.id.ibeacon_uuid);
|
||||
viewHolder.ibeaconTxPower = (TextView) view.findViewById(R.id.ibeacon_tx_power);
|
||||
viewHolder.ibeaconSection = (View) view.findViewById(R.id.ibeacon_section);
|
||||
viewHolder.ibeaconDistanceDescriptor = (TextView) view.findViewById(R.id.ibeacon_distance_descriptor);
|
||||
view.setTag(viewHolder);
|
||||
} else {
|
||||
viewHolder = (ViewHolder) view.getTag();
|
||||
@@ -102,13 +105,15 @@ public class LeDeviceListAdapter extends BaseAdapter {
|
||||
viewHolder.ibeaconMinor.setText(String.valueOf(data.getMinor()));
|
||||
viewHolder.ibeaconTxPower.setText(String.valueOf(data.getCalibratedTxPower()));
|
||||
viewHolder.ibeaconUUID.setText(data.getUUID());
|
||||
viewHolder.ibeaconDistance.setText(
|
||||
DOUBLE_TWO_DIGIT_ACCURACY.format(accuracy) + "m " + data.getDistanceDescriptor(accuracy));
|
||||
viewHolder.ibeaconDistance.setText(DOUBLE_TWO_DIGIT_ACCURACY.format(accuracy) + "m");
|
||||
viewHolder.ibeaconDistanceDescriptor.setText(data.getDistanceDescriptor(accuracy));
|
||||
} else {
|
||||
viewHolder.deviceIcon.setImageResource(R.drawable.ic_bluetooth);
|
||||
viewHolder.ibeaconSection.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
viewHolder.deviceLastUpdated.setText(
|
||||
android.text.format.DateFormat.format(TIME_FORMAT, new java.util.Date(device.getTimestamp())));
|
||||
viewHolder.deviceAddress.setText(device.getAddress());
|
||||
viewHolder.deviceRssi.setText(String.valueOf(rssi) + "db");
|
||||
return view;
|
||||
@@ -123,6 +128,8 @@ public class LeDeviceListAdapter extends BaseAdapter {
|
||||
TextView ibeaconMinor;
|
||||
TextView ibeaconTxPower;
|
||||
TextView ibeaconDistance;
|
||||
TextView ibeaconDistanceDescriptor;
|
||||
TextView deviceLastUpdated;
|
||||
View ibeaconSection;
|
||||
ImageView deviceIcon;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user