1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 10:05: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()) {
deviceStatusLabel.setText(device.getBusyTask());
busyIndicator.setVisibility(View.VISIBLE);
batteryLabel.setVisibility(View.GONE);
batteryStatusLabel.setVisibility(View.GONE);
batteryLabel.setVisibility(View.INVISIBLE);
batteryStatusLabel.setVisibility(View.INVISIBLE);
} else {
deviceStatusLabel.setText(device.getStateString());
busyIndicator.setVisibility(View.GONE);
busyIndicator.setVisibility(View.INVISIBLE);
batteryLabel.setVisibility(View.VISIBLE);
batteryStatusLabel.setVisibility(View.VISIBLE);
}
@ -113,13 +113,25 @@ public class GBDeviceAdapter extends ArrayAdapter<GBDevice> {
switch (device.getType()) {
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;
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;
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;

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
android:id="@+id/device_busy_indicator"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="140dp"
android:layout_height="4dp"
android:layout_rowSpan="1"
android:indeterminate="true"
android:visibility="visible"
style="@android:style/Widget.ProgressBar.Horizontal"
tools:visibility="visible" />
</GridLayout>
<ListView
android:id="@+id/device_item_infos"
android:layout_width="match_parent"