1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 18:45:49 +01:00

Apply gray images on non-connected devices in the list.

This commit is contained in:
Lem Dulfo 2016-04-10 20:13:48 +08:00 committed by cpfeiffer
parent e5726075a4
commit 39cba84ab1
6 changed files with 19 additions and 9 deletions

View File

@ -60,11 +60,11 @@ public class GBDeviceAdapter extends ArrayAdapter<GBDevice> {
if (device.isBusy()) { if (device.isBusy()) {
deviceStatusLabel.setText(device.getBusyTask()); deviceStatusLabel.setText(device.getBusyTask());
busyIndicator.setVisibility(View.VISIBLE); busyIndicator.setVisibility(View.VISIBLE);
batteryLabel.setVisibility(View.GONE); batteryLabel.setVisibility(View.INVISIBLE);
batteryStatusLabel.setVisibility(View.GONE); batteryStatusLabel.setVisibility(View.INVISIBLE);
} else { } else {
deviceStatusLabel.setText(device.getStateString()); deviceStatusLabel.setText(device.getStateString());
busyIndicator.setVisibility(View.GONE); busyIndicator.setVisibility(View.INVISIBLE);
batteryLabel.setVisibility(View.VISIBLE); batteryLabel.setVisibility(View.VISIBLE);
batteryStatusLabel.setVisibility(View.VISIBLE); batteryStatusLabel.setVisibility(View.VISIBLE);
} }
@ -113,13 +113,25 @@ public class GBDeviceAdapter extends ArrayAdapter<GBDevice> {
switch (device.getType()) { switch (device.getType()) {
case PEBBLE: case PEBBLE:
deviceImageView.setImageResource(R.drawable.ic_device_pebble); if (device.isConnected()) {
deviceImageView.setImageResource(R.drawable.ic_device_pebble);
} else {
deviceImageView.setImageResource(R.drawable.ic_device_pebble_disabled);
}
break; break;
case MIBAND: case MIBAND:
deviceImageView.setImageResource(R.drawable.ic_device_miband); if (device.isConnected()) {
deviceImageView.setImageResource(R.drawable.ic_device_miband);
} else {
deviceImageView.setImageResource(R.drawable.ic_device_miband_disabled);
}
break; break;
default: default:
deviceImageView.setImageResource(R.drawable.ic_launcher); if (device.isConnected()) {
deviceImageView.setImageResource(R.drawable.ic_launcher);
} else {
deviceImageView.setImageResource(R.drawable.ic_device_default_disabled);
}
} }
return view; return view;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -73,17 +73,15 @@
<ProgressBar <ProgressBar
android:id="@+id/device_busy_indicator" android:id="@+id/device_busy_indicator"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="140dp" android:layout_width="140dp"
android:layout_height="4dp" android:layout_height="4dp"
android:layout_rowSpan="1"
android:indeterminate="true" android:indeterminate="true"
android:visibility="visible" android:visibility="visible"
style="@android:style/Widget.ProgressBar.Horizontal"
tools:visibility="visible" /> tools:visibility="visible" />
</GridLayout> </GridLayout>
<ListView <ListView
android:id="@+id/device_item_infos" android:id="@+id/device_item_infos"
android:layout_width="match_parent" android:layout_width="match_parent"