Fixed devices flashing on update (again).

This commit is contained in:
Felix Ableitner 2013-09-26 18:49:01 +02:00
parent 5edbd2886f
commit 86f301791d
3 changed files with 20 additions and 2 deletions

View file

@ -244,4 +244,9 @@ public class RemotePlayService extends Service implements DeviceListenerCallback
} }
} }
@Override
public void deviceUpdated(Device<?, ?, ?> device) {
// No need to update as the parameters we need are already known.
}
} }

View file

@ -56,6 +56,7 @@ public class DeviceListener implements RegistryListener {
public interface DeviceListenerCallback { public interface DeviceListenerCallback {
public void deviceAdded(Device<?, ?, ?> device); public void deviceAdded(Device<?, ?, ?> device);
public void deviceRemoved(Device<?, ?, ?> device); public void deviceRemoved(Device<?, ?, ?> device);
public void deviceUpdated(Device<?, ?, ?> device);
} }
private ArrayList<Device<?, ?, ?>> mDevices = new ArrayList<Device<?, ?, ?>>(); private ArrayList<Device<?, ?, ?>> mDevices = new ArrayList<Device<?, ?, ?>>();
@ -127,8 +128,9 @@ public class DeviceListener implements RegistryListener {
@Override @Override
public void remoteDeviceUpdated(Registry registry, RemoteDevice device) { public void remoteDeviceUpdated(Registry registry, RemoteDevice device) {
deviceRemoved(device); for (DeviceListenerCallback l : mListeners) {
deviceAdded(device); l.deviceUpdated(device);
}
} }
} }

View file

@ -132,4 +132,15 @@ public class DeviceArrayAdapter extends ArrayAdapter<Device<?, ?, ?>>
} }
}); });
} }
@Override
public void deviceUpdated(Device<?, ?, ?> device) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
notifyDataSetChanged();
}
});
}
} }